]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 8.0.0610: the screen is redrawn when default 'background' is detected v8.0.0610
authorBram Moolenaar <Bram@vim.org>
Sun, 4 Jun 2017 13:37:46 +0000 (15:37 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 4 Jun 2017 13:37:46 +0000 (15:37 +0200)
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.

src/term.c
src/version.c

index d23d8cba6184863fa7690ff74798296102881c4a..fb6b59e96213bc6f5561ffdf32f866a592a1dcbb 100644 (file)
@@ -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 */
index 8c5679e5434c3ab44f76d07b56da627f119f80c7..bb3581c0bf6cae9467fd343453f970737e79738f 100644 (file)
@@ -764,6 +764,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    610,
 /**/
     609,
 /**/