diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-21 18:00:59 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-04-21 18:00:59 +0300 |
| commit | bc410c4261f12377a2eb7ea08f4112a1a9574a77 (patch) | |
| tree | 99fef6ff2406c9be4147e63b0145f89c612261ea /src/ghostty | |
| parent | b1c9833b828d12e7e0196c5607ae63372998e25a (diff) | |
perf: reduce headless server render overhead
Diffstat (limited to 'src/ghostty')
| -rw-r--r-- | src/ghostty/mod.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/ghostty/mod.rs b/src/ghostty/mod.rs index e236b36f..75e600b8 100644 --- a/src/ghostty/mod.rs +++ b/src/ghostty/mod.rs @@ -1121,10 +1121,17 @@ impl<'a> RowCellIter<'a> { } pub fn graphemes(&self) -> Result<Vec<u32>, Error> { + let mut out = Vec::new(); + self.graphemes_into(&mut out)?; + Ok(out) + } + + pub fn graphemes_into(&self, out: &mut Vec<u32>) -> Result<(), Error> { let len = self.grapheme_len()? as usize; - let mut out = vec![0u32; len]; + out.clear(); + out.resize(len, 0); if len == 0 { - return Ok(out); + return Ok(()); } // SAFETY: out buffer is allocated for the grapheme count returned by the API. unsafe { @@ -1135,7 +1142,7 @@ impl<'a> RowCellIter<'a> { ) .into_result()?; } - Ok(out) + Ok(()) } } |
