PATCH: changing 'guifont' in console does not cause an unnecessary screen redraw

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

PATCH: changing 'guifont' in console does not cause an unnecessary screen redraw

Lech Lorens
The attached patch gets rid of the unnecessary screen redraw when
'guifont', 'guifontset' or 'guifontwide' is set in Vim running in a console.

--
Cheers,
Lech

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---


Index: src/option.c
===================================================================
--- src/option.c (revision 1341)
+++ src/option.c (working copy)
@@ -5407,6 +5407,9 @@
     int did_chartab = FALSE;
     char_u **gvarp;
     long_u free_oldval = (options[opt_idx].flags & P_ALLOCED);
+#ifdef FEAT_GUI
+    int dont_check_redraw = FALSE;
+#endif
 
     /* Get the global option to compare with, otherwise we would have to check
      * two values for all local options. */
@@ -6055,6 +6058,8 @@
     errmsg = (char_u *)N_("E596: Invalid font(s)");
     }
  }
+ else
+    dont_check_redraw = TRUE;
     }
 # ifdef FEAT_XFONTSET
     else if (varp == &p_guifontset)
@@ -6063,6 +6068,8 @@
     errmsg = (char_u *)N_("E597: can't select fontset");
  else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
     errmsg = (char_u *)N_("E598: Invalid fontset");
+ if (!gui.in_use)
+    dont_check_redraw = TRUE;
     }
 # endif
 # ifdef FEAT_MBYTE
@@ -6072,6 +6079,8 @@
     errmsg = (char_u *)N_("E533: can't select wide font");
  else if (gui_get_wide_font() == FAIL)
     errmsg = (char_u *)N_("E534: Invalid wide font");
+ if (!gui.in_use)
+    dont_check_redraw = TRUE;
     }
 # endif
 #endif
@@ -6717,7 +6726,10 @@
 
     if (curwin->w_curswant != MAXCOL)
  curwin->w_set_curswant = TRUE;  /* in case 'showbreak' changed */
-    check_redraw(options[opt_idx].flags);
+#ifdef FEAT_GUI
+    if (!dont_check_redraw)
+#endif
+ check_redraw(options[opt_idx].flags);
 
     return errmsg;
 }
Index: runtime/doc/todo.txt
===================================================================
--- runtime/doc/todo.txt (revision 1341)
+++ runtime/doc/todo.txt (working copy)
@@ -369,8 +369,6 @@
 Test 61 fails sometimes.  This is a timing problem: "sleep 2" sometimes takes
 longer than 2 seconds.
 
-Changing 'guifont' in the console causes an unnecessary redraw.
-
 "vim -C" often has 'nocompatible', because it's set in some startup script.
 Set 'compatible' after startup is done?  Patch by James Vega, 2008 Feb 7.
 
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: changing 'guifont' in console does not cause an unnecessary screen redraw

Bram Moolenaar


Lech Lorens wrote:

> The attached patch gets rid of the unnecessary screen redraw when
> 'guifont', 'guifontset' or 'guifontwide' is set in Vim running in a
> console.

Thanks!  Looks OK, except that I usually avoid variables with a negative
name, as this leads to double negatives: "!dont_check".  Using
"check_redraw" with default TRUE is simpler.

--
hundred-and-one symptoms of being an internet addict:
34. You laugh at people with 14400 baud modems.

 /// Bram Moolenaar -- [hidden email] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---