mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-01 21:21:15 -03:00
Fix off-by-one pager height error on empty lines
Commit 7db9553 (Fix regression causing off-by-one pager height on
truncated autosuggestion) adds line to pager if cursor located at
the start of line and previous line is softwrapped, even if line was
softwrapped normally and not by autosuggestion, giving pager too much space.
Fix that.
Part of #11911
This commit is contained in:
committed by
Johannes Altmanninger
parent
6f5644a77c
commit
bb7180a2d8
@@ -29,7 +29,7 @@
|
||||
use crate::fallback::fish_wcwidth;
|
||||
use crate::flog::FLOGF;
|
||||
use crate::global_safety::RelaxedAtomicBool;
|
||||
use crate::highlight::{HighlightColorResolver, HighlightSpec};
|
||||
use crate::highlight::{HighlightColorResolver, HighlightRole, HighlightSpec};
|
||||
use crate::terminal::TerminalCommand::{
|
||||
self, ClearToEndOfLine, ClearToEndOfScreen, CursorDown, CursorLeft, CursorMove, CursorRight,
|
||||
CursorUp, EnterDimMode, ExitAttributeMode, Osc133PromptStart, ScrollContentUp,
|
||||
@@ -457,12 +457,13 @@ struct ScrolledCursor {
|
||||
|
||||
let full_line_count = self.desired.cursor.y
|
||||
- if self.desired.cursor.x == 0
|
||||
&& self
|
||||
.desired
|
||||
.cursor
|
||||
.y
|
||||
.checked_sub(1)
|
||||
.is_some_and(|y| self.desired.line_datas[y].is_soft_wrapped)
|
||||
&& self.desired.cursor.y.checked_sub(1).is_some_and(|y| {
|
||||
self.desired.line_datas[y].is_soft_wrapped
|
||||
&& self.desired.line_datas[y]
|
||||
.color_at(self.desired.line_datas[y].len() - 1)
|
||||
.foreground
|
||||
== HighlightRole::autosuggestion
|
||||
})
|
||||
{
|
||||
1
|
||||
} else {
|
||||
|
||||
@@ -9,6 +9,7 @@ set -g isolated_tmux_fish_extra_args -C '
|
||||
|
||||
isolated-tmux-start
|
||||
|
||||
# Check that completions don't break from truncated autosuggestion
|
||||
isolated-tmux send-keys : Space Tab Tab
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p
|
||||
@@ -22,3 +23,19 @@ isolated-tmux capture-pane -p
|
||||
# CHECK: 7 141 275 409 543 677
|
||||
# CHECK: 8 142 276 410 544 678
|
||||
# CHECK: rows 1 to 8 of 134
|
||||
|
||||
# Check that completions don't break than called on empty line
|
||||
isolated-tmux send-keys C-u 'set fish_autosuggestion_enabled 0; function fish_prompt; string repeat (math $COLUMNS - 2) 0; end' Enter
|
||||
isolated-tmux send-keys C-l : Space Tab Tab
|
||||
tmux-sleep
|
||||
isolated-tmux capture-pane -p
|
||||
# CHECK: 000000000000000000000000000000000000000000000000000000000000000000000000000000:
|
||||
# CHECK:
|
||||
# CHECK: 1 135 269 403 537 671
|
||||
# CHECK: 2 136 270 404 538 672
|
||||
# CHECK: 3 137 271 405 539 673
|
||||
# CHECK: 4 138 272 406 540 674
|
||||
# CHECK: 5 139 273 407 541 675
|
||||
# CHECK: 6 140 274 408 542 676
|
||||
# CHECK: 7 141 275 409 543 677
|
||||
# CHECK: rows 1 to 7 of 134
|
||||
|
||||
Reference in New Issue
Block a user