Skip to content

Commit

Permalink
patch 8.0.0610: the screen is redrawn when default 'background' is de…
Browse files Browse the repository at this point in the history
…tected

Problem:    The screen is redrawn when t_BG is set and used to detect the
            value for 'background'.
Solution:   Don't redraw when the value of 'background' didn't change.
  • Loading branch information
brammool committed Jun 4, 2017
1 parent 28a8193 commit 4b974d5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/term.c
Original file line number Diff line number Diff line change
Expand Up @@ -4385,14 +4385,20 @@ check_termcode(
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 */
Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
610,
/**/
609,
/**/
Expand Down

0 comments on commit 4b974d5

Please sign in to comment.