aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/reader.cpp
diff options
context:
space:
mode:
authorGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-09-09 17:11:53 +0800
committerGravatar David Adam <zanchey@ucc.gu.uwa.edu.au>2015-09-10 16:22:39 +0800
commita66d44054c4aae44c307b10bb10469b4565e5027 (patch)
tree7d5e2d4916de8fe83ada2e11d225d5919565e7cf /src/reader.cpp
parente9fcbb334eebdc4a581bf72f1c2e403a4e685ff7 (diff)
reader.cpp: send smkx/rmkx when entering/leaving interactive mode
Closes #2139.
Diffstat (limited to 'src/reader.cpp')
-rw-r--r--src/reader.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/reader.cpp b/src/reader.cpp
index 0b492cf4..ceb5959f 100644
--- a/src/reader.cpp
+++ b/src/reader.cpp
@@ -43,6 +43,20 @@ commence.
#include <sys/select.h>
#endif
+#if HAVE_NCURSES_H
+#include <ncurses.h>
+#elif HAVE_NCURSES_CURSES_H
+#include <ncurses/curses.h>
+#else
+#include <curses.h>
+#endif
+
+#if HAVE_TERM_H
+#include <term.h>
+#elif HAVE_NCURSES_TERM_H
+#include <ncurses/term.h>
+#endif
+
#include <signal.h>
#include <fcntl.h>
#include <wchar.h>
@@ -3083,6 +3097,13 @@ const wchar_t *reader_readline(int nchars)
exec_prompt();
+ /* Send the smkx sequence if defined to enable arrow keys etc.
+ See https://github.com/fish-shell/fish-shell/issues/2139 and
+ http://invisible-island.net/xterm/xterm.faq.html#xterm_arrows
+ */
+
+ tputs(keypad_xmit, 1, &writeb);
+
reader_super_highlight_me_plenty();
s_reset(&data->screen, screen_reset_abandon_line);
reader_repaint();
@@ -4195,6 +4216,13 @@ const wchar_t *reader_readline(int nchars)
wperror(L"tcsetattr");
}
+ /* Send the rmkx sequence if defined to disable arrow keys etc.
+ See https://github.com/fish-shell/fish-shell/issues/2139 and
+ http://invisible-island.net/xterm/xterm.faq.html#xterm_arrows
+ */
+
+ tputs(keypad_local, 1, &writeb);
+
set_color(rgb_color_t::reset(), rgb_color_t::reset());
}