|
Karsten Hopp |
8c8d37 |
To: vim-dev@vim.org
|
|
Karsten Hopp |
8c8d37 |
Subject: Patch 7.3.032
|
|
Karsten Hopp |
8c8d37 |
Fcc: outbox
|
|
Karsten Hopp |
8c8d37 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
Karsten Hopp |
8c8d37 |
Mime-Version: 1.0
|
|
Karsten Hopp |
8c8d37 |
Content-Type: text/plain; charset=UTF-8
|
|
Karsten Hopp |
8c8d37 |
Content-Transfer-Encoding: 8bit
|
|
Karsten Hopp |
8c8d37 |
------------
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
Patch 7.3.032
|
|
Karsten Hopp |
8c8d37 |
Problem: maparg() doesn't return the flags, such as <buffer>, <script>,
|
|
Karsten Hopp |
8c8d37 |
<silent>. These are needed to save and restore a mapping.
|
|
Karsten Hopp |
8c8d37 |
Solution: Improve maparg(). (also by Christian Brabandt)
|
|
Karsten Hopp |
8c8d37 |
Files: runtime/doc/eval.txt, src/eval.c, src/getchar.c, src/gui_w48.c, src/message.c, src/proto/getchar.pro, src/proto/message.pro, src/structs.h src/testdir/test75.in, src/testdir/test75.ok
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/runtime/doc/eval.txt 2010-10-20 19:17:43.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- runtime/doc/eval.txt 2010-10-20 19:44:41.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 1827,1833 ****
|
|
Karsten Hopp |
8c8d37 |
log( {expr}) Float natural logarithm (base e) of {expr}
|
|
Karsten Hopp |
8c8d37 |
log10( {expr}) Float logarithm of Float {expr} to base 10
|
|
Karsten Hopp |
8c8d37 |
map( {expr}, {string}) List/Dict change each item in {expr} to {expr}
|
|
Karsten Hopp |
8c8d37 |
! maparg( {name}[, {mode} [, {abbr}]])
|
|
Karsten Hopp |
8c8d37 |
String rhs of mapping {name} in mode {mode}
|
|
Karsten Hopp |
8c8d37 |
mapcheck( {name}[, {mode} [, {abbr}]])
|
|
Karsten Hopp |
8c8d37 |
String check for mappings matching {name}
|
|
Karsten Hopp |
8c8d37 |
--- 1827,1833 ----
|
|
Karsten Hopp |
8c8d37 |
log( {expr}) Float natural logarithm (base e) of {expr}
|
|
Karsten Hopp |
8c8d37 |
log10( {expr}) Float logarithm of Float {expr} to base 10
|
|
Karsten Hopp |
8c8d37 |
map( {expr}, {string}) List/Dict change each item in {expr} to {expr}
|
|
Karsten Hopp |
8c8d37 |
! maparg( {name}[, {mode} [, {abbr} [, {dict}]]])
|
|
Karsten Hopp |
8c8d37 |
String rhs of mapping {name} in mode {mode}
|
|
Karsten Hopp |
8c8d37 |
mapcheck( {name}[, {mode} [, {abbr}]])
|
|
Karsten Hopp |
8c8d37 |
String check for mappings matching {name}
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3971,3993 ****
|
|
Karsten Hopp |
8c8d37 |
further items in {expr} are processed.
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! maparg({name}[, {mode} [, {abbr}]]) *maparg()*
|
|
Karsten Hopp |
8c8d37 |
! Return the rhs of mapping {name} in mode {mode}. When there
|
|
Karsten Hopp |
8c8d37 |
! is no mapping for {name}, an empty String is returned.
|
|
Karsten Hopp |
8c8d37 |
{mode} can be one of these strings:
|
|
Karsten Hopp |
8c8d37 |
"n" Normal
|
|
Karsten Hopp |
8c8d37 |
! "v" Visual
|
|
Karsten Hopp |
8c8d37 |
"o" Operator-pending
|
|
Karsten Hopp |
8c8d37 |
"i" Insert
|
|
Karsten Hopp |
8c8d37 |
"c" Cmd-line
|
|
Karsten Hopp |
8c8d37 |
"l" langmap |language-mapping|
|
|
Karsten Hopp |
8c8d37 |
"" Normal, Visual and Operator-pending
|
|
Karsten Hopp |
8c8d37 |
When {mode} is omitted, the modes for "" are used.
|
|
Karsten Hopp |
8c8d37 |
When {abbr} is there and it is non-zero use abbreviations
|
|
Karsten Hopp |
8c8d37 |
instead of mappings.
|
|
Karsten Hopp |
8c8d37 |
! The {name} can have special key names, like in the ":map"
|
|
Karsten Hopp |
8c8d37 |
! command. The returned String has special characters
|
|
Karsten Hopp |
8c8d37 |
! translated like in the output of the ":map" command listing.
|
|
Karsten Hopp |
8c8d37 |
The mappings local to the current buffer are checked first,
|
|
Karsten Hopp |
8c8d37 |
then the global mappings.
|
|
Karsten Hopp |
8c8d37 |
This function can be used to map a key even when it's already
|
|
Karsten Hopp |
8c8d37 |
--- 3972,4022 ----
|
|
Karsten Hopp |
8c8d37 |
further items in {expr} are processed.
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! maparg({name}[, {mode} [, {abbr} [, {dict}]]]) *maparg()*
|
|
Karsten Hopp |
8c8d37 |
! When {dict} is omitted or zero: Return the rhs of mapping
|
|
Karsten Hopp |
8c8d37 |
! {name} in mode {mode}. The returned String has special
|
|
Karsten Hopp |
8c8d37 |
! characters translated like in the output of the ":map" command
|
|
Karsten Hopp |
8c8d37 |
! listing.
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
! When there is no mapping for {name}, an empty String is
|
|
Karsten Hopp |
8c8d37 |
! returned.
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
! The {name} can have special key names, like in the ":map"
|
|
Karsten Hopp |
8c8d37 |
! command.
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
{mode} can be one of these strings:
|
|
Karsten Hopp |
8c8d37 |
"n" Normal
|
|
Karsten Hopp |
8c8d37 |
! "v" Visual (including Select)
|
|
Karsten Hopp |
8c8d37 |
"o" Operator-pending
|
|
Karsten Hopp |
8c8d37 |
"i" Insert
|
|
Karsten Hopp |
8c8d37 |
"c" Cmd-line
|
|
Karsten Hopp |
8c8d37 |
+ "s" Select
|
|
Karsten Hopp |
8c8d37 |
+ "x" Visual
|
|
Karsten Hopp |
8c8d37 |
"l" langmap |language-mapping|
|
|
Karsten Hopp |
8c8d37 |
"" Normal, Visual and Operator-pending
|
|
Karsten Hopp |
8c8d37 |
When {mode} is omitted, the modes for "" are used.
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
When {abbr} is there and it is non-zero use abbreviations
|
|
Karsten Hopp |
8c8d37 |
instead of mappings.
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
! When {dict} is there and it is non-zero return a dictionary
|
|
Karsten Hopp |
8c8d37 |
! containing all the information of the mapping with the
|
|
Karsten Hopp |
8c8d37 |
! following items:
|
|
Karsten Hopp |
8c8d37 |
! "lhs" The {lhs} of the mapping.
|
|
Karsten Hopp |
8c8d37 |
! "rhs" The {rhs} of the mapping as typed.
|
|
Karsten Hopp |
8c8d37 |
! "silent" 1 for a |:map-silent| mapping, else 0.
|
|
Karsten Hopp |
8c8d37 |
! "noremap" 1 if the {rhs} of the mapping is remappable.
|
|
Karsten Hopp |
8c8d37 |
! "expr" 1 for an expression mapping (|:map-<expr>|).
|
|
Karsten Hopp |
8c8d37 |
! "buffer" 1 for a buffer local mapping (|:map-local|).
|
|
Karsten Hopp |
8c8d37 |
! "mode" Modes for which the mapping is defined. In
|
|
Karsten Hopp |
8c8d37 |
! addition to the modes mentioned above, these
|
|
Karsten Hopp |
8c8d37 |
! characters will be used:
|
|
Karsten Hopp |
8c8d37 |
! " " Normal, Visual and Operator-pending
|
|
Karsten Hopp |
8c8d37 |
! "!" Insert and Commandline mode
|
|
Karsten Hopp |
8c8d37 |
! (|mapmpde-ic|)
|
|
Karsten Hopp |
8c8d37 |
! "sid" the Script local ID, used for <sid> mappings
|
|
Karsten Hopp |
8c8d37 |
! (|<SID>|)
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
The mappings local to the current buffer are checked first,
|
|
Karsten Hopp |
8c8d37 |
then the global mappings.
|
|
Karsten Hopp |
8c8d37 |
This function can be used to map a key even when it's already
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/eval.c 2010-10-20 19:17:43.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/eval.c 2010-10-20 21:15:55.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 7804,7810 ****
|
|
Karsten Hopp |
8c8d37 |
{"log10", 1, 1, f_log10},
|
|
Karsten Hopp |
8c8d37 |
#endif
|
|
Karsten Hopp |
8c8d37 |
{"map", 2, 2, f_map},
|
|
Karsten Hopp |
8c8d37 |
! {"maparg", 1, 3, f_maparg},
|
|
Karsten Hopp |
8c8d37 |
{"mapcheck", 1, 3, f_mapcheck},
|
|
Karsten Hopp |
8c8d37 |
{"match", 2, 4, f_match},
|
|
Karsten Hopp |
8c8d37 |
{"matchadd", 2, 4, f_matchadd},
|
|
Karsten Hopp |
8c8d37 |
--- 7804,7810 ----
|
|
Karsten Hopp |
8c8d37 |
{"log10", 1, 1, f_log10},
|
|
Karsten Hopp |
8c8d37 |
#endif
|
|
Karsten Hopp |
8c8d37 |
{"map", 2, 2, f_map},
|
|
Karsten Hopp |
8c8d37 |
! {"maparg", 1, 4, f_maparg},
|
|
Karsten Hopp |
8c8d37 |
{"mapcheck", 1, 3, f_mapcheck},
|
|
Karsten Hopp |
8c8d37 |
{"match", 2, 4, f_match},
|
|
Karsten Hopp |
8c8d37 |
{"matchadd", 2, 4, f_matchadd},
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 13292,13299 ****
|
|
Karsten Hopp |
8c8d37 |
char_u *keys_buf = NULL;
|
|
Karsten Hopp |
8c8d37 |
char_u *rhs;
|
|
Karsten Hopp |
8c8d37 |
int mode;
|
|
Karsten Hopp |
8c8d37 |
- garray_T ga;
|
|
Karsten Hopp |
8c8d37 |
int abbr = FALSE;
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
/* return empty string for failure */
|
|
Karsten Hopp |
8c8d37 |
rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
8c8d37 |
--- 13292,13301 ----
|
|
Karsten Hopp |
8c8d37 |
char_u *keys_buf = NULL;
|
|
Karsten Hopp |
8c8d37 |
char_u *rhs;
|
|
Karsten Hopp |
8c8d37 |
int mode;
|
|
Karsten Hopp |
8c8d37 |
int abbr = FALSE;
|
|
Karsten Hopp |
8c8d37 |
+ int get_dict = FALSE;
|
|
Karsten Hopp |
8c8d37 |
+ mapblock_T *mp;
|
|
Karsten Hopp |
8c8d37 |
+ int buffer_local;
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
/* return empty string for failure */
|
|
Karsten Hopp |
8c8d37 |
rettv->v_type = VAR_STRING;
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 13307,13313 ****
|
|
Karsten Hopp |
8c8d37 |
--- 13309,13319 ----
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
which = get_tv_string_buf_chk(&argvars[1], buf);
|
|
Karsten Hopp |
8c8d37 |
if (argvars[2].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
8c8d37 |
+ {
|
|
Karsten Hopp |
8c8d37 |
abbr = get_tv_number(&argvars[2]);
|
|
Karsten Hopp |
8c8d37 |
+ if (argvars[3].v_type != VAR_UNKNOWN)
|
|
Karsten Hopp |
8c8d37 |
+ get_dict = get_tv_number(&argvars[3]);
|
|
Karsten Hopp |
8c8d37 |
+ }
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
else
|
|
Karsten Hopp |
8c8d37 |
which = (char_u *)"";
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 13317,13335 ****
|
|
Karsten Hopp |
8c8d37 |
mode = get_map_mode(&which, 0);
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
|
|
Karsten Hopp |
8c8d37 |
! rhs = check_map(keys, mode, exact, FALSE, abbr);
|
|
Karsten Hopp |
8c8d37 |
vim_free(keys_buf);
|
|
Karsten Hopp |
8c8d37 |
- if (rhs != NULL)
|
|
Karsten Hopp |
8c8d37 |
- {
|
|
Karsten Hopp |
8c8d37 |
- ga_init(&ga);
|
|
Karsten Hopp |
8c8d37 |
- ga.ga_itemsize = 1;
|
|
Karsten Hopp |
8c8d37 |
- ga.ga_growsize = 40;
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! while (*rhs != NUL)
|
|
Karsten Hopp |
8c8d37 |
! ga_concat(&ga, str2special(&rhs, FALSE));
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! ga_append(&ga, NUL);
|
|
Karsten Hopp |
8c8d37 |
! rettv->vval.v_string = (char_u *)ga.ga_data;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
--- 13323,13356 ----
|
|
Karsten Hopp |
8c8d37 |
mode = get_map_mode(&which, 0);
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, FALSE);
|
|
Karsten Hopp |
8c8d37 |
! rhs = check_map(keys, mode, exact, FALSE, abbr, &mp, &buffer_local);
|
|
Karsten Hopp |
8c8d37 |
vim_free(keys_buf);
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! if (!get_dict)
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! /* Return a string. */
|
|
Karsten Hopp |
8c8d37 |
! if (rhs != NULL)
|
|
Karsten Hopp |
8c8d37 |
! rettv->vval.v_string = str2special_save(rhs, FALSE);
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
! }
|
|
Karsten Hopp |
8c8d37 |
! else if (rettv_dict_alloc(rettv) != FAIL && rhs != NULL)
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! /* Return a dictionary. */
|
|
Karsten Hopp |
8c8d37 |
! char_u *lhs = str2special_save(mp->m_keys, TRUE);
|
|
Karsten Hopp |
8c8d37 |
! char_u *mapmode = map_mode_to_chars(mp->m_mode);
|
|
Karsten Hopp |
8c8d37 |
! dict_T *dict = rettv->vval.v_dict;
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "lhs", 0L, lhs);
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "rhs", 0L, mp->m_orig_str);
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "noremap", mp->m_noremap ? 1L : 0L , NULL);
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "expr", mp->m_expr ? 1L : 0L, NULL);
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "silent", mp->m_silent ? 1L : 0L, NULL);
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "sid", (long)mp->m_script_ID, NULL);
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "buffer", (long)buffer_local, NULL);
|
|
Karsten Hopp |
8c8d37 |
! dict_add_nr_str(dict, "mode", 0L, mapmode);
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! vim_free(lhs);
|
|
Karsten Hopp |
8c8d37 |
! vim_free(mapmode);
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/getchar.c 2010-08-15 21:57:25.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/getchar.c 2010-10-20 21:16:24.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3168,3173 ****
|
|
Karsten Hopp |
8c8d37 |
--- 3168,3174 ----
|
|
Karsten Hopp |
8c8d37 |
int expr = FALSE;
|
|
Karsten Hopp |
8c8d37 |
#endif
|
|
Karsten Hopp |
8c8d37 |
int noremap;
|
|
Karsten Hopp |
8c8d37 |
+ char_u *orig_rhs;
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
keys = arg;
|
|
Karsten Hopp |
8c8d37 |
map_table = maphash;
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3266,3271 ****
|
|
Karsten Hopp |
8c8d37 |
--- 3267,3273 ----
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
if (*p != NUL)
|
|
Karsten Hopp |
8c8d37 |
*p++ = NUL;
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
p = skipwhite(p);
|
|
Karsten Hopp |
8c8d37 |
rhs = p;
|
|
Karsten Hopp |
8c8d37 |
hasarg = (*rhs != NUL);
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3290,3295 ****
|
|
Karsten Hopp |
8c8d37 |
--- 3292,3298 ----
|
|
Karsten Hopp |
8c8d37 |
keys = replace_termcodes(keys, &keys_buf, TRUE, TRUE, special);
|
|
Karsten Hopp |
8c8d37 |
if (hasarg)
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
+ orig_rhs = rhs;
|
|
Karsten Hopp |
8c8d37 |
if (STRICMP(rhs, "<nop>") == 0) /* "<Nop>" means nothing */
|
|
Karsten Hopp |
8c8d37 |
rhs = (char_u *)"";
|
|
Karsten Hopp |
8c8d37 |
else
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3298,3304 ****
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
#ifdef FEAT_FKMAP
|
|
Karsten Hopp |
8c8d37 |
/*
|
|
Karsten Hopp |
8c8d37 |
! * when in right-to-left mode and alternate keymap option set,
|
|
Karsten Hopp |
8c8d37 |
* reverse the character flow in the rhs in Farsi.
|
|
Karsten Hopp |
8c8d37 |
*/
|
|
Karsten Hopp |
8c8d37 |
if (p_altkeymap && curwin->w_p_rl)
|
|
Karsten Hopp |
8c8d37 |
--- 3301,3307 ----
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
#ifdef FEAT_FKMAP
|
|
Karsten Hopp |
8c8d37 |
/*
|
|
Karsten Hopp |
8c8d37 |
! * When in right-to-left mode and alternate keymap option set,
|
|
Karsten Hopp |
8c8d37 |
* reverse the character flow in the rhs in Farsi.
|
|
Karsten Hopp |
8c8d37 |
*/
|
|
Karsten Hopp |
8c8d37 |
if (p_altkeymap && curwin->w_p_rl)
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3556,3561 ****
|
|
Karsten Hopp |
8c8d37 |
--- 3559,3566 ----
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
vim_free(mp->m_str);
|
|
Karsten Hopp |
8c8d37 |
mp->m_str = newstr;
|
|
Karsten Hopp |
8c8d37 |
+ vim_free(mp->m_orig_str);
|
|
Karsten Hopp |
8c8d37 |
+ mp->m_orig_str = vim_strsave(orig_rhs);
|
|
Karsten Hopp |
8c8d37 |
mp->m_noremap = noremap;
|
|
Karsten Hopp |
8c8d37 |
mp->m_silent = silent;
|
|
Karsten Hopp |
8c8d37 |
mp->m_mode = mode;
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3633,3642 ****
|
|
Karsten Hopp |
8c8d37 |
--- 3638,3649 ----
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
mp->m_keys = vim_strsave(keys);
|
|
Karsten Hopp |
8c8d37 |
mp->m_str = vim_strsave(rhs);
|
|
Karsten Hopp |
8c8d37 |
+ mp->m_orig_str = vim_strsave(orig_rhs);
|
|
Karsten Hopp |
8c8d37 |
if (mp->m_keys == NULL || mp->m_str == NULL)
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
vim_free(mp->m_keys);
|
|
Karsten Hopp |
8c8d37 |
vim_free(mp->m_str);
|
|
Karsten Hopp |
8c8d37 |
+ vim_free(mp->m_orig_str);
|
|
Karsten Hopp |
8c8d37 |
vim_free(mp);
|
|
Karsten Hopp |
8c8d37 |
retval = 4; /* no mem */
|
|
Karsten Hopp |
8c8d37 |
goto theend;
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3682,3687 ****
|
|
Karsten Hopp |
8c8d37 |
--- 3689,3695 ----
|
|
Karsten Hopp |
8c8d37 |
mp = *mpp;
|
|
Karsten Hopp |
8c8d37 |
vim_free(mp->m_keys);
|
|
Karsten Hopp |
8c8d37 |
vim_free(mp->m_str);
|
|
Karsten Hopp |
8c8d37 |
+ vim_free(mp->m_orig_str);
|
|
Karsten Hopp |
8c8d37 |
*mpp = mp->m_next;
|
|
Karsten Hopp |
8c8d37 |
vim_free(mp);
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3851,3862 ****
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
static void
|
|
Karsten Hopp |
8c8d37 |
showmap(mp, local)
|
|
Karsten Hopp |
8c8d37 |
mapblock_T *mp;
|
|
Karsten Hopp |
8c8d37 |
int local; /* TRUE for buffer-local map */
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
! int len = 1;
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
if (msg_didout || msg_silent != 0)
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
--- 3859,3915 ----
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
+ /*
|
|
Karsten Hopp |
8c8d37 |
+ * Return characters to represent the map mode in an allocated string.
|
|
Karsten Hopp |
8c8d37 |
+ * Returns NULL when out of memory.
|
|
Karsten Hopp |
8c8d37 |
+ */
|
|
Karsten Hopp |
8c8d37 |
+ char_u *
|
|
Karsten Hopp |
8c8d37 |
+ map_mode_to_chars(mode)
|
|
Karsten Hopp |
8c8d37 |
+ int mode;
|
|
Karsten Hopp |
8c8d37 |
+ {
|
|
Karsten Hopp |
8c8d37 |
+ garray_T mapmode;
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
+ ga_init2(&mapmode, 1, 7);
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
+ if ((mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, '!'); /* :map! */
|
|
Karsten Hopp |
8c8d37 |
+ else if (mode & INSERT)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 'i'); /* :imap */
|
|
Karsten Hopp |
8c8d37 |
+ else if (mode & LANGMAP)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 'l'); /* :lmap */
|
|
Karsten Hopp |
8c8d37 |
+ else if (mode & CMDLINE)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 'c'); /* :cmap */
|
|
Karsten Hopp |
8c8d37 |
+ else if ((mode & (NORMAL + VISUAL + SELECTMODE + OP_PENDING))
|
|
Karsten Hopp |
8c8d37 |
+ == NORMAL + VISUAL + SELECTMODE + OP_PENDING)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, ' '); /* :map */
|
|
Karsten Hopp |
8c8d37 |
+ else
|
|
Karsten Hopp |
8c8d37 |
+ {
|
|
Karsten Hopp |
8c8d37 |
+ if (mode & NORMAL)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 'n'); /* :nmap */
|
|
Karsten Hopp |
8c8d37 |
+ if (mode & OP_PENDING)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 'o'); /* :omap */
|
|
Karsten Hopp |
8c8d37 |
+ if ((mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 'v'); /* :vmap */
|
|
Karsten Hopp |
8c8d37 |
+ else
|
|
Karsten Hopp |
8c8d37 |
+ {
|
|
Karsten Hopp |
8c8d37 |
+ if (mode & VISUAL)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 'x'); /* :xmap */
|
|
Karsten Hopp |
8c8d37 |
+ if (mode & SELECTMODE)
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, 's'); /* :smap */
|
|
Karsten Hopp |
8c8d37 |
+ }
|
|
Karsten Hopp |
8c8d37 |
+ }
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&mapmode, NUL);
|
|
Karsten Hopp |
8c8d37 |
+ return (char_u *)mapmode.ga_data;
|
|
Karsten Hopp |
8c8d37 |
+ }
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
static void
|
|
Karsten Hopp |
8c8d37 |
showmap(mp, local)
|
|
Karsten Hopp |
8c8d37 |
mapblock_T *mp;
|
|
Karsten Hopp |
8c8d37 |
int local; /* TRUE for buffer-local map */
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
! int len = 1;
|
|
Karsten Hopp |
8c8d37 |
! char_u *mapchars;
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
if (msg_didout || msg_silent != 0)
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3864,3912 ****
|
|
Karsten Hopp |
8c8d37 |
if (got_int) /* 'q' typed at MORE prompt */
|
|
Karsten Hopp |
8c8d37 |
return;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
! if ((mp->m_mode & (INSERT + CMDLINE)) == INSERT + CMDLINE)
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('!'); /* :map! */
|
|
Karsten Hopp |
8c8d37 |
! else if (mp->m_mode & INSERT)
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('i'); /* :imap */
|
|
Karsten Hopp |
8c8d37 |
! else if (mp->m_mode & LANGMAP)
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('l'); /* :lmap */
|
|
Karsten Hopp |
8c8d37 |
! else if (mp->m_mode & CMDLINE)
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('c'); /* :cmap */
|
|
Karsten Hopp |
8c8d37 |
! else if ((mp->m_mode & (NORMAL + VISUAL + SELECTMODE + OP_PENDING))
|
|
Karsten Hopp |
8c8d37 |
! == NORMAL + VISUAL + SELECTMODE + OP_PENDING)
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar(' '); /* :map */
|
|
Karsten Hopp |
8c8d37 |
! else
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
! len = 0;
|
|
Karsten Hopp |
8c8d37 |
! if (mp->m_mode & NORMAL)
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('n'); /* :nmap */
|
|
Karsten Hopp |
8c8d37 |
! ++len;
|
|
Karsten Hopp |
8c8d37 |
! }
|
|
Karsten Hopp |
8c8d37 |
! if (mp->m_mode & OP_PENDING)
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('o'); /* :omap */
|
|
Karsten Hopp |
8c8d37 |
! ++len;
|
|
Karsten Hopp |
8c8d37 |
! }
|
|
Karsten Hopp |
8c8d37 |
! if ((mp->m_mode & (VISUAL + SELECTMODE)) == VISUAL + SELECTMODE)
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('v'); /* :vmap */
|
|
Karsten Hopp |
8c8d37 |
! ++len;
|
|
Karsten Hopp |
8c8d37 |
! }
|
|
Karsten Hopp |
8c8d37 |
! else
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! if (mp->m_mode & VISUAL)
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('x'); /* :xmap */
|
|
Karsten Hopp |
8c8d37 |
! ++len;
|
|
Karsten Hopp |
8c8d37 |
! }
|
|
Karsten Hopp |
8c8d37 |
! if (mp->m_mode & SELECTMODE)
|
|
Karsten Hopp |
8c8d37 |
! {
|
|
Karsten Hopp |
8c8d37 |
! msg_putchar('s'); /* :smap */
|
|
Karsten Hopp |
8c8d37 |
! ++len;
|
|
Karsten Hopp |
8c8d37 |
! }
|
|
Karsten Hopp |
8c8d37 |
! }
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
while (++len <= 3)
|
|
Karsten Hopp |
8c8d37 |
msg_putchar(' ');
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
--- 3917,3931 ----
|
|
Karsten Hopp |
8c8d37 |
if (got_int) /* 'q' typed at MORE prompt */
|
|
Karsten Hopp |
8c8d37 |
return;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
!
|
|
Karsten Hopp |
8c8d37 |
! mapchars = map_mode_to_chars(mp->m_mode);
|
|
Karsten Hopp |
8c8d37 |
! if (mapchars != NULL)
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
! msg_puts(mapchars);
|
|
Karsten Hopp |
8c8d37 |
! len = STRLEN(mapchars);
|
|
Karsten Hopp |
8c8d37 |
! vim_free(mapchars);
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
while (++len <= 3)
|
|
Karsten Hopp |
8c8d37 |
msg_putchar(' ');
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 3931,3938 ****
|
|
Karsten Hopp |
8c8d37 |
msg_putchar(' ');
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
/* Use FALSE below if we only want things like <Up> to show up as such on
|
|
Karsten Hopp |
8c8d37 |
! * the rhs, and not M-x etc, TRUE gets both -- webb
|
|
Karsten Hopp |
8c8d37 |
! */
|
|
Karsten Hopp |
8c8d37 |
if (*mp->m_str == NUL)
|
|
Karsten Hopp |
8c8d37 |
msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8));
|
|
Karsten Hopp |
8c8d37 |
else
|
|
Karsten Hopp |
8c8d37 |
--- 3950,3956 ----
|
|
Karsten Hopp |
8c8d37 |
msg_putchar(' ');
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
/* Use FALSE below if we only want things like <Up> to show up as such on
|
|
Karsten Hopp |
8c8d37 |
! * the rhs, and not M-x etc, TRUE gets both -- webb */
|
|
Karsten Hopp |
8c8d37 |
if (*mp->m_str == NUL)
|
|
Karsten Hopp |
8c8d37 |
msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8));
|
|
Karsten Hopp |
8c8d37 |
else
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 4995,5013 ****
|
|
Karsten Hopp |
8c8d37 |
sourcing_name = save_name;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! #ifdef FEAT_EVAL
|
|
Karsten Hopp |
8c8d37 |
/*
|
|
Karsten Hopp |
8c8d37 |
! * Check the string "keys" against the lhs of all mappings
|
|
Karsten Hopp |
8c8d37 |
! * Return pointer to rhs of mapping (mapblock->m_str)
|
|
Karsten Hopp |
8c8d37 |
! * NULL otherwise
|
|
Karsten Hopp |
8c8d37 |
*/
|
|
Karsten Hopp |
8c8d37 |
char_u *
|
|
Karsten Hopp |
8c8d37 |
! check_map(keys, mode, exact, ign_mod, abbr)
|
|
Karsten Hopp |
8c8d37 |
char_u *keys;
|
|
Karsten Hopp |
8c8d37 |
int mode;
|
|
Karsten Hopp |
8c8d37 |
int exact; /* require exact match */
|
|
Karsten Hopp |
8c8d37 |
int ign_mod; /* ignore preceding modifier */
|
|
Karsten Hopp |
8c8d37 |
int abbr; /* do abbreviations */
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
int hash;
|
|
Karsten Hopp |
8c8d37 |
int len, minlen;
|
|
Karsten Hopp |
8c8d37 |
--- 5013,5033 ----
|
|
Karsten Hopp |
8c8d37 |
sourcing_name = save_name;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
! #if defined(FEAT_EVAL) || defined(PROTO)
|
|
Karsten Hopp |
8c8d37 |
/*
|
|
Karsten Hopp |
8c8d37 |
! * Check the string "keys" against the lhs of all mappings.
|
|
Karsten Hopp |
8c8d37 |
! * Return pointer to rhs of mapping (mapblock->m_str).
|
|
Karsten Hopp |
8c8d37 |
! * NULL when no mapping found.
|
|
Karsten Hopp |
8c8d37 |
*/
|
|
Karsten Hopp |
8c8d37 |
char_u *
|
|
Karsten Hopp |
8c8d37 |
! check_map(keys, mode, exact, ign_mod, abbr, mp_ptr, local_ptr)
|
|
Karsten Hopp |
8c8d37 |
char_u *keys;
|
|
Karsten Hopp |
8c8d37 |
int mode;
|
|
Karsten Hopp |
8c8d37 |
int exact; /* require exact match */
|
|
Karsten Hopp |
8c8d37 |
int ign_mod; /* ignore preceding modifier */
|
|
Karsten Hopp |
8c8d37 |
int abbr; /* do abbreviations */
|
|
Karsten Hopp |
8c8d37 |
+ mapblock_T **mp_ptr; /* return: pointer to mapblock or NULL */
|
|
Karsten Hopp |
8c8d37 |
+ int *local_ptr; /* return: buffer-local mapping or NULL */
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
int hash;
|
|
Karsten Hopp |
8c8d37 |
int len, minlen;
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 5062,5068 ****
|
|
Karsten Hopp |
8c8d37 |
--- 5082,5094 ----
|
|
Karsten Hopp |
8c8d37 |
minlen = mp->m_keylen - 3;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
if (STRNCMP(s, keys, minlen) == 0)
|
|
Karsten Hopp |
8c8d37 |
+ {
|
|
Karsten Hopp |
8c8d37 |
+ if (mp_ptr != NULL)
|
|
Karsten Hopp |
8c8d37 |
+ *mp_ptr = mp;
|
|
Karsten Hopp |
8c8d37 |
+ if (local_ptr != NULL)
|
|
Karsten Hopp |
8c8d37 |
+ *local_ptr = local;
|
|
Karsten Hopp |
8c8d37 |
return mp->m_str;
|
|
Karsten Hopp |
8c8d37 |
+ }
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/gui_w48.c 2010-08-15 21:57:29.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/gui_w48.c 2010-10-20 20:29:20.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 1810,1816 ****
|
|
Karsten Hopp |
8c8d37 |
* mapped we want to use the mapping instead. */
|
|
Karsten Hopp |
8c8d37 |
if (vk == VK_F10
|
|
Karsten Hopp |
8c8d37 |
&& gui.menu_is_active
|
|
Karsten Hopp |
8c8d37 |
! && check_map(k10, State, FALSE, TRUE, FALSE) == NULL)
|
|
Karsten Hopp |
8c8d37 |
break;
|
|
Karsten Hopp |
8c8d37 |
#endif
|
|
Karsten Hopp |
8c8d37 |
if (GetKeyState(VK_SHIFT) & 0x8000)
|
|
Karsten Hopp |
8c8d37 |
--- 1810,1817 ----
|
|
Karsten Hopp |
8c8d37 |
* mapped we want to use the mapping instead. */
|
|
Karsten Hopp |
8c8d37 |
if (vk == VK_F10
|
|
Karsten Hopp |
8c8d37 |
&& gui.menu_is_active
|
|
Karsten Hopp |
8c8d37 |
! && check_map(k10, State, FALSE, TRUE, FALSE,
|
|
Karsten Hopp |
8c8d37 |
! NULL, NULL) == NULL)
|
|
Karsten Hopp |
8c8d37 |
break;
|
|
Karsten Hopp |
8c8d37 |
#endif
|
|
Karsten Hopp |
8c8d37 |
if (GetKeyState(VK_SHIFT) & 0x8000)
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 1924,1930 ****
|
|
Karsten Hopp |
8c8d37 |
/* Check for <F10>: Default effect is to select the menu. When <F10> is
|
|
Karsten Hopp |
8c8d37 |
* mapped we need to stop it here to avoid strange effects (e.g., for the
|
|
Karsten Hopp |
8c8d37 |
* key-up event) */
|
|
Karsten Hopp |
8c8d37 |
! if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE) == NULL)
|
|
Karsten Hopp |
8c8d37 |
#endif
|
|
Karsten Hopp |
8c8d37 |
DispatchMessage(&msg;;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
--- 1925,1932 ----
|
|
Karsten Hopp |
8c8d37 |
/* Check for <F10>: Default effect is to select the menu. When <F10> is
|
|
Karsten Hopp |
8c8d37 |
* mapped we need to stop it here to avoid strange effects (e.g., for the
|
|
Karsten Hopp |
8c8d37 |
* key-up event) */
|
|
Karsten Hopp |
8c8d37 |
! if (vk != VK_F10 || check_map(k10, State, FALSE, TRUE, FALSE,
|
|
Karsten Hopp |
8c8d37 |
! NULL, NULL) == NULL)
|
|
Karsten Hopp |
8c8d37 |
#endif
|
|
Karsten Hopp |
8c8d37 |
DispatchMessage(&msg;;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/message.c 2010-08-15 21:57:29.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/message.c 2010-10-20 20:31:33.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 1477,1482 ****
|
|
Karsten Hopp |
8c8d37 |
--- 1477,1503 ----
|
|
Karsten Hopp |
8c8d37 |
return retval;
|
|
Karsten Hopp |
8c8d37 |
}
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
+ #if defined(FEAT_EVAL) || defined(PROTO)
|
|
Karsten Hopp |
8c8d37 |
+ /*
|
|
Karsten Hopp |
8c8d37 |
+ * Return the lhs or rhs of a mapping, with the key codes turned into printable
|
|
Karsten Hopp |
8c8d37 |
+ * strings, in an allocated string.
|
|
Karsten Hopp |
8c8d37 |
+ */
|
|
Karsten Hopp |
8c8d37 |
+ char_u *
|
|
Karsten Hopp |
8c8d37 |
+ str2special_save(str, is_lhs)
|
|
Karsten Hopp |
8c8d37 |
+ char_u *str;
|
|
Karsten Hopp |
8c8d37 |
+ int is_lhs; /* TRUE for lhs, FALSE for rhs */
|
|
Karsten Hopp |
8c8d37 |
+ {
|
|
Karsten Hopp |
8c8d37 |
+ garray_T ga;
|
|
Karsten Hopp |
8c8d37 |
+ char_u *p = str;
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
+ ga_init2(&ga, 1, 40);
|
|
Karsten Hopp |
8c8d37 |
+ while (*p != NUL)
|
|
Karsten Hopp |
8c8d37 |
+ ga_concat(&ga, str2special(&p, is_lhs));
|
|
Karsten Hopp |
8c8d37 |
+ ga_append(&ga, NUL);
|
|
Karsten Hopp |
8c8d37 |
+ return (char_u *)ga.ga_data;
|
|
Karsten Hopp |
8c8d37 |
+ }
|
|
Karsten Hopp |
8c8d37 |
+ #endif
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
/*
|
|
Karsten Hopp |
8c8d37 |
* Return the printable string for the key codes at "*sp".
|
|
Karsten Hopp |
8c8d37 |
* Used for translating the lhs or rhs of a mapping to printable chars.
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/proto/getchar.pro 2010-08-15 21:57:28.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/proto/getchar.pro 2010-10-20 21:06:01.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 51,56 ****
|
|
Karsten Hopp |
8c8d37 |
--- 51,57 ----
|
|
Karsten Hopp |
8c8d37 |
int get_map_mode __ARGS((char_u **cmdp, int forceit));
|
|
Karsten Hopp |
8c8d37 |
void map_clear __ARGS((char_u *cmdp, char_u *arg, int forceit, int abbr));
|
|
Karsten Hopp |
8c8d37 |
void map_clear_int __ARGS((buf_T *buf, int mode, int local, int abbr));
|
|
Karsten Hopp |
8c8d37 |
+ char_u *map_mode_to_chars __ARGS((int mode));
|
|
Karsten Hopp |
8c8d37 |
int map_to_exists __ARGS((char_u *str, char_u *modechars, int abbr));
|
|
Karsten Hopp |
8c8d37 |
int map_to_exists_mode __ARGS((char_u *rhs, int mode, int abbr));
|
|
Karsten Hopp |
8c8d37 |
char_u *set_context_in_map_cmd __ARGS((expand_T *xp, char_u *cmd, char_u *arg, int forceit, int isabbrev, int isunmap, cmdidx_T cmdidx));
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 61,67 ****
|
|
Karsten Hopp |
8c8d37 |
int makemap __ARGS((FILE *fd, buf_T *buf));
|
|
Karsten Hopp |
8c8d37 |
int put_escstr __ARGS((FILE *fd, char_u *strstart, int what));
|
|
Karsten Hopp |
8c8d37 |
void check_map_keycodes __ARGS((void));
|
|
Karsten Hopp |
8c8d37 |
! char_u *check_map __ARGS((char_u *keys, int mode, int exact, int ign_mod, int abbr));
|
|
Karsten Hopp |
8c8d37 |
void init_mappings __ARGS((void));
|
|
Karsten Hopp |
8c8d37 |
void add_map __ARGS((char_u *map, int mode));
|
|
Karsten Hopp |
8c8d37 |
/* vim: set ft=c : */
|
|
Karsten Hopp |
8c8d37 |
--- 62,68 ----
|
|
Karsten Hopp |
8c8d37 |
int makemap __ARGS((FILE *fd, buf_T *buf));
|
|
Karsten Hopp |
8c8d37 |
int put_escstr __ARGS((FILE *fd, char_u *strstart, int what));
|
|
Karsten Hopp |
8c8d37 |
void check_map_keycodes __ARGS((void));
|
|
Karsten Hopp |
8c8d37 |
! char_u *check_map __ARGS((char_u *keys, int mode, int exact, int ign_mod, int abbr, mapblock_T **mp_ptr, int *local_ptr));
|
|
Karsten Hopp |
8c8d37 |
void init_mappings __ARGS((void));
|
|
Karsten Hopp |
8c8d37 |
void add_map __ARGS((char_u *map, int mode));
|
|
Karsten Hopp |
8c8d37 |
/* vim: set ft=c : */
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/proto/message.pro 2010-08-15 21:57:28.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/proto/message.pro 2010-10-20 20:31:25.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 33,38 ****
|
|
Karsten Hopp |
8c8d37 |
--- 33,39 ----
|
|
Karsten Hopp |
8c8d37 |
int msg_outtrans_len_attr __ARGS((char_u *msgstr, int len, int attr));
|
|
Karsten Hopp |
8c8d37 |
void msg_make __ARGS((char_u *arg));
|
|
Karsten Hopp |
8c8d37 |
int msg_outtrans_special __ARGS((char_u *strstart, int from));
|
|
Karsten Hopp |
8c8d37 |
+ char_u *str2special_save __ARGS((char_u *str, int is_lhs));
|
|
Karsten Hopp |
8c8d37 |
char_u *str2special __ARGS((char_u **sp, int from));
|
|
Karsten Hopp |
8c8d37 |
void str2specialbuf __ARGS((char_u *sp, char_u *buf, int len));
|
|
Karsten Hopp |
8c8d37 |
void msg_prt_line __ARGS((char_u *s, int list));
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/structs.h 2010-08-15 21:57:28.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/structs.h 2010-10-20 20:23:38.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 979,987 ****
|
|
Karsten Hopp |
8c8d37 |
struct mapblock
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
mapblock_T *m_next; /* next mapblock in list */
|
|
Karsten Hopp |
8c8d37 |
! char_u *m_keys; /* mapped from */
|
|
Karsten Hopp |
8c8d37 |
int m_keylen; /* strlen(m_keys) */
|
|
Karsten Hopp |
8c8d37 |
! char_u *m_str; /* mapped to */
|
|
Karsten Hopp |
8c8d37 |
int m_mode; /* valid mode */
|
|
Karsten Hopp |
8c8d37 |
int m_noremap; /* if non-zero no re-mapping for m_str */
|
|
Karsten Hopp |
8c8d37 |
char m_silent; /* <silent> used, don't echo commands */
|
|
Karsten Hopp |
8c8d37 |
--- 979,988 ----
|
|
Karsten Hopp |
8c8d37 |
struct mapblock
|
|
Karsten Hopp |
8c8d37 |
{
|
|
Karsten Hopp |
8c8d37 |
mapblock_T *m_next; /* next mapblock in list */
|
|
Karsten Hopp |
8c8d37 |
! char_u *m_keys; /* mapped from, lhs */
|
|
Karsten Hopp |
8c8d37 |
int m_keylen; /* strlen(m_keys) */
|
|
Karsten Hopp |
8c8d37 |
! char_u *m_str; /* mapped to, rhs */
|
|
Karsten Hopp |
8c8d37 |
! char_u *m_orig_str; /* rhs as entered by the user */
|
|
Karsten Hopp |
8c8d37 |
int m_mode; /* valid mode */
|
|
Karsten Hopp |
8c8d37 |
int m_noremap; /* if non-zero no re-mapping for m_str */
|
|
Karsten Hopp |
8c8d37 |
char m_silent; /* <silent> used, don't echo commands */
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/testdir/test75.in 2010-10-20 21:13:30.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/testdir/test75.in 2010-10-20 20:54:04.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 0 ****
|
|
Karsten Hopp |
8c8d37 |
--- 1,16 ----
|
|
Karsten Hopp |
8c8d37 |
+ " Tests for functions.
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
+ STARTTEST
|
|
Karsten Hopp |
8c8d37 |
+ :so small.vim
|
|
Karsten Hopp |
8c8d37 |
+ :" Test maparg() with a string result
|
|
Karsten Hopp |
8c8d37 |
+ :map foo<C-V> is<F4>foo
|
|
Karsten Hopp |
8c8d37 |
+ :vnoremap <script> <buffer> <expr> <silent> bar isbar
|
|
Karsten Hopp |
8c8d37 |
+ :call append('$', maparg('foo<C-V>'))
|
|
Karsten Hopp |
8c8d37 |
+ :call append('$', string(maparg('foo<C-V>', '', 0, 1)))
|
|
Karsten Hopp |
8c8d37 |
+ :call append('$', string(maparg('bar', '', 0, 1)))
|
|
Karsten Hopp |
8c8d37 |
+ :"
|
|
Karsten Hopp |
8c8d37 |
+ :/^eof/+1,$w! test.out
|
|
Karsten Hopp |
8c8d37 |
+ :qa!
|
|
Karsten Hopp |
8c8d37 |
+ ENDTEST
|
|
Karsten Hopp |
8c8d37 |
+
|
|
Karsten Hopp |
8c8d37 |
+ eof
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/testdir/test75.ok 2010-10-20 21:13:30.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/testdir/test75.ok 2010-10-20 20:54:08.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 0 ****
|
|
Karsten Hopp |
8c8d37 |
--- 1,3 ----
|
|
Karsten Hopp |
8c8d37 |
+ is<F4>foo
|
|
Karsten Hopp |
8c8d37 |
+ {'silent': 0, 'noremap': 0, 'lhs': 'foo<C-V>', 'mode': ' ', 'expr': 0, 'sid': 0, 'rhs': 'is<F4>foo', 'buffer': 0}
|
|
Karsten Hopp |
8c8d37 |
+ {'silent': 1, 'noremap': 1, 'lhs': 'bar', 'mode': 'v', 'expr': 1, 'sid': 0, 'rhs': 'isbar', 'buffer': 1}
|
|
Karsten Hopp |
8c8d37 |
*** ../vim-7.3.031/src/version.c 2010-10-20 19:17:43.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
--- src/version.c 2010-10-20 21:13:18.000000000 +0200
|
|
Karsten Hopp |
8c8d37 |
***************
|
|
Karsten Hopp |
8c8d37 |
*** 716,717 ****
|
|
Karsten Hopp |
8c8d37 |
--- 716,719 ----
|
|
Karsten Hopp |
8c8d37 |
{ /* Add new patch number below this line */
|
|
Karsten Hopp |
8c8d37 |
+ /**/
|
|
Karsten Hopp |
8c8d37 |
+ 32,
|
|
Karsten Hopp |
8c8d37 |
/**/
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
--
|
|
Karsten Hopp |
8c8d37 |
Not too long ago, compress was something you did to garbage...
|
|
Karsten Hopp |
8c8d37 |
|
|
Karsten Hopp |
8c8d37 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
Karsten Hopp |
8c8d37 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
Karsten Hopp |
8c8d37 |
\\\ download, build and distribute -- http://www.A-A-P.org ///
|
|
Karsten Hopp |
8c8d37 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|