From 924d6aac71f3748505c9c63eae41194663a948cb Mon Sep 17 00:00:00 2001 From: ridiculousfish Date: Sun, 9 Jun 2024 18:11:33 -0700 Subject: [PATCH] Remove another call to current_data() Continue to get off of globals. --- src/input.rs | 2 +- src/reader.rs | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/input.rs b/src/input.rs index d2c13c423..905ab4f77 100644 --- a/src/input.rs +++ b/src/input.rs @@ -419,7 +419,7 @@ impl<'a> InputEventQueuer for Reader<'a> { } // 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]; if vintr != 0 { self.push_front(CharEvent::from_key(Key::from_single_byte(vintr))); diff --git a/src/reader.rs b/src/reader.rs index cc7ac8608..2e8a59dcf 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -943,18 +943,16 @@ 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 -/// was set. If the current reader is interruptible, call \c reader_exit(). -pub fn reader_reading_interrupted() -> i32 { +/// was set. If the current reader is interruptible, mark the reader as exit_loop_requested. +pub fn reader_reading_interrupted(data: &mut ReaderData) -> i32 { let res = reader_test_and_clear_interrupted(); if res == 0 { return 0; } - if let Some(data) = current_data() { - if data.conf.exit_on_interrupt { - data.exit_loop_requested = true; - // We handled the interrupt ourselves, our caller doesn't need to handle it. - return 0; - } + if data.conf.exit_on_interrupt { + data.exit_loop_requested = true; + // We handled the interrupt ourselves, our caller doesn't need to handle it. + return 0; } res }