zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <pws@csr.com>
To: zsh-workers@sunsite.dk (Zsh hackers list)
Subject: Re: PATCH: command line highlighting
Date: Thu, 3 Apr 2008 16:29:27 +0100	[thread overview]
Message-ID: <20080403162927.0eebc411@news01> (raw)
In-Reply-To: <553.1207231873@dcle12>

On Thu, 03 Apr 2008 16:11:13 +0200
Oliver Kiddle <okiddle@yahoo.co.uk> wrote:
> By the way, the documented feature that accepting a line does not save
> region_highlight doesn't appear to work. For me, the variable and the
> highlights are persisting.

I got confused.  region_highlight doesn't get unset when it goes out of
scope: this is standard behaviour for ZLE variables and we need the effect
to persist for the life of the command line here, too.  So it needs to be
reset explicitly.  Clearly it won't be valid for a new line.

(For that reason, history could be a bit of a nightmare to get right.)

> > We need to be able to see if a key is read within the time and if it is
> > unget it and return (like sit-for in Emacs).  Something like
> >   read -kt 1 && zle -U $REPLY
> > should work, but I haven't played around with it yet.
> 
> I had to add a call to "zle -R" so that it doesn't wait till the end of
> the widget to display the highlight but otherwise, that seems to work.
> An additional key typed in less than a second will remove the
> highlighting but that's actually fine.

Yes, that was deliberate.

Index: Src/Zle/zle_main.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v
retrieving revision 1.106
diff -u -r1.106 zle_main.c
--- Src/Zle/zle_main.c	3 Apr 2008 15:20:30 -0000	1.106
+++ Src/Zle/zle_main.c	3 Apr 2008 15:23:51 -0000
@@ -1225,6 +1225,8 @@
     zleline = NULL;
     forget_edits();
     errno = old_errno;
+    /* highlight no longer valid */
+    set_region_highlight(NULL, NULL);
     return s;
 }
 
Index: Src/Zle/zle_refresh.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_refresh.c,v
retrieving revision 1.54
diff -u -r1.54 zle_refresh.c
--- Src/Zle/zle_refresh.c	3 Apr 2008 11:39:12 -0000	1.54
+++ Src/Zle/zle_refresh.c	3 Apr 2008 15:23:51 -0000
@@ -434,6 +434,11 @@
 }
 
 
+/*
+ * The parameter system requires the pm argument, but this
+ * may be NULL if called directly.
+ */
+
 /**/
 void
 set_region_highlight(UNUSED(Param pm), char **aval)

-- 
Peter Stephenson <pws@csr.com>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


  reply	other threads:[~2008-04-03 15:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-02 19:39 Peter Stephenson
2008-04-03 10:30 ` Oliver Kiddle
2008-04-03 11:33   ` Peter Stephenson
2008-04-03 14:11     ` Oliver Kiddle
2008-04-03 15:29       ` Peter Stephenson [this message]
2008-04-03 15:13     ` Peter Stephenson
2008-04-04  9:13 ` Mikael Magnusson
2008-04-04 16:28   ` Peter Stephenson
2008-04-06 20:31 ` Bart Schaefer
2008-04-07  9:36   ` 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=20080403162927.0eebc411@news01 \
    --to=pws@csr.com \
    --cc=zsh-workers@sunsite.dk \
    /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).