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 more robust method to retrieve config JSON from the terminal #16

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

stereokai
Copy link

@timolins
This fixes Hyperlayout simply printing out config for me and gets Hyperlayout to work on Windows. 😄

Copy link
Owner

@timolins timolins left a 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
Copy link
Owner

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.

Copy link
Author

@stereokai stereokai Dec 14, 2016

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.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@timolins
Copy link
Owner

Awesome! Would be cool if you changed the variables from snake_case to camelCase to obey the linter. 🐫

@timolins
Copy link
Owner

Thanks 🙏

@stereokai
Copy link
Author

Green light

@timolins
Copy link
Owner

This might sound weird, but your pull request basically killed my Hyper.app. 😅
crash

@stereokai
Copy link
Author

:(

Maybe try to disable one or more of the regexes I introduced to discover the culprit?

@stereokai
Copy link
Author

@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?

@stereokai
Copy link
Author

@timolins still there? :)

@timolins
Copy link
Owner

timolins commented Dec 19, 2016

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.

@timolins
Copy link
Owner

And no, my command prompt doesn't print anything before it's ready for input.

@stereokai
Copy link
Author

@timolins Did you try to disable one or more of the regexes I introduced to discover the culprit like I suggested? :)

@colinbate
Copy link

This code killed my Hyper too. It is the configMatcher which does it.

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.

@colinbate
Copy link

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?

@timolins
Copy link
Owner

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! 🙂

@colinbate
Copy link

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?

@iamstarkov
Copy link

this fix seems to solve problems on windows

@philoserf
Copy link

I see the project has drifted from the pull request.

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.

5 participants