mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-15 00:06:09 +03:00
core: no need for hasTabs apprt function
This commit is contained in:
@ -3670,39 +3670,18 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||||||
},
|
},
|
||||||
|
|
||||||
.previous_tab => {
|
.previous_tab => {
|
||||||
if (@hasDecl(apprt.Surface, "hasTabs")) {
|
|
||||||
if (!self.rt_surface.hasTabs()) {
|
|
||||||
log.debug("surface has no tabs, ignoring previous_tab binding", .{});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (@hasDecl(apprt.Surface, "gotoTab")) {
|
if (@hasDecl(apprt.Surface, "gotoTab")) {
|
||||||
self.rt_surface.gotoTab(.previous);
|
self.rt_surface.gotoTab(.previous);
|
||||||
} else log.warn("runtime doesn't implement gotoTab", .{});
|
} else log.warn("runtime doesn't implement gotoTab", .{});
|
||||||
},
|
},
|
||||||
|
|
||||||
.next_tab => {
|
.next_tab => {
|
||||||
if (@hasDecl(apprt.Surface, "hasTabs")) {
|
|
||||||
if (!self.rt_surface.hasTabs()) {
|
|
||||||
log.debug("surface has no tabs, ignoring next_tab binding", .{});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (@hasDecl(apprt.Surface, "gotoTab")) {
|
if (@hasDecl(apprt.Surface, "gotoTab")) {
|
||||||
self.rt_surface.gotoTab(.next);
|
self.rt_surface.gotoTab(.next);
|
||||||
} else log.warn("runtime doesn't implement gotoTab", .{});
|
} else log.warn("runtime doesn't implement gotoTab", .{});
|
||||||
},
|
},
|
||||||
|
|
||||||
.last_tab => {
|
.last_tab => {
|
||||||
if (@hasDecl(apprt.Surface, "hasTabs")) {
|
|
||||||
if (!self.rt_surface.hasTabs()) {
|
|
||||||
log.debug("surface has no tabs, ignoring last_tab binding", .{});
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (@hasDecl(apprt.Surface, "gotoTab")) {
|
if (@hasDecl(apprt.Surface, "gotoTab")) {
|
||||||
self.rt_surface.gotoTab(.last);
|
self.rt_surface.gotoTab(.last);
|
||||||
} else log.warn("runtime doesn't implement gotoTab", .{});
|
} else log.warn("runtime doesn't implement gotoTab", .{});
|
||||||
|
@ -790,11 +790,6 @@ pub fn newTab(self: *Surface) !void {
|
|||||||
try window.newTab(&self.core_surface);
|
try window.newTab(&self.core_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn hasTabs(self: *const Surface) bool {
|
|
||||||
const window = self.container.window() orelse return false;
|
|
||||||
return window.hasTabs();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn gotoTab(self: *Surface, tab: apprt.GotoTab) void {
|
pub fn gotoTab(self: *Surface, tab: apprt.GotoTab) void {
|
||||||
const window = self.container.window() orelse {
|
const window = self.container.window() orelse {
|
||||||
log.info(
|
log.info(
|
||||||
|
@ -421,11 +421,6 @@ pub fn closeTab(self: *Window, tab: *Tab) void {
|
|||||||
self.notebook.closeTab(tab);
|
self.notebook.closeTab(tab);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns true if this window has any tabs.
|
|
||||||
pub fn hasTabs(self: *const Window) bool {
|
|
||||||
return self.notebook.nPages() > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Go to the previous tab for a surface.
|
/// Go to the previous tab for a surface.
|
||||||
pub fn gotoPreviousTab(self: *Window, surface: *Surface) void {
|
pub fn gotoPreviousTab(self: *Window, surface: *Surface) void {
|
||||||
const tab = surface.container.tab() orelse {
|
const tab = surface.container.tab() orelse {
|
||||||
|
Reference in New Issue
Block a user