refactor: simplify Plane/Widget usage
This commit is contained in:
parent
62cd53c0f3
commit
4145460012
15 changed files with 64 additions and 50 deletions
|
@ -115,7 +115,7 @@ pub fn Create(options: type) type {
|
|||
}
|
||||
if (tui.current().mini_mode) |*mini_mode| {
|
||||
mini_mode.text = self.file_path.items;
|
||||
mini_mode.cursor = tui.current().stdplane().egc_chunk_width(self.file_path.items, 0, 8);
|
||||
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 8);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ pub fn Create(options: type) type {
|
|||
defer {
|
||||
if (tui.current().mini_mode) |*mini_mode| {
|
||||
mini_mode.text = self.file_path.items;
|
||||
mini_mode.cursor = tui.current().stdplane().egc_chunk_width(self.file_path.items, 0, 8);
|
||||
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 8);
|
||||
}
|
||||
}
|
||||
var count: usize = undefined;
|
||||
|
@ -243,7 +243,7 @@ pub fn Create(options: type) type {
|
|||
fn update_mini_mode_text(self: *Self) void {
|
||||
if (tui.current().mini_mode) |*mini_mode| {
|
||||
mini_mode.text = self.file_path.items;
|
||||
mini_mode.cursor = tui.current().stdplane().egc_chunk_width(self.file_path.items, 0, 8);
|
||||
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 8);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -273,7 +273,7 @@ pub fn Create(options: type) type {
|
|||
pub fn mini_mode_delete_backwards(self: *Self, _: Ctx) Result {
|
||||
if (self.file_path.items.len > 0) {
|
||||
self.complete_trigger_count = 0;
|
||||
self.file_path.shrinkRetainingCapacity(self.file_path.items.len - tui.current().stdplane().egc_last(self.file_path.items).len);
|
||||
self.file_path.shrinkRetainingCapacity(self.file_path.items.len - tui.egc_last(self.file_path.items).len);
|
||||
}
|
||||
self.update_mini_mode_text();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue