Eliminate a call to reader_current_data

Try to get off of these globals.
This commit is contained in:
ridiculousfish 2024-05-27 12:04:08 -07:00 committed by Peter Ammon
parent c297df38c7
commit dfd948fcb5
No known key found for this signature in database
2 changed files with 11 additions and 3 deletions

View file

@ -13,7 +13,7 @@ use crate::reader::{
ReaderData,
};
use crate::signal::signal_clear_cancel;
use crate::threads::assert_is_main_thread;
use crate::threads::{assert_is_main_thread, iothread_service_main};
use crate::wchar::prelude::*;
use once_cell::sync::{Lazy, OnceCell};
use std::ffi::CString;
@ -434,6 +434,10 @@ impl InputEventQueuer for ReaderData {
self.parser().sync_uvars_and_fire(true /* always */);
}
fn ioport_notified(&mut self) {
iothread_service_main(self);
}
fn paste_start_buffering(&mut self) {
self.input_data.paste_buffer = Some(vec![]);
self.push_front(CharEvent::from_readline(ReadlineCmd::BeginUndoGroup));

View file

@ -12,7 +12,7 @@ use crate::key::{
Key, Modifiers,
};
use crate::reader::{reader_current_data, reader_test_and_clear_interrupted};
use crate::threads::{iothread_port, iothread_service_main, MainThread};
use crate::threads::{iothread_port, MainThread};
use crate::universal_notifier::default_notifier;
use crate::wchar::{encode_byte_to_char, prelude::*};
use crate::wutil::encoding::{mbrtowc, mbstate_t, zero_mbstate};
@ -595,7 +595,7 @@ pub trait InputEventQueuer {
}
ReadbResult::IOPortNotified => {
iothread_service_main(reader_current_data().unwrap());
self.ioport_notified();
}
ReadbResult::Byte(read_byte) => {
@ -1215,6 +1215,10 @@ pub trait InputEventQueuer {
/// The default does nothing.
fn uvar_change_notified(&mut self) {}
/// Override point for when the ioport is ready.
/// The default does nothing.
fn ioport_notified(&mut self) {}
/// Reset the function status.
fn get_function_status(&self) -> bool {
self.get_input_data().function_status