diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-04 00:56:07 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-06-04 00:56:07 +0300 |
| commit | 3cbe4ec7936745543e16d1ceb37f6db6c38d65ac (patch) | |
| tree | 0252b71e0b92653c4e81168a98b7a341a7717424 /src/pane | |
| parent | e05bd5cb2a26e3690d73ca241e1e457d3eb664cb (diff) | |
fix: avoid ghostty utf8 grapheme buffer crash
refs #453
Diffstat (limited to 'src/pane')
| -rw-r--r-- | src/pane/terminal.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pane/terminal.rs b/src/pane/terminal.rs index 0a67f11a..88924d36 100644 --- a/src/pane/terminal.rs +++ b/src/pane/terminal.rs @@ -1058,7 +1058,7 @@ impl GhosttyPaneTerminal { Ok(rows) => rows, Err(_) => return, }; - let mut grapheme_bytes = Vec::new(); + let mut grapheme_codepoints = Vec::new(); let mut symbol_scratch = String::new(); let mut y = 0u16; while y < area.height && rows.next() { @@ -1081,7 +1081,7 @@ impl GhosttyPaneTerminal { &cells, basic.wide, hide_kitty_placeholders, - &mut grapheme_bytes, + &mut grapheme_codepoints, &mut symbol_scratch, ) { Ok(symbol) => symbol, @@ -1226,7 +1226,7 @@ fn ghostty_collect_dirty_patch( let Ok(mut rows) = render_state.populate_row_iterator(&mut row_iterator) else { fallback!("populate_rows_error"); }; - let mut grapheme_bytes = Vec::new(); + let mut grapheme_codepoints = Vec::new(); let mut symbol_scratch = String::new(); let mut patch_rows = Vec::new(); let mut y = 0u16; @@ -1264,7 +1264,7 @@ fn ghostty_collect_dirty_patch( &cells, basic.wide, hide_kitty_placeholders, - &mut grapheme_bytes, + &mut grapheme_codepoints, &mut symbol_scratch, ) { Ok(symbol) => symbol.to_owned(), @@ -1539,7 +1539,7 @@ fn ghostty_buffer_symbol_into<'a>( cells: &crate::ghostty::RowCellIter<'_>, wide: crate::ghostty::CellWide, hide_kitty_placeholders: bool, - grapheme_bytes: &mut Vec<u8>, + grapheme_codepoints: &mut Vec<u32>, symbol_scratch: &'a mut String, ) -> Result<&'a str, crate::ghostty::Error> { symbol_scratch.clear(); @@ -1547,7 +1547,7 @@ fn ghostty_buffer_symbol_into<'a>( crate::ghostty::CellWide::SpacerTail => {} crate::ghostty::CellWide::SpacerHead => symbol_scratch.push(' '), crate::ghostty::CellWide::Narrow | crate::ghostty::CellWide::Wide => { - cells.grapheme_text_into(grapheme_bytes, symbol_scratch)?; + cells.grapheme_text_into(grapheme_codepoints, symbol_scratch)?; let hidden_kitty_placeholder = hide_kitty_placeholders && symbol_scratch.chars().next().map(u32::from) == Some(crate::ghostty::KITTY_UNICODE_PLACEHOLDER); |
