Compare commits
No commits in common. "d8fa1b28aa613ff6fadb7f028b150b5eb1cd46cb" and "77379a58cf46d067c68184b9f7e4392541ef1daa" have entirely different histories.
d8fa1b28aa
...
77379a58cf
5 changed files with 2 additions and 32 deletions
|
|
@ -54,7 +54,6 @@ start_debugger_on_crash: bool = false,
|
|||
|
||||
completion_trigger: CompletionTrigger = .automatic,
|
||||
completion_style: CompletionStyle = .dropdown,
|
||||
completion_insert_mode: CompletionInsertMode = .insert,
|
||||
|
||||
widget_style: WidgetStyle = .compact,
|
||||
palette_style: WidgetStyle = .bars_top_bottom,
|
||||
|
|
@ -183,11 +182,6 @@ pub const CompletionStyle = enum {
|
|||
dropdown,
|
||||
};
|
||||
|
||||
pub const CompletionInsertMode = enum {
|
||||
insert,
|
||||
replace,
|
||||
};
|
||||
|
||||
pub const Alignment = enum {
|
||||
left,
|
||||
right,
|
||||
|
|
|
|||
|
|
@ -6408,19 +6408,6 @@ pub const Editor = struct {
|
|||
self.completion_is_complete = is_incomplete;
|
||||
}
|
||||
|
||||
pub fn get_completion_replacement_selection(self: *Self, replace: Selection) ?Selection {
|
||||
var sel = replace.from_pos(self.buf_root() catch return null, self.metrics);
|
||||
sel.normalize();
|
||||
const cursor = self.get_primary().cursor;
|
||||
return switch (tui.config().completion_insert_mode) {
|
||||
.insert => if (self.get_primary().cursor.within(sel))
|
||||
.{ .begin = sel.begin, .end = cursor }
|
||||
else
|
||||
sel,
|
||||
.replace => sel,
|
||||
};
|
||||
}
|
||||
|
||||
pub fn select(self: *Self, ctx: Context) Result {
|
||||
var sel: Selection = .{};
|
||||
if (!try ctx.args.match(.{ tp.extract(&sel.begin.row), tp.extract(&sel.begin.col), tp.extract(&sel.end.row), tp.extract(&sel.end.col) }))
|
||||
|
|
|
|||
|
|
@ -276,7 +276,7 @@ fn get_replace_selection(replace: Buffer.Selection) ?Buffer.Selection {
|
|||
return if (replace.empty())
|
||||
null
|
||||
else if (tui.get_active_editor()) |edt|
|
||||
edt.get_completion_replacement_selection(replace)
|
||||
replace.from_pos(edt.buf_root() catch return null, edt.metrics)
|
||||
else
|
||||
replace;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,7 +205,7 @@ fn get_replace_selection(replace: Buffer.Selection) ?Buffer.Selection {
|
|||
return if (replace.empty())
|
||||
null
|
||||
else if (tui.get_active_editor()) |edt|
|
||||
edt.get_completion_replacement_selection(replace)
|
||||
replace.from_pos(edt.buf_root() catch return null, edt.metrics)
|
||||
else
|
||||
replace;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1150,17 +1150,6 @@ const cmds = struct {
|
|||
}
|
||||
pub const toggle_completion_trigger_meta: Meta = .{ .description = "Toggle auto completion" };
|
||||
|
||||
pub fn toggle_completion_insert_mode(self: *Self, _: Ctx) Result {
|
||||
self.config_.completion_insert_mode = switch (self.config_.completion_insert_mode) {
|
||||
.insert => .replace,
|
||||
.replace => .insert,
|
||||
};
|
||||
defer self.logger.print("completion insert mode {t}", .{self.config_.completion_insert_mode});
|
||||
try save_config();
|
||||
resize();
|
||||
}
|
||||
pub const toggle_completion_insert_mode_meta: Meta = .{ .description = "Toggle completion insert mode" };
|
||||
|
||||
pub fn toggle_keybind_hints(self: *Self, _: Ctx) Result {
|
||||
self.hint_mode = switch (self.hint_mode) {
|
||||
.all => .prefix,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue