Patch 8.0.0567

88 views
Skip to first unread message

Bram Moolenaar

unread,
Apr 18, 2017, 12:53:18 PM4/18/17
to vim...@googlegroups.com

Patch 8.0.0567
Problem: Call for requesting color and ambiwidth is too early. (Hirohito
Higashi)
Solution: Move the call down to below resetting "starting".
Files: src/main.c


*** ../vim-8.0.0566/src/main.c 2017-04-02 18:19:48.376143576 +0200
--- src/main.c 2017-04-18 18:47:16.909399297 +0200
***************
*** 666,677 ****

starttermcap(); /* start termcap if not done by wait_return() */
TIME_MSG("start termcap");
- #if defined(FEAT_TERMRESPONSE)
- # if defined(FEAT_MBYTE)
- may_req_ambiguous_char_width();
- # endif
- may_req_bg_color();
- #endif

#ifdef FEAT_MOUSE
setmouse(); /* may start using the mouse */
--- 666,671 ----
***************
*** 801,806 ****
--- 795,805 ----
/* Requesting the termresponse is postponed until here, so that a "-c q"
* argument doesn't make it appear in the shell Vim was started from. */
may_req_termresponse();
+
+ # if defined(FEAT_MBYTE)
+ may_req_ambiguous_char_width();
+ # endif
+ may_req_bg_color();
#endif

/* start in insert mode */
*** ../vim-8.0.0566/src/version.c 2017-04-15 15:37:09.646798989 +0200
--- src/version.c 2017-04-18 18:49:24.664614475 +0200
***************
*** 766,767 ****
--- 766,769 ----
{ /* Add new patch number below this line */
+ /**/
+ 567,
/**/

--
DEAD PERSON: I'm getting better!
CUSTOMER: No, you're not -- you'll be stone dead in a moment.
MORTICIAN: Oh, I can't take him like that -- it's against regulations.
The Quest for the Holy Grail (Monty Python)

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

François Ingelrest

unread,
May 1, 2017, 2:21:48 AM5/1/17
to vim...@googlegroups.com
Hi,

On 18 April 2017 at 18:53, Bram Moolenaar <Br...@moolenaar.net> wrote:
> Patch 8.0.0567
> Problem: Call for requesting color and ambiwidth is too early. (Hirohito
> Higashi)
> Solution: Move the call down to below resetting "starting".
> Files: src/main.c

This patch broke termguicolors for me (debian 64 bits, Gnome
terminal), it was working fine before this patch.

Am I the only one affected by this?

Bram Moolenaar

unread,
May 1, 2017, 9:36:03 AM5/1/17
to vim...@googlegroups.com, François Ingelrest
Strange. Do you have t_RB set? If so, does it help to make it empty?

--
Shaw's Principle: Build a system that even a fool can use, and
only a fool will want to use it.

François Ingelrest

unread,
May 1, 2017, 9:49:49 AM5/1/17
to vim...@googlegroups.com
Hi Bram,

On 1 May 2017 at 15:35, Bram Moolenaar <Br...@moolenaar.net> wrote:
> Strange. Do you have t_RB set? If so, does it help to make it empty?

Yes it seems to be automatically set (at least not set in my .vimrc)
to <1b>]11;?<07>. If I make it empty in my .vimrc, termguicolors works
as expected.

Bram Moolenaar

unread,
May 1, 2017, 11:37:45 AM5/1/17
to vim...@googlegroups.com, François Ingelrest
OK, well then maybe we should implement this comment:
{/* TODO: don't set option when already the right value */

Try this patch:

--- /home/mool/vim/git/vim80/src/term.c 2017-04-20 19:44:05.409983042 +0200
+++ term.c 2017-05-01 17:29:12.709850330 +0200
@@ -4385,14 +4385,20 @@
if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0
&& tp[j + 11] == '/' && tp[j + 16] == '/'
&& !option_was_set((char_u *)"bg"))
- {/* TODO: don't set option when already the right value */
+ {
+ char *newval = (3 * '6' < tp[j+7] + tp[j+12]
+ + tp[j+17]) ? "light" : "dark";
+
LOG_TR("Received RBG");
rbg_status = RBG_GOT;
- set_option_value((char_u *)"bg", 0L, (char_u *)(
- (3 * '6' < tp[j+7] + tp[j+12] + tp[j+17])
- ? "light" : "dark"), 0);
- reset_option_was_set((char_u *)"bg");
- redraw_asap(CLEAR);
+ if (STRCMP(p_bg, newval) != 0)
+ {
+ /* value differs, apply it */
+ set_option_value((char_u *)"bg", 0L,
+ (char_u *)newval, 0);
+ reset_option_was_set((char_u *)"bg");
+ redraw_asap(CLEAR);
+ }
}

/* got finished code: consume it */

--
Dreams are free, but there's a small charge for alterations.

François Ingelrest

unread,
May 2, 2017, 2:04:59 AM5/2/17
to vim...@googlegroups.com
Hi,

On 1 May 2017 at 17:37, Bram Moolenaar <Br...@moolenaar.net> wrote:
> OK, well then maybe we should implement this comment:
> {/* TODO: don't set option when already the right value */
>
> Try this patch:
>
> ...

Sorry but that doesn't work.

Patch applies cleanly and compilation doesn't generate any error or
warning, but if I remove the 'set t_RB=' line from my .vimrc
termguicolors doesn't work.

Bram Moolenaar

unread,
May 2, 2017, 5:16:45 AM5/2/17
to vim...@googlegroups.com, François Ingelrest

François Ingelrest wrote;
Hmm, and when you set 'background' to the right value in your .vimrc,
does that make any difference?

--
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.

François Ingelrest

unread,
May 2, 2017, 5:35:32 AM5/2/17
to vim...@googlegroups.com
On 2 May 2017 at 11:15, Bram Moolenaar <Br...@moolenaar.net> wrote:
> Hmm, and when you set 'background' to the right value in your .vimrc,
> does that make any difference?

Yes this works. I added 'set t_RB=<1b>]11;?<07>' and I get the proper
colors. Actually setting it to any value seems to work as well since
it's overwritten by vim's code later on if I got it correctly. So
setting it to be empty or to any string works, it's not setting it at
all in my .vimrc that breaks termguicolors for me.

Bram Moolenaar

unread,
May 2, 2017, 2:53:41 PM5/2/17
to vim...@googlegroups.com, François Ingelrest
Yeah, as son as you set 'background' explicitly then Vim won't try to
fetch the background color from the terminal. So only when the original
guess is wrong it would result in a redraw and the side effects of
setting 'background'.

We can't influence the first guess for the background, thus there is not
much else to play with here to see if we can make the side effects of
setting 'background' not break termguicolors.

--
Permission is granted to read this message out aloud on Kings Cross Road,
London, under the condition that the orator is properly dressed.
Reply all
Reply to author
Forward
0 new messages