Skip to content

Commit

Permalink
global: fix "setup => set up" and refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Feb 20, 2021
1 parent 69658ef commit c37a9dd
Show file tree
Hide file tree
Showing 11 changed files with 101 additions and 91 deletions.
2 changes: 1 addition & 1 deletion README-ja_JP.md
Expand Up @@ -57,7 +57,7 @@ make -C ble.sh install DESTDIR=/tmp/blesh-package PREFIX=/usr/local

`ble.sh` はよくある Bash 設定集のようにプロンプト (`PS1`)、エイリアス、関数を提供するものではありません。
`ble.sh` はより低層の基盤を提供するもので、ユーザは自分でプロンプトやエイリアスを設定する必要があります。
勿論 `bash-it'`oh-my-bash` の様な他の Bash 設定と一緒に使っていただくことも可能です。
勿論 `bash-it``oh-my-bash` の様な他の Bash 設定と一緒に使っていただくことも可能です。

> デモ
>
Expand Down
4 changes: 2 additions & 2 deletions ble.pp
Expand Up @@ -724,8 +724,8 @@ function ble-update {
# Solaris: .freeze-utility-path で上書きされた awk を戻す
ble/bin/awk.use-solaris-xpg4

ble/builtin/trap/setup-hook EXIT
ble/builtin/trap/setup-hook INT
ble/builtin/trap/install-hook EXIT
ble/builtin/trap/install-hook INT

blehook ERR+='ble/builtin/trap/invoke ERR'
blehook ERR+='ble/function#try TRAPERR'
Expand Down
8 changes: 4 additions & 4 deletions blerc
Expand Up @@ -2,7 +2,7 @@

## This is a template for "~/.blerc".
##
## To use ble.sh in bash, please setup "~/.bashrc" as follows:
## To use ble.sh in bash, please set up "~/.bashrc" as follows:
##
## ```bash
## # bashrc
Expand All @@ -14,7 +14,7 @@
## # Your bashrc contents should come between the two lines.
##
## # Please put the following line in the end of .bashrc
## ((_ble_bash)) && ble-attach
## [[ ${BLE_VERSION-} ]] && ble-attach
## ```
##

Expand Down Expand Up @@ -311,7 +311,7 @@
#bleopt decode_abort_char=28


## The following settings setups the behavior for errors while user input
## The following settings sets up the behavior for errors while user input
## decoding. "error_char" is the decoding error for the current character
## encoding. "error_cseq" indicates the unrecognized CSI sequences.
## "error_kseq" indicates the unbound key sequences. "abell" and "vbell" turn
Expand Down Expand Up @@ -612,7 +612,7 @@ function blerc/vim-load-hook {
# bleopt keymap_vi_mode_name_blockwise=BLOCK


## The following setting setups the keymap settings with Meta modifiers
## The following setting sets up the keymap settings with Meta modifiers

# ble-decode/keymap:vi_imap/define-meta-bindings

Expand Down
12 changes: 6 additions & 6 deletions keymap/vi.sh
Expand Up @@ -434,7 +434,7 @@ function ble/widget/vi_imap/normal-mode.impl {
ble/keymap:vi/mark/end-edit-area
[[ :$opts: == *:InsertLeave:* ]] && builtin eval -- "$_ble_keymap_vi_insert_leave"

# setup normal mode
# set up normal mode
_ble_edit_mark_active=
_ble_edit_overwrite_mode=
_ble_keymap_vi_insert_leave=
Expand Down Expand Up @@ -5380,9 +5380,9 @@ function ble/widget/vi_xmap/command-help {

#------------------------------------------------------------------------------

## @fn ble/keymap:vi/setup-map
## @fn ble/keymap:vi/set-up-command-map
## @var[in] ble_bind_keymap
function ble/keymap:vi/setup-map {
function ble/keymap:vi/set-up-command-map {
ble-bind -f 0 vi-command/append-arg
ble-bind -f 1 vi-command/append-arg
ble-bind -f 2 vi-command/append-arg
Expand Down Expand Up @@ -5542,7 +5542,7 @@ function ble/widget/vi_omap/switch-to-blockwise {
}

function ble-decode/keymap:vi_omap/define {
ble/keymap:vi/setup-map
ble/keymap:vi/set-up-command-map

ble-bind -f __default__ vi_omap/__default__
ble-bind -f __line_limit__ nop
Expand Down Expand Up @@ -5744,7 +5744,7 @@ function ble/widget/vi_nmap/__line_limit__ {
}

function ble-decode/keymap:vi_nmap/define {
ble/keymap:vi/setup-map
ble/keymap:vi/set-up-command-map

ble-bind -f __default__ vi-command/decompose-meta
ble-bind -f __line_limit__ vi_nmap/__line_limit__
Expand Down Expand Up @@ -7401,7 +7401,7 @@ function ble/widget/vi_xmap/progressive-decrement { ble/widget/vi_xmap/increment
#--------------------------------------

function ble-decode/keymap:vi_xmap/define {
ble/keymap:vi/setup-map
ble/keymap:vi/set-up-command-map

ble-bind -f __default__ vi-command/decompose-meta

Expand Down
10 changes: 5 additions & 5 deletions lib/core-complete.sh
Expand Up @@ -3694,7 +3694,7 @@ function ble/complete/candidates/determine-common-prefix {
local common=${cand_word[0]}
local clen=${#common}
if ((cand_count>1)); then
# setup ignore case
# set up ignore case
local unset_nocasematch= flag_tolower=
if [[ :$comp_type: == *:i:* ]]; then
if ((_ble_bash<30100)); then
Expand Down Expand Up @@ -5374,9 +5374,9 @@ function ble/complete/auto-complete/.search-history-heavy {
return 0
}

## @fn ble/complete/auto-complete/.setup-auto-complete-mode
## @fn ble/complete/auto-complete/.enter-auto-complete-mode
## @var[in] type COMP1 cand word insert suffix
function ble/complete/auto-complete/.setup-auto-complete-mode {
function ble/complete/auto-complete/.enter-auto-complete-mode {
_ble_complete_ac_type=$type
_ble_complete_ac_comp1=$COMP1
_ble_complete_ac_cand=$cand
Expand Down Expand Up @@ -5416,7 +5416,7 @@ function ble/complete/auto-complete/.check-history {
ble/complete/auto-complete/.insert "${insert:${#COMPS}}"

# vars: type COMP1 cand word insert suffix
ble/complete/auto-complete/.setup-auto-complete-mode
ble/complete/auto-complete/.enter-auto-complete-mode
return 0
}

Expand Down Expand Up @@ -5473,7 +5473,7 @@ function ble/complete/auto-complete/.check-context {
fi

# vars: type COMP1 cand word insert suffix
ble/complete/auto-complete/.setup-auto-complete-mode
ble/complete/auto-complete/.enter-auto-complete-mode
return 0
}

Expand Down
8 changes: 4 additions & 4 deletions lib/core-syntax.sh
Expand Up @@ -6310,10 +6310,10 @@ _ble_syntax_progcolor_vars=(
# ble/syntax/progcolor/wattr#*
wattr_buff wattr_pos wattr_g)

## @fn ble/syntax/progcolor/setup-vars i:nofs
## @fn ble/syntax/progcolor/load-word-data i:nofs
## @var[out] TE_i TE_nofs node
## @var[out] wtype wlen wbeg wend wattr
function ble/syntax/progcolor/setup-vars {
function ble/syntax/progcolor/load-word-data {
# TE_i TE_nofs
TE_i=${1%%:*} TE_nofs=${1#*:}
[[ $1 != *:* ]] && TE_nofs=0
Expand Down Expand Up @@ -6696,7 +6696,7 @@ function ble/syntax/progcolor/default {
local ref=${tree_words[i]}
[[ $ref ]] || continue
local progcolor_iword=$i
ble/syntax/progcolor/setup-vars "$ref"
ble/syntax/progcolor/load-word-data "$ref"
ble/syntax/progcolor/word:default
done
}
Expand Down Expand Up @@ -6756,7 +6756,7 @@ function ble/syntax/progcolor {
# コマンド名に対しては既定の着色を実行
if [[ ${tree_words[0]} ]]; then
local "${_ble_syntax_progcolor_vars[@]}"
ble/syntax/progcolor/setup-vars "${tree_words[0]}"
ble/syntax/progcolor/load-word-data "${tree_words[0]}"
[[ $wattr == - ]] && ble/syntax/progcolor/word:default
fi
}
Expand Down
3 changes: 2 additions & 1 deletion memo/ChangeLog.md
Expand Up @@ -34,7 +34,7 @@
- edit (`kill-forward-logical-line`): fix a bug not deleting newline at the end of the line `#D1443` 09cf7f1
- complete (mandb): fix an encoding prpblem of utf8 manuals `#D1446` 7a4a480
- util (`ble/util/msleep`): fix hang in Cygwin by swithing from `/dev/udp/0.0.0.0/80` to `/dev/zero` `#D1452` d4d718a
- syntax: fix broken AST with `[[` keyword `#D1454` 0000000
- syntax: fix broken AST with `[[` keyword `#D1454` 69658ef
- global:work around bash-4.2 bug of `declare -gA` (reported by 0xC0ncord) `#D1470` 8856a04
- global: fix declaration of associative arrays for `ble-reload` `#D1471` 3cae6e4

Expand All @@ -44,6 +44,7 @@
- global: update the style of document comments ff4c4e7
- util: add function `ble/string#quote-words` `#D1451` f03b87b
- syntax (`ble/syntax:bash/simple-word/eval`): cache `#D1453` 6d8311e
- global: refactor `setup => set up / set-up` `#D1456` 0000000

<!---------------------------------------------------------------------------->
# ble-0.4.0-devel2
Expand Down
9 changes: 9 additions & 0 deletions note.txt
Expand Up @@ -3811,6 +3811,15 @@ bash_tips

全て 40300 に書き換えた。まあ、これで何も起こらないだろう。

2021-02-01

* setup を動詞の様に使っている箇所が多くて気になるので修正する [#D1456]

set up に代わる動詞を探しても余り良いのが見つからない。文脈に応じて全く違う
表現に改めた関数もある。set up だけの場合には関数名としてはくっつけて setup
としても良い事にした。setup-xxx というのは気になるのでせめて set-up-xxx の
様に変更した。

2021-01-30

* edit: emoji の表を更新する (reported by endorfina) [#D1455]
Expand Down
6 changes: 3 additions & 3 deletions src/decode.sh
Expand Up @@ -2036,7 +2036,7 @@ function ble-decode/widget/.call-keyseq {
# for keylog suppress
local _ble_decode_keylog_depth=$((_ble_decode_keylog_depth+1))

# setup variables
# set up variables
local WIDGET=$command KEYMAP=$_ble_decode_keymap LASTWIDGET=$_ble_decode_widget_last
local -a KEYS=(${_ble_decode_key__seq//_/ } $key)
_ble_decode_widget_last=$WIDGET
Expand All @@ -2056,7 +2056,7 @@ function ble-decode/widget/.call-async-read {
# for keylog suppress
local _ble_decode_keylog_depth=$((_ble_decode_keylog_depth+1))

# setup variables
# set up variables
local WIDGET=$1 KEYMAP=$_ble_decode_keymap LASTWIDGET=$_ble_decode_widget_last
local -a KEYS=($2)
builtin eval -- "$WIDGET"; local ext=$?
Expand Down Expand Up @@ -2571,7 +2571,7 @@ function ble/decode/cmap/decode-chars {
local bleopt_decode_error_cseq_vbell=
local bleopt_decode_error_cseq_discard=

# setup hook and run
# set up hook and run
local -a ble_decode_bind_keys=()
local _ble_decode_key__hook=ble/decode/cmap/decode-chars.hook
local ble_decode_char_sync=1 # ユーザ入力があっても中断しない
Expand Down

0 comments on commit c37a9dd

Please sign in to comment.