Remove another call to current_data()

Continue to get off of globals.
This commit is contained in:
ridiculousfish 2024-06-09 18:11:33 -07:00 committed by Peter Ammon
parent dee692759a
commit 924d6aac71
No known key found for this signature in database
2 changed files with 7 additions and 9 deletions

View file

@ -419,7 +419,7 @@ impl<'a> InputEventQueuer for Reader<'a> {
} }
// Tell the reader an event occurred. // Tell the reader an event occurred.
if reader_reading_interrupted() != 0 { if reader_reading_interrupted(self) != 0 {
let vintr = shell_modes().c_cc[libc::VINTR]; let vintr = shell_modes().c_cc[libc::VINTR];
if vintr != 0 { if vintr != 0 {
self.push_front(CharEvent::from_key(Key::from_single_byte(vintr))); self.push_front(CharEvent::from_key(Key::from_single_byte(vintr)));

View file

@ -943,19 +943,17 @@ pub fn reader_execute_readline_cmd(parser: &Parser, ch: CharEvent) {
} }
/// Return the value of the interrupted flag, which is set by the sigint handler, and clear it if it /// Return the value of the interrupted flag, which is set by the sigint handler, and clear it if it
/// was set. If the current reader is interruptible, call \c reader_exit(). /// was set. If the current reader is interruptible, mark the reader as exit_loop_requested.
pub fn reader_reading_interrupted() -> i32 { pub fn reader_reading_interrupted(data: &mut ReaderData) -> i32 {
let res = reader_test_and_clear_interrupted(); let res = reader_test_and_clear_interrupted();
if res == 0 { if res == 0 {
return 0; return 0;
} }
if let Some(data) = current_data() {
if data.conf.exit_on_interrupt { if data.conf.exit_on_interrupt {
data.exit_loop_requested = true; data.exit_loop_requested = true;
// We handled the interrupt ourselves, our caller doesn't need to handle it. // We handled the interrupt ourselves, our caller doesn't need to handle it.
return 0; return 0;
} }
}
res res
} }