-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Restore terminal if hwatch
is killed
#78
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ilyagr
force-pushed
the
cleankill
branch
12 times, most recently
from
December 14, 2022 02:49
eaf8e30
to
7a79712
Compare
(Previous version of this was a bit too complicated and didn't work right on panics, so I simplified it a bit) |
The mouse events are not used in this commit
Mouse wheel always scrolls the main window by 2 lines. I think this might be preferable to scrolling different windows dependng on mouse position. (Also, the latter is harder to implement) Scrolling by 1 line feels too slow on my machine, thus scrolling by 2 lines.
Currently, if `hwatch` is running in one terminal and you run `killall hwatch` from another, the first terminal ends up with an invisible cursor. A workaround I found is to run `tput reset` in that terminal. This commit uses the [Ctrl-C crate] to make `hwatch` restore the terminal to a sane state even if it's killed or otherwise interrupted (within limits, `killall -9 hwatch` will not let `hwatch` do anything before being killed). [Ctrl-C crate]: https://crates.io/crates/ctrlc
blacknon
approved these changes
Dec 31, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's working!
Thanks!
Merged
blacknon
added a commit
that referenced
this pull request
Jan 4, 2023
Version 0.3.8. - Added a function to notify with a beep sound when updating result(add `-B` option) #22 - Added a function to execute the specified command when there is a change in the command output result(add `-A "command..."` option) - Added a function to switch to display only lines with differences by <kbd>Shift</kbd> + <kbd>O</kbd> when line/word diff. - Added option to hide header and history window(add `-t` option and <kbd>T</kbd> and <kbd>Backspace</kbd> key) #70 - Added an option to hide the message "Display help with h key" (add `--no-help-banner` option) #76 - Added a function that can be set by writing options in the environment variable "HWATCH" #76 - Mouse wheel support(add `--mouse` option) #77 - Changed to restore the terminal cleanly when killed #78 - Debug hwatch_log #64
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, if
hwatch
is running in one terminal andyou run
killall hwatch
from another, the first terminalends up with an invisible cursor.
Aside: A workaround I found when this problem occurs
is to run
tput reset
in that terminal.This commit uses the Ctrl-C crate to make
hwatch
restore the terminal to a sane state even if it's killed
or otherwise interrupted (within limits,
killall -9 hwatch
will not let
hwatch
do anything before being killed).This PR currently depends on and includes #77, but this is easy to change if desired.