mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-16 23:52:46 +08:00
Fix code duplication in commandline rendering
Will use this in the next commit.
This commit is contained in:
parent
0d5e6f356e
commit
50333d8d00
|
@ -317,11 +317,14 @@ impl Screen {
|
|||
|
||||
// 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 @@ impl Screen {
|
|||
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
|
||||
|
|
Loading…
Reference in New Issue
Block a user