tweaks: elide three unneeded #defines
Backspace and Tab and Carriage Return have standard backslash escapes.master
parent
39ed865043
commit
4ce2e146ea
|
@ -83,7 +83,7 @@ bool is_blank_char(const char *c)
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if ((signed char)*c >= 0)
|
if ((signed char)*c >= 0)
|
||||||
return (*c == ' ' || *c == TAB_CODE);
|
return (*c == ' ' || *c == '\t');
|
||||||
|
|
||||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
if (mbtowc(&wc, c, MAXCHARLEN) < 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -1130,13 +1130,13 @@ void shortcut_init(void)
|
||||||
/* Link key combos to functions in certain menus. */
|
/* Link key combos to functions in certain menus. */
|
||||||
add_to_sclist(MMOST|MBROWSER, "^M", 0, do_enter, 0);
|
add_to_sclist(MMOST|MBROWSER, "^M", 0, do_enter, 0);
|
||||||
add_to_sclist(MMOST|MBROWSER, "Enter", KEY_ENTER, do_enter, 0);
|
add_to_sclist(MMOST|MBROWSER, "Enter", KEY_ENTER, do_enter, 0);
|
||||||
add_to_sclist(MMOST, "^H", BS_CODE, do_backspace, 0);
|
add_to_sclist(MMOST, "^H", '\b', do_backspace, 0);
|
||||||
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0);
|
add_to_sclist(MMOST, "Bsp", KEY_BACKSPACE, do_backspace, 0);
|
||||||
add_to_sclist(MMOST, "Sh-Del", SHIFT_DELETE, do_backspace, 0);
|
add_to_sclist(MMOST, "Sh-Del", SHIFT_DELETE, do_backspace, 0);
|
||||||
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
add_to_sclist(MMOST, "^D", 0, do_delete, 0);
|
||||||
add_to_sclist(MMOST, "Del", KEY_DC, do_delete, 0);
|
add_to_sclist(MMOST, "Del", KEY_DC, do_delete, 0);
|
||||||
add_to_sclist(MMOST, "^I", 0, do_tab, 0);
|
add_to_sclist(MMOST, "^I", 0, do_tab, 0);
|
||||||
add_to_sclist(MMOST, "Tab", TAB_CODE, do_tab, 0);
|
add_to_sclist(MMOST, "Tab", '\t', do_tab, 0);
|
||||||
add_to_sclist((MMOST|MBROWSER) & ~MFINDINHELP, "^G", 0, do_help, 0);
|
add_to_sclist((MMOST|MBROWSER) & ~MFINDINHELP, "^G", 0, do_help, 0);
|
||||||
add_to_sclist(MMAIN|MBROWSER|MHELP, "^X", 0, do_exit, 0);
|
add_to_sclist(MMAIN|MBROWSER|MHELP, "^X", 0, do_exit, 0);
|
||||||
if (!ISSET(PRESERVE))
|
if (!ISSET(PRESERVE))
|
||||||
|
|
|
@ -1469,13 +1469,13 @@ void suck_up_input_and_paste_it(void)
|
||||||
while (bracketed_paste) {
|
while (bracketed_paste) {
|
||||||
int input = get_kbinput(edit, BLIND);
|
int input = get_kbinput(edit, BLIND);
|
||||||
|
|
||||||
if (input == CR_CODE) {
|
if (input == '\r') {
|
||||||
line->next = make_new_node(line);
|
line->next = make_new_node(line);
|
||||||
line = line->next;
|
line = line->next;
|
||||||
line->data = copy_of("");
|
line->data = copy_of("");
|
||||||
index = 0;
|
index = 0;
|
||||||
} else if ((0x20 <= input && input <= 0xFF && input != DEL_CODE) ||
|
} else if ((0x20 <= input && input <= 0xFF && input != DEL_CODE) ||
|
||||||
input == TAB_CODE) {
|
input == '\t') {
|
||||||
line->data = charealloc(line->data, index + 2);
|
line->data = charealloc(line->data, index + 2);
|
||||||
line->data[index++] = (char)input;
|
line->data[index++] = (char)input;
|
||||||
line->data[index] = '\0';
|
line->data[index] = '\0';
|
||||||
|
|
|
@ -565,9 +565,6 @@ enum
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Basic control codes. */
|
/* Basic control codes. */
|
||||||
#define BS_CODE 0x08
|
|
||||||
#define TAB_CODE 0x09
|
|
||||||
#define CR_CODE 0x0D
|
|
||||||
#define ESC_CODE 0x1B
|
#define ESC_CODE 0x1B
|
||||||
#define DEL_CODE 0x7F
|
#define DEL_CODE 0x7F
|
||||||
|
|
||||||
|
|
|
@ -460,7 +460,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
|
||||||
if (func == do_tab) {
|
if (func == do_tab) {
|
||||||
#ifdef ENABLE_HISTORIES
|
#ifdef ENABLE_HISTORIES
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
if (last_kbinput != the_code_for(do_tab, TAB_CODE))
|
if (last_kbinput != the_code_for(do_tab, '\t'))
|
||||||
complete_len = strlen(answer);
|
complete_len = strlen(answer);
|
||||||
|
|
||||||
if (complete_len > 0) {
|
if (complete_len > 0) {
|
||||||
|
|
|
@ -930,7 +930,7 @@ int parse_kbinput(WINDOW *win)
|
||||||
case 1:
|
case 1:
|
||||||
if (keycode >= 0x80)
|
if (keycode >= 0x80)
|
||||||
retval = keycode;
|
retval = keycode;
|
||||||
else if (keycode == TAB_CODE)
|
else if (keycode == '\t')
|
||||||
retval = SHIFT_TAB;
|
retval = SHIFT_TAB;
|
||||||
else if ((keycode != 'O' && keycode != 'o' && keycode != '[') ||
|
else if ((keycode != 'O' && keycode != 'o' && keycode != '[') ||
|
||||||
key_buffer_len == 0 || *key_buffer == ESC_CODE) {
|
key_buffer_len == 0 || *key_buffer == ESC_CODE) {
|
||||||
|
@ -1144,7 +1144,7 @@ int parse_kbinput(WINDOW *win)
|
||||||
}
|
}
|
||||||
/* Is Shift being held? */
|
/* Is Shift being held? */
|
||||||
if (modifiers & 0x01) {
|
if (modifiers & 0x01) {
|
||||||
if (retval == TAB_CODE)
|
if (retval == '\t')
|
||||||
return SHIFT_TAB;
|
return SHIFT_TAB;
|
||||||
if (!meta_key)
|
if (!meta_key)
|
||||||
shift_held = TRUE;
|
shift_held = TRUE;
|
||||||
|
@ -1194,7 +1194,7 @@ int parse_kbinput(WINDOW *win)
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* When <Tab> is pressed while the mark is on, do an indent. */
|
/* When <Tab> is pressed while the mark is on, do an indent. */
|
||||||
if (retval == TAB_CODE && openfile->mark && currmenu == MMAIN &&
|
if (retval == '\t' && openfile->mark && currmenu == MMAIN &&
|
||||||
!bracketed_paste && openfile->mark != openfile->current)
|
!bracketed_paste && openfile->mark != openfile->current)
|
||||||
return INDENT_KEY;
|
return INDENT_KEY;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue