fix: override cursor focus rendering during dropdown completion
This commit is contained in:
parent
7c61b2dac6
commit
d5166e2f68
2 changed files with 7 additions and 1 deletions
|
|
@ -361,6 +361,7 @@ pub const Editor = struct {
|
|||
find_operation: ?enum { goto_next_match, goto_prev_match } = null,
|
||||
highlight_references_state: enum { adding, done } = .done,
|
||||
highlight_references_pending: Match.List = .empty,
|
||||
cursor_focus_override: bool = false,
|
||||
|
||||
prefix_buf: [8]u8 = undefined,
|
||||
prefix: []const u8 = &[_]u8{},
|
||||
|
|
@ -1307,7 +1308,7 @@ pub const Editor = struct {
|
|||
try self.render_cursor_primary(&self.get_primary().cursor, theme, cell_map, focused);
|
||||
}
|
||||
|
||||
fn render_cursor_primary(self: *Self, cursor: *const Cursor, theme: *const Widget.Theme, cell_map: CellMap, focused: bool) !void {
|
||||
fn render_cursor_primary(self: *Self, cursor: *const Cursor, theme: *const Widget.Theme, cell_map: CellMap, focused_: bool) !void {
|
||||
const configured_shape = tui.get_cursor_shape();
|
||||
const cursor_shape = if (tui.rdr().vx.caps.multi_cursor)
|
||||
configured_shape
|
||||
|
|
@ -1321,6 +1322,8 @@ pub const Editor = struct {
|
|||
const screen_pos = self.screen_cursor(cursor);
|
||||
if (screen_pos) |pos| set_cell_map_cursor(cell_map, pos.row, pos.col);
|
||||
|
||||
const focused = focused_ or self.cursor_focus_override;
|
||||
|
||||
if (focused and self.enable_terminal_cursor) {
|
||||
if (screen_pos) |pos| {
|
||||
self.render_term_cursor(pos, cursor_shape);
|
||||
|
|
@ -7145,6 +7148,7 @@ pub const EditorWidget = struct {
|
|||
}
|
||||
|
||||
pub fn focus(self: *Self) void {
|
||||
self.editor.cursor_focus_override = false;
|
||||
if (self.focused) return;
|
||||
self.commands.register() catch @panic("editor.commands.register");
|
||||
self.focused = true;
|
||||
|
|
@ -7153,6 +7157,7 @@ pub const EditorWidget = struct {
|
|||
}
|
||||
|
||||
pub fn unfocus(self: *Self) void {
|
||||
self.editor.cursor_focus_override = false;
|
||||
if (self.focused) self.commands.unregister();
|
||||
self.focused = false;
|
||||
command.executeName("enter_mode_default", .{}) catch {};
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ pub fn init(self: *Type) error{ Stop, OutOfMemory }!void {
|
|||
try self.value.commands.init(self);
|
||||
self.value.editor = tui.get_active_editor() orelse return error.Stop;
|
||||
self.value.view = self.value.editor.view;
|
||||
self.value.editor.cursor_focus_override = true;
|
||||
}
|
||||
|
||||
pub fn load_entries(self: *Type) !usize {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue