[SCM] Vim packaging branch, master, updated. debian/7.2.130-1

James Vega jamessan at debian.org
Thu Mar 5 15:27:09 UTC 2009


The following commit has been merged in the master branch:
commit 0a474f9d80d5ae029577bb134f5013f86b251ba7
Merge: aa37cdb25511c88e2afd4582a428cd3a4a405390 c3198e0fef087f0f72d1008027cc99874596cfab
Author: James Vega <jamessan at debian.org>
Date:   Tue Mar 3 10:07:19 2009 -0500

    Merge branch 'debian'

diff --combined runtime/doc/options.txt
index bdbbd0d,bebaa03..904d6aa
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@@ -4175,9 -4175,6 +4175,6 @@@ A jump table for the options with a sho
  	be able to execute Normal mode commands.
  	This is the opposite of the 'keymap' option, where characters are
  	mapped in Insert mode.
- 	This only works for 8-bit characters.  The value of 'langmap' may be
- 	specified with multi-byte characters (e.g., UTF-8), but only the lower
- 	8 bits of each character will be used.
  
  	Example (for Greek, in UTF-8):				*greek*  >
  	    :set langmap=ΑA,ΒB,ΨC,ΔD,ΕE,ΦF,ΓG,ΗH,ΙI,ΞJ,ΚK,ΛL,ΜM,ΝN,ΟO,ΠP,QQ,ΡR,ΣS,ΤT,ΘU,ΩV,WW,ΧX,ΥY,ΖZ,αa,βb,ψc,δd,εe,φf,γg,ηh,ιi,ξj,κk,λl,μm,νn,οo,πp,qq,ρr,σs,τt,θu,ωv,ςw,χx,υy,ζz
@@@ -4589,7 -4586,7 +4586,7 @@@
  
  				   *'modeline'* *'ml'* *'nomodeline'* *'noml'*
  'modeline' 'ml'		boolean	(Vim default: on (off for root),
 -				 Vi default: off)
 +				 Debian: off, Vi default: off)
  			local to buffer
  						*'modelines'* *'mls'*
  'modelines' 'mls'	number	(default 5)
diff --combined src/option.c
index 0605360,87497ea..d3a5892
--- a/src/option.c
+++ b/src/option.c
@@@ -4119,11 -4119,23 +4119,23 @@@ do_set(arg, opt_flags
  					   && options[opt_idx].var == VAR_WIN)
  		goto skip;
  
- 	    /* Disallow changing some options from modelines */
- 	    if ((opt_flags & OPT_MODELINE) && (flags & P_SECURE))
+ 	    /* Disallow changing some options from modelines. */
+ 	    if (opt_flags & OPT_MODELINE)
  	    {
- 		errmsg = (char_u *)_("E520: Not allowed in a modeline");
- 		goto skip;
+ 		if (flags & P_SECURE)
+ 		{
+ 		    errmsg = (char_u *)_("E520: Not allowed in a modeline");
+ 		    goto skip;
+ 		}
+ #ifdef FEAT_DIFF
+ 		/* In diff mode some options are overruled.  This avoids that
+ 		 * 'foldmethod' becomes "marker" instead of "diff" and that
+ 		 * "wrap" gets set. */
+ 		if (curwin->w_p_diff
+ 			&& (options[opt_idx].indir == PV_FDM
+ 			    || options[opt_idx].indir == PV_WRAP))
+ 		    goto skip;
+ #endif
  	    }
  
  #ifdef HAVE_SANDBOX
@@@ -5268,6 -5280,21 +5280,21 @@@ insecure_flag(opt_idx, opt_flags
  }
  #endif
  
+ #ifdef FEAT_TITLE
+ static void redraw_titles __ARGS((void));
+ 
+ /*
+  * Redraw the window title and/or tab page text later.
+  */
+ static void redraw_titles()
+ {
+     need_maketitle = TRUE;
+ # ifdef FEAT_WINDOWS
+     redraw_tabline = TRUE;
+ # endif
+ }
+ #endif
+ 
  /*
   * Set a string option to a new value (without checking the effect).
   * The string is copied into allocated memory.
@@@ -5407,6 -5434,10 +5434,10 @@@ did_set_string_option(opt_idx, varp, ne
      int		did_chartab = FALSE;
      char_u	**gvarp;
      long_u	free_oldval = (options[opt_idx].flags & P_ALLOCED);
+ #ifdef FEAT_GUI
+     /* set when changing an option that only requires a redraw in the GUI */
+     int		redraw_gui_only = FALSE;
+ #endif
  
      /* Get the global option to compare with, otherwise we would have to check
       * two values for all local options. */
@@@ -5668,7 -5699,7 +5699,7 @@@
  	    {
  # ifdef FEAT_TITLE
  		/* May show a "+" in the title now. */
- 		need_maketitle = TRUE;
+ 		redraw_titles();
  # endif
  		/* Add 'fileencoding' to the swap file. */
  		ml_setflags(curbuf);
@@@ -5687,7 -5718,7 +5718,7 @@@
  	    {
  		errmsg = mb_init();
  # ifdef FEAT_TITLE
- 		need_maketitle = TRUE;
+ 		redraw_titles();
  # endif
  	    }
  	}
@@@ -5796,7 -5827,7 +5827,7 @@@
  	    else
  		curbuf->b_p_tx = FALSE;
  #ifdef FEAT_TITLE
- 	    need_maketitle = TRUE;
+ 	    redraw_titles();
  #endif
  	    /* update flag in swap file */
  	    ml_setflags(curbuf);
@@@ -6055,6 -6086,7 +6086,7 @@@
  		    errmsg = (char_u *)N_("E596: Invalid font(s)");
  	    }
  	}
+ 	redraw_gui_only = TRUE;
      }
  # ifdef FEAT_XFONTSET
      else if (varp == &p_guifontset)
@@@ -6063,6 -6095,7 +6095,7 @@@
  	    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");
+ 	redraw_gui_only = TRUE;
      }
  # endif
  # ifdef FEAT_MBYTE
@@@ -6072,6 -6105,7 +6105,7 @@@
  	    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");
+ 	redraw_gui_only = TRUE;
      }
  # endif
  #endif
@@@ -6133,13 -6167,24 +6167,24 @@@
  #ifdef FEAT_GUI
      /* 'guioptions' */
      else if (varp == &p_go)
+     {
  	gui_init_which_components(oldval);
+ 	redraw_gui_only = TRUE;
+     }
  #endif
  
  #if defined(FEAT_GUI_TABLINE)
      /* 'guitablabel' */
      else if (varp == &p_gtl)
+     {
  	redraw_tabline = TRUE;
+ 	redraw_gui_only = TRUE;
+     }
+     /* 'guitabtooltip' */
+     else if (varp == &p_gtt)
+     {
+ 	redraw_gui_only = TRUE;
+     }
  #endif
  
  #if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
@@@ -6717,7 -6762,11 +6762,11 @@@
  
      if (curwin->w_curswant != MAXCOL)
  	curwin->w_set_curswant = TRUE;  /* in case 'showbreak' changed */
-     check_redraw(options[opt_idx].flags);
+ #ifdef FEAT_GUI
+     /* check redraw when it's not a GUI option or the GUI is active. */
+     if (!redraw_gui_only || gui.in_use)
+ #endif
+ 	check_redraw(options[opt_idx].flags);
  
      return errmsg;
  }
@@@ -7105,22 -7154,28 +7154,28 @@@ set_bool_option(opt_idx, varp, value, o
  	    curbuf->b_did_warn = FALSE;
  
  #ifdef FEAT_TITLE
- 	need_maketitle = TRUE;
+ 	redraw_titles();
  #endif
      }
  
  #ifdef FEAT_TITLE
      /* when 'modifiable' is changed, redraw the window title */
      else if ((int *)varp == &curbuf->b_p_ma)
- 	need_maketitle = TRUE;
+     {
+ 	redraw_titles();
+     }
      /* when 'endofline' is changed, redraw the window title */
      else if ((int *)varp == &curbuf->b_p_eol)
- 	need_maketitle = TRUE;
- #ifdef FEAT_MBYTE
-     /* when 'bomb' is changed, redraw the window title */
+     {
+ 	redraw_titles();
+     }
+ # ifdef FEAT_MBYTE
+     /* when 'bomb' is changed, redraw the window title and tab page text */
      else if ((int *)varp == &curbuf->b_p_bomb)
- 	need_maketitle = TRUE;
- #endif
+     {
+ 	redraw_titles();
+     }
+ # endif
  #endif
  
      /* when 'bin' is set also set some other options */
@@@ -7128,7 -7183,7 +7183,7 @@@
      {
  	set_options_bin(old_value, curbuf->b_p_bin, opt_flags);
  #ifdef FEAT_TITLE
- 	need_maketitle = TRUE;
+ 	redraw_titles();
  #endif
      }
  
@@@ -7279,7 -7334,7 +7334,7 @@@
  	if (!value)
  	    save_file_ff(curbuf);	/* Buffer is unchanged */
  #ifdef FEAT_TITLE
- 	need_maketitle = TRUE;
+ 	redraw_titles();
  #endif
  #ifdef FEAT_AUTOCMD
  	modified_was_set = value;
@@@ -7714,7 -7769,7 +7769,7 @@@ set_num_option(opt_idx, varp, value, er
  	newFoldLevel();
      }
  
-     /* 'foldminlevel' */
+     /* 'foldminlines' */
      else if (pp == &curwin->w_p_fml)
      {
  	foldUpdateAll(curwin);
@@@ -10098,25 -10153,110 +10153,110 @@@ wc_use_keyname(varp, wcp
  
  #ifdef FEAT_LANGMAP
  /*
-  * Any character has an equivalent character.  This is used for keyboards that
-  * have a special language mode that sends characters above 128 (although
-  * other characters can be translated too).
+  * Any character has an equivalent 'langmap' character.  This is used for
+  * keyboards that have a special language mode that sends characters above
+  * 128 (although other characters can be translated too).  The "to" field is a
+  * Vim command character.  This avoids having to switch the keyboard back to
+  * ASCII mode when leaving Insert mode.
+  *
+  * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
+  * commands.
+  * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
+  * langmap_entry_T.  This does the same as langmap_mapchar[] for characters >=
+  * 256.
   */
+ # ifdef FEAT_MBYTE
+ /*
+  * With multi-byte support use growarray for 'langmap' chars >= 256
+  */
+ typedef struct
+ {
+     int	    from;
+     int     to;
+ } langmap_entry_T;
+ 
+ static garray_T langmap_mapga;
+ static void langmap_set_entry __ARGS((int from, int to));
  
  /*
-  * char_u langmap_mapchar[256];
-  * Normally maps each of the 128 upper chars to an <128 ascii char; used to
-  * "translate" native lang chars in normal mode or some cases of
-  * insert mode without having to tediously switch lang mode back&forth.
+  * Search for an entry in "langmap_mapga" for "from".  If found set the "to"
+  * field.  If not found insert a new entry at the appropriate location.
   */
+     static void
+ langmap_set_entry(from, to)
+     int    from;
+     int    to;
+ {
+     langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
+     int             a = 0;
+     int             b = langmap_mapga.ga_len;
+ 
+     /* Do a binary search for an existing entry. */
+     while (a != b)
+     {
+ 	int i = (a + b) / 2;
+ 	int d = entries[i].from - from;
+ 
+ 	if (d == 0)
+ 	{
+ 	    entries[i].to = to;
+ 	    return;
+ 	}
+ 	if (d < 0)
+ 	    a = i + 1;
+ 	else
+ 	    b = i;
+     }
+ 
+     if (ga_grow(&langmap_mapga, 1) != OK)
+ 	return;  /* out of memory */
+ 
+     /* insert new entry at position "a" */
+     entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a;
+     mch_memmove(entries + 1, entries,
+ 			(langmap_mapga.ga_len - a) * sizeof(langmap_entry_T));
+     ++langmap_mapga.ga_len;
+     entries[0].from = from;
+     entries[0].to = to;
+ }
+ 
+ /*
+  * Apply 'langmap' to multi-byte character "c" and return the result.
+  */
+     int
+ langmap_adjust_mb(c)
+     int c;
+ {
+     langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
+     int a = 0;
+     int b = langmap_mapga.ga_len;
+ 
+     while (a != b)
+     {
+ 	int i = (a + b) / 2;
+ 	int d = entries[i].from - c;
+ 
+ 	if (d == 0)
+ 	    return entries[i].to;  /* found matching entry */
+ 	if (d < 0)
+ 	    a = i + 1;
+ 	else
+ 	    b = i;
+     }
+     return c;  /* no entry found, return "c" unmodified */
+ }
+ # endif
  
      static void
  langmap_init()
  {
      int i;
  
-     for (i = 0; i < 256; i++)		/* we init with a-one-to one map */
- 	langmap_mapchar[i] = i;
+     for (i = 0; i < 256; i++)
+ 	langmap_mapchar[i] = i;	 /* we init with a one-to-one map */
+ # ifdef FEAT_MBYTE
+     ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
+ # endif
  }
  
  /*
@@@ -10128,9 -10268,12 +10268,12 @@@ langmap_set(
  {
      char_u  *p;
      char_u  *p2;
 -    int	    from, to;
 +    int	    from=NUL, to=NUL;
  
-     langmap_init();			    /* back to one-to-one map first */
+ #ifdef FEAT_MBYTE
+     ga_clear(&langmap_mapga);		    /* clear the previous map first */
+ #endif
+     langmap_init();			    /* back to one-to-one map */
  
      for (p = p_langmap; p[0] != NUL; )
      {
@@@ -10146,11 -10289,6 +10289,11 @@@
  	    p2 = NULL;	    /* aAbBcCdD form, p2 is NULL */
  	while (p[0])
  	{
 +	    if (p[0] == ',')
 +	    {
 +		++p;
 +		break;
 +	    }
  	    if (p[0] == '\\' && p[1] != NUL)
  		++p;
  #ifdef FEAT_MBYTE
@@@ -10161,29 -10299,23 +10304,29 @@@
  	    if (p2 == NULL)
  	    {
  		mb_ptr_adv(p);
 -		if (p[0] == '\\')
 -		    ++p;
 +		if (p[0] != ',')
 +		{
 +		    if (p[0] == '\\')
 +			++p;
  #ifdef FEAT_MBYTE
 -		to = (*mb_ptr2char)(p);
 +		    to = (*mb_ptr2char)(p);
  #else
 -		to = p[0];
 +		    to = p[0];
  #endif
 +		}
  	    }
  	    else
  	    {
 -		if (p2[0] == '\\')
 -		    ++p2;
 +		if (p2[0] != ',')
 +		{
 +		    if (p2[0] == '\\')
 +			++p2;
  #ifdef FEAT_MBYTE
 -		to = (*mb_ptr2char)(p2);
 +		    to = (*mb_ptr2char)(p2);
  #else
 -		to = p2[0];
 +		    to = p2[0];
  #endif
 +		}
  	    }
  	    if (to == NUL)
  	    {
@@@ -10191,7 -10323,13 +10334,13 @@@
  							     transchar(from));
  		return;
  	    }
- 	    langmap_mapchar[from & 255] = to;
+ 
+ #ifdef FEAT_MBYTE
+ 	    if (from >= 256)
+ 		langmap_set_entry(from, to);
+ 	    else
+ #endif
+ 		langmap_mapchar[from & 255] = to;
  
  	    /* Advance to next pair */
  	    mb_ptr_adv(p);

-- 
Vim packaging



More information about the pkg-vim-maintainers mailing list