Skip to content

Commit

Permalink
global: fix leak variable "ret"
Browse files Browse the repository at this point in the history
  • Loading branch information
akinomyoga committed Feb 12, 2019
1 parent 18766d2 commit 9892d63
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
2 changes: 2 additions & 0 deletions keymap/vi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1298,6 +1298,7 @@ function ble/keymap:vi/operator:d {
# 最後の行が削除される時は前の行の非空白行頭まで後退
if ((end==${#_ble_edit_str}&&beg>0)); then
# fix start position
local ret
((beg--))
ble-edit/content/find-logical-bol "$beg"
ble-edit/content/find-non-space "$ret"
Expand Down Expand Up @@ -6989,6 +6990,7 @@ function ble/widget/vi_xmap/increment.impl {
local beg=$_ble_edit_mark end=$_ble_edit_ind
((beg<=end)) || local beg=$end end=$beg
if [[ $mark_type == vi_line ]]; then
local ret
ble-edit/content/find-logical-bol "$beg"; local beg=$ret
ble-edit/content/find-logical-eol "$end"; local end=$ret
else
Expand Down
3 changes: 2 additions & 1 deletion lib/core-complete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2004,6 +2004,7 @@ function ble-complete/insert {
local insert_beg=$1 insert_end=$2
local insert=$3 suffix=$4
local original_text=${_ble_edit_str:insert_beg:insert_end-insert_beg}
local ret

# 編集範囲の最小化
local insert_replace=
Expand All @@ -2013,7 +2014,7 @@ function ble-complete/insert {
((insert_beg=insert_end))
else
# 既存部分の置換がある場合
local ret; ble/string#common-prefix "$insert" "$original_text"
ble/string#common-prefix "$insert" "$original_text"
if [[ $ret ]]; then
insert=${insert:${#ret}}
((insert_beg+=${#ret}))
Expand Down
2 changes: 1 addition & 1 deletion lib/core-syntax.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5134,7 +5134,7 @@ else
_ble_syntax_highlight_lscolors_ext[ret+1]=$value
}
function ble-syntax/highlight/ls_colors/.read-extension {
local key=$1 ret
local key=$1
ble-syntax/highlight/ls_colors/.find-extension "$key"
ret=${_ble_syntax_highlight_lscolors_ext[ret+1]}
[[ $ret ]]
Expand Down
11 changes: 6 additions & 5 deletions src/edit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2177,7 +2177,7 @@ function ble/widget/batch-insert {
done

if ((index<N)); then
local ins=
local ret ins=
while ((index<N)); do
ble/util/c2s "${chars[index]}"; ins=$ins$ret
((index++))
Expand Down Expand Up @@ -4021,7 +4021,7 @@ function ble-edit/undo/.load {

# Note: 実際の編集過程に依らず、現在位置 _ble_edit_ind の周辺で
# 変更前と変更後の文字列だけから「変更範囲」を決定する事にする。
local old=$_ble_edit_str new=$str
local old=$_ble_edit_str new=$str ret
if [[ $bleopt_undo_point == end ]]; then
ble/string#common-suffix "${old:_ble_edit_ind}" "$new"; local s1=${#ret}
local old=${old::${#old}-s1} new=${new:${#new}-s1}
Expand Down Expand Up @@ -5487,13 +5487,14 @@ function ble-edit/isearch/history-backward.fib {
ble-edit/isearch/.next-history.fib
}
function ble-edit/isearch/history-self-insert.fib {
local needle=
if [[ ! $fib_suspend ]]; then
local code=$1
((code==0)) && return
local ret needle
ble/util/c2s "$code"
local ret; ble/util/c2s "$code"
needle=$_ble_edit_isearch_str$ret
fi
ble-edit/isearch/.next-history.fib append "$_ble_edit_isearch_str$ret"
ble-edit/isearch/.next-history.fib append "$needle"
}

function ble-edit/isearch/prev {
Expand Down

0 comments on commit 9892d63

Please sign in to comment.