refactor: add mainview get_active_view and get_view_count functions

This commit is contained in:
CJ van den Berg 2026-01-20 13:36:40 +01:00
parent ad44443bba
commit abe15a973d
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -1590,6 +1590,14 @@ fn store_last_match_text(self: *Self, text: ?[]const u8) void {
self.last_match_text = text; self.last_match_text = text;
} }
pub fn get_active_view(self: *const Self) usize {
return self.active_view;
}
pub fn get_view_count(self: *const Self) usize {
return self.views.widgets.items.len;
}
pub fn get_active_editor(self: *Self) ?*ed.Editor { pub fn get_active_editor(self: *Self) ?*ed.Editor {
const active_view = self.views.get_at(self.active_view) orelse return null; const active_view = self.views.get_at(self.active_view) orelse return null;
const editor = active_view.get("editor") orelse return null; const editor = active_view.get("editor") orelse return null;