Skip to content

Commit

Permalink
decode (bind): do not treat non-beginning "#" as comments
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Jul 9, 2022
1 parent e222c48 commit f9db7d8
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/decode.sh
Expand Up @@ -2718,10 +2718,15 @@ function ble/builtin/bind/option:u/search-recursive {
function ble/builtin/bind/option:- {
local ret; ble/string#trim "$1"; local arg=$ret

# コメント除去 (quote されていない "空白+#" 以降はコメント)
local q=\' ifs=$_ble_term_IFS
local rex='^(([^\"'$q$ifs']|"([^\"]|\\.)*"|'$q'([^\'$q']|\\.)*'$q'|\\.|['$ifs']+[^#'$_ifs'])*)['$ifs']+#'
[[ $arg =~ $rex ]] && arg=${BASH_REMATCH[1]}
# Note (#D1820): これまで行の途中から始まるコメントを除去していたが、実際に
# inputrc 色々書き込んで調べると特に無視されている訳では無い事が分かった。
# なので、行頭に # がある場合にのみ処理を中断することにする。
[[ ! $arg || $arg == '#'* ]] && return 0

# # コメント除去 (quote されていない "空白+#" 以降はコメント)
# local q=\' ifs=$_ble_term_IFS
# local rex='^(([^\"'$q$ifs']|"([^\"]|\\.)*"|'$q'([^\'$q']|\\.)*'$q'|\\.|['$ifs']+[^#'$_ifs'])*)['$ifs']+#'
# [[ $arg =~ $rex ]] && arg=${BASH_REMATCH[1]}

local ifs=$' \t\n'
if [[ $arg == 'set'["$ifs"]* ]]; then
Expand Down

0 comments on commit f9db7d8

Please sign in to comment.