|
Karsten Hopp |
20af70 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
20af70 |
Subject: Patch 7.2.109
|
|
Karsten Hopp |
20af70 |
Fcc: outbox
|
|
Karsten Hopp |
20af70 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
20af70 |
Mime-Version: 1.0
|
|
Karsten Hopp |
20af70 |
Content-Type: text/plain; charset=ISO-8859-1
|
|
Karsten Hopp |
20af70 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
20af70 |
------------
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
Patch 7.2.109
|
|
Karsten Hopp |
20af70 |
Problem: 'langmap' does not work for multi-byte characters.
|
|
Karsten Hopp |
20af70 |
Solution: Add a list of mapped multi-byte characters. (based on work by
|
|
Karsten Hopp |
20af70 |
Konstantin Korikov, Agathoklis Hatzimanikas)
|
|
Karsten Hopp |
20af70 |
Files: runtime/doc/options.txt, src/edit.c, src/getchar.c, src/macros.h,
|
|
Karsten Hopp |
20af70 |
src/normal.c, src/option.c, src/proto/option.pro, src/window.c
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/runtime/doc/options.txt Fri Nov 28 10:59:57 2008
|
|
Karsten Hopp |
20af70 |
--- runtime/doc/options.txt Wed Feb 11 18:59:34 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 4175,4183 ****
|
|
Karsten Hopp |
20af70 |
be able to execute Normal mode commands.
|
|
Karsten Hopp |
20af70 |
This is the opposite of the 'keymap' option, where characters are
|
|
Karsten Hopp |
20af70 |
mapped in Insert mode.
|
|
Karsten Hopp |
20af70 |
- This only works for 8-bit characters. The value of 'langmap' may be
|
|
Karsten Hopp |
20af70 |
- specified with multi-byte characters (e.g., UTF-8), but only the lower
|
|
Karsten Hopp |
20af70 |
- 8 bits of each character will be used.
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
Example (for Greek, in UTF-8): *greek* >
|
|
Karsten Hopp |
20af70 |
: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
|
|
Karsten Hopp |
20af70 |
--- 4188,4193 ----
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/src/edit.c Wed Feb 4 11:19:40 2009
|
|
Karsten Hopp |
20af70 |
--- src/edit.c Sat Feb 21 19:54:03 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 7703,7711 ****
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
++no_mapping;
|
|
Karsten Hopp |
20af70 |
regname = plain_vgetc();
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(regname, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
if (regname == Ctrl_R || regname == Ctrl_O || regname == Ctrl_P)
|
|
Karsten Hopp |
20af70 |
{
|
|
Karsten Hopp |
20af70 |
/* Get a third key for literal register insertion */
|
|
Karsten Hopp |
20af70 |
--- 7703,7709 ----
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 7714,7722 ****
|
|
Karsten Hopp |
20af70 |
add_to_showcmd_c(literally);
|
|
Karsten Hopp |
20af70 |
#endif
|
|
Karsten Hopp |
20af70 |
regname = plain_vgetc();
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(regname, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
}
|
|
Karsten Hopp |
20af70 |
--no_mapping;
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
--- 7712,7718 ----
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/src/macros.h Wed Aug 15 20:41:07 2007
|
|
Karsten Hopp |
20af70 |
--- src/macros.h Sat Feb 21 19:55:38 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 127,141 ****
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
* Adjust chars in a language according to 'langmap' option.
|
|
Karsten Hopp |
20af70 |
! * NOTE that there is NO overhead if 'langmap' is not set; but even
|
|
Karsten Hopp |
20af70 |
! * when set we only have to do 2 ifs and an array lookup.
|
|
Karsten Hopp |
20af70 |
* Don't apply 'langmap' if the character comes from the Stuff buffer.
|
|
Karsten Hopp |
20af70 |
* The do-while is just to ignore a ';' after the macro.
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
! # define LANGMAP_ADJUST(c, condition) do { \
|
|
Karsten Hopp |
20af70 |
! if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
|
|
Karsten Hopp |
20af70 |
! c = langmap_mapchar[c]; \
|
|
Karsten Hopp |
20af70 |
} while (0)
|
|
Karsten Hopp |
20af70 |
#endif
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
--- 127,157 ----
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
* Adjust chars in a language according to 'langmap' option.
|
|
Karsten Hopp |
20af70 |
! * NOTE that there is no noticeable overhead if 'langmap' is not set.
|
|
Karsten Hopp |
20af70 |
! * When set the overhead for characters < 256 is small.
|
|
Karsten Hopp |
20af70 |
* Don't apply 'langmap' if the character comes from the Stuff buffer.
|
|
Karsten Hopp |
20af70 |
* The do-while is just to ignore a ';' after the macro.
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
! # ifdef FEAT_MBYTE
|
|
Karsten Hopp |
20af70 |
! # define LANGMAP_ADJUST(c, condition) \
|
|
Karsten Hopp |
20af70 |
! do { \
|
|
Karsten Hopp |
20af70 |
! if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0) \
|
|
Karsten Hopp |
20af70 |
! { \
|
|
Karsten Hopp |
20af70 |
! if ((c) < 256) \
|
|
Karsten Hopp |
20af70 |
! c = langmap_mapchar[c]; \
|
|
Karsten Hopp |
20af70 |
! else \
|
|
Karsten Hopp |
20af70 |
! c = langmap_adjust_mb(c); \
|
|
Karsten Hopp |
20af70 |
! } \
|
|
Karsten Hopp |
20af70 |
} while (0)
|
|
Karsten Hopp |
20af70 |
+ # else
|
|
Karsten Hopp |
20af70 |
+ # define LANGMAP_ADJUST(c, condition) \
|
|
Karsten Hopp |
20af70 |
+ do { \
|
|
Karsten Hopp |
20af70 |
+ if (*p_langmap && (condition) && !KeyStuffed && (c) >= 0 && (c) < 256) \
|
|
Karsten Hopp |
20af70 |
+ c = langmap_mapchar[c]; \
|
|
Karsten Hopp |
20af70 |
+ } while (0)
|
|
Karsten Hopp |
20af70 |
+ # endif
|
|
Karsten Hopp |
20af70 |
+ #else
|
|
Karsten Hopp |
20af70 |
+ # define LANGMAP_ADJUST(c, condition) /* nop */
|
|
Karsten Hopp |
20af70 |
#endif
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/src/normal.c Wed Feb 4 11:45:28 2009
|
|
Karsten Hopp |
20af70 |
--- src/normal.c Sat Feb 21 19:55:17 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 651,660 ****
|
|
Karsten Hopp |
20af70 |
* Get the command character from the user.
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
c = safe_vgetc();
|
|
Karsten Hopp |
20af70 |
-
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(c, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_VISUAL
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
--- 651,657 ----
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 744,752 ****
|
|
Karsten Hopp |
20af70 |
}
|
|
Karsten Hopp |
20af70 |
++no_zero_mapping; /* don't map zero here */
|
|
Karsten Hopp |
20af70 |
c = plain_vgetc();
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(c, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
--no_zero_mapping;
|
|
Karsten Hopp |
20af70 |
if (ctrl_w)
|
|
Karsten Hopp |
20af70 |
{
|
|
Karsten Hopp |
20af70 |
--- 741,747 ----
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 769,777 ****
|
|
Karsten Hopp |
20af70 |
++no_mapping;
|
|
Karsten Hopp |
20af70 |
++allow_keys; /* no mapping for nchar, but keys */
|
|
Karsten Hopp |
20af70 |
c = plain_vgetc(); /* get next character */
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(c, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
--no_mapping;
|
|
Karsten Hopp |
20af70 |
--allow_keys;
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_CMDL_INFO
|
|
Karsten Hopp |
20af70 |
--- 764,770 ----
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 959,967 ****
|
|
Karsten Hopp |
20af70 |
* "gr", "g'" and "g`".
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
ca.nchar = plain_vgetc();
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(ca.nchar, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_CMDL_INFO
|
|
Karsten Hopp |
20af70 |
need_flushbuf |= add_to_showcmd(ca.nchar);
|
|
Karsten Hopp |
20af70 |
#endif
|
|
Karsten Hopp |
20af70 |
--- 952,958 ----
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 1062,1071 ****
|
|
Karsten Hopp |
20af70 |
}
|
|
Karsten Hopp |
20af70 |
#endif
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
/* adjust chars > 127, except after "tTfFr" commands */
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(*cp, !lang);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_RIGHTLEFT
|
|
Karsten Hopp |
20af70 |
/* adjust Hebrew mapped char */
|
|
Karsten Hopp |
20af70 |
if (p_hkmap && lang && KeyTyped)
|
|
Karsten Hopp |
20af70 |
--- 1053,1060 ----
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 4630,4638 ****
|
|
Karsten Hopp |
20af70 |
++no_mapping;
|
|
Karsten Hopp |
20af70 |
++allow_keys; /* no mapping for nchar, but allow key codes */
|
|
Karsten Hopp |
20af70 |
nchar = plain_vgetc();
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(nchar, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
--no_mapping;
|
|
Karsten Hopp |
20af70 |
--allow_keys;
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_CMDL_INFO
|
|
Karsten Hopp |
20af70 |
--- 4619,4625 ----
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 4988,4996 ****
|
|
Karsten Hopp |
20af70 |
++no_mapping;
|
|
Karsten Hopp |
20af70 |
++allow_keys; /* no mapping for nchar, but allow key codes */
|
|
Karsten Hopp |
20af70 |
nchar = plain_vgetc();
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(nchar, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
--no_mapping;
|
|
Karsten Hopp |
20af70 |
--allow_keys;
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_CMDL_INFO
|
|
Karsten Hopp |
20af70 |
--- 4975,4981 ----
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/src/option.c Wed Feb 11 22:47:32 2009
|
|
Karsten Hopp |
20af70 |
--- src/option.c Sat Feb 21 19:46:13 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 10153,10177 ****
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
! * Any character has an equivalent character. This is used for keyboards that
|
|
Karsten Hopp |
20af70 |
! * have a special language mode that sends characters above 128 (although
|
|
Karsten Hopp |
20af70 |
! * other characters can be translated too).
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
! * char_u langmap_mapchar[256];
|
|
Karsten Hopp |
20af70 |
! * Normally maps each of the 128 upper chars to an <128 ascii char; used to
|
|
Karsten Hopp |
20af70 |
! * "translate" native lang chars in normal mode or some cases of
|
|
Karsten Hopp |
20af70 |
! * insert mode without having to tediously switch lang mode back&forth.
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
static void
|
|
Karsten Hopp |
20af70 |
langmap_init()
|
|
Karsten Hopp |
20af70 |
{
|
|
Karsten Hopp |
20af70 |
int i;
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
! for (i = 0; i < 256; i++) /* we init with a-one-to one map */
|
|
Karsten Hopp |
20af70 |
! langmap_mapchar[i] = i;
|
|
Karsten Hopp |
20af70 |
}
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
--- 10153,10262 ----
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
! * Any character has an equivalent 'langmap' character. This is used for
|
|
Karsten Hopp |
20af70 |
! * keyboards that have a special language mode that sends characters above
|
|
Karsten Hopp |
20af70 |
! * 128 (although other characters can be translated too). The "to" field is a
|
|
Karsten Hopp |
20af70 |
! * Vim command character. This avoids having to switch the keyboard back to
|
|
Karsten Hopp |
20af70 |
! * ASCII mode when leaving Insert mode.
|
|
Karsten Hopp |
20af70 |
! *
|
|
Karsten Hopp |
20af70 |
! * langmap_mapchar[] maps any of 256 chars to an ASCII char used for Vim
|
|
Karsten Hopp |
20af70 |
! * commands.
|
|
Karsten Hopp |
20af70 |
! * When FEAT_MBYTE is defined langmap_mapga.ga_data is a sorted table of
|
|
Karsten Hopp |
20af70 |
! * langmap_entry_T. This does the same as langmap_mapchar[] for characters >=
|
|
Karsten Hopp |
20af70 |
! * 256.
|
|
Karsten Hopp |
20af70 |
! */
|
|
Karsten Hopp |
20af70 |
! # ifdef FEAT_MBYTE
|
|
Karsten Hopp |
20af70 |
! /*
|
|
Karsten Hopp |
20af70 |
! * With multi-byte support use growarray for 'langmap' chars >= 256
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
+ typedef struct
|
|
Karsten Hopp |
20af70 |
+ {
|
|
Karsten Hopp |
20af70 |
+ int from;
|
|
Karsten Hopp |
20af70 |
+ int to;
|
|
Karsten Hopp |
20af70 |
+ } langmap_entry_T;
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ static garray_T langmap_mapga;
|
|
Karsten Hopp |
20af70 |
+ static void langmap_set_entry __ARGS((int from, int to));
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ /*
|
|
Karsten Hopp |
20af70 |
+ * Search for an entry in "langmap_mapga" for "from". If found set the "to"
|
|
Karsten Hopp |
20af70 |
+ * field. If not found insert a new entry at the appropriate location.
|
|
Karsten Hopp |
20af70 |
+ */
|
|
Karsten Hopp |
20af70 |
+ static void
|
|
Karsten Hopp |
20af70 |
+ langmap_set_entry(from, to)
|
|
Karsten Hopp |
20af70 |
+ int from;
|
|
Karsten Hopp |
20af70 |
+ int to;
|
|
Karsten Hopp |
20af70 |
+ {
|
|
Karsten Hopp |
20af70 |
+ langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
|
|
Karsten Hopp |
20af70 |
+ int a = 0;
|
|
Karsten Hopp |
20af70 |
+ int b = langmap_mapga.ga_len;
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ /* Do a binary search for an existing entry. */
|
|
Karsten Hopp |
20af70 |
+ while (a != b)
|
|
Karsten Hopp |
20af70 |
+ {
|
|
Karsten Hopp |
20af70 |
+ int i = (a + b) / 2;
|
|
Karsten Hopp |
20af70 |
+ int d = entries[i].from - from;
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ if (d == 0)
|
|
Karsten Hopp |
20af70 |
+ {
|
|
Karsten Hopp |
20af70 |
+ entries[i].to = to;
|
|
Karsten Hopp |
20af70 |
+ return;
|
|
Karsten Hopp |
20af70 |
+ }
|
|
Karsten Hopp |
20af70 |
+ if (d < 0)
|
|
Karsten Hopp |
20af70 |
+ a = i + 1;
|
|
Karsten Hopp |
20af70 |
+ else
|
|
Karsten Hopp |
20af70 |
+ b = i;
|
|
Karsten Hopp |
20af70 |
+ }
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ if (ga_grow(&langmap_mapga, 1) != OK)
|
|
Karsten Hopp |
20af70 |
+ return; /* out of memory */
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ /* insert new entry at position "a" */
|
|
Karsten Hopp |
20af70 |
+ entries = (langmap_entry_T *)(langmap_mapga.ga_data) + a;
|
|
Karsten Hopp |
20af70 |
+ mch_memmove(entries + 1, entries,
|
|
Karsten Hopp |
20af70 |
+ (langmap_mapga.ga_len - a) * sizeof(langmap_entry_T));
|
|
Karsten Hopp |
20af70 |
+ ++langmap_mapga.ga_len;
|
|
Karsten Hopp |
20af70 |
+ entries[0].from = from;
|
|
Karsten Hopp |
20af70 |
+ entries[0].to = to;
|
|
Karsten Hopp |
20af70 |
+ }
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
! * Apply 'langmap' to multi-byte character "c" and return the result.
|
|
Karsten Hopp |
20af70 |
*/
|
|
Karsten Hopp |
20af70 |
+ int
|
|
Karsten Hopp |
20af70 |
+ langmap_adjust_mb(c)
|
|
Karsten Hopp |
20af70 |
+ int c;
|
|
Karsten Hopp |
20af70 |
+ {
|
|
Karsten Hopp |
20af70 |
+ langmap_entry_T *entries = (langmap_entry_T *)(langmap_mapga.ga_data);
|
|
Karsten Hopp |
20af70 |
+ int a = 0;
|
|
Karsten Hopp |
20af70 |
+ int b = langmap_mapga.ga_len;
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ while (a != b)
|
|
Karsten Hopp |
20af70 |
+ {
|
|
Karsten Hopp |
20af70 |
+ int i = (a + b) / 2;
|
|
Karsten Hopp |
20af70 |
+ int d = entries[i].from - c;
|
|
Karsten Hopp |
20af70 |
+
|
|
Karsten Hopp |
20af70 |
+ if (d == 0)
|
|
Karsten Hopp |
20af70 |
+ return entries[i].to; /* found matching entry */
|
|
Karsten Hopp |
20af70 |
+ if (d < 0)
|
|
Karsten Hopp |
20af70 |
+ a = i + 1;
|
|
Karsten Hopp |
20af70 |
+ else
|
|
Karsten Hopp |
20af70 |
+ b = i;
|
|
Karsten Hopp |
20af70 |
+ }
|
|
Karsten Hopp |
20af70 |
+ return c; /* no entry found, return "c" unmodified */
|
|
Karsten Hopp |
20af70 |
+ }
|
|
Karsten Hopp |
20af70 |
+ # endif
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
static void
|
|
Karsten Hopp |
20af70 |
langmap_init()
|
|
Karsten Hopp |
20af70 |
{
|
|
Karsten Hopp |
20af70 |
int i;
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
! for (i = 0; i < 256; i++)
|
|
Karsten Hopp |
20af70 |
! langmap_mapchar[i] = i; /* we init with a one-to-one map */
|
|
Karsten Hopp |
20af70 |
! # ifdef FEAT_MBYTE
|
|
Karsten Hopp |
20af70 |
! ga_init2(&langmap_mapga, sizeof(langmap_entry_T), 8);
|
|
Karsten Hopp |
20af70 |
! # endif
|
|
Karsten Hopp |
20af70 |
}
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/*
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 10185,10191 ****
|
|
Karsten Hopp |
20af70 |
char_u *p2;
|
|
Karsten Hopp |
20af70 |
int from, to;
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
! langmap_init(); /* back to one-to-one map first */
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
for (p = p_langmap; p[0] != NUL; )
|
|
Karsten Hopp |
20af70 |
{
|
|
Karsten Hopp |
20af70 |
--- 10270,10279 ----
|
|
Karsten Hopp |
20af70 |
char_u *p2;
|
|
Karsten Hopp |
20af70 |
int from, to;
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
! #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
20af70 |
! ga_clear(&langmap_mapga); /* clear the previous map first */
|
|
Karsten Hopp |
20af70 |
! #endif
|
|
Karsten Hopp |
20af70 |
! langmap_init(); /* back to one-to-one map */
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
for (p = p_langmap; p[0] != NUL; )
|
|
Karsten Hopp |
20af70 |
{
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 10235,10241 ****
|
|
Karsten Hopp |
20af70 |
transchar(from));
|
|
Karsten Hopp |
20af70 |
return;
|
|
Karsten Hopp |
20af70 |
}
|
|
Karsten Hopp |
20af70 |
! langmap_mapchar[from & 255] = to;
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/* Advance to next pair */
|
|
Karsten Hopp |
20af70 |
mb_ptr_adv(p);
|
|
Karsten Hopp |
20af70 |
--- 10323,10335 ----
|
|
Karsten Hopp |
20af70 |
transchar(from));
|
|
Karsten Hopp |
20af70 |
return;
|
|
Karsten Hopp |
20af70 |
}
|
|
Karsten Hopp |
20af70 |
!
|
|
Karsten Hopp |
20af70 |
! #ifdef FEAT_MBYTE
|
|
Karsten Hopp |
20af70 |
! if (from >= 256)
|
|
Karsten Hopp |
20af70 |
! langmap_set_entry(from, to);
|
|
Karsten Hopp |
20af70 |
! else
|
|
Karsten Hopp |
20af70 |
! #endif
|
|
Karsten Hopp |
20af70 |
! langmap_mapchar[from & 255] = to;
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/* Advance to next pair */
|
|
Karsten Hopp |
20af70 |
mb_ptr_adv(p);
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/src/proto/option.pro Sat May 5 19:28:04 2007
|
|
Karsten Hopp |
20af70 |
--- src/proto/option.pro Wed Feb 11 21:21:05 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 44,49 ****
|
|
Karsten Hopp |
20af70 |
--- 44,50 ----
|
|
Karsten Hopp |
20af70 |
void set_context_in_set_cmd __ARGS((expand_T *xp, char_u *arg, int opt_flags));
|
|
Karsten Hopp |
20af70 |
int ExpandSettings __ARGS((expand_T *xp, regmatch_T *regmatch, int *num_file, char_u ***file));
|
|
Karsten Hopp |
20af70 |
int ExpandOldSetting __ARGS((int *num_file, char_u ***file));
|
|
Karsten Hopp |
20af70 |
+ int langmap_adjust_mb __ARGS((int c));
|
|
Karsten Hopp |
20af70 |
int has_format_option __ARGS((int x));
|
|
Karsten Hopp |
20af70 |
int shortmess __ARGS((int x));
|
|
Karsten Hopp |
20af70 |
void vimrc_found __ARGS((char_u *fname, char_u *envname));
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/src/window.c Fri Nov 28 21:26:50 2008
|
|
Karsten Hopp |
20af70 |
--- src/window.c Sat Feb 21 19:55:25 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 594,602 ****
|
|
Karsten Hopp |
20af70 |
++allow_keys; /* no mapping for xchar, but allow key codes */
|
|
Karsten Hopp |
20af70 |
if (xchar == NUL)
|
|
Karsten Hopp |
20af70 |
xchar = plain_vgetc();
|
|
Karsten Hopp |
20af70 |
- #ifdef FEAT_LANGMAP
|
|
Karsten Hopp |
20af70 |
LANGMAP_ADJUST(xchar, TRUE);
|
|
Karsten Hopp |
20af70 |
- #endif
|
|
Karsten Hopp |
20af70 |
--no_mapping;
|
|
Karsten Hopp |
20af70 |
--allow_keys;
|
|
Karsten Hopp |
20af70 |
#ifdef FEAT_CMDL_INFO
|
|
Karsten Hopp |
20af70 |
--- 594,600 ----
|
|
Karsten Hopp |
20af70 |
*** ../vim-7.2.108/src/version.c Wed Feb 11 22:47:32 2009
|
|
Karsten Hopp |
20af70 |
--- src/version.c Sat Feb 21 19:34:28 2009
|
|
Karsten Hopp |
20af70 |
***************
|
|
Karsten Hopp |
20af70 |
*** 678,679 ****
|
|
Karsten Hopp |
20af70 |
--- 678,681 ----
|
|
Karsten Hopp |
20af70 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
20af70 |
+ /**/
|
|
Karsten Hopp |
20af70 |
+ 109,
|
|
Karsten Hopp |
20af70 |
/**/
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
--
|
|
Karsten Hopp |
20af70 |
hundred-and-one symptoms of being an internet addict:
|
|
Karsten Hopp |
20af70 |
99. The hum of a cooling fan and the click of keys is comforting to you.
|
|
Karsten Hopp |
20af70 |
|
|
Karsten Hopp |
20af70 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
20af70 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
20af70 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
20af70 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|