Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:26
erlang
2622-kernel-Fix-shell_update_window-test.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2622-kernel-Fix-shell_update_window-test.patch of Package erlang
From 6505378800a15ad59eb8e6b50c2590b8f7f8fbc5 Mon Sep 17 00:00:00 2001 From: Lukas Larsson <lukas@erlang.org> Date: Tue, 19 Dec 2023 14:42:32 +0100 Subject: [PATCH 02/11] kernel: Fix shell_update_window test The test broke with the addition of the shell expand pager. The reason it broke is because we now redraw the prompt on backspace, which means that the cursor will be repositioned to the correct place. --- lib/kernel/test/interactive_shell_SUITE.erl | 38 +++++++++++++++------ 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/lib/kernel/test/interactive_shell_SUITE.erl b/lib/kernel/test/interactive_shell_SUITE.erl index 4a7a303656..4720917a15 100644 --- a/lib/kernel/test/interactive_shell_SUITE.erl +++ b/lib/kernel/test/interactive_shell_SUITE.erl @@ -953,12 +953,26 @@ shell_update_window(Config) -> send_tty(Term,"a"), check_location(Term, {0, -Col}), send_tty(Term,"BSpace"), + check_location(Term, {-1, width(Text)}), tmux(["resize-window -t ",tty_name(Term)," -x ",width(Text)+Col]), - %% xnfix bug! at least in tmux... seems to work in iTerm as it does not - %% need xnfix when resizing - check_location(Term, {0, -Col}), + %% When resizing, tmux does not xnfix the cursor, so it will remain + %% at the previous locations + check_location(Term, {-1, width(Text)}), + send_tty(Term,"a"), + check_location(Term, {0, -Col + 1}), + + %% When we do backspace here, tmux seems to place the cursor in an + %% incorrect position except when a terminal is attached. + send_tty(Term,"BSpace"), + %% This really should be {0, -Col}, but sometimes tmux sets it to + %% {-1, width(Text)} instead. + check_location(Term, [{0, -Col}, {-1, width(Text)}]), + tmux(["resize-window -t ",tty_name(Term)," -x ",width(Text) div 2 + Col]), - check_location(Term, {0, -Col + width(Text) div 2}), + %% Depending on what happened with the cursor above, the line will be + %% different here. + check_location(Term, [{0, -Col + width(Text) div 2}, + {-1, -Col + width(Text) div 2}]), ok after stop_tty(Term) @@ -1823,17 +1837,21 @@ send_stdin(Term, Chars) -> check_location(Term, Where) -> check_location(Term, Where, 5). +check_location(Term, Where, Attempt) when is_tuple(Where) -> + check_location(Term, [Where], Attempt); check_location(#tmux{ orig_location = {OrigRow, OrigCol} = Orig } = Term, - {AdjRow, AdjCol} = Where, Attempt) -> + Where, Attempt) -> NewLocation = get_location(Term), - case {OrigRow+AdjRow,OrigCol+AdjCol} of - NewLocation -> NewLocation; - _ when Attempt =:= 0 -> + case lists:any(fun({AdjRow, AdjCol}) -> + {OrigRow+AdjRow,OrigCol+AdjCol} =:= NewLocation + end, Where) of + true -> NewLocation; + false when Attempt =:= 0 -> {NewRow, NewCol} = NewLocation, - ct:fail({wrong_location, {expected,{AdjRow, AdjCol}}, + ct:fail({wrong_location, {expected,Where}, {got,{NewRow - OrigRow, NewCol - OrigCol}, {NewLocation, Orig}}}); - _ -> + false -> timer:sleep(50), check_location(Term, Where, Attempt -1) end. -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor