zsh-users
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Doron Behar <doron.behar@gmail.com>
Cc: zsh-users@zsh.org
Subject: Re: ZLE Vi-mode: visual mode selection doesn't match the characters highlighted
Date: Sun, 13 Oct 2019 10:02:11 +0200	[thread overview]
Message-ID: <11565-1570953731.113937@7Hja.mAXg.cCYH> (raw)
In-Reply-To: <20191012150611.rwjwhbiqpvwla656@NUX>

Doron Behar wrote:
> I'm having a small inconvenience with the way characters are highlighted
> in visual mode.
>
> Say my $BUFFER has the following text, current $KEYMAP is "vicmd", and
> the cursor is located where ^ is:

>     ZSH is the best shell
>               ^
>               -----            (selected characters)

> The problem is, that only the 3 characters ("bes") are highlighted so
> it's not clear what characters exactly are selected.

I can't reproduce this. Could you perhaps try with your setup/plugins
disabled by starting from `zsh -df'. It may also be worth trying a
different terminal emulator. If you use a vi command such as x or c, is
the full region affected?

If the position of the actual cursor is not highlighted, I would
suspect that your terminal emulator uses standout (reverse video)
for the cursor which combined with the default zsh use of standout
for the region reverses it back to the original state. What do you
have in the zle_highlight array? Try configuring the region, i.e.
region:bg=<something> It might also be worth configuring how your
terminal emulator displays the cursor.

The last character not being highlighted (the `t' of best) is curious.
This seems to perhaps reflect the emacs mode style where you wouldn't
expect `t' to be included in the selection because the original cursor
can logically be viewed as being situated between the `s' and the `t'.

This would imply a problem with the two lines in zle_refresh.c that
read:

        } else if (invicmdmode())
            INCPOS(region_highlights[0].end);

invicmdmode() merely checks !strcmp(curkeymapname, "vicmd")

If you're able to check curkeymapname at this point in a debugger, that
might help. Note that it should be `vicmd' and not `visual' because
`visual' is only used as a local keymap. If you've got some plugin that
has replaced 'vicmd' then I'd expect that to have broken a whole lot
more of vi mode.

Oliver

  reply	other threads:[~2019-10-13  8:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-12 15:06 Doron Behar
2019-10-13  8:02 ` Oliver Kiddle [this message]
     [not found]   ` <20191013110016.pdkjrobevpxkqx6e@NUX>
     [not found]     ` <68873-1571254670.273502@yOop.8xvF.viEb>
2019-10-17 10:51       ` Doron Behar
2019-10-17 15:23         ` Oliver Kiddle
2019-10-17 12:07       ` Doron Behar

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=11565-1570953731.113937@7Hja.mAXg.cCYH \
    --to=okiddle@yahoo.co.uk \
    --cc=doron.behar@gmail.com \
    --cc=zsh-users@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).