Skip to content

Commit 1843f84

Browse files
yosuke-wolfsslejohnstown
authored andcommitted
Fix cursor mode handling
1 parent 788ab6d commit 1843f84

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/wolfterm.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,12 @@ static int wolfSSH_DoControlSeq(WOLFSSH* ssh, WOLFSSH_HANDLE handle, byte* buf,
467467
switch (c) {
468468
case 'H': /* move cursor to indicated row and column -1 to account
469469
* for 1,1 on linux vs 0,0 on windows */
470-
wolfSSH_CursorMove(handle, args[1] - OFST, args[0] - OFST, 1);
470+
{
471+
word32 row = (args[0] > 0) ? args[0] : 1;
472+
word32 col = (args[1] > 0) ? args[1] : 1;
473+
wolfSSH_CursorMove(handle, col - OFST, row - OFST, 1);
471474
break;
475+
}
472476

473477
case 'C': /* move cursor right */
474478
wolfSSH_CursorMove(handle, args[0], 0, 0);

0 commit comments

Comments
 (0)