mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-24 17:00:32 +02:00
unposted: replace-argument can take negative prefix to count from end
This commit is contained in:
parent
341d443414
commit
6076c474f2
3 changed files with 16 additions and 7 deletions
|
|
@ -12,21 +12,23 @@ if (( ${#BUFFER} == 0 )); then
|
|||
CURSOR=${#BUFFER}
|
||||
fi
|
||||
|
||||
local widget=$WIDGET
|
||||
integer numeric cursor=CURSOR
|
||||
local widget=$WIDGET numeric
|
||||
integer cursor=CURSOR
|
||||
if (( ${+NUMERIC} )); then
|
||||
numeric=$NUMERIC
|
||||
else
|
||||
numeric=-1
|
||||
fi
|
||||
local reply REPLY REPLY2
|
||||
integer index
|
||||
split-shell-arguments
|
||||
|
||||
if (( numeric >= 0 )); then
|
||||
index=$(( 2 + 2*numeric ))
|
||||
if [[ -n $numeric ]]; then
|
||||
if (( numeric < 0 )); then
|
||||
(( index = ${#reply} - 1 + 2*(numeric+1) ))
|
||||
else
|
||||
(( index = 2 + 2*numeric ))
|
||||
fi
|
||||
else
|
||||
index=$((REPLY & ~1 ))
|
||||
(( index = REPLY & ~1 ))
|
||||
fi
|
||||
|
||||
local edit
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue