get rid of Esc
hotkey
For a variety of historical reasons, terminals pause every time you press `Esc`. Let's get rid of that lag.
This commit is contained in:
parent
fe5f542991
commit
bbab1a7c10
10
src/kilo.c
10
src/kilo.c
|
@ -687,7 +687,7 @@ static void editorFindMenu(void) {
|
||||||
attrset(A_NORMAL);
|
attrset(A_NORMAL);
|
||||||
extern int menu_column;
|
extern int menu_column;
|
||||||
menu_column = 2;
|
menu_column = 2;
|
||||||
draw_menu_item("Esc", "cancel");
|
draw_menu_item("^x", "cancel");
|
||||||
draw_menu_item("Enter", "submit");
|
draw_menu_item("Enter", "submit");
|
||||||
draw_menu_item("^h", "back up cursor");
|
draw_menu_item("^h", "back up cursor");
|
||||||
draw_menu_item("^u", "clear");
|
draw_menu_item("^u", "clear");
|
||||||
|
@ -713,7 +713,7 @@ static void editorGoMenu(void) {
|
||||||
attrset(A_NORMAL);
|
attrset(A_NORMAL);
|
||||||
extern int menu_column;
|
extern int menu_column;
|
||||||
menu_column = 2;
|
menu_column = 2;
|
||||||
draw_menu_item("Esc", "cancel");
|
draw_menu_item("^x", "cancel");
|
||||||
draw_menu_item("Enter", "submit");
|
draw_menu_item("Enter", "submit");
|
||||||
draw_menu_item("^h", "back up cursor");
|
draw_menu_item("^h", "back up cursor");
|
||||||
draw_menu_item("^u", "clear");
|
draw_menu_item("^u", "clear");
|
||||||
|
@ -837,8 +837,8 @@ static void editorFind() {
|
||||||
if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
|
if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
|
||||||
if (qlen != 0) query[--qlen] = '\0';
|
if (qlen != 0) query[--qlen] = '\0';
|
||||||
last_match = -1;
|
last_match = -1;
|
||||||
} else if (c == ESC || c == ENTER) {
|
} else if (c == CTRL_X || c == ENTER) {
|
||||||
if (c == ESC) {
|
if (c == CTRL_X) {
|
||||||
E.cx = saved_cx; E.cy = saved_cy;
|
E.cx = saved_cx; E.cy = saved_cy;
|
||||||
E.coloff = saved_coloff; E.rowoff = saved_rowoff;
|
E.coloff = saved_coloff; E.rowoff = saved_rowoff;
|
||||||
}
|
}
|
||||||
|
@ -1039,7 +1039,7 @@ static void editorGo(lua_State* L) {
|
||||||
int c = getch();
|
int c = getch();
|
||||||
if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
|
if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
|
||||||
if (qlen != 0) query[--qlen] = '\0';
|
if (qlen != 0) query[--qlen] = '\0';
|
||||||
} else if (c == ESC || c == ENTER) {
|
} else if (c == CTRL_X || c == ENTER) {
|
||||||
editorSetStatusMessage("");
|
editorSetStatusMessage("");
|
||||||
if (c == ENTER) {
|
if (c == ENTER) {
|
||||||
save_to_current_definition_and_editor_buffer(L, query);
|
save_to_current_definition_and_editor_buffer(L, query);
|
||||||
|
|
|
@ -442,7 +442,7 @@ static void recent_changes_menu (int cursor, int history_array_size) {
|
||||||
attrset(A_NORMAL);
|
attrset(A_NORMAL);
|
||||||
extern int menu_column;
|
extern int menu_column;
|
||||||
menu_column = 2;
|
menu_column = 2;
|
||||||
draw_menu_item("Esc", "go back");
|
draw_menu_item("^x", "go back");
|
||||||
/* draw_menu_item("↓/space", "older"); */
|
/* draw_menu_item("↓/space", "older"); */
|
||||||
attroff(A_REVERSE);
|
attroff(A_REVERSE);
|
||||||
mvaddstr(LINES-1, menu_column, " ↓/space ");
|
mvaddstr(LINES-1, menu_column, " ↓/space ");
|
||||||
|
@ -608,7 +608,7 @@ void recent_changes_view (lua_State *L) {
|
||||||
render_recent_changes(L, history_array, cursor, history_array_size);
|
render_recent_changes(L, history_array, cursor, history_array_size);
|
||||||
int c = getch();
|
int c = getch();
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case ESC:
|
case CTRL_X:
|
||||||
quit = 1;
|
quit = 1;
|
||||||
break;
|
break;
|
||||||
case KEY_DOWN:
|
case KEY_DOWN:
|
||||||
|
@ -649,7 +649,7 @@ static void big_picture_menu (void) {
|
||||||
attrset(A_NORMAL);
|
attrset(A_NORMAL);
|
||||||
extern int menu_column;
|
extern int menu_column;
|
||||||
menu_column = 2;
|
menu_column = 2;
|
||||||
draw_menu_item("Esc", "go back");
|
draw_menu_item("^x", "go back");
|
||||||
draw_menu_item("Enter", "submit");
|
draw_menu_item("Enter", "submit");
|
||||||
draw_menu_item("^h", "back up cursor");
|
draw_menu_item("^h", "back up cursor");
|
||||||
draw_menu_item("^u", "clear");
|
draw_menu_item("^u", "clear");
|
||||||
|
@ -816,7 +816,7 @@ restart:
|
||||||
int c = getch();
|
int c = getch();
|
||||||
if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
|
if (c == KEY_BACKSPACE || c == DELETE || c == CTRL_H) {
|
||||||
if (qlen != 0) query[--qlen] = '\0';
|
if (qlen != 0) query[--qlen] = '\0';
|
||||||
} else if (c == ESC) {
|
} else if (c == CTRL_X) {
|
||||||
return;
|
return;
|
||||||
} else if (c == ENTER) {
|
} else if (c == ENTER) {
|
||||||
save_to_current_definition_and_editor_buffer(L, query);
|
save_to_current_definition_and_editor_buffer(L, query);
|
||||||
|
|
|
@ -20,7 +20,6 @@ enum KEY_ACTION {
|
||||||
CTRL_S = 19,
|
CTRL_S = 19,
|
||||||
CTRL_U = 21,
|
CTRL_U = 21,
|
||||||
CTRL_X = 24,
|
CTRL_X = 24,
|
||||||
ESC = 27,
|
|
||||||
CTRL_SLASH = 31,
|
CTRL_SLASH = 31,
|
||||||
DELETE = 127,
|
DELETE = 127,
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue
Block a user