Ticket #3640 (closed defect: fixed)
Subshell cursor position lost after window resizing
Reported by: | yurikhan | Owned by: | andrew_b |
---|---|---|---|
Priority: | major | Milestone: | 4.8.17 |
Component: | mc-tty | Version: | 4.8.15 |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master |
Description
To reproduce:
- Start xterm.
- Start tmux with default configuration:
(xterm)$ tmux -f /dev/null
- Start mc.
(tmux)$ mc
- Hide panels (Ctrl+O).
- Resize the xterm window.
- Note the cursor position.
- Switch panels on and off again (Ctrl+O Ctrl+O).
- Note the cursor position.
Expected behavior: cursor position is the same in steps 6 and 8.
Observed behavior: cursor moves to the top line.
Versions:
- Ubuntu 16.04
- tmux 2.1
- mc 4.8.15 compiled with libslang2 2.3.0
$ mc -V GNU Midnight Commander 4.8.15 Built with GLib 2.47.3 Using the S-Lang library with terminfo database With builtin Editor With subshell support as default With support for background operations With mouse support on xterm and Linux console With support for X11 events With internationalization support With multiple codepages support Virtual File Systems: cpiofs, tarfs, sfs, extfs, ext2undelfs, ftpfs, sftpfs, fish Data types: char: 8; int: 32; long: 64; void *: 64; size_t: 64; off_t: 64;
Attachments
Change History
comment:2 Changed 9 years ago by andrew_b
Insert the library-specific #ifdef into library-independent code is not good way. do_enter_ca_mode and do_exit_ca_mode should be reimplemented like other library-specific tty functions.
comment:3 follow-up: ↓ 4 Changed 9 years ago by yurikhan
I agree but I’d like for someone to confirm that this code is in fact needed in the ncurses build. If not, we could remove these two functions altogether.
comment:4 in reply to: ↑ 3 Changed 9 years ago by andrew_b
Replying to yurikhan:
I agree but I’d like for someone to confirm that this code is in fact needed in the ncurses build.
With ncurses (5.9 in my case) and without this code, cursor moves to the 1st column in the prompt line:
- Run mc
- Press ctrl-o to switch to subshell. Everything looks fine.
- Press ctrl-o to return to panels
- Press ctrl-o to switch to subshell again. Cursor is in the 1st column.
- And in all following switches to subshell cursor will be in the 1st column.
comment:5 Changed 9 years ago by yurikhan
Yes, I see that. The second time panels are hidden, there is no prompt.
Would it be okay to move the existing functions do_enter_ca_mode and do_exit_ca_mode into tty-ncurses.c, renaming them tty_enter_ca_mode and tty_exit_ca_mode, and provide empty implementations with the same names in tty-slang.c? Do I just delete calls to them from within tty-slang.c, or keep calls to known empty functions?
Changed 9 years ago by yurikhan
- Attachment 0001-Ticket-3640-Do-not-duplicate-alternate-screen-switch.patch added
comment:6 Changed 9 years ago by andrew_b
- Status changed from new to accepted
- Owner set to andrew_b
- Branch state changed from no branch to on review
- Milestone changed from Future Releases to 4.8.17
I split the patch in two commits.
Branch: 3640_subshell_cursor_position
Initial changeset:fb5d1317df39a7a2d27214990c79ea2f58f9556e
comment:7 Changed 9 years ago by yurikhan
Thanks. Please see also #3639 — it is related and arguably more severe than this one.
comment:8 Changed 9 years ago by zaytsev
- Votes for changeset set to zaytsev
- Branch state changed from on review to approved
comment:9 Changed 9 years ago by andrew_b
- Status changed from accepted to testing
- Votes for changeset changed from zaytsev to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
Merged to master: [7fd0f172ef8b1a6cca5f6162764198aa97c7a6ba].
git log --pretty=oneline c4a8882..7fd0f17
Cause:
So what happens, chronologically:
I propose that at least in the slang build the functions do_enter_ca_mode and do_exit_ca_mode should do nothing. A patch will follow shortly.