Skip to content

Commit 4b974d5

Browse files
committed
patch 8.0.0610: the screen is redrawn when default 'background' is detected
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.
1 parent 28a8193 commit 4b974d5

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

src/term.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4385,14 +4385,20 @@ check_termcode(
43854385
if (i - j >= 21 && STRNCMP(tp + j + 3, "rgb:", 4) == 0
43864386
&& tp[j + 11] == '/' && tp[j + 16] == '/'
43874387
&& !option_was_set((char_u *)"bg"))
4388-
{/* TODO: don't set option when already the right value */
4388+
{
4389+
char *newval = (3 * '6' < tp[j+7] + tp[j+12]
4390+
+ tp[j+17]) ? "light" : "dark";
4391+
43894392
LOG_TR("Received RBG");
43904393
rbg_status = RBG_GOT;
4391-
set_option_value((char_u *)"bg", 0L, (char_u *)(
4392-
(3 * '6' < tp[j+7] + tp[j+12] + tp[j+17])
4393-
? "light" : "dark"), 0);
4394-
reset_option_was_set((char_u *)"bg");
4395-
redraw_asap(CLEAR);
4394+
if (STRCMP(p_bg, newval) != 0)
4395+
{
4396+
/* value differs, apply it */
4397+
set_option_value((char_u *)"bg", 0L,
4398+
(char_u *)newval, 0);
4399+
reset_option_was_set((char_u *)"bg");
4400+
redraw_asap(CLEAR);
4401+
}
43964402
}
43974403

43984404
/* got finished code: consume it */

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
610,
767769
/**/
768770
609,
769771
/**/

0 commit comments

Comments
 (0)