support the comment/uncomment hotkey on Macs
^/ works on Linux but not on Mac ^- emits the same character code on Mac ^_ seems to be the underlying character code, and works on both ctrl-7 also emits the same character code
This commit is contained in:
parent
950957619c
commit
267489c19f
|
@ -673,7 +673,7 @@ static void editorMenu(void) {
|
||||||
draw_menu_item("^g", "go");
|
draw_menu_item("^g", "go");
|
||||||
draw_menu_item("^b", "big picture");
|
draw_menu_item("^b", "big picture");
|
||||||
draw_menu_item("^f", "find");
|
draw_menu_item("^f", "find");
|
||||||
draw_menu_item("^/", "(un)comment line");
|
draw_menu_item("^/|^-|^_", "(un)comment line");
|
||||||
draw_menu_item("^h", "back up cursor");
|
draw_menu_item("^h", "back up cursor");
|
||||||
draw_menu_item("^l", "end of line");
|
draw_menu_item("^l", "end of line");
|
||||||
attrset(A_NORMAL);
|
attrset(A_NORMAL);
|
||||||
|
@ -1145,7 +1145,7 @@ static void editorProcessKeypress(lua_State* L) {
|
||||||
editorDelChar();
|
editorDelChar();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case CTRL_SLASH:
|
case CTRL_SLASH: /* same as CTRL_UNDERSCORE */
|
||||||
if (starts_with(E.row[E.rowoff+E.cy].chars, "--? "))
|
if (starts_with(E.row[E.rowoff+E.cy].chars, "--? "))
|
||||||
editorUncommentCursorRow();
|
editorUncommentCursorRow();
|
||||||
else
|
else
|
||||||
|
|
|
@ -21,6 +21,7 @@ enum KEY_ACTION {
|
||||||
CTRL_U = 21,
|
CTRL_U = 21,
|
||||||
CTRL_X = 24,
|
CTRL_X = 24,
|
||||||
CTRL_SLASH = 31,
|
CTRL_SLASH = 31,
|
||||||
|
CTRL_UNDERSCORE = 31,
|
||||||
DELETE = 127,
|
DELETE = 127,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue