Remove space for prompt if it occupies full line

If the prompt occupies the full width of the first line, each new line will soft wrap, leaving empty lines between. This change removes the indentation that matches the start of the line to the end of the prompt if the prompt width equals the terminal width.

Steps to reproduce:
fish -C 'function fish_prompt; printf %0"$COLUMNS"d 0; end'
# type "begin" and Enter
# observe that there was a spurious empty line
This commit is contained in:
kerty
2025-01-23 23:53:52 +03:00
committed by Johannes Altmanninger
parent e63fea1127
commit d667ec5061

View File

@@ -374,8 +374,12 @@ struct ScrolledCursor {
);
}
// If overflowing, give the prompt its own line to improve the situation.
let first_line_prompt_space = layout.left_prompt_space;
// If the prompt doesn't occupy the full line, justify the command line to the end of the prompt.
let first_line_prompt_space = if layout.left_prompt_space == screen_width {
0
} else {
layout.left_prompt_space
};
// Reconstruct the command line.
let effective_commandline = explicit_before_suggestion.to_owned()