diff options
| author | Kunal Mohan <44079328+kunalmohan@users.noreply.github.com> | 2020-12-09 22:31:26 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-09 18:01:26 +0100 |
| commit | 92d1bcff4c0d1d886cefee6984d5533c5ea8dd6f (patch) | |
| tree | 2ef85153a55e61f1d97e03dfa608ac853fe22887 /src/screen.rs | |
| parent | fix(style): else-if ladder -> match (#86) (diff) | |
| download | sl0ppij-92d1bcff4c0d1d886cefee6984d5533c5ea8dd6f.tar.gz sl0ppij-92d1bcff4c0d1d886cefee6984d5533c5ea8dd6f.tar.xz sl0ppij-92d1bcff4c0d1d886cefee6984d5533c5ea8dd6f.zip | |
feat(infrastructure): introduce ErrorContext for tracking errors across threads (#83)
* Implement ErrorContext for tracking errors across threads
* reorder Instruction and ErrorContext
* Add ContextType, AppContext, ScreenContext, PtyContext
* Use ArrayVec in ErrorContext
* increase MAX_THREAD_CALL_STACK to 6
* Custom implement Debug for ErrorContext ad ContextType and color output
* Use os_input instead of println!()
* Use array instead of ArrayVec and some cleanup
* Introduce SenderWithContext
* Keep arrayvec at v0.5.1
Diffstat (limited to 'src/screen.rs')
| -rw-r--r-- | src/screen.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/screen.rs b/src/screen.rs index e00cc0a9..79442a97 100644 --- a/src/screen.rs +++ b/src/screen.rs @@ -1,16 +1,16 @@ use std::collections::{BTreeMap, HashSet}; use std::io::Write; use std::os::unix::io::RawFd; -use std::sync::mpsc::{Receiver, Sender, SyncSender}; +use std::sync::mpsc::Receiver; use crate::boundaries::Boundaries; use crate::boundaries::Rect; +use crate::errors::ErrorContext; use crate::layout::Layout; use crate::os_input_output::OsApi; use crate::pty_bus::{PtyInstruction, VteEvent}; use crate::terminal_pane::{PositionAndSize, TerminalPane}; -use crate::utils::logging::debug_log_to_file; -use crate::AppInstruction; +use crate::{AppInstruction, SenderWithContext}; /* * Screen @@ -78,10 +78,10 @@ pub enum ScreenInstruction { } pub struct Screen { - pub receiver: Receiver<ScreenInstruction>, + pub receiver: Receiver<(ScreenInstruction, ErrorContext)>, max_panes: Option<usize>, - send_pty_instructions: Sender<PtyInstruction>, - send_app_instructions: SyncSender<AppInstruction>, + pub send_pty_instructions: SenderWithContext<PtyInstruction>, + pub send_app_instructions: SenderWithContext<AppInstruction>, full_screen_ws: PositionAndSize, terminals: BTreeMap<RawFd, TerminalPane>, // BTreeMap because we need a predictable order when changing focus panes_to_hide: HashSet<RawFd>, @@ -92,9 +92,9 @@ pub struct Screen { impl Screen { pub fn new( - receive_screen_instructions: Receiver<ScreenInstruction>, - send_pty_instructions: Sender<PtyInstruction>, - send_app_instructions: SyncSender<AppInstruction>, + receive_screen_instructions: Receiver<(ScreenInstruction, ErrorContext)>, + send_pty_instructions: SenderWithContext<PtyInstruction>, + send_app_instructions: SenderWithContext<AppInstruction>, full_screen_ws: &PositionAndSize, os_api: Box<dyn OsApi>, max_panes: Option<usize>, |
