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

Add suspend for vty #1080

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

junjihashimoto
Copy link
Contributor

This PR adds suspend-function for vty.

@noughtmare
Copy link
Member

I think vty still doesn't handle the suspend signal properly, see #152 and jtdaugherty/vty#120. So I think this won't work properly.

@junjihashimoto
Copy link
Contributor Author

junjihashimoto commented May 28, 2018

In my environment, suspend and wake-up work.
After waking up, userForceRefresh is needed. I just type Control-L.
If we do not use this function, we always kill a editor to switch to a shell.
I hope jtdaugherty/vty properly supports suspend and wake-up.

@junjihashimoto
Copy link
Contributor Author

I tried userForceRefresh by sigCONT. See below.
But this code does not work.

suspend :: FrontendState -> IORef Editor -> IO ()
suspend fs editorRef = do
    void $ installHandler sigCONT (Catch $ void $ readIORef editorRef >>= refresh fs) Nothing
    raiseSignal sigSTOP

@junjihashimoto
Copy link
Contributor Author

I'll try setAttrs of vty after wake-up.

@simonmichael
Copy link

I hope jtdaugherty/vty properly supports suspend and wake-up.

+1, I wanted this today while using hledger-ui. Does this change need to be submitted as a PR to vty ?

@simonmichael
Copy link

simonmichael commented Jan 19, 2019

@junjihashimoto: FWIW I used your code in another project, and just calling vty's refresh after the suspend call (so it gets executed when resumed) works well for me. (The part I haven't figured out is resetting the terminal attributes when suspending.)

@junjihashimoto
Copy link
Contributor Author

Good, thx!
l'll try it.

@junjihashimoto
Copy link
Contributor Author

junjihashimoto commented Feb 4, 2019

@simonmichael
In my environment(ubuntu), calling vty's refresh works well, too.
Is suspendAndResume of jtdaugherty/vty#120 also doing the same thing?

@simonmichael
Copy link

@junjihashimoto sorry the details have slipped my memory, I will point to my solution recorded there and the source of suspendAndResume.

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

Successfully merging this pull request may close these issues.

3 participants