From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.2 Received: from primenet.com.au (ns1.primenet.com.au [203.24.36.2]) by inbox.vuxu.org (OpenSMTPD) with ESMTP id b78390ab for ; Thu, 17 Oct 2019 12:09:01 +0000 (UTC) Received: (qmail 9036 invoked by alias); 17 Oct 2019 12:08:53 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: List-Unsubscribe: X-Seq: 24353 Received: (qmail 23981 invoked by uid 1010); 17 Oct 2019 12:08:53 -0000 X-Qmail-Scanner-Diagnostics: from mail-wm1-f42.google.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.102.0/25601. spamassassin: 3.4.2. Clear:RC:0(209.85.128.42):SA:0(-1.0/5.0):. Processed in 2.399113 secs); 17 Oct 2019 12:08:53 -0000 X-Envelope-From: doron.behar@gmail.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _netblocks.google.com designates 209.85.128.42 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:reply-to:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eZ6ggyDkny+S8ogpLGeXUHG9zaznt1jP3Trv7waLxQA=; b=V0rqeMTBpkEDV6FX3o8q6z0zup6l3bBuJfNUtkFEaEspTjZwH/6zWj+lvMO8Kdvxts +Te7mCK2pVdW6/2lDtZwF0dKEMF+kXdThL8fDsKqG7jRvFjSsoECiqNhynAv0Dqu8n9/ H/P8floBr67Q53Wdfe5j0naxV4y26jClzRTb0SQgkljXk6HFuZitkypJMJiOEacE8Fow rVfNdIHurzrloMv3FNY2PcTU00Ud/T/rd6klbo8ASMfUZNRsaTF31L9NcLj+E+uHFGKN Xx/T8MtR7pfl1QqsjGbnDTg3ufxPD2QzKY9T0ZKQPi3lzK0S5tijcj5p1n+odKf3Fe87 hmoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:reply-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=eZ6ggyDkny+S8ogpLGeXUHG9zaznt1jP3Trv7waLxQA=; b=iFz8YUbaIqGdmFuKX0YNMjZe9ONjyGdvDYxE+ZkVeuBCTngQf8bQFf/wzDDrdHfmon +gd96+spjv+OVLRFAu0v/Uj/UaxafdwUfKVziRw8QgQpfPW/7AnU+OKbPDzYL5m9toIw PukKZBxafncPxFF/SGsDCDtXRGR2n+0v+bJ+CbL/fcFrK6FtMNemuw7x1Ocm5CFWt3jB Aw4AkLpDfK7je15MbzAsy+iQi3s5RMmQ1Li1W8mu1Wo+rkmznHd48izNYe9fXnyg49SX yscBHEFAz+VUAqOakvC6n+5clcyN9j9hgmzO9ukSLpaNvEv5obPj6667ntl8fWf9T7oT xLeQ== X-Gm-Message-State: APjAAAUsk7ZuyZP7J3Q/c5lo7fSEiM0lrIi50EGhgQroC4NklaHbCCNP FotRdNQUsJEtE/Mkb0n7rXM= X-Google-Smtp-Source: APXvYqz0eJh7aCccsKx/cvhrC0Z3rwRTJ4x5yqFj2rRf8CVfRI/ua+llnXJJ4B3IQrgqJV4FgseeYg== X-Received: by 2002:a7b:c7d3:: with SMTP id z19mr2483732wmk.83.1571314096120; Thu, 17 Oct 2019 05:08:16 -0700 (PDT) Date: Thu, 17 Oct 2019 15:07:58 +0300 From: Doron Behar To: Oliver Kiddle , zsh-users@zsh.org Subject: Re: ZLE Vi-mode: visual mode selection doesn't match the characters highlighted Message-ID: <20191017120758.buf5bzi4ceidfpcw@NUX> Reply-To: Oliver Kiddle , zsh-users@zsh.org References: <20191012150611.rwjwhbiqpvwla656@NUX> <11565-1570953731.113937@7Hja.mAXg.cCYH> <20191013110016.pdkjrobevpxkqx6e@NUX> <68873-1571254670.273502@yOop.8xvF.viEb> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <68873-1571254670.273502@yOop.8xvF.viEb> User-Agent: NeoMutt/20180716 On Wed, Oct 16, 2019 at 09:37:50PM +0200, Oliver Kiddle wrote: > Replying off-list because your message was off-list. Feel free to quote > me from this message if you reply back on-list. > > On 13 Oct, Doron Behar wrote: > > Thanks for suggesting that. Indeed this is a combination of terminal > > emulators' settings / differences in behaviour along with a certain > > plugin I use: https://github.com/zsh-users/zsh-syntax-highlighting > > If I run zsh -df and then enable just that plugin by doing > . zsh-syntax-highlighting.zsh > then I still can't reproduce the problem with highlighting of the t. > > It doesn't appear to create any new keymaps so I'm unsure why you > don't get the `t' highlighted. Are you loading it with a plugin > manager. It'd be useful to isolate just the minimum required to > cause the problem. Oliver I appreciate your attendance to this issue yet I believe it's not related to the cursor's character not getting highlighted. I'd like to focus here on the cursor's character's highlighting and tend to the `t` not highlighted at the GitHub thread: https://github.com/zsh-users/zsh-syntax-highlighting/issues/637 I'll emphasize though, that _that_ plugin's issue, making the `t` not highlighted, appears only when the plugin colors the text selected, as best explained and demonstrated here: https://github.com/zsh-users/zsh-syntax-highlighting/issues/637#issuecomment-541623625 > Zsh does highlight the cursor position. It is down to the terminal > emulator how that appears. What terminal emulator do you use? What is > $TERM set to and what OS are you on? I use a green solid block as my > cursor and I know that the cursor position is included in the > selection. It appears much the same in vim and gvim. I'm using NixOS with URxvt. Our urxvt is compiled according to this "recipe": https://github.com/NixOS/nixpkgs/blob/7885eeaffdbd02ff6ce5483239fba1a063b314a9/pkgs/applications/misc/rxvt_unicode/default.nix My `$TERM` using `Urxvt` is `rxvt-unicode-256color`. I tested Urxvt with a blank .Xresources (I ran `xrdb merge .Xresources`) and other terminal emulators: - Gnome Terminal - Konsole Using a **non blinking cursor**, **all terminal emulators** have this issue. I made a demonstration of the other terminals here: https://gist.github.com/doronbehar/cba65dbac52b5859e8e967a6bc71ea91#gistcomment-3057815 I dearly hope the issue is clear now. ------- > You may be able to configure the cursor with escape sequences. For > example, for a vertical bar (good for vi insert mode): > print -n $'\e[5 q' I tried using an underline cursor and it's a good enough workaround for now - The character the cursor is located at is highlighted and I can even see the cursor's underline at the same color of the background right below that character. I wouldn't consider this as a solution because I tend to prefer the block cursor. > We could perhaps use some hooks for when visual mode is invoked and > finished. Yea I can use zle-keymap-select to further improve the experience but I still prefer using a unchanging block cursor. > > Oliver, do you think perhaps ZSH could 'double reverse' the cursor in > > visual mode? I think this will emulate Vim's behaviour better because > > this way, with a non blinking cursor in visual mode, the character the cursor > > stands upon will standout as well. > > That could make it hard to see which end of the selection the cursor > is at. I agree, but the current behavior is even worse: With a non blinking cursor, it's still impossible to see what end of the selection the cursor is at. On top of that, the character the cursor is at is not highlighted at all - misleading me into thinking it's an exclusive selection. > Whatever highlighting is chosen, there will be some terminal > setup for which it is not ideal and somebody who complains. I tend to disagree, as my GIF demonstrations show that probably all terminal emulators, with whatever colors and configured to not the cursor don't highlight characters properly. > Vim's defaults result in a barely visible selection if you chose a > near-white default background colour. I tested the terminal emulators listed above with white or whitish backgrounds, and the same misleading highlighting behaviour was there, only the colors were reversed. Again, only with a non blinking cursor. > Copying Vim might be tempting but Vim is not the only editor - zsh > uses the term region for the selection in many cases because the > feature first appeared in an Emacs form. I don't know how Emacs feels in that sense, nor ZSH when trying to emulate Emacs. But since ZSH emulates no more then 2 editors - I don't think it would be too much to emulate Vim better, if `bindkey -v` was set. > Feel free to lobby on zsh-workers if you want the defaults changed. > Personally I was happy to just tweak zle_highlight and the terminal > emulator. Thanks for the suggestion, yet I'm not sure what defaults I can change as it seems to me the underlying code needs a change. I'd thank you a lot Oliver if you'll merely tell me whether you get a sense of the issue thanks to the GIF demonstrations. Hoping you'll be able to advice me how to describe it better for zsh-workers. Doron.