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

Strange behaviour with key presses after using onKeyPressed or runUntilKeyPressed #116

Open
jack-darlington-at opened this issue May 24, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@jack-darlington-at
Copy link

Describe the bug
When using onKeyPressed if I try and launch vi in the same session, vi will no longer respond correctly to key presses

To Reproduce
Steps to reproduce the behavior:

  1. Code:
section {
        textLine("Wait for q")
    }.runUntilKeyPressed(Keys.Q)

platform.posix.system("vi test")
  1. Run the following, and try to use vi

Expected behavior
vi works as expected

Desktop (please complete the following information):

  • OS: macosxArm64
  • Version 1.1.2

Additional context
I think it may be related to this still consuming keys based on this comment:

// there's no reason for us to keep recreating it. It's pretty likely that if a session uses input in one block, it
// will use input again in others. (We can always revisit this decision later and scope this to a Section lifecycle
// instead)
private val KeyFlowKey = Session.Lifecycle.createKey<Flow<Key>>()```
@jack-darlington-at jack-darlington-at added the bug Something isn't working label May 24, 2024
@bitspittle
Copy link
Contributor

bitspittle commented Jun 11, 2024

Hey! Sorry I missed this bug until just now. It's been crazy over here as I was preparing for a talk (that I finally gave last Friday) and it just consumed all my time.

Would you be able to try wrapping your logic in a session? As in:

session {
   section {
        textLine("Wait for q")
    }.runUntilKeyPressed(Keys.Q)
}

platform.posix.system("vi test")

If that works for you, I could think about making that logic apply to a section scope instead. However, part of me feels that within a session, I really think that Kotter should be thought of as the main process in control of the keyboard. Trying to design a system that plays nice with external processes is probably not something that will scale, I worry.

Of course, if you can let me know your use-case and why you wouldn't want to exit a session before launching vi, please let me know. Also, it's possible that wrapping things in a session won't fix the issue! So let me know that as well if you can.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants