Make ScreenData track multiline prompt

Instead of pretending that prompt is always 1 line, track multiline
prompt in ScreenData.visible_prompt_lines and ScreenData.line_datas as
empty lines.

This enables:
- Trimming part of the prompt that leaves the viewport.
- Removing of the old hack needed for locating first prompt line.
- Fixing #11875.

Part of #11911
This commit is contained in:
kerty
2025-10-15 13:41:27 +03:00
committed by Johannes Altmanninger
parent 71b619bab0
commit 606802daaf
7 changed files with 163 additions and 121 deletions

View File

@@ -42,29 +42,40 @@ isolated-tmux capture-pane -p
isolated-tmux send-keys C-c
tmux-sleep
isolated-tmux send-keys C-l 'commandline -i ": \'$(seq $LINES)" A B "C\'"' Enter Enter
isolated-tmux send-keys C-l '
function fish_right_prompt
echo right-prompt
end
' 'commandline -i ": \'$(seq (math $LINES \* 2))\'"' Enter Enter
tmux-sleep
isolated-tmux capture-pane -p
isolated-tmux capture-pane -p -S -12
# CHECK: prompt 4> commandline -i ": '$(seq (math $LINES \* 2))'" right-prompt
# CHECK: prompt 5> : '1 right-prompt
# CHECK: 2
# CHECK: 3
# CHECK: 4
# CHECK: 5
# CHECK: 6
# CHECK: 7
# CHECK: 8
# CHECK: 9
# CHECK: 10
# CHECK: A
# CHECK: B
# CHECK: C'
# CHECK: prompt 5>
# CHECK: 11
# CHECK: 12
# CHECK: 13
# CHECK: 14
# CHECK: 15
# CHECK: 16
# CHECK: 17
# CHECK: 18
# CHECK: 19
# CHECK: 20'
# CHECK: prompt 6> right-prompt
# Soft-wrapped commandline with omitted right prompt.
isolated-tmux send-keys C-q '
function fish_right_prompt
echo right-prompt
end
commandline -i "echo $(printf %0"$COLUMNS"d)"
' Enter
isolated-tmux send-keys 'commandline -i "echo $(printf %0"$COLUMNS"d)"' Enter C-l Enter
tmux-sleep
isolated-tmux capture-pane -p | sed 1,5d
isolated-tmux capture-pane -p
# CHECK: prompt {{\d+}}> echo 00000000000000000000000000000000000000000000000000000000000000000
# CHECK: 000000000000000
# CHECK: 00000000000000000000000000000000000000000000000000000000000000000000000000000000