Clear selection when IME input starts
parent
2409d46600
commit
af5e423ea5
|
|
@ -748,6 +748,7 @@ void ghostty_surface_complete_clipboard_request(ghostty_surface_t,
|
|||
bool);
|
||||
bool ghostty_surface_has_selection(ghostty_surface_t);
|
||||
uintptr_t ghostty_surface_selection(ghostty_surface_t, char*, uintptr_t);
|
||||
void ghostty_surface_clear_selection(ghostty_surface_t);
|
||||
|
||||
#ifdef __APPLE__
|
||||
void ghostty_surface_set_display_id(ghostty_surface_t, uint32_t);
|
||||
|
|
|
|||
|
|
@ -1293,6 +1293,11 @@ extension Ghostty.SurfaceView: NSTextInputClient {
|
|||
}
|
||||
|
||||
func setMarkedText(_ string: Any, selectedRange: NSRange, replacementRange: NSRange) {
|
||||
// Clear selection when IME input starts
|
||||
if let surface = self.surface, ghostty_surface_has_selection(surface) {
|
||||
ghostty_surface_clear_selection(surface)
|
||||
}
|
||||
|
||||
switch string {
|
||||
case let v as NSAttributedString:
|
||||
self.markedText = NSMutableAttributedString(attributedString: v)
|
||||
|
|
|
|||
|
|
@ -1550,6 +1550,11 @@ 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();
|
||||
|
|
|
|||
Loading…
Reference in New Issue