Skip to content

Commit

Permalink
keymap/vi (expand-range-for-linewise-operator): fix non-extended end …
Browse files Browse the repository at this point in the history
…point
  • Loading branch information
akinomyoga committed Apr 3, 2023
1 parent 78dd47e commit 2a8e746
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 4 additions & 4 deletions ble-edit.sh
Expand Up @@ -2104,14 +2104,14 @@ function _ble_edit_str.update-syntax {
fi
}

## 関数 ble-edit/content/bolp
## 現在カーソルが行頭に位置しているかどうかを判定します
## @fn ble-edit/content/bolp
## 現在カーソルが行末に位置しているかどうかを判定します
function ble-edit/content/eolp {
local pos=${1:-$_ble_edit_ind}
((pos==${#_ble_edit_str})) || [[ ${_ble_edit_str:pos:1} == $'\n' ]]
}
## 関数 ble-edit/content/bolp
## 現在カーソルが行末に位置しているかどうかを判定します
## @fn ble-edit/content/bolp
## 現在カーソルが行頭に位置しているかどうかを判定します
function ble-edit/content/bolp {
local pos=${1:-$_ble_edit_ind}
((pos<=0)) || [[ ${_ble_edit_str:pos-1:1} == $'\n' ]]
Expand Down
3 changes: 2 additions & 1 deletion keymap/vi.sh
Expand Up @@ -1403,7 +1403,7 @@ function ble/keymap:vi/expand-range-for-linewise-operator {
if ((beg<bol2&&_ble_edit_ind<=bol2&&end<=nol2)); then
end=$bol2
else
ble-edit/content/find-logical-eol "$end"; local end=$ret
ble-edit/content/find-logical-eol "$end"; end=$ret
[[ ${_ble_edit_str:end:1} == $'\n' ]] && ((end++))
fi
}
Expand Down Expand Up @@ -1832,6 +1832,7 @@ function ble/keymap:vi/operator:filter/.hook {
return 1
fi
new=${new%$'\n'}$'\n'
((end<${#_ble_edit_str})) && new=$new$'\n'
ble/widget/.replace-range "$beg" "$end" "$new" 1

_ble_edit_ind=$beg
Expand Down

0 comments on commit 2a8e746

Please sign in to comment.