Skip to content

Commit

Permalink
edit (ble/builtin/read): cancel by "C-d" on an empty line
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Feb 20, 2021
1 parent 51d2c05 commit ecb8888
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion memo/ChangeLog.md
Expand Up @@ -13,7 +13,7 @@
- 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` 69228fa
- canvas (panel): always call panel::render to update height `#D1472` 0000000
- canvas (panel): always call `panel::render` to update height `#D1472` 51d2c05
- prompt: support `bleopt prompt_status_{line,align}` and `face prompt_status_line` `#D1462` cca1cbc

## Changes
Expand All @@ -29,6 +29,7 @@
- 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` cc2881a
- prompt: rename `bleopt prompt_{status_line => term_status}` `#D1462` cca1cbc
- edit (`ble/builtin/read`): cancel by <kbd>C-d</kbd> on an empty line `#D1473` 0000000

## Fixes

Expand Down
7 changes: 7 additions & 0 deletions note.txt
Expand Up @@ -3764,6 +3764,13 @@ bash_tips

2021-02-10

* ble/builtin/read: 空文字列の時 C-d でキャンセルしない [#D1473]

使い心地が変だと思って plain Bash で試してみたら C-d でちゃんとキャンセルに
なる。ble/builtin/read もこれと同様に振る舞うべきである。

→これも実装した。これは簡単な修正。

* ble/builtin/read: 全く描画されなくなっている [#D1472]

これは ble/canvas/panel/render において描画するかどうかを各パネルの高さで決
Expand Down
9 changes: 8 additions & 1 deletion src/edit.sh
Expand Up @@ -3656,7 +3656,6 @@ function ble/widget/exit {
function ble/widget/delete-forward-char-or-exit {
if [[ $_ble_edit_str ]]; then
ble/widget/delete-forward-char
return "$?"
else
ble/widget/exit
fi
Expand Down Expand Up @@ -7275,6 +7274,13 @@ function ble/widget/read/cancel {
ble/widget/read/accept
_ble_edit_read_accept=2
}
function ble/widget/read/delete-forward-char-or-cancel {
if [[ $_ble_edit_str ]]; then
ble/widget/delete-forward-char
else
ble/widget/read/cancel
fi
}

function ble/widget/read/__line_limit__.edit {
local content=$1
Expand All @@ -7300,6 +7306,7 @@ function ble-decode/keymap:read/define {
ble-bind -f 'C-m' read/accept
ble-bind -f 'RET' read/accept
ble-bind -f 'C-j' read/accept
ble-bind -f 'C-d' 'delete-region-or read/delete-forward-char-or-cancel'

# shell functions
ble-bind -f 'C-g' bell
Expand Down

0 comments on commit ecb8888

Please sign in to comment.