mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-08 10:56:34 +00:00
renderer/metal: handle preedit wider than our screen
This commit is contained in:
@@ -48,4 +48,12 @@ pub const Preedit = struct {
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
pub fn range(self: *const Preedit, start: usize, max: usize) [2]usize {
|
||||
// If our preedit goes off the end of the screen, we adjust it so
|
||||
// that it shifts left.
|
||||
const end = start + self.width();
|
||||
const offset = if (end > max) end - max else 0;
|
||||
return .{ start -| offset, end -| offset };
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user