mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
gtk: make goto_tab go to last tab if too large
This commit is contained in:
@ -466,11 +466,10 @@ pub fn gotoLastTab(self: *Window) void {
|
|||||||
pub fn gotoTab(self: *Window, n: usize) void {
|
pub fn gotoTab(self: *Window, n: usize) void {
|
||||||
if (n == 0) return;
|
if (n == 0) return;
|
||||||
const max = self.notebook.nPages();
|
const max = self.notebook.nPages();
|
||||||
|
if (max == 0) return;
|
||||||
const page_idx = std.math.cast(c_int, n - 1) orelse return;
|
const page_idx = std.math.cast(c_int, n - 1) orelse return;
|
||||||
if (page_idx < max) {
|
self.notebook.gotoNthTab(@min(page_idx, max - 1));
|
||||||
self.notebook.gotoNthTab(page_idx);
|
self.focusCurrentTab();
|
||||||
self.focusCurrentTab();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Toggle tab overview (if present)
|
/// Toggle tab overview (if present)
|
||||||
|
Reference in New Issue
Block a user