Fix flashing cursor

This commit is contained in:
Manuele Sarfatti 2025-05-11 14:08:24 +02:00
parent 4334716ff3
commit 5eed38d418
3 changed files with 16 additions and 17 deletions

View file

@ -39,7 +39,7 @@ release:
sed -i '' "s/# Version: .*/# Version: $$VERSION/" $(OUTPUT); \
git add $(OUTPUT); \
git commit -m "Release $$VERSION"; \
git tag -a "$$VERSION" -m "Release $$VERSION"
git tag -a "$$VERSION" -m "Release $$VERSION"; \
@echo "\nRelease complete: \033[32m$$VERSION\033[0m"
%:

View file

@ -1,15 +1,13 @@
#!/usr/bin/env bash
# Import the beddu.sh library
# shellcheck disable=SC1091
source "$(dirname -- "$0")/../build/beddu.sh"
source "$(dirname -- "$0")/../dist/beddu.sh"
# Demo function to showcase the framework
demo() {
_violet=99
_pink=219
pen "\n>> $_q <<\n"
hide_cursor
line
pen $_violet "╔═════════════════════════════════════════════╗"
@ -27,7 +25,7 @@ demo() {
line
spin $_pink "Loading text formatting..."
sleep 1
spop
spop --keep-cursor-hidden
upclear
pen $_pink italic "-- Text formatting --"
line
@ -39,7 +37,7 @@ demo() {
line
spin $_pink "Loading basic colors..."
sleep 1
spop
spop --keep-cursor-hidden
upclear
pen $_pink italic "-- Basic colors --"
line
@ -58,7 +56,7 @@ demo() {
line
spin $_pink "Loading ANSI 256 colors..."
sleep 1
spop
spop --keep-cursor-hidden
upclear
pen $_pink italic "-- ANSI 256 colors (examples) --"
line
@ -70,7 +68,7 @@ demo() {
line
spin $_pink "Loading combined formatting..."
sleep 1
spop
spop --keep-cursor-hidden
upclear
pen $_pink italic "-- Combined formatting --"
line
@ -88,7 +86,7 @@ demo() {
line
spin $_pink "Loading output utilities..."
sleep 1
spop
spop --keep-cursor-hidden
upclear
pen $_pink italic "-- Output utilities --"
line
@ -99,7 +97,7 @@ demo() {
line
spin $_pink "Starting interactive experience..."
sleep 1
spop
spop --keep-cursor-hidden
upclear
pen $_pink italic "-- Interactive functions --"
line

View file

@ -46,7 +46,7 @@ spin() {
hide_cursor
# Use a trap to catch USR1 signal for clean shutdown
trap "show_cursor; exit 0" USR1
trap "exit 0" USR1
# Print the first frame of the spinner
pen -n cyan "${spinner:0:1} "
@ -82,11 +82,12 @@ spop() {
# Ensure it's really gone
if ps -p "${_spinner_pid}" >/dev/null 2>&1; then
kill "${_spinner_pid}" 2>/dev/null
fi
# Manually clean up display, unless asked not to do so
if [[ "$keep_cursor_hidden" == false ]]; then
show_cursor
fi
fi
_spinner_pid=""
fi