Skip to content

Commit

Permalink
canvas, edit: support "bleopt info_display"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Feb 20, 2021
1 parent cc2881a commit 69228fa
Show file tree
Hide file tree
Showing 16 changed files with 705 additions and 196 deletions.
2 changes: 1 addition & 1 deletion archive/layer/adapter.sh
Expand Up @@ -47,7 +47,7 @@ function ble/highlight/layer:adapter/update {
ble/highlight/layer/update/shift _ble_highlight_layer_adapter_buff
local i g gprev=0 ctx=0 ret
((i1>0)) && { ble/highlight/layer/getg $((i1-1)); gprev=$g; }
# ble-edit/info/show text "layer:adapter u = $i1-$i2"
# ble/edit/info/show text "layer:adapter u = $i1-$i2"
for ((i=i1;i<=i2;i++)); do
local ch
if [[ ${_ble_region_highlight_table[i]} ]]; then
Expand Down
4 changes: 2 additions & 2 deletions ble.pp
Expand Up @@ -809,7 +809,7 @@ function ble-attach {

# Note: ble-decode/{initialize,reset-default-keymap} 内で
# info を設定する事があるので表示する。
ble-edit/info/default
ble/edit/info/default
ble-edit/bind/.tail
}

Expand All @@ -835,7 +835,7 @@ function ble-detach/impl {
function ble-detach/message {
ble/util/buffer.flush >&2
printf '%s\n' "$@" 1>&2
ble-edit/info/hide
ble/edit/info/hide
ble/textarea#render
ble/util/buffer.flush >&2
}
Expand Down
9 changes: 9 additions & 0 deletions blerc
Expand Up @@ -111,6 +111,15 @@
#bleopt edit_line_type=graphical


## The following option controls the position of the info pane where completion
## menu, mode names, and other information are shown. When the value "top" is
## specified, the info pane is shown just below the command line. When the
## value "bottom" is specified, the info pane is shown at the bottom of the
## terminal. The default is "top".

#bleopt info_display=top


## The following settings controls the prompt after the cursor left the command
## line. "prompt_ps1_final" contains a prompt string. "prompt_ps1_transient"
## is a colon-separated list of fields "always", "same-dir" and "trim". The
Expand Down
6 changes: 3 additions & 3 deletions keymap/emacs.sh
Expand Up @@ -94,7 +94,7 @@ function ble/keymap:emacs/update-mode-name {

[[ $name ]] || info=${info#' '}
name=$name$info
ble-edit/info/default ansi "$name"
ble/edit/info/default ansi "$name"
}

function ble/widget/emacs/__after_widget__ {
Expand Down Expand Up @@ -209,15 +209,15 @@ function ble-decode/keymap:emacs/initialize {
source "$fname_keymap_cache" && return 0
fi

ble-edit/info/immediate-show text "ble.sh: updating cache/keymap.emacs..."
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.emacs..."

{
ble-decode/keymap/load isearch dump
ble-decode/keymap/load nsearch dump
ble-decode/keymap/load emacs dump
} 3>| "$fname_keymap_cache"

ble-edit/info/immediate-show text "ble.sh: updating cache/keymap.emacs... done"
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.emacs... done"
}

ble-decode/keymap:emacs/initialize
Expand Down
23 changes: 13 additions & 10 deletions keymap/vi.sh
Expand Up @@ -360,7 +360,7 @@ function ble/keymap:vi/update-mode-name {
ble/util/buffer "$bleopt_term_vi_omap"
ble/term/cursor-state/set-internal "$bleopt_keymap_vi_omap_cursor"
elif [[ $kmap == vi_cmap ]]; then
ble-edit/info/default text ''
ble/edit/info/default text ''
ble/util/buffer "$bleopt_term_vi_cmap"
ble/term/cursor-state/set-internal "$bleopt_keymap_vi_cmap_cursor"
return 0
Expand Down Expand Up @@ -423,7 +423,7 @@ function ble/keymap:vi/update-mode-name {
elif [[ $_ble_edit_kbdmacro_record ]]; then
name=$name${name:+' '}$'\e[1;31mREC\e[m'
fi
ble-edit/info/default ansi "$name" # 6ms
ble/edit/info/default ansi "$name" # 6ms
}

function ble/widget/vi_imap/normal-mode.impl {
Expand Down Expand Up @@ -913,7 +913,7 @@ function ble/keymap:vi/register#dump {

out=$out'"'$k' ('$type') '$content$'\n'
done
ble-edit/info/show ansi "$out"
ble/edit/info/show ansi "$out"
return 0
}
function ble/widget/vi-command:reg { ble/keymap:vi/register#dump; }
Expand Down Expand Up @@ -4982,7 +4982,7 @@ function ble/widget/vi-command:w {
local wc
ble/util/assign wc 'ble/bin/wc "$file"'
ble/string#split-words wc "$wc"
ble-edit/info/show text "\"$file\" ${wc[0]}L, ${wc[2]}C written"
ble/edit/info/show text "\"$file\" ${wc[0]}L, ${wc[2]}C written"
ble/keymap:vi/adjust-command-mode
return 0
}
Expand Down Expand Up @@ -5158,7 +5158,7 @@ function ble/widget/vi-command/search.core {
else
ble/history/isearch-forward regex:progress
fi; local r=$?
ble-edit/info/default
ble/edit/info/default

if ((r==0)); then
local new_index; ble/history/get-index -v new_index
Expand Down Expand Up @@ -5598,7 +5598,7 @@ function ble/widget/vi-command/show-line-info {
local line_ratio=$(((100*iline+nline-1)/nline))%
local line_stat=$'line \e[34m'$iline$'\e[m / \e[34m'$nline$'\e[m --\e[34m'$line_ratio$'\e[m--'

ble-edit/info/show ansi "\"$hist_stat\" $line_stat"
ble/edit/info/show ansi "\"$hist_stat\" $line_stat"
ble/keymap:vi/adjust-command-mode
return 0
}
Expand All @@ -5613,9 +5613,9 @@ function ble/widget/vi-command/cancel {
local joblist; ble/util/joblist
if ((${#joblist[*]})); then
ble/array#push joblist $'Type \e[35m:q!\e[m and press \e[35m<Enter>\e[m to abandon all \e[31mjobs\e[m and exit Bash'
IFS=$'\n' builtin eval 'ble-edit/info/show ansi "${joblist[*]}"'
IFS=$'\n' builtin eval 'ble/edit/info/show ansi "${joblist[*]}"'
else
ble-edit/info/show ansi $'Type \e[35m:q\e[m and press \e[35m<Enter>\e[m to exit Bash'
ble/edit/info/show ansi $'Type \e[35m:q\e[m and press \e[35m<Enter>\e[m to exit Bash'
fi
fi
ble/widget/vi-command/bell
Expand Down Expand Up @@ -7894,6 +7894,7 @@ function ble/keymap:vi/async-commandline-mode {
# 記録
ble/textarea#render
ble/textarea#save-state _ble_keymap_vi_cmap
ble/util/save-vars _ble_keymap_vi_cmap _ble_canvas_panel_focus
_ble_keymap_vi_cmap_history_prefix=$_ble_history_prefix

# 初期化
Expand All @@ -7902,6 +7903,7 @@ function ble/keymap:vi/async-commandline-mode {

# textarea
_ble_textarea_panel=1
_ble_canvas_panel_focus=1
ble/textarea#invalidate

# edit/prompt
Expand Down Expand Up @@ -7943,6 +7945,7 @@ function ble/widget/vi_cmap/accept {
# 復元
ble/textarea#restore-state _ble_keymap_vi_cmap
ble/textarea#clear-state _ble_keymap_vi_cmap
ble/util/restore-vars _ble_keymap_vi_cmap _ble_canvas_panel_focus
[[ $_ble_edit_overwrite_mode ]] && ble/util/buffer "$_ble_term_civis"
_ble_history_prefix=$_ble_keymap_vi_cmap_history_prefix

Expand Down Expand Up @@ -8026,7 +8029,7 @@ function ble-decode/keymap:vi/initialize {
source "$fname_keymap_cache" && return 0
fi

ble-edit/info/immediate-show text "ble.sh: updating cache/keymap.vi..."
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.vi..."

{
ble-decode/keymap/load isearch dump
Expand All @@ -8038,7 +8041,7 @@ function ble-decode/keymap:vi/initialize {
ble-decode/keymap/load vi_cmap dump
} 3>| "$fname_keymap_cache"

ble-edit/info/immediate-show text "ble.sh: updating cache/keymap.vi... done"
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.vi... done"
}

ble-decode/keymap:vi/initialize
Expand Down
4 changes: 2 additions & 2 deletions keymap/vi_digraph.sh
Expand Up @@ -54,12 +54,12 @@ function ble-decode/keymap:vi_digraph/initialize {
return 0
fi

ble-edit/info/immediate-show text "ble.sh: updating cache/keymap.vi_digraph..."
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.vi_digraph..."

: >| "$fname_keymap_cache"
ble-decode/keymap/load vi_digraph dump 3>> "$fname_keymap_cache"

ble-edit/info/immediate-show text "ble.sh: updating cache/keymap.vi_digraph... done"
ble/edit/info/immediate-show text "ble.sh: updating cache/keymap.vi_digraph... done"
}

ble-decode/keymap:vi_digraph/initialize
16 changes: 8 additions & 8 deletions lib/core-complete.sh
Expand Up @@ -424,7 +424,7 @@ function ble/complete/menu-style:desc-raw/guess {
## @fn ble/complete/menu#construct/.initialize-size
## @var[out] cols lines
function ble/complete/menu#construct/.initialize-size {
ble-edit/info/.initialize-size
ble/edit/info/.initialize-size
local maxlines=$((bleopt_complete_menu_maxlines))
((maxlines>0&&lines>maxlines)) && lines=$maxlines
}
Expand Down Expand Up @@ -535,10 +535,10 @@ function ble/complete/menu#construct {
}

function ble/complete/menu#show {
ble-edit/info/immediate-show "${_ble_complete_menu_info_data[@]}"
ble/edit/info/immediate-show "${_ble_complete_menu_info_data[@]}"
}
function ble/complete/menu#clear {
ble-edit/info/clear
ble/edit/info/clear
}


Expand Down Expand Up @@ -583,7 +583,7 @@ function ble/complete/menu#select {
fi

local -a DRAW_BUFF=()
local x0=$_ble_canvas_x y0=$_ble_canvas_y
local ret; ble/canvas/panel/save-position; local pos0=$ret
if ((osel>=0)); then
# 消去
local entry=${_ble_complete_menu_icons[osel-visible_beg]}
Expand Down Expand Up @@ -629,7 +629,7 @@ function ble/complete/menu#select {
_ble_complete_menu_selected=-1
value=$_ble_complete_menu_original
fi
ble/canvas/goto.draw "$x0" "$y0"
ble/canvas/panel/load-position.draw "$pos0"
ble/canvas/bflush.draw

ble/function#try "$menu_class"/onselect "$nsel" "$osel"
Expand Down Expand Up @@ -4896,7 +4896,7 @@ function ble/widget/complete {
if ((ext!=0||cand_count==0)); then
[[ :$opts: != *:no-bell:* && ! $cand_limit_reached ]] &&
ble/widget/.bell 'complete: no completions'
ble-edit/info/clear
ble/edit/info/clear
return 1
fi
fi
Expand Down Expand Up @@ -6070,14 +6070,14 @@ function ble/complete/dabbrev/.show-status.fib {

((fib_ntask)) && text="$text *$fib_ntask"

ble-edit/info/show text "$text"
ble/edit/info/show text "$text"
}
function ble/complete/dabbrev/show-status {
local fib_ntask=${#_ble_util_fiberchain[@]}
ble/complete/dabbrev/.show-status.fib
}
function ble/complete/dabbrev/erase-status {
ble-edit/info/default
ble/edit/info/default
}

## @fn ble/complete/dabbrev/initialize-variables
Expand Down
4 changes: 2 additions & 2 deletions lib/core-syntax.sh
Expand Up @@ -7095,7 +7095,7 @@ function ble/highlight/layer:syntax/update {
local ret; ble/canvas/sflush.draw
status=$status$ret
#ble/util/assign buff 'declare -p _ble_textarea_bufferName $_ble_textarea_bufferName | cat -A'; status="$status$buff"
ble-edit/info/show ansi "$status"
ble/edit/info/show ansi "$status"
fi
#%end

Expand All @@ -7113,7 +7113,7 @@ function ble/highlight/layer:syntax/update {
# ble/array#push words "[$value ${word[*]}]"
# fi
# done
# ble-edit/info/show text "${words[*]}"
# ble/edit/info/show text "${words[*]}"
}

function ble/highlight/layer:syntax/getg {
Expand Down
4 changes: 2 additions & 2 deletions lib/init-bind.sh
Expand Up @@ -30,7 +30,7 @@ function ble/init:bind/generate-binder {
local fbind1=$_ble_base_cache/ble-decode-bind.$_ble_bash.$bleopt_input_encoding.bind
local fbind2=$_ble_base_cache/ble-decode-bind.$_ble_bash.$bleopt_input_encoding.unbind

ble-edit/info/show text "ble.sh: updating binders..."
ble/edit/info/show text "ble.sh: updating binders..."

: >| "$fbind1"
: >| "$fbind2"
Expand Down Expand Up @@ -216,7 +216,7 @@ function ble/init:bind/generate-binder {

ble/function#try ble/encoding:"$bleopt_input_encoding"/generate-binder

ble-edit/info/immediate-show text "ble.sh: updating binders... done"
ble/edit/info/immediate-show text "ble.sh: updating binders... done"
}

ble/init:bind/generate-binder
4 changes: 2 additions & 2 deletions lib/init-cmap.sh
Expand Up @@ -76,7 +76,7 @@ function ble/init:cmap/initialize {
# print = f16 [xterm]
# deleteline = A-delete

ble-edit/info/immediate-show text "ble/lib/init-cmap.sh: updating key sequences..."
ble/edit/info/immediate-show text "ble/lib/init-cmap.sh: updating key sequences..."

# pc-style keys
# # vt52, xterm, rxvt
Expand Down Expand Up @@ -255,7 +255,7 @@ function ble/init:cmap/initialize {
# ble-bind -k "CAN @ m" meta
# ble-bind -k "CAN @ s" super

ble-edit/info/immediate-show text "ble/lib/init-cmap.sh: updating key sequences... done"
ble/edit/info/immediate-show text "ble/lib/init-cmap.sh: updating key sequences... done"
}

ble/init:cmap/initialize
3 changes: 2 additions & 1 deletion memo/ChangeLog.md
Expand Up @@ -12,6 +12,7 @@
- edit (kill/copy): combine multiple kills and copies (suggested by 3ximus) `#D1443` 66564e1
- edit (`{kill,copy}-region-or`): fix unconditionally combined kills/copies (reported by 3ximus) `#D1447` 1631751
- canvas: update emoji database and support `bleopt emoji_version` (motivated by endorfina) `#D1454` d1f8c27
- canvas, edit: support `bleopt info_display` (suggested by 0neGuyDev) `#D1458` 0000000

## Changes

Expand All @@ -21,7 +22,7 @@
- edit: change default behavior of <kbd>C-w</kbd> and <kbd>M-w</kbd> to operate on backward words `#D1448` 47a3301
- syntax (`layer:syntax/word`): perform pathname expansions in background subshells (motivated by 3ximus) `#D1449` 13e7bdd
- complete: perform pathname expansions in subshells (motivated by 3ximus) `#D1450` d511896
- complete: support `bleopt complete_timeout_compvar` to time out pathname expansions for `COMP_WORDS` / `COMP_LINE` `#D1457` 0000000
- complete: support `bleopt complete_timeout_compvar` to time out pathname expansions for `COMP_WORDS` / `COMP_LINE` `#D1457` cc2881a

## Fixes

Expand Down

0 comments on commit 69228fa

Please sign in to comment.