aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2015-09-06 23:21:15 +0200
committerMarc André Tanner <mat@brain-dump.org>2015-09-06 23:21:15 +0200
commit0a52f918d01a298236a2edf7a005548edf34a8fb (patch)
tree2e070ab43368ed45146cb62cd11011997684b0ea
parent6f532df9641d59a7d168f68715a95609ffe2a253 (diff)
downloadvis-0a52f918d01a298236a2edf7a005548edf34a8fb.tar.gz
vis-0a52f918d01a298236a2edf7a005548edf34a8fb.tar.xz
ui: differentiate between Ctrl-J and enter
Thus enter no longer creates new cursors, use CTRL-j instead. Closes #69
-rw-r--r--config.def.h6
-rw-r--r--ui-curses.c1
-rw-r--r--ui-curses.h1
3 files changed, 5 insertions, 3 deletions
diff --git a/config.def.h b/config.def.h
index fdd20ae..1516762 100644
--- a/config.def.h
+++ b/config.def.h
@@ -104,7 +104,8 @@ static KeyBinding vis_movements[] = {
{ { NONE('j') }, movement, { .i = MOVE_LINE_DOWN } },
{ { CONTROL('J') }, movement, { .i = MOVE_LINE_DOWN } },
{ { CONTROL('N') }, movement, { .i = MOVE_LINE_DOWN } },
- { { KEY(ENTER) }, movement, { .i = MOVE_LINE_DOWN } },
+ { { NONE('\n') }, movement, { .i = MOVE_LINE_DOWN } },
+ { { NONE('\r') }, movement, { .i = MOVE_LINE_DOWN } },
{ { NONE('g'), NONE('j') }, movement, { .i = MOVE_SCREEN_LINE_DOWN } },
{ { NONE('g'), KEY(DOWN) }, movement, { .i = MOVE_SCREEN_LINE_DOWN } },
{ { NONE('^') }, movement, { .i = MOVE_LINE_START } },
@@ -513,7 +514,8 @@ static KeyBinding vis_mode_readline[] = {
static KeyBinding vis_mode_prompt[] = {
{ { KEY(BACKSPACE) }, prompt_backspace,{ .s = NULL } },
- { { KEY(ENTER) }, prompt_enter, { NULL } },
+ { { NONE('\n') }, prompt_enter, { NULL } },
+ { { NONE('\r') }, prompt_enter, { NULL } },
{ { CONTROL('J') }, prompt_enter, { NULL } },
{ { KEY(UP) }, prompt_up, { NULL } },
{ { KEY(DOWN) }, prompt_down, { NULL } },
diff --git a/ui-curses.c b/ui-curses.c
index a256461..4705d08 100644
--- a/ui-curses.c
+++ b/ui-curses.c
@@ -597,6 +597,7 @@ Ui *ui_curses_new(Color *colors) {
use_default_colors();
raw();
noecho();
+ nonl();
keypad(stdscr, TRUE);
meta(stdscr, TRUE);
curs_set(0);
diff --git a/ui-curses.h b/ui-curses.h
index 32cdf2f..a2e1dc6 100644
--- a/ui-curses.h
+++ b/ui-curses.h
@@ -15,7 +15,6 @@ enum {
UI_KEY_DELETE = KEY_DC,
UI_KEY_PAGE_DOWN = KEY_NPAGE,
UI_KEY_PAGE_UP = KEY_PPAGE,
- UI_KEY_ENTER = KEY_ENTER,
UI_KEY_END = KEY_END,
UI_KEY_SHIFT_LEFT = KEY_SLEFT,
UI_KEY_SHIFT_RIGHT = KEY_SRIGHT,