mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-31 04:39:01 +00:00
core: clear selection whenever preedit is changed
This commit is contained in:
@@ -1591,6 +1591,15 @@ pub fn preeditCallback(self: *Surface, preedit_: ?[]const u8) !void {
|
||||
self.renderer_state.mutex.lock();
|
||||
defer self.renderer_state.mutex.unlock();
|
||||
|
||||
// We clear our selection when ANY OF:
|
||||
// 1. We have an existing preedit
|
||||
// 2. We have preedit text
|
||||
if (self.renderer_state.preedit != null or
|
||||
preedit_ != null)
|
||||
{
|
||||
self.setSelection(null) catch {};
|
||||
}
|
||||
|
||||
// We always clear our prior preedit
|
||||
if (self.renderer_state.preedit) |p| {
|
||||
self.alloc.free(p.codepoints);
|
||||
|
||||
@@ -1550,11 +1550,6 @@ pub const CAPI = struct {
|
||||
return selection.len;
|
||||
}
|
||||
|
||||
/// Clear the current selection in the surface.
|
||||
export fn ghostty_surface_clear_selection(surface: *Surface) void {
|
||||
surface.core_surface.io.terminal.screen.clearSelection();
|
||||
}
|
||||
|
||||
/// Tell the surface that it needs to schedule a render
|
||||
export fn ghostty_surface_refresh(surface: *Surface) void {
|
||||
surface.refresh();
|
||||
|
||||
Reference in New Issue
Block a user