Skip to content

Merge stack before printing - #9304

Merged
fdncred merged 7 commits into
nushell:mainfrom
zhiburt:patch-9264-3
May 30, 2023
Merged

fdncred merged 7 commits into
nushell:mainfrom
zhiburt:patch-9264-3

Conversation

@zhiburt

@zhiburt zhiburt commented May 27, 2023

Copy link
Copy Markdown
Contributor

Could you @fdncred try it?

close?: #9264

@fdncred

fdncred commented May 27, 2023 •

Copy link
Copy Markdown
Contributor

@zhiburt Doesn't seem to work. Here's my test.

  1. save preview-theme.nu from some theme items do not change colors when requested #9264 (comment)
  2. source preview-theme.nu
  3. cd nu_scripts
  4. preview and i randomly picked apprentice
  5. which then puts this on the command line use themes/themes/apprentice.nu; $env.config.color_config = (apprentice); preview_theme | table -e and hit enter
  6. I get this
    image
    Which you can tell it's not working because the header and row index (which are the same color) {fg: #87af87, attr: b} are not being drawn in that color. the green header and cyan index are from my current theme, before i use'd the one above.

If i run the command in 5 above again, i get this
image

One last comment here. After the first screenshot is shown with the preview_theme | table -e, if I do a ls, the theme is applied, even though the table that is drawn right after doesn't show it.
image

@fdncred

fdncred commented May 27, 2023

Copy link
Copy Markdown
Contributor

This is so strange. If I do the commands on separate lines, it seems to work.
image

@fdncred

fdncred commented May 27, 2023

Copy link
Copy Markdown
Contributor

It seems this may have something to do with how nushell is handling one-liners with multiple commands separated with semicolons? like all the stuff that is changing in this pr may not be happening on this type of one-liner?

zhiburt added 2 commits May 29, 2023 02:46
Signed-off-by: Maxim Zhiburt <[email protected]>
Signed-off-by: Maxim Zhiburt <[email protected]>
@zhiburt

zhiburt commented May 28, 2023

Copy link
Copy Markdown
Contributor Author

I think must be addressed.
I got lazy a bit here and just followed @kubouch suggestion for this case.

Let me know if it works.

@fdncred

fdncred commented May 29, 2023

Copy link
Copy Markdown
Contributor

wow, this is working great! still playing but just wow!!!

@fdncred

fdncred commented May 29, 2023

Copy link
Copy Markdown
Contributor

@zhiburt I'm ready to merge this but can we have more descriptive fn names for merge_env2 and merge_env3?

Signed-off-by: Maxim Zhiburt <[email protected]>
@fdncred

fdncred commented May 30, 2023

Copy link
Copy Markdown
Contributor

Thanks @zhiburt!

@fdncred
fdncred merged commit 7f758d3 into nushell:main May 30, 2023
@kubouch

kubouch commented May 30, 2023

Copy link
Copy Markdown
Contributor

I didn't have time to look into it yet but we shouldn't clone the EngineState before every print, that will be super slow.

@zhiburt

zhiburt commented May 30, 2023

Copy link
Copy Markdown
Contributor Author

Precisely clone will make it slower.
The same for table.

I am not sure to which degree though; you could test it.

Ideally the env shall be just merged somewhere in nu-engine/eval; but I haven't cracked this one.

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