From: Huy Z <h-zsh@huyz.us>
To: zsh-workers@zsh.org
Subject: Path to fix copy-earlier-word handling of numeric arguments
Date: Thu, 4 Apr 2024 02:39:49 -0700 [thread overview]
Message-ID: <03af2fe1-21d3-65cb-4bfe-d8e84c79c2dd@huyz.us> (raw)
[-- Attachment #1: Type: text/plain, Size: 1066 bytes --]
As initially submitted at https://github.com/zsh-users/zsh/pull/116 :
------------------------------------------------------------------------
As mentioned in the code comment:
# 1 means last word, 2 second last, etc.
the numeric argument is supposed to be interpreted as an offset from the
end.
The intended behavior is a lot more useful than the current behavior.
------------------------------------------------------------------------
diff --git a/Functions/Zle/copy-earlier-word
b/Functions/Zle/copy-earlier-word
index 90e862da3..1262c0c82 100644
--- a/Functions/Zle/copy-earlier-word
+++ b/Functions/Zle/copy-earlier-word
@@ -11,7 +11,7 @@ setopt typesetsilent
typeset -g __copyword
if (( ${NUMERIC:-0} )); then
# 1 means last word, 2 second last, etc.
- (( __copyword = ${NUMERIC:-0} ))
+ (( __copyword = -${NUMERIC:-0} ))
zstyle -s :$WIDGET widget __copywidget
elif [[ -n $__copyword && $WIDGET = $LASTWIDGET ]]; then
(( __copyword-- ))
------------------------------------------------------------------------
[-- Attachment #2: Type: text/html, Size: 7119 bytes --]
next reply other threads:[~2024-04-04 9:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-04 9:39 Huy Z [this message]
2024-04-04 10:03 ` Mikael Magnusson
2024-04-04 10:10 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=03af2fe1-21d3-65cb-4bfe-d8e84c79c2dd@huyz.us \
--to=h-zsh@huyz.us \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).