aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/reader.cpp
diff options
context:
space:
mode:
authorGravatar Kurtis Rader <krader@skepticism.us>2016-05-24 20:42:50 -0700
committerGravatar Kurtis Rader <krader@skepticism.us>2016-05-25 12:05:39 -0700
commitd1208386d21e4e85fa99538fef0bf23475a3c3e1 (patch)
treef680858003a08e79f1a6d0875914f463964d4e91 /src/reader.cpp
parentd7a4838a545beebad3786eb9289a04f87de480b6 (diff)
tty driver ignore lnext (\cV) and werase (\cW)
Configure the tty driver to ignore the lnext (\cV) and werase (\cW) characters so they can be bound to fish functions. Correct the `fish_key_bindings` program to initialize the tty in the same manner as the `fish` program. Fixes #3064
Diffstat (limited to 'src/reader.cpp')
-rw-r--r--src/reader.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/reader.cpp b/src/reader.cpp
index 235086c9..47258c64 100644
--- a/src/reader.cpp
+++ b/src/reader.cpp
@@ -784,23 +784,19 @@ void reader_init() {
// Set the mode used for the terminal, initialized to the current mode.
memcpy(&shell_modes, &terminal_mode_on_startup, sizeof shell_modes);
- shell_modes.c_iflag &= ~ICRNL; // turn off mapping CR (\cM) to NL (\cJ)
- shell_modes.c_iflag &= ~INLCR; // turn off mapping NL (\cJ) to CR (\cM)
+
+ shell_modes.c_iflag &= ~ICRNL; // disable mapping CR (\cM) to NL (\cJ)
+ shell_modes.c_iflag &= ~INLCR; // disable mapping NL (\cJ) to CR (\cM)
+ shell_modes.c_iflag &= ~IXON; // disable flow control
+ shell_modes.c_iflag &= ~IXOFF; // disable flow control
+
shell_modes.c_lflag &= ~ICANON; // turn off canonical mode
shell_modes.c_lflag &= ~ECHO; // turn off echo mode
- shell_modes.c_iflag &= ~IXON; // disable flow control
- shell_modes.c_iflag &= ~IXOFF; // disable flow control
+ shell_modes.c_lflag &= ~IEXTEN; // turn off handling of discard and lnext characters
+
shell_modes.c_cc[VMIN] = 1;
shell_modes.c_cc[VTIME] = 0;
-#if defined(_POSIX_VDISABLE)
-// PCA disable VDSUSP (typically control-Y), which is a funny job control. function available only
-// on OS X and BSD systems. This lets us use control-Y for yank instead.
-#ifdef VDSUSP
- shell_modes.c_cc[VDSUSP] = _POSIX_VDISABLE;
-#endif
-#endif
-
// We don't use term_steal because this can fail if fd 0 isn't associated with a tty and this
// function is run regardless of whether stdin is tied to a tty. This is harmless in that case.
// We do it unconditionally because disabling ICRNL mode (see above) needs to be done at the
@@ -1107,8 +1103,7 @@ wcstring completion_apply_to_command_line(const wcstring &val_str, complete_flag
// Perform the insertion and compute the new location.
wcstring result = command_line;
result.insert(insertion_point, replaced);
- size_t new_cursor_pos =
- insertion_point + replaced.size() + (back_into_trailing_quote ? 1 : 0);
+ size_t new_cursor_pos = insertion_point + replaced.size() + (back_into_trailing_quote ? 1 : 0);
if (add_space) {
if (quote != L'\0' && unescaped_quote(command_line, insertion_point) != quote) {
// This is a quoted parameter, first print a quote.