Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

fix(ui): Home and End stay in the text field being typed into

Gareth Gwync5549fda6c89
diff --git a/src/crates/concat/ui/dialogs/captions.slint b/src/crates/concat/ui/dialogs/captions.slint
index 06652185..c62794b4 100644
--- a/src/crates/concat/ui/dialogs/captions.slint
+++ b/src/crates/concat/ui/dialogs/captions.slint
@@ -130,6 +130,19 @@ export component CaptionsDialog inherits Modal {
selection-foreground-color: Theme.on-accent;
changed has-focus => { root.typing = self.has-focus; }
edited => { root.text-edited(self.text); }
+ // Home and End are unbound in Slint on macOS and would
+ // walk up to the window's playhead shortcuts.
+ key-pressed(event) => {
+ if (event.text == Key.Home) {
+ self.set-selection-offsets(0, 0);
+ return accept;
+ }
+ if (event.text == Key.End) {
+ self.set-selection-offsets(1000000000, 1000000000);
+ return accept;
+ }
+ return reject;
+ }
}
if root.draft == "" && !script.has-focus: Text {
diff --git a/src/crates/concat/ui/dialogs/speech.slint b/src/crates/concat/ui/dialogs/speech.slint
index 9785d075..1b808da9 100644
--- a/src/crates/concat/ui/dialogs/speech.slint
+++ b/src/crates/concat/ui/dialogs/speech.slint
@@ -111,6 +111,19 @@ export component SpeechDialog inherits Modal {
selection-foreground-color: Theme.on-accent;
changed has-focus => { root.typing = self.has-focus; }
edited => { root.text-edited(self.text); }
+ // Home and End are unbound in Slint on macOS and would
+ // walk up to the window's playhead shortcuts.
+ key-pressed(event) => {
+ if (event.text == Key.Home) {
+ self.set-selection-offsets(0, 0);
+ return accept;
+ }
+ if (event.text == Key.End) {
+ self.set-selection-offsets(1000000000, 1000000000);
+ return accept;
+ }
+ return reject;
+ }
}
if root.draft == "" && !script.has-focus: Text {
diff --git a/src/crates/concat/ui/inspector/text-panel.slint b/src/crates/concat/ui/inspector/text-panel.slint
index a1d92cfd..1da3ac55 100644
--- a/src/crates/concat/ui/inspector/text-panel.slint
+++ b/src/crates/concat/ui/inspector/text-panel.slint
@@ -112,6 +112,22 @@ export component TextPanel inherits VerticalLayout {
root.commit();
}
}
+
+ // Slint binds Home and End to nothing on macOS, so they
+ // walked up to the window's playhead shortcuts and the
+ // preview went blank mid-sentence. They belong to the
+ // text: the start and the end of it.
+ key-pressed(event) => {
+ if (event.text == Key.Home) {
+ self.set-selection-offsets(0, 0);
+ return accept;
+ }
+ if (event.text == Key.End) {
+ self.set-selection-offsets(1000000000, 1000000000);
+ return accept;
+ }
+ return reject;
+ }
}
}
}
diff --git a/src/crates/concat/ui/primitives/number-field.slint b/src/crates/concat/ui/primitives/number-field.slint
index 810a01f5..10d12770 100644
--- a/src/crates/concat/ui/primitives/number-field.slint
+++ b/src/crates/concat/ui/primitives/number-field.slint
@@ -147,6 +147,16 @@ export component NumberField inherits Rectangle {
self.select-all();
return EventResult.accept;
}
+ // Home and End are unbound in Slint on macOS and would walk
+ // up to the window's playhead shortcuts; keep them in the field.
+ if (event.text == Key.Home) {
+ self.set-selection-offsets(0, 0);
+ return EventResult.accept;
+ }
+ if (event.text == Key.End) {
+ self.set-selection-offsets(1000000000, 1000000000);
+ return EventResult.accept;
+ }
return EventResult.reject;
}
}