Skip to content

Commit

Permalink
util (ble/util/buffer): hide cursor on rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jul 28, 2022
1 parent e7adfb3 commit 4ecbbdc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ble-core.sh
Expand Up @@ -1073,7 +1073,15 @@ function ble/util/buffer.print {
ble/util/buffer "$1"$'\n'
}
function ble/util/buffer.flush {
IFS= builtin eval 'builtin echo -n "${_ble_util_buffer[*]-}"'
IFS= builtin eval 'local text="${_ble_util_buffer[*]-}"'

# Note: 出力の瞬間だけカーソルを非表示にする。Windows terminal 途中
# のカーソル移動も無理やり表示しようとする端末に対する対策。
[[ $_ble_term_state == internal ]] &&
[[ $_ble_term_cursor_hidden_internal != hidden ]] &&
text=$_ble_term_civis$text$_ble_term_cvvis

ble/util/put "$text"
_ble_util_buffer=()
}
function ble/util/buffer.clear {
Expand Down
1 change: 1 addition & 0 deletions ble.pp
Expand Up @@ -138,6 +138,7 @@ function ble/restore-bash-options {
#------------------------------------------------------------------------------
# check environment

function ble/util/put { builtin printf '%s' "$1"; }
function ble/util/print { builtin printf '%s\n' "$1"; }

# will be overwritten by src/util.sh
Expand Down

0 comments on commit 4ecbbdc

Please sign in to comment.