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

Terminal output display missing after quitting IRust #36

Closed
tobz1000 opened this issue Jul 11, 2019 · 6 comments
Closed

Terminal output display missing after quitting IRust #36

tobz1000 opened this issue Jul 11, 2019 · 6 comments

Comments

@tobz1000
Copy link

tobz1000 commented Jul 11, 2019

Issue experienced with Bash 4.4.9 and the following terminal emulators:

  • LXTerminal 0.3.1
  • Guake 3.0.5
  • xterm 330

To reproduce:

  1. Start irust
  2. Close with ctrl-d or ctrl-c
  3. Start typing in parent shell

My typed command does not display in the terminal. If I press enter, the command output is displayed; however, line breaks do not return to the start of the line.

Here is a correctly-displayed ls:
2019-07-11-124428_736x468_scrot

Here is the result of ls after closing IRust:
2019-07-11-124457_736x449_scrot

@tobz1000 tobz1000 changed the title Terminal output display missing Terminal output display missing after quitting IRust Jul 11, 2019
@pzmarzly
Copy link
Contributor

At first I thought it may be a bug in crossterm::Terminal::exit() but it's just a wrapper for std::process::exit(0). Could you try running:

irust && stty sane
irust && tput clear
irust && tput reset

Hopefully at least 1 of these commands should help, and knowing which one does should help sigmaSd fix the issue.

@tobz1000
Copy link
Author

Thanks! stty sane and tput reset fix the issue (only one is needed). tput clear doesn't make any difference. Hopefully that helps with a diagnosis...

Let me know if you'd like any more testing.

@sigmaSd
Copy link
Owner

sigmaSd commented Jul 11, 2019

Hi @tobz1000 @pzmarzly, I should hopefully have time to look into it tomorrow,
thx for helping @pzmarzly!

@sigmaSd
Copy link
Owner

sigmaSd commented Jul 12, 2019

@tobz1000 can you try 5fe3a57
Its weird that this fixes it, since terminal.exit() does the same thing, I'll probably dig deeper
Edit: Nvm I imagined that terminal.exit() stops the raw mode, guess it doesn't, now everything make sense^^

@tobz1000
Copy link
Author

tobz1000 commented Jul 12, 2019

Yep - the patch fixes it, thanks!

Yeah, Terminal::exit is a bit of weird one, pretty much a re-export of sys::exit. But I guess since Terminal doesn't own/know about any RawScreen, it doesn't try to guess the current or previous terminal state.

It seems like it would be cleaner to break out of the control loop and let IRust::run return instead, and relying the RawScreen's Drop implementation to do this instead, but that would require some refactoring.

@sigmaSd
Copy link
Owner

sigmaSd commented Jul 13, 2019

@tobz1000 I like your idea! I'll keep it in mind for now

@sigmaSd sigmaSd closed this as completed Jul 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants