aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/output
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2025-10-09 11:29:55 +0200
committerGitHub <noreply@github.com>2025-10-09 11:29:55 +0200
commit7e66ae3125bf5031b6c013dee8038c838b42bbc5 (patch)
tree061c2311461cbe52b40b8ad433023085cfae67bf /zellij-server/src/output
parentbuild(cargo): Update Rust toolchain to 1.90.0 (#4457) (diff)
downloadsl0ppij-7e66ae3125bf5031b6c013dee8038c838b42bbc5.tar.gz
sl0ppij-7e66ae3125bf5031b6c013dee8038c838b42bbc5.tar.xz
sl0ppij-7e66ae3125bf5031b6c013dee8038c838b42bbc5.zip
Give plugins the ability to read pane contents (#4465)
* initial implementation * add Selection and better types * event to plugins * only send viewport diff * simplify data structure sent over the wire * cleanups * rustfmt * remove dead code and fix tests * commit tests * get pane scrollback plugin command without implementation * add lines above and lines below to pane contents * implement get scrollback plugin command * selection => selected_text * add convenience method to get the selected text * move Selection back to zellij-server * rustfmt * bring back client id to get contents command * rustfmt * add pr
Diffstat (limited to 'zellij-server/src/output')
-rw-r--r--zellij-server/src/output/mod.rs19
1 files changed, 17 insertions, 2 deletions
diff --git a/zellij-server/src/output/mod.rs b/zellij-server/src/output/mod.rs
index 537e4cf2..3ed8db69 100644
--- a/zellij-server/src/output/mod.rs
+++ b/zellij-server/src/output/mod.rs
@@ -1,12 +1,12 @@
use std::collections::VecDeque;
-use crate::panes::selection::Selection;
use crate::panes::Row;
+use crate::panes::Selection;
use crate::{
panes::sixel::SixelImageStore,
panes::terminal_character::{AnsiCode, CharacterStyles},
- panes::{LinkHandler, TerminalCharacter, DEFAULT_STYLES, EMPTY_TERMINAL_CHARACTER},
+ panes::{LinkHandler, PaneId, TerminalCharacter, DEFAULT_STYLES, EMPTY_TERMINAL_CHARACTER},
ClientId,
};
use std::cell::RefCell;
@@ -16,6 +16,7 @@ use std::{
collections::{HashMap, HashSet},
str,
};
+use zellij_utils::data::{PaneContents, PaneRenderReport};
use zellij_utils::errors::prelude::*;
use zellij_utils::pane_size::PaneGeom;
use zellij_utils::pane_size::SizeInPixels;
@@ -246,6 +247,7 @@ pub struct Output {
character_cell_size: Rc<RefCell<Option<SizeInPixels>>>,
floating_panes_stack: Option<FloatingPanesStack>,
styled_underlines: bool,
+ pane_render_report: PaneRenderReport,
}
impl Output {
@@ -454,6 +456,19 @@ impl Output {
.map(|s| s.cursor_is_visible(cursor_x, cursor_y))
.unwrap_or(true)
}
+ pub fn add_pane_contents(
+ &mut self,
+ client_ids: &[ClientId],
+ pane_id: PaneId,
+ pane_contents: PaneContents,
+ ) {
+ self.pane_render_report
+ .add_pane_contents(client_ids, pane_id.into(), pane_contents);
+ }
+ pub fn drain_pane_render_report(&mut self) -> PaneRenderReport {
+ let empty_pane_render_report = PaneRenderReport::default();
+ std::mem::replace(&mut self.pane_render_report, empty_pane_render_report)
+ }
}
// this struct represents the geometry of a group of floating panes