-
Notifications
You must be signed in to change notification settings - Fork 20
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 more robust method to retrieve config JSON from the terminal #16
base: master
Are you sure you want to change the base?
Conversation
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.
great job! Will test this out as soon as I can.
@@ -154,12 +154,19 @@ exports.middleware = store => next => action => { | |||
const {type, data} = action | |||
const {sessions} = store.getState() | |||
const {activeUid} = sessions | |||
// Remove ANSI escape code sequences. Visualization: https://goo.gl/IY8vuU | |||
const ANSI_escape_codes = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/gm |
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.
These constants won't change, so they shouldn't be defined inside the middleware.
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.
That's true. I'll update.
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.
Done.
Awesome! Would be cool if you changed the variables from snake_case to camelCase to obey the linter. 🐫 |
Thanks 🙏 |
Green light |
:( Maybe try to disable one or more of the regexes I introduced to discover the culprit? |
@timolins I had the same problem with PowerShell in my machine. (I tried with 3 different shells, including cmd and native Bash). The problem with PowerShell was that it was printing a security error to the terminal immediately after it was loaded - and it threw hyperlayout into a loop or a freeze somehow. Just to be more clear - that error text was being printed to the terminal before PowerShell's command prompt was visible and ready to receive commands. That error was not related to Hyper, and would happen even if I opened PowerShell independently. The moment I fixed the error, (read: removed the content that was being printed before the command prompt was available in the terminal) the freeze was gone. Does your terminal print some things before the command prompt is ready for input? |
@timolins still there? :) |
Awesome, thank you! Don't know how I missed this... Will check this out soon! Edit: Oh wait, I mixed something up here. For some reason I thought you fixed that issue. |
And no, my command prompt doesn't print anything before it's ready for input. |
@timolins Did you try to disable one or more of the regexes I introduced to discover the culprit like I suggested? :) |
This code killed my Hyper too. It is the I've been wrestling with getting hyperlayout to work at all on Windows 7. The addition of the ANSI codes and line breaks isn't a simple one to solve. For example, my config was broken onto three lines, the first line break being inserted instead of a space within a command string. The second was inserted mid-string. If I replace the newlines with an empty string, I break that first command. |
If I change the size of my Hyper window, then the line breaks go elsewhere and can be removed more safely. Is this really the best way to communicate between the command and the plugin? |
I'm open for suggestions. While developing hyperlayout, I tried a few different approaches, but the current implementation was the best one I came up with. Of course this doesn't mean that there isn't a better one. Feel free to come up with a new solution! 🙂 |
Fair enough. At the moment I feel frustrated by the lack of documentation around the Hyper APIs. :) I don't think the issue is with hyperlayout per se. Would it be possible for the plugin to do some of the work the command does? Reading the config files? |
this fix seems to solve problems on windows |
I see the project has drifted from the pull request. |
@timolins
This fixes Hyperlayout simply printing out config for me and gets Hyperlayout to work on Windows. 😄