Add find shortcut in browser.
This commit is contained in:
+20
-2
@@ -14,6 +14,7 @@ const gobject = @import("gobject");
|
||||
const gtk = @import("gtk");
|
||||
const vt = @import("ghostty-vt");
|
||||
|
||||
const Browser = @import("Browser.zig");
|
||||
const Layouts = @import("Layouts.zig");
|
||||
const OpenLayoutDialog = @import("OpenLayoutDialog.zig");
|
||||
const Pane = @import("Pane.zig");
|
||||
@@ -1348,6 +1349,12 @@ fn focusedTerminal(self: *Window) ?*Terminal {
|
||||
return tab.view.focusedTerminal();
|
||||
}
|
||||
|
||||
/// The focused web view of the visible tab, or null when a terminal has focus.
|
||||
fn focusedBrowser(self: *Window) ?*Browser {
|
||||
const tab = self.activeTab() orelse return null;
|
||||
return tab.view.focusedBrowser();
|
||||
}
|
||||
|
||||
/// Split the visible tab's focused pane, adding a pane of the given kind.
|
||||
fn addPane(self: *Window, kind: View.Kind) void {
|
||||
const tab = self.activeTab() orelse return;
|
||||
@@ -1442,10 +1449,21 @@ fn onShortcut(
|
||||
}
|
||||
}
|
||||
|
||||
// Ctrl+PageUp/PageDown cycles tabs, matching most tabbed terminals.
|
||||
// Ctrl+comma opens settings, which is the convention nearly everywhere.
|
||||
// Chords without Shift, which have to be the ones a terminal doesn't want
|
||||
// for itself. Ctrl+PageUp/PageDown cycles tabs, matching most tabbed
|
||||
// terminals; Ctrl+comma opens settings, which is the convention nearly
|
||||
// everywhere; Ctrl+F is claimed only over a web pane.
|
||||
if (ctrl and !shift) {
|
||||
switch (keyval) {
|
||||
gdk.KEY_F, gdk.KEY_f => {
|
||||
// Find-in-page, on the chord every browser uses. In a
|
||||
// terminal Ctrl+F is an ordinary control character that the
|
||||
// program running there is waiting for, so this only claims
|
||||
// the key when a web pane has focus.
|
||||
const browser = self.focusedBrowser() orelse return 0;
|
||||
browser.openFind();
|
||||
return 1;
|
||||
},
|
||||
gdk.KEY_comma => {
|
||||
self.openSettings();
|
||||
return 1;
|
||||
|
||||
Reference in New Issue
Block a user