Skip to content

Add suspend for vty#1080

Open
junjihashimoto wants to merge 1 commit into
yi-editor:masterfrom
junjihashimoto:feature/suspend
Open

Add suspend for vty#1080
junjihashimoto wants to merge 1 commit into
yi-editor:masterfrom
junjihashimoto:feature/suspend

Conversation

@junjihashimoto

Copy link
Copy Markdown
Contributor

This PR adds suspend-function for vty.

@noughtmare

Copy link
Copy Markdown
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

junjihashimoto commented May 28, 2018

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@simonmichael

Copy link
Copy Markdown

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

simonmichael commented Jan 19, 2019

Copy link
Copy Markdown

@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
Copy Markdown
Contributor Author

Good, thx!
l'll try it.

@junjihashimoto

junjihashimoto commented Feb 4, 2019

Copy link
Copy Markdown
Contributor Author

@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
Copy Markdown

@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