zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: zsh-workers@zsh.org
Subject: Re: State of the ZLE region across new prompts
Date: Wed, 13 Jul 2016 12:13:46 +0200	[thread overview]
Message-ID: <53283.1468404826@hydra.kiddle.eu> (raw)
In-Reply-To: <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();
 


  parent reply	other threads:[~2016-07-13 10:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-12  4:28 Bart Schaefer
2016-07-12  8:28 ` Peter Stephenson
2016-07-13 10:13 ` Oliver Kiddle [this message]
2016-07-13 16:38   ` Bart Schaefer
2016-07-13 17:01     ` Peter Stephenson

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=53283.1468404826@hydra.kiddle.eu \
    --to=okiddle@yahoo.co.uk \
    --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).