mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-12 14:51:16 -03:00
Fix code duplication in commandline rendering
Will use this in the next commit.
This commit is contained in:
@@ -317,11 +317,14 @@ pub fn write(
|
||||
|
||||
// Output the command line.
|
||||
let mut i = 0;
|
||||
while i < effective_commandline.len() {
|
||||
loop {
|
||||
// Grab the current cursor's x,y position if this character matches the cursor's offset.
|
||||
if !cursor_is_within_pager && i == cursor_pos {
|
||||
cursor_arr = self.desired.cursor;
|
||||
}
|
||||
if i == effective_commandline.len() {
|
||||
break;
|
||||
}
|
||||
self.desired_append_char(
|
||||
effective_commandline.as_char_slice()[i],
|
||||
colors[i],
|
||||
@@ -332,11 +335,6 @@ pub fn write(
|
||||
i += 1;
|
||||
}
|
||||
|
||||
// Cursor may have been at the end too.
|
||||
if !cursor_is_within_pager && i == cursor_pos {
|
||||
cursor_arr = self.desired.cursor;
|
||||
}
|
||||
|
||||
let full_line_count = self.desired.cursor.y + 1;
|
||||
|
||||
// Now that we've output everything, set the cursor to the position that we saved in the loop
|
||||
|
||||
Reference in New Issue
Block a user