version 1.1, 1996/09/07 21:40:26 |
version 1.2, 1996/09/21 06:22:59 |
|
|
static void copy_redo __ARGS((int)); |
static void copy_redo __ARGS((int)); |
static void init_typebuf __ARGS((void)); |
static void init_typebuf __ARGS((void)); |
static void gotchars __ARGS((char_u *, int)); |
static void gotchars __ARGS((char_u *, int)); |
|
static void may_sync_undo __ARGS((void)); |
static int vgetorpeek __ARGS((int)); |
static int vgetorpeek __ARGS((int)); |
static int inchar __ARGS((char_u *, int, long)); |
static int inchar __ARGS((char_u *, int, long)); |
static void map_free __ARGS((struct mapblock *)); |
static void map_free __ARGS((struct mapblock *)); |
|
|
add_buff(&recordbuff, buf); |
add_buff(&recordbuff, buf); |
} |
} |
} |
} |
|
may_sync_undo(); |
|
} |
|
|
/* |
/* |
* Do not sync in insert mode, unless cursor key has been used. |
* Sync undo. Called when typed characters are obtained from the typeahead |
* Also don't sync while reading a script file. |
* buffer, or when a menu is used. |
*/ |
* Do not sync in insert mode, unless cursor key has been used. |
|
* Also don't sync while reading a script file. |
|
*/ |
|
static void |
|
may_sync_undo() |
|
{ |
if ((!(State & (INSERT + CMDLINE)) || arrow_used) && |
if ((!(State & (INSERT + CMDLINE)) || arrow_used) && |
scriptin[curscript] == NULL) |
scriptin[curscript] == NULL) |
u_sync(); |
u_sync(); |
|
|
typebuf[typeoff + 1] == KS_MENU) |
typebuf[typeoff + 1] == KS_MENU) |
{ |
{ |
/* |
/* |
* Using a menu causes a break in undo! |
* Using a menu may cause a break in undo! |
|
* It's like using gotchars(), but without |
|
* recording or writing to a script file. |
*/ |
*/ |
u_sync(); |
may_sync_undo(); |
del_typebuf(3, 0); |
del_typebuf(3, 0); |
idx = gui_get_menu_index(current_menu, |
idx = gui_get_menu_index(current_menu, |
local_State); |
local_State); |
|
|
/* |
/* |
* Insert the 'to' part in the typebuf. |
* Insert the 'to' part in the typebuf. |
* If 'from' field is the same as the start of the |
* If 'from' field is the same as the start of the |
* 'to' field, don't remap this part. |
* 'to' field, don't remap the first character. |
* If m_noremap is set, don't remap the whole 'to' |
* If m_noremap is set, don't remap the whole 'to' |
* part. |
* part. |
*/ |
*/ |
if (ins_typebuf(mp->m_str, mp->m_noremap ? -1 : |
if (ins_typebuf(mp->m_str, mp->m_noremap ? -1 : |
STRNCMP(mp->m_str, mp->m_keys, |
STRNCMP(mp->m_str, mp->m_keys, |
(size_t)keylen) ? 0 : keylen, |
(size_t)keylen) ? 0 : 1, |
0, TRUE) == FAIL) |
0, TRUE) == FAIL) |
{ |
{ |
c = -1; |
c = -1; |
|
|
* 'abbr' should be FALSE for mappings, TRUE for abbreviations. |
* 'abbr' should be FALSE for mappings, TRUE for abbreviations. |
*/ |
*/ |
void |
void |
map_clear(modec, force, abbr) |
map_clear(modec, forceit, abbr) |
int modec; |
int modec; |
int force; |
int forceit; |
int abbr; |
int abbr; |
{ |
{ |
struct mapblock *mp; |
struct mapblock *mp; |
int mode; |
int mode; |
|
|
if (force) /* :mapclear! */ |
if (forceit) /* :mapclear! */ |
mode = INSERT + CMDLINE; |
mode = INSERT + CMDLINE; |
else if (modec == 'i') |
else if (modec == 'i') |
mode = INSERT; |
mode = INSERT; |
|
|
/* insert the last typed char */ |
/* insert the last typed char */ |
(void)ins_typebuf(tb, TRUE, 0, TRUE); |
(void)ins_typebuf(tb, TRUE, 0, TRUE); |
/* insert the to string */ |
/* insert the to string */ |
(void)ins_typebuf(mp->m_str, mp->m_noremap, 0, TRUE); |
(void)ins_typebuf(mp->m_str, mp->m_noremap ? -1 : 0, 0, TRUE); |
/* no abbrev. for these chars */ |
/* no abbrev. for these chars */ |
no_abbr_cnt += STRLEN(mp->m_str) + j + 1; |
no_abbr_cnt += STRLEN(mp->m_str) + j + 1; |
|
|