diff options
author | Aram Drevekenin <aram@poor.dev> | 2022-07-08 17:19:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-08 17:19:42 +0200 |
commit | c89b416d764d80a72130821506f36157a08321e9 (patch) | |
tree | 6d1cc2d7fd5fddbb33fcbff192153700a9788bec /zellij-server/src/panes/terminal_pane.rs | |
parent | 61deca80edb1632eb8ca22f627c6001b757021dc (diff) |
feat(terminal): sixel support (#1557)
* work
* work
* work
* work
* work
* more work
* work
* work
* work
* hack around stdin repeater
* refactor(sixel): rename sixel structs
* feat(sixel): render text above images
* fix(sixel): reap images once they're past the end of the scrollbuffer
* fix(sixel): display images in the middle of the line
* fix(sixel): render crash
* fix(sixel): react to SIGWINCH
* fix(sixel): behave properly in alternate screen mode
* fix(sixel): reap images on terminal reset
* feat(sixel): handle DECSDM
* fix(terminal): properly respond to XTSMGRAPHICS and device attributes with Sixel
* Add comment
* fix(sixel): hack for unknown event overflow until we fix the api
* feat(input): query terminal for all OSC 4 colors and respond to them in a buggy way
* fix(sixel): do not render corrupted image
* feat(input): improve STDIN queries
* fix(client): mistake in clear terminal attributes string
* fix(ansi): report correct number of supported color registers
* fix(sixel): reap images that are completely covered
* style(comment): fix name
* test(sixel): infra
* test(sixel): cases and fixes
* fix(sixel): forward dcs bytes to sixel parser
* refactor(client): ansi stdin parser
* refactor(output): cleanup
* some refactorings
* fix test
* refactor(grid): sixel-grid / sixel-image-store
* refactor(grid): grid debug method
* refactor(grid): move various logic to sixel.rs
* refactor(grid): remove unused methods
* fix(sixel): work with multiple users
* refactor(pane): remove unused z_index
* style(fmt): prepend unused variable
* style(fmt): rustfmt
* fix(tests): various apis
* chore(dependencies): use published version of sixel crates
* style(fmt): rustfmt
* style(fmt): rustfmt
* style(lint): make clippy happy
* style(lint): make clippy happy... again
* style(lint): make clippy happy... again (chapter 2)
* style(comment): remove unused
* fix(colors): export COLORTERM and respond to XTVERSION
* fix(test): color register count
* fix(stdin): adjust STDIN sleep times
Diffstat (limited to 'zellij-server/src/panes/terminal_pane.rs')
-rw-r--r-- | zellij-server/src/panes/terminal_pane.rs | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/zellij-server/src/panes/terminal_pane.rs b/zellij-server/src/panes/terminal_pane.rs index 64af58591..b66400374 100644 --- a/zellij-server/src/panes/terminal_pane.rs +++ b/zellij-server/src/panes/terminal_pane.rs @@ -1,4 +1,5 @@ -use crate::output::CharacterChunk; +use crate::output::{CharacterChunk, SixelImageChunk}; +use crate::panes::sixel::SixelImageStore; use crate::panes::{ grid::Grid, terminal_character::{CursorShape, TerminalCharacter, EMPTY_TERMINAL_CHARACTER}, @@ -99,10 +100,10 @@ impl Pane for TerminalPane { self.reflow_lines(); } fn handle_pty_bytes(&mut self, bytes: VteBytes) { + self.set_should_render(true); for &byte in &bytes { self.vte_parser.advance(&mut self.grid, byte); } - self.set_should_render(true); } fn cursor_coordinates(&self) -> Option<(usize, usize)> { // (x, y) @@ -205,13 +206,14 @@ impl Pane for TerminalPane { fn render( &mut self, _client_id: Option<ClientId>, - ) -> Option<(Vec<CharacterChunk>, Option<String>)> { + ) -> Option<(Vec<CharacterChunk>, Option<String>, Vec<SixelImageChunk>)> { if self.should_render() { let mut raw_vte_output = String::new(); let content_x = self.get_content_x(); let content_y = self.get_content_y(); - let mut character_chunks = self.grid.read_changes(content_x, content_y); + let (mut character_chunks, sixel_image_chunks) = + self.grid.read_changes(content_x, content_y); for character_chunk in character_chunks.iter_mut() { character_chunk.add_changed_colors(self.grid.changed_colors); if self @@ -237,7 +239,7 @@ impl Pane for TerminalPane { self.grid.ring_bell = false; } self.set_should_render(false); - Some((character_chunks, Some(raw_vte_output))) + Some((character_chunks, Some(raw_vte_output), sixel_image_chunks)) } else { None } @@ -509,15 +511,19 @@ impl TerminalPane { pane_name: String, link_handler: Rc<RefCell<LinkHandler>>, character_cell_size: Rc<RefCell<Option<SizeInPixels>>>, + sixel_image_store: Rc<RefCell<SixelImageStore>>, terminal_emulator_colors: Rc<RefCell<Palette>>, + terminal_emulator_color_codes: Rc<RefCell<HashMap<usize, String>>>, ) -> TerminalPane { let initial_pane_title = format!("Pane #{}", pane_index); let grid = Grid::new( position_and_size.rows.as_usize(), position_and_size.cols.as_usize(), terminal_emulator_colors, + terminal_emulator_color_codes, link_handler, character_cell_size, + sixel_image_store, ); TerminalPane { frame: HashMap::new(), |