feat: use terminal cursors for mini mode and overlay input boxes

closes: #80
This commit is contained in:
CJ van den Berg 2024-12-17 19:15:20 +01:00
parent ff0987c108
commit 32d67a3972
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 35 additions and 14 deletions

View file

@ -585,6 +585,10 @@ pub fn save_config(self: *const Self) !void {
try root.write_config(self.config, self.allocator);
}
pub fn is_mini_or_overlay_enabled(self: *const Self) bool {
return !(self.mini_mode == null or self.input_mode_outer == null);
}
fn enter_overlay_mode(self: *Self, mode: type) command.Result {
command.executeName("disable_fast_scroll", .{}) catch {};
command.executeName("disable_jump_mode", .{}) catch {};
@ -767,6 +771,7 @@ const cmds = struct {
pub const change_file_type_meta = .{ .description = "Change file type" };
pub fn exit_overlay_mode(self: *Self, _: Ctx) Result {
self.rdr.cursor_disable();
if (self.input_mode_outer == null) return;
if (self.input_mode) |*mode| mode.deinit();
self.input_mode = self.input_mode_outer;
@ -818,6 +823,7 @@ const cmds = struct {
}
pub fn exit_mini_mode(self: *Self, _: Ctx) Result {
self.rdr.cursor_disable();
if (self.mini_mode) |_| {} else return;
if (self.input_mode) |*mode| mode.deinit();
self.input_mode = self.input_mode_outer;