Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: State of the ZLE region across new prompts
- X-seq: zsh-workers 38845
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: State of the ZLE region across new prompts
- Date: Wed, 13 Jul 2016 12:13:46 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1468404827; bh=fnZD0Ll7+oeU/bxfkLae5b3tkq5fjyz3Apjb+f8zsrQ=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=K0y03eVjvfhUsDFSoi2ahub7bpZ22KcLve4zjBDafehvLydhQAjyVmGgfwrCDCcOuWQiUZ/k8vvFR8yCquOLomwGgM5BVdTpI2MIzwodOIrcuv+83gPbNbRpgbr+10Nph2K3GPlxqwPp4N+BEl/pv3z2y8z2fYTx5gbhFZkjuQsLmqsfHnJFMs2p3x3HWcYNvLBwXbzWd4tyyeMvNK1zV4gh7bJ3OL7QByA2SOSXPNWCwHyB2rXfr/wYoCeDnG+0LOLNTD/qP5/q5btcOl/qq4auBkZVWbzE5pCyFrBH3up0QlEdSHSqJ/s953Lgb8/sGJHrmCtwOSNsUFPAsO7AiQ==
- In-reply-to: <160711212814.ZM15416@torch.brasslantern.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <160711212814.ZM15416@torch.brasslantern.com>
Bart wrote:
> With this in place, run a command, then when ZLE resumes at the next
> prompt, start recalling commands with up-line-or-history. Note that
> they are highlighted. I'm not entirely sure but I believe this means
> the region is still active, not just that highlighting is confused.
> Is REGION_ACTIVE intended to persist in this way?
Yes, the region is remaining active. We reset it before calling
zle-line-finish. The patch below instead resets it on entry, before
zle-line-init.
> Aside: The documentation for the zle_highlight "region" context
> discusses "calling set-mark-command with a negative numeric argument"
> and "exchange-point-and-mark with a zero numeric argument" but does
> not mention deactivate-region or assignments to REGION_ACTIVE.
How about the following rewording? I don't think it is the right place
in the documentation to enumerate all the ways in which the region can
be activated and deactivated so this removes the part about numeric
arguments (which is covered under the respective widgets documentation).
"selection" is probably the most common term for what emacs calls the
region and vim's visual mode warrants a mention.
Oliver
diff --git a/Doc/Zsh/zle.yo b/Doc/Zsh/zle.yo
index f51eada..1642c5b 100644
--- a/Doc/Zsh/zle.yo
+++ b/Doc/Zsh/zle.yo
@@ -2571,15 +2571,14 @@ When one of the incremental history search widgets is active, the
area of the command line matched by the search string or pattern.
)
item(tt(region))(
-The region between the cursor (point) and the mark as set with
-tt(set-mark-command). The region is only highlighted if it is active,
-which is the case if tt(set-mark-command) or tt(exchange-point-and-mark)
-has been called and the line has not been subsequently modified. The
-region can be deactivated by calling tt(set-mark-command) with a
-negative numeric argument, or reactivated by calling
-tt(exchange-point-and-mark) with a zero numeric argument. Note
-that whether or not the region is active has no effect on its
-use within widgets, it simply determines whether it is highlighted.
+The currently selected text. In emacs terminology, this is referred to as
+the region and is bounded by the cursor (point) and the mark. The region
+is only highlighted if it is active, which is the case after the mark
+is modified with tt(set-mark-command) or tt(exchange-point-and-mark).
+Note that whether or not the region is active has no effect on its
+use within emacs style widgets, it simply determines whether it is
+highlighted. In vi mode, the region corresponds to selected text in
+visual mode.
)
cindex(special characters, highlighting)
cindex(highlighting, special characters)
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index 472e326..ac31d4e 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -1159,7 +1159,6 @@ zlecore(void)
}
- region_active = 0;
popheap();
}
@@ -1292,6 +1291,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
lastcol = -1;
initmodifier(&zmod);
prefixflag = 0;
+ region_active = 0;
zrefresh();
Messages sorted by:
Reverse Date,
Date,
Thread,
Author