mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-29 18:51:15 -03:00
Fix empty soft-wrapped line not being removed before execution
Commit 7acc2b7 added an empty line to our screen representation if we are
wrapped. This regressed the fix for #6826. In the attached test case, there is
a spurious empty line after the first one. Adjust the fix to remove it again.
Patch-by: kerty <g.kabakov@inbox.ru>
https://github.com/fish-shell/fish-shell/pull/11153#issuecomment-2800087389
This commit is contained in:
@@ -756,11 +756,11 @@ pub fn save_status(&mut self) {
|
||||
/// Return whether we believe the cursor is wrapped onto the last line, and that line is
|
||||
/// otherwise empty. This includes both soft and hard wrapping.
|
||||
pub fn cursor_is_wrapped_to_own_line(&self) -> bool {
|
||||
// Note == comparison against the line count is correct: we do not create a line just for the
|
||||
// cursor. If there is a line containing the cursor, then it means that line has contents and we
|
||||
// should return false.
|
||||
// Don't consider dumb terminals to have wrapping for the purposes of this function.
|
||||
self.actual.cursor.x == 0 && self.actual.cursor.y == self.actual.line_count() && !is_dumb()
|
||||
self.actual.cursor.x == 0
|
||||
&& self.actual.cursor.y != 0
|
||||
&& self.actual.cursor.y + 1 == self.actual.line_count()
|
||||
&& !is_dumb()
|
||||
}
|
||||
|
||||
/// Appends a character to the end of the line that the output cursor is on. This function
|
||||
|
||||
17
tests/checks/tmux-wrapping.fish
Normal file
17
tests/checks/tmux-wrapping.fish
Normal file
@@ -0,0 +1,17 @@
|
||||
#RUN: %fish %s
|
||||
#REQUIRES: command -v tmux
|
||||
|
||||
set -g isolated_tmux_fish_extra_args -C '
|
||||
function fish_prompt; echo \'$ \'; end
|
||||
bind ctrl-g "commandline -i \'echo \'(printf %0(math \$COLUMNS - (string length \'\$ echo \'))d 0)"
|
||||
'
|
||||
isolated-tmux-start
|
||||
|
||||
isolated-tmux send-keys C-g Enter
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p | awk 'NR <= 4 {print NR ":" $0}'
|
||||
|
||||
# CHECK: 1:$ echo 0000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
# CHECK: 2:0000000000000000000000000000000000000000000000000000000000000000000000000
|
||||
# CHECK: 3:$
|
||||
# CHECK: 4:
|
||||
Reference in New Issue
Block a user