mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-31 20:31:19 -03:00
builtin read: enable terminal protocols again
It's not clear whether builtin read should be able to do everything
that the normal prompt does but I guess we haven't found a problem yet.
Given that read could be used to read a single character at a type,
it's a bit odd to toggle terminal protocols all the time.
But that's not the typical case (at least not for when stdin is a TTY),
and it seems fine.
Teste with
bind ctrl-4 'echo yay'
Regressed in 8164855b7 (Disable terminal protocols throughout evaluation,
2024-04-02).
This commit is contained in:
@@ -16,7 +16,6 @@
|
|||||||
use crate::libc::MB_CUR_MAX;
|
use crate::libc::MB_CUR_MAX;
|
||||||
use crate::nix::isatty;
|
use crate::nix::isatty;
|
||||||
use crate::reader::commandline_set_buffer;
|
use crate::reader::commandline_set_buffer;
|
||||||
use crate::reader::reader_current_data;
|
|
||||||
use crate::reader::ReaderConfig;
|
use crate::reader::ReaderConfig;
|
||||||
use crate::reader::{reader_pop, reader_push, reader_readline};
|
use crate::reader::{reader_pop, reader_push, reader_readline};
|
||||||
use crate::tokenizer::Tokenizer;
|
use crate::tokenizer::Tokenizer;
|
||||||
@@ -592,8 +591,7 @@ pub fn read(parser: &Parser, streams: &mut IoStreams, argv: &mut [&wstr]) -> Opt
|
|||||||
let stream_stdin_is_a_tty = isatty(streams.stdin_fd);
|
let stream_stdin_is_a_tty = isatty(streams.stdin_fd);
|
||||||
|
|
||||||
// Enable terminal protocols if noninteractive.
|
// Enable terminal protocols if noninteractive.
|
||||||
let _terminal_protocols = (stream_stdin_is_a_tty && reader_current_data().is_none())
|
let _terminal_protocols = stream_stdin_is_a_tty.then(terminal_protocols_enable_scoped);
|
||||||
.then(terminal_protocols_enable_scoped);
|
|
||||||
|
|
||||||
// Normally, we either consume a line of input or all available input. But if we are reading a
|
// Normally, we either consume a line of input or all available input. But if we are reading a
|
||||||
// line at a time, we need a middle ground where we only consume as many lines as we need to
|
// line at a time, we need a middle ground where we only consume as many lines as we need to
|
||||||
|
|||||||
Reference in New Issue
Block a user