Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:18
erlang
0500-ssh-Fix-cli-problems-at-line-end.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0500-ssh-Fix-cli-problems-at-line-end.patch of Package erlang
From 1891b32adb8fabfd45a57af55c4cb14959a536eb Mon Sep 17 00:00:00 2001 From: Hans Nilsson <hans@erlang.org> Date: Tue, 15 Oct 2019 15:22:15 +0200 Subject: [PATCH] ssh: Fix cli problems at line end Was a bug when one 1) wrote a few chars, 2) moved back and inserted more chars until the last chars should flow into the next line The cursor then jumped one line above what one expects --- lib/ssh/src/ssh_cli.erl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/ssh/src/ssh_cli.erl b/lib/ssh/src/ssh_cli.erl index c386806cb5..7f04fcb804 100644 --- a/lib/ssh/src/ssh_cli.erl +++ b/lib/ssh/src/ssh_cli.erl @@ -366,7 +366,7 @@ insert_chars([], {Buf, BufTail, Col}, _Tty) -> insert_chars(Chars, {Buf, BufTail, Col}, Tty) -> {NewBuf, _NewBufTail, WriteBuf, NewCol} = conv_buf(Chars, Buf, [], [], Col), - M = move_cursor(NewCol + length(BufTail), NewCol, Tty), + M = move_cursor(special_at_width(NewCol+length(BufTail), Tty), NewCol, Tty), {[WriteBuf, BufTail | M], {NewBuf, BufTail, NewCol}}. %%% delete characters at current position, (backwards if negative argument) @@ -381,7 +381,7 @@ delete_chars(N, {Buf, BufTail, Col}, Tty) -> % N < 0 NewBuf = nthtail(-N, Buf), NewCol = case Col + N of V when V >= 0 -> V; _ -> 0 end, M1 = move_cursor(Col, NewCol, Tty), - M2 = move_cursor(NewCol + length(BufTail) - N, NewCol, Tty), + M2 = move_cursor(special_at_width(NewCol+length(BufTail)-N, Tty), NewCol, Tty), {[M1, BufTail, lists:duplicate(-N, $ ) | M2], {NewBuf, BufTail, NewCol}}. @@ -438,6 +438,10 @@ move_cursor(From, To, #ssh_pty{width=Width, term=Type}) -> end, [Tcol | Trow]. +%%% Caution for line "breaks" +special_at_width(From0, #ssh_pty{width=Width}) when (From0 rem Width) == 0 -> From0 - 1; +special_at_width(From0, _) -> From0. + %% %%% write out characters %% %%% make sure that there is data to send %% %%% before calling ssh_connection:send -- 2.16.4
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