Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected author abbreviations when restoring from background #232

Closed
stuarthicks opened this issue Jan 24, 2014 · 7 comments
Closed

Unexpected author abbreviations when restoring from background #232

stuarthicks opened this issue Jan 24, 2014 · 7 comments
Labels
component:terminal Ncurses and terminal type:bug
Milestone

Comments

@stuarthicks
Copy link

Using tig 1.2.1 (Nov 22 2013) on OSX 10.8.5, iTerm 2 and zsh.

Steps.

  1. Launch tig
  2. Press Up arrow (message appears on screen to say you cannot move above the top row)
  3. Press ctrl-z to suspend tig
  4. Bring tig back to the foreground with fg
  5. Press Up arrow again

Expected: To see message on screen again about being at the top of the list.
Actual: Author field becomes abbreviated.

This can be repeated to un-abbreviate the author field. So I presume calling a toggleAuthorAbbreviation function somehow.

Also observed, immediately after restoring from background, I have to press the down arrow twice to go down. Are key mappings offset/incorrect in this state?

@jonas
Copy link
Owner

jonas commented Feb 19, 2014

Reproduced. Thanks.

@jonas
Copy link
Owner

jonas commented Mar 10, 2014

Looking at the ncurses code, it does try to flush the input buffer after returning from the suspended state.

https://github.com/gittup/ncurses/blob/gittup/ncurses/tty/lib_tstp.c#L215

@jonas jonas added the Bug label Mar 18, 2014
@igoralmeida
Copy link

I think a similar problem happens if you suspend $EDITOR while editing a commit message. Only tested with vim+bash:

  1. In the status view, have some changes ready and press C to start a commit
  2. Press control-z to suspend, shell shows up. Run fg to get vim back to foreground.
  3. Finish the commit message, save and quit. Commit output is shown, press enter and tig shows up again.
  4. Screen is not updated, it seems: keys pressed are just printed to the statusbar. I type q<CR> as many times as necessary to quit tig at this point.

@commonquail
Copy link

commonquail commented Jul 7, 2017

I can't reproduce @stuarthicks' issue on 4b0aba8 ("erase status line at exit time") but I traced @igoralmeida's issue to 83df6c3 ("Remove unneeded calls to {def,reset}_prog_mode"). It's consistently reproducible and it's not necessary write or save anything. Reverting that commit restores editor suspension capability, however, when eventually quitting tig the terminal screen doesn't clear like it normally does (and like top vs htop); same behaviour as in tig 2.0.1.

git bisect start
# good: [942ac254a9bf1c813a3a288452db83ee144bba49] tig-2.0.1
git bisect good 942ac254a9bf1c813a3a288452db83ee144bba49
# bad: [6222182b44e103872abb07417cb2f51b4fe28d97] tig-2.2.1
git bisect bad 6222182b44e103872abb07417cb2f51b4fe28d97
# good: [55307527b7bd5fa232544f8e536fb146a9909e8d] Fix segfault in the stage view when view->parent is NULL
git bisect good 55307527b7bd5fa232544f8e536fb146a9909e8d
# good: [c4249ce798a737a0c28cdc127d58763d832eb98f] Add utility to inject time when testing
git bisect good c4249ce798a737a0c28cdc127d58763d832eb98f
# bad: [ebd8a238266cdebb970ec8d77a3382963d437e09] Fix out-of-bound memory access in keybinding_matches
git bisect bad ebd8a238266cdebb970ec8d77a3382963d437e09
# bad: [198ce00c5978977e095aeaa3f21d7a5d2a24cf75] status: Update unstaged label in tests
git bisect bad 198ce00c5978977e095aeaa3f21d7a5d2a24cf75
# good: [956e1240500a10a222a4d3b989809eb7ad9e086e] Fix user command flag display regression
git bisect good 956e1240500a10a222a4d3b989809eb7ad9e086e
# bad: [8dc8d1a8d156189dd63fab83a64dcec9860f42f8] Merge pull request #457 from vivien/text-variable
git bisect bad 8dc8d1a8d156189dd63fab83a64dcec9860f42f8
# bad: [58ca811a5d63b93ab2007a5899f82e546cb24813] blame: allow user to specify rev arguments to blame
git bisect bad 58ca811a5d63b93ab2007a5899f82e546cb24813
# bad: [4951c2e50edae06dc20224c6ad1fe1eba0f46b44] Update OSX make config to find brew installed ncurses
git bisect bad 4951c2e50edae06dc20224c6ad1fe1eba0f46b44
# bad: [83df6c3a9931818a9727442484f0e232543fb8f6] Remove unneeded calls to {def,reset}_prog_mode
git bisect bad 83df6c3a9931818a9727442484f0e232543fb8f6
# first bad commit: [83df6c3a9931818a9727442484f0e232543fb8f6] Remove unneeded calls to {def,reset}_prog_mode

jonas added a commit that referenced this issue Jul 10, 2017
Clear the terminal before calling out to an external command so the
altscreen won't mess up any downstream subshell management. Restore
terminal settings as per init_display when restoring. Reproducible with
example from[0]:

 - Run `tig status`
 - Press 'e' to open Vim
 - Press Ctrl-Z to suspend Vim
 - Run `fg`
 - Quit Vim

 [0] #232 (comment)
jonas added a commit that referenced this issue Jul 10, 2017
Clear the terminal before calling out to an external command so the
altscreen won't mess up any downstream subshell management. Restore
terminal settings as per init_display when restoring. Reproducible with
example from[0]:

 - Run `tig status`
 - Press 'e' to open Vim
 - Press Ctrl-Z to suspend Vim
 - Run `fg`
 - Quit Vim

 [0] #232 (comment)

Refs: #232
@jonas
Copy link
Owner

jonas commented Jul 10, 2017

@commonquail Thanks for tracking down the commits. I reproduced @igoralmeida 's issue with the latest version and managed to come up with #657 to fix that.

jonas added a commit that referenced this issue Jul 14, 2017
Move the special case of Ctrl-Z introduced in
167d59e so no input is generated by
get_input.
@jonas
Copy link
Owner

jonas commented Jul 14, 2017

Helped by @rolandwalker 's work in #665 and 167d59e I believe I finally found a fix for the initial issue also.

@stuarthicks
Copy link
Author

@jonas @rolandwalker Thanks! 😄

@jonas jonas added this to the tig-2.3 milestone Jul 15, 2017
jonas added a commit that referenced this issue Jul 17, 2017
Clear the terminal before calling out to an external command so the
altscreen won't mess up any downstream subshell management. Restore
terminal settings as per init_display when restoring. Reproducible with
example from[0]:

 - Run `tig status`
 - Press 'e' to open Vim
 - Press Ctrl-Z to suspend Vim
 - Run `fg`
 - Quit Vim

 [0] #232 (comment)

Refs: #232
jonas added a commit that referenced this issue Sep 18, 2017
Clear the terminal before calling out to an external command so the
altscreen won't mess up any downstream subshell management. Restore
terminal settings as per init_display when restoring. Reproducible with
example from[0]:

 - Run `tig status`
 - Press 'e' to open Vim
 - Press Ctrl-Z to suspend Vim
 - Run `fg`
 - Quit Vim

 [0] #232 (comment)

Refs: #232
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:terminal Ncurses and terminal type:bug
Projects
None yet
Development

No branches or pull requests

4 participants