home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 6.1.136 < prev    next >
Encoding:
Internet Message Format  |  2002-07-20  |  3.5 KB

  1. To: vim-dev@vim.org
  2. Subject: Patch 6.1.136
  3. Fcc: outbox
  4. From: Bram Moolenaar <Bram@moolenaar.net>
  5. Mime-Version: 1.0
  6. Content-Type: text/plain; charset=ISO-8859-1
  7. Content-Transfer-Encoding: 8bit
  8. ------------
  9.  
  10. Patch 6.1.136
  11. Problem:    When $TERM is "linux" the default for 'background' is "dark", even
  12.         though the GUI uses a light background. (Hugh Allen)
  13. Solution:   Don't mark the option as set when defaulting to "dark" for the
  14.         linux console.  Also reset 'background' to "light" when the GUI
  15.         has a light background.
  16. Files:        src/option.c
  17.  
  18.  
  19. *** ../vim61.135/src/option.c    Sat Jun 29 16:35:43 2002
  20. --- src/option.c    Thu Jul 11 21:40:13 2002
  21. ***************
  22. *** 2786,2792 ****
  23. --- 2794,2805 ----
  24.        */
  25.       idx4 = findoption((char_u *)"bg");
  26.       if (!(options[idx4].flags & P_WAS_SET) && STRCMP(T_NAME, "linux") == 0)
  27. +     {
  28.           set_string_option_direct(NULL, idx4, (char_u *)"dark", OPT_FREE);
  29. +         /* don't mark it as set, when starting the GUI it may be changed
  30. +          * again */
  31. +         options[idx4].flags &= ~P_WAS_SET;
  32. +     }
  33.       }
  34.   #endif
  35.   }
  36. ***************
  37. *** 2941,2946 ****
  38. --- 2954,2969 ----
  39.   }
  40.   
  41.   #ifdef FEAT_GUI
  42. + static char_u *gui_bg_default __ARGS((void));
  43. +     static char_u *
  44. + gui_bg_default()
  45. + {
  46. +     if (gui_get_lightness(gui.back_pixel) < 127)
  47. +     return (char_u *)"dark";
  48. +     return (char_u *)"light";
  49. + }
  50.   /*
  51.    * Option initializations that can only be done after opening the GUI window.
  52.    */
  53. ***************
  54. *** 2948,2958 ****
  55.   init_gui_options()
  56.   {
  57.       /* Set the 'background' option according to the lightness of the
  58. !      * background color. */
  59. !     if (!option_was_set((char_u *)"bg")
  60. !                    && gui_get_lightness(gui.back_pixel) < 127)
  61.       {
  62. !     set_option_value((char_u *)"bg", 0L, (char_u *)"dark", 0);
  63.       highlight_changed();
  64.       }
  65.   }
  66. --- 2971,2980 ----
  67.   init_gui_options()
  68.   {
  69.       /* Set the 'background' option according to the lightness of the
  70. !      * background color, unless the user has set it already. */
  71. !     if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
  72.       {
  73. !     set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
  74.       highlight_changed();
  75.       }
  76.   }
  77. ***************
  78. *** 3443,3457 ****
  79.                            ?  VI_DEFAULT : VIM_DEFAULT];
  80.                   if ((char_u **)varp == &p_bg)
  81.                   {
  82.   #ifdef FEAT_GUI
  83.                   if (gui.in_use)
  84. !                 {
  85. !                     /* guess the value of 'background' */
  86. !                     if (gui_get_lightness(gui.back_pixel) < 127)
  87. !                     newval = (char_u *)"dark";
  88. !                     else
  89. !                     newval = (char_u *)"light";
  90. !                 }
  91.                   else
  92.   #endif
  93.                       if (STRCMP(T_NAME, "linux") == 0)
  94. --- 3465,3474 ----
  95.                            ?  VI_DEFAULT : VIM_DEFAULT];
  96.                   if ((char_u **)varp == &p_bg)
  97.                   {
  98. +                 /* guess the value of 'background' */
  99.   #ifdef FEAT_GUI
  100.                   if (gui.in_use)
  101. !                     newval = gui_bg_default();
  102.                   else
  103.   #endif
  104.                       if (STRCMP(T_NAME, "linux") == 0)
  105. *** ../vim61.135/src/version.c    Sun Jul 21 21:04:38 2002
  106. --- src/version.c    Sun Jul 21 21:13:35 2002
  107. ***************
  108. *** 608,609 ****
  109. --- 608,611 ----
  110.   {   /* Add new patch number below this line */
  111. + /**/
  112. +     136,
  113.   /**/
  114.  
  115. -- 
  116. hundred-and-one symptoms of being an internet addict:
  117. 17. You turn on your intercom when leaving the room so you can hear if new
  118.     e-mail arrives.
  119.  
  120.  ///  Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net  \\\
  121. ///   Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim   \\\
  122. \\\           Project leader for A-A-P -- http://www.a-a-p.org           ///
  123.  \\\ Lord Of The Rings helps Uganda - http://iccf-holland.org/lotr.html ///
  124.