version 1.6, 2001/01/29 01:58:07 |
version 1.7, 2001/05/23 16:13:59 |
|
|
KEYMAP *curmap; /* pointer to the map being changed */ |
KEYMAP *curmap; /* pointer to the map being changed */ |
int c; /* character being changed */ |
int c; /* character being changed */ |
PF funct; /* function being changed to */ |
PF funct; /* function being changed to */ |
KEYMAP *pref_map; /* if funct==prefix, map to bind to or |
KEYMAP *pref_map; /* if funct==NULL, map to bind to or |
NULL for new */ |
NULL for new */ |
{ |
{ |
int i, n1, n2, nold; |
int i, n1, n2, nold; |
|
|
MAP_ELEMENT *mep; |
MAP_ELEMENT *mep; |
|
|
if (ele >= &curmap->map_element[curmap->map_num] || c < ele->k_base) { |
if (ele >= &curmap->map_element[curmap->map_num] || c < ele->k_base) { |
if (ele > &curmap->map_element[0] && (funct != prefix || |
if (ele > &curmap->map_element[0] && (funct != NULL || |
(ele - 1)->k_prefmap == NULL)) |
(ele - 1)->k_prefmap == NULL)) |
n1 = c - (ele - 1)->k_num; |
n1 = c - (ele - 1)->k_num; |
else |
else |
n1 = HUGE; |
n1 = HUGE; |
if (ele < &curmap->map_element[curmap->map_num] && |
if (ele < &curmap->map_element[curmap->map_num] && |
(funct != prefix || ele->k_prefmap == NULL)) |
(funct != NULL || ele->k_prefmap == NULL)) |
n2 = ele->k_base - c; |
n2 = ele->k_base - c; |
else |
else |
n2 = HUGE; |
n2 = HUGE; |
|
|
ele->k_prefmap = NULL; |
ele->k_prefmap = NULL; |
curmap->map_num++; |
curmap->map_num++; |
} |
} |
if (funct == prefix) { |
if (funct == NULL) { |
if (pref_map != NULL) { |
if (pref_map != NULL) { |
ele->k_prefmap = pref_map; |
ele->k_prefmap = pref_map; |
} else { |
} else { |
|
|
} |
} |
} else { |
} else { |
n1 = c - ele->k_base; |
n1 = c - ele->k_base; |
if (ele->k_funcp[n1] == funct && (funct != prefix || |
if (ele->k_funcp[n1] == funct && (funct != NULL || |
pref_map == NULL || pref_map == ele->k_prefmap)) |
pref_map == NULL || pref_map == ele->k_prefmap)) |
/* no change */ |
/* no change */ |
return TRUE; |
return TRUE; |
if (funct != prefix || ele->k_prefmap == NULL) { |
if (funct != NULL || ele->k_prefmap == NULL) { |
if (ele->k_funcp[n1] == prefix) |
if (ele->k_funcp[n1] == NULL) |
ele->k_prefmap = (KEYMAP *) NULL; |
ele->k_prefmap = (KEYMAP *) NULL; |
/* easy case */ |
/* easy case */ |
ele->k_funcp[n1] = funct; |
ele->k_funcp[n1] = funct; |
if (funct == prefix) { |
if (funct == NULL) { |
if (pref_map != NULL) |
if (pref_map != NULL) |
ele->k_prefmap = pref_map; |
ele->k_prefmap = pref_map; |
else { |
else { |
|
|
*/ |
*/ |
n2 = 1; |
n2 = 1; |
for (i = 0; n2 && i < n1; i++) |
for (i = 0; n2 && i < n1; i++) |
n2 &= ele->k_funcp[i] != prefix; |
n2 &= ele->k_funcp[i] != NULL; |
if (curmap->map_num >= curmap->map_max && |
if (curmap->map_num >= curmap->map_max && |
(curmap = realocmap(curmap)) == NULL) |
(curmap = realocmap(curmap)) == NULL) |
return FALSE; |
return FALSE; |
|
|
ewprintf("Out of memory"); |
ewprintf("Out of memory"); |
return FALSE; |
return FALSE; |
} |
} |
ele->k_funcp[n1] = prefix; |
ele->k_funcp[n1] = NULL; |
for (i = n1 + n2; i <= ele->k_num - ele->k_base; i++) |
for (i = n1 + n2; i <= ele->k_num - ele->k_base; i++) |
pfp[i - n1 - n2] = ele->k_funcp[i]; |
pfp[i - n1 - n2] = ele->k_funcp[i]; |
for (mep = &curmap->map_element[curmap->map_num]; |
for (mep = &curmap->map_element[curmap->map_num]; |
|
|
if (inmacro) { |
if (inmacro) { |
for (s = 0; s < maclcur->l_used - 1; s++) { |
for (s = 0; s < maclcur->l_used - 1; s++) { |
if (doscan(curmap, c = CHARMASK(maclcur->l_text[s])) |
if (doscan(curmap, c = CHARMASK(maclcur->l_text[s])) |
!= prefix) { |
!= NULL) { |
if (remap(curmap, c, prefix, (KEYMAP *)NULL) |
if (remap(curmap, c, NULL, (KEYMAP *)NULL) |
!= TRUE) |
!= TRUE) |
return FALSE; |
return FALSE; |
} |
} |
|
|
ewprintf("%s", prompt); |
ewprintf("%s", prompt); |
pep[-1] = ' '; |
pep[-1] = ' '; |
pep = keyname(pep, c = getkey(FALSE)); |
pep = keyname(pep, c = getkey(FALSE)); |
if (doscan(curmap, c) != prefix) |
if (doscan(curmap, c) != NULL) |
break; |
break; |
*pep++ = '-'; |
*pep++ = '-'; |
*pep = '\0'; |
*pep = '\0'; |
|
|
if ((s = eread("%s to command: ", prompt, 80, EFFUNC | EFNEW, |
if ((s = eread("%s to command: ", prompt, 80, EFFUNC | EFNEW, |
prompt)) != TRUE) |
prompt)) != TRUE) |
return s; |
return s; |
if (((funct = name_function(prompt)) == prefix) ? |
if (((funct = name_function(prompt)) == NULL) ? |
(pref_map = name_map(prompt)) == NULL : funct == NULL) { |
(pref_map = name_map(prompt)) == NULL : funct == NULL) { |
ewprintf("[No match]"); |
ewprintf("[No match]"); |
return FALSE; |
return FALSE; |
|
|
|
|
if (fname == NULL) |
if (fname == NULL) |
funct = rescan; |
funct = rescan; |
else if (((funct = name_function(fname)) == prefix) ? |
else if (((funct = name_function(fname)) == NULL) ? |
(pref_map = name_map(fname)) == NULL : funct == NULL) { |
(pref_map = name_map(fname)) == NULL : funct == NULL) { |
ewprintf("[No match: %s]", fname); |
ewprintf("[No match: %s]", fname); |
return FALSE; |
return FALSE; |
} |
} |
while (--kcount) { |
while (--kcount) { |
if (doscan(curmap, c = *keys++) != prefix) { |
if (doscan(curmap, c = *keys++) != NULL) { |
if (remap(curmap, c, prefix, (KEYMAP *)NULL) != TRUE) |
if (remap(curmap, c, NULL, (KEYMAP *)NULL) != TRUE) |
return FALSE; |
return FALSE; |
} |
} |
curmap = ele->k_prefmap; |
curmap = ele->k_prefmap; |