Skip to content

Commit

Permalink
bind: fix "M-C-@", "C-x C-@", and "M-C-x" (bash-4.2 -o emacs)
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Feb 19, 2023
1 parent 9e10b54 commit 342826f
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions bind.sh
Expand Up @@ -33,6 +33,7 @@ function ble/init:bind/generate-binder {
: >| "$fbind2"

local q=\' Q="'\\''"
local altdqs00='\xC0\x80'
local altdqs24='\xC0\x98'
local altdqs27='\xC0\x9B'

Expand Down Expand Up @@ -157,7 +158,7 @@ function ble/init:bind/generate-binder {
# C-@
if ((esc00)); then
# ENCODING: UTF-8 2-byte code of 0 (UTF-8依存)
ble/init:bind/append-macro '\C-@' '\xC0\x80'
ble/init:bind/append-macro '\C-@' "$altdqs00"
else
ble/init:bind/append "$ret" "$i"
fi
Expand Down Expand Up @@ -193,7 +194,9 @@ function ble/init:bind/generate-binder {
# emacs mode では "C-x ?" の組み合わせで登録する。
# Note: 普通に bind -x すると cmd_xmap の \C-x が曖昧になって vi 側の単一
# "C-x" が動かなくなるので、ここでは UTF-8 2B 表示を通して受信する。
if ((i==24)); then
if ((i==0)); then
ble/init:bind/append-macro "\C-x$ret" "$altdqs24$altdqs00" '[[ -o emacs ]]'
elif ((i==24)); then
ble/init:bind/append-macro "\C-x$ret" "$altdqs24$altdqs24" '[[ -o emacs ]]'
else
ble/init:bind/append-macro "\C-x$ret" "$altdqs24$ret" '[[ -o emacs ]]'
Expand All @@ -202,7 +205,13 @@ function ble/init:bind/generate-binder {

# ESC *
if ((esc1B==3)); then
ble/init:bind/append-macro '\e'"$ret" "$altdqs27$ret"
if ((i==0)); then
ble/init:bind/append-macro '\e'"$ret" "$altdqs27$altdqs00"
elif ((bind18XX&&i==24)); then
ble/init:bind/append-macro '\e'"$ret" "$altdqs27$altdqs24"
else
ble/init:bind/append-macro '\e'"$ret" "$altdqs27$ret"
fi
else
if ((esc1B==1)); then
# ESC [
Expand Down

0 comments on commit 342826f

Please sign in to comment.