Wednesday, October 18, 2017

Re: How to check if strikethrough is available

On Sat, Oct 14, 2017 at 5:56 AM, Rick Howe <rdcxy754@ybb.ne.jp> wrote:
> A strikethrough attribute is available since patch 1038.
> :help strikethrough says
> In general "undercurl" and "strikethrough" is only available in the GUI.
> But my cygwin and neovim terminals can also show it
> and then I am looking for how to check and use it as much as possible.
>
> I am now trying with:
> has('patch-8.0.1038') &&
> \(&term == 'builtin_gui' || &termguicolors || (!empty(&t_Ts) && !empty(&t_Te)))
>
> I would appreciate if you could give me more useful way.

1. The usual way to test for the GUI is

:if has('gui_running')

rather than

:if &term == 'builtin_gui'

which, however, should work too.

2. 'termguicolors' can be on even in a terminal emulator which doesn't
support strikethrough or undercurl: it just means that your terminal
understands #RRGGBB color codes (where each of these letters
represents a hex digit), though maybe only for background and
foreground. IMHO you should not rely of it.

3. I notice that in my gvim 8.0.1203 with GTK2 GUI running in GUI
mode, t_Ts and t_Te are defined as ^[|4c and ^[|4C respectively, so I
suppose that the test for has('gui_running') is superfluous. (In the
same executable running as "vim" in a konsole terminal, they are ^[[9m
and ^[[29m respectively.)


The above give the following simplified test:

:if has('patch-8.0.1038') && &t_Ts != '' && &t_Te != ''


Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment