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

Fix pasting unicode into terminal sometimes not working #492

Merged
merged 3 commits into from
Jun 23, 2020

Conversation

Nokel81
Copy link
Collaborator

@Nokel81 Nokel81 commented Jun 17, 2020

  • add LANG env with UTF-8 specified
  • When Lens is run (especially on macos) the LANG env var was not being picked up (even by shell-env) which for some reason broke pasting utf-8 unicode into the terminal emulator.

Fixes #351

Signed-off-by: Sebastian Malton smalton@mirantis.com

@Nokel81 Nokel81 added the bug Something isn't working label Jun 17, 2020
@Nokel81 Nokel81 requested a review from a team June 17, 2020 19:34
@Nokel81 Nokel81 self-assigned this Jun 17, 2020
@Nokel81
Copy link
Collaborator Author

Nokel81 commented Jun 17, 2020

I think that this could also be classified as a bug in shell-env, so should I register a bug over there?

Signed-off-by: Sebastian Malton <smalton@mirantis.com>
@jakolehm
Copy link
Contributor

I think that this could also be classified as a bug in shell-env, so should I register a bug over there?

Yes, makes sense.


// Overwrite PATH on darwin
if (process.env.NODE_ENV === "production" && process.platform === "darwin") {
process.env["PATH"] = env.PATH
}

let key = null
for(key in env) {
if(!env.hasOwnProperty(key) || process.env[key]) continue // skip existing and prototype keys
Copy link
Contributor

Choose a reason for hiding this comment

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

@kke do you remember why did we have this check?

Copy link

Choose a reason for hiding this comment

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

Yes. The loop will go through all of the JS prototype object's functions and what ever without that. This check will limit the loop to only go through the actual user defined attributes.

And the || process.env[key] is to avoid overwriting.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we want to explicitly overwrite LANG here. Maybe it could be done similar way as PATH?

Copy link

Choose a reason for hiding this comment

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

Maybe. But it could also have been done stupidly orginally :)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Given this fiddle: https://jsfiddle.net/2v3pdbqL/

I think that I should have put ...env first because JS overwrites the first's fields when joining.

@nevalla nevalla added this to the 3.5.1 milestone Jun 22, 2020
Sebastian Malton added 2 commits June 22, 2020 11:23
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
Signed-off-by: Sebastian Malton <smalton@mirantis.com>
Copy link
Contributor

@nevalla nevalla left a comment

Choose a reason for hiding this comment

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

LGTM

@Nokel81 Nokel81 merged commit f620b31 into lensapp:master Jun 23, 2020
nevalla pushed a commit that referenced this pull request Jun 24, 2020
* add LANG env with UTF-8 specified

* fix precedence of union of env objects

Signed-off-by: Sebastian Malton <smalton@mirantis.com>

Co-authored-by: Sebastian Malton <smalton@mirantis.com>
This was referenced Jun 24, 2020
@jakolehm jakolehm mentioned this pull request Jul 1, 2020
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

Successfully merging this pull request may close these issues.

Terminal does not like Unicode strings with kube_ps1
4 participants