fix: render control codes in mini buffer input with unicode control code symbols

closes #236
This commit is contained in:
CJ van den Berg 2025-04-28 16:46:36 +02:00
parent 993add1a43
commit e39d9ed4b3
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
7 changed files with 24 additions and 8 deletions

View file

@ -60,7 +60,7 @@ pub fn Create(options: type) type {
fn update_mini_mode_text(self: *Self) void {
if (tui.mini_mode()) |mini_mode| {
mini_mode.text = self.input.items;
mini_mode.cursor = tui.egc_chunk_width(self.input.items, 0, 8);
mini_mode.cursor = tui.egc_chunk_width(self.input.items, 0, 1);
}
}

View file

@ -115,7 +115,7 @@ pub fn Create(options: type) type {
}
if (tui.mini_mode()) |mini_mode| {
mini_mode.text = self.file_path.items;
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 8);
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 1);
}
return;
}
@ -139,7 +139,7 @@ pub fn Create(options: type) type {
defer {
if (tui.mini_mode()) |mini_mode| {
mini_mode.text = self.file_path.items;
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 8);
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 1);
}
}
var count: usize = undefined;
@ -243,7 +243,7 @@ pub fn Create(options: type) type {
fn update_mini_mode_text(self: *Self) void {
if (tui.mini_mode()) |mini_mode| {
mini_mode.text = self.file_path.items;
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 8);
mini_mode.cursor = tui.egc_chunk_width(self.file_path.items, 0, 1);
}
}

View file

@ -142,7 +142,7 @@ fn load_history(self: *Self, pos: usize) void {
fn update_mini_mode_text(self: *Self) void {
if (tui.mini_mode()) |mini_mode| {
mini_mode.text = self.input_.items;
mini_mode.cursor = tui.egc_chunk_width(self.input_.items, 0, 8);
mini_mode.cursor = tui.egc_chunk_width(self.input_.items, 0, 1);
}
}

View file

@ -83,7 +83,7 @@ fn start_query(self: *Self) !void {
fn update_mini_mode_text(self: *Self) void {
if (tui.mini_mode()) |mini_mode| {
mini_mode.text = self.input_;
mini_mode.cursor = tui.egc_chunk_width(self.input_, 0, 8);
mini_mode.cursor = tui.egc_chunk_width(self.input_, 0, 1);
}
}

View file

@ -54,7 +54,7 @@ fn update_mini_mode_text(self: *Self) void {
(fmt.bufPrint(&self.buf, "{d}", .{linenum}) catch "")
else
"";
mini_mode.cursor = tui.egc_chunk_width(mini_mode.text, 0, 8);
mini_mode.cursor = tui.egc_chunk_width(mini_mode.text, 0, 1);
}
}