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

Refractor: group colors #802

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
Draft

Conversation

adaschma
Copy link
Contributor

In #800 (comment) @fdncred said:

we really need to make the colors configurable but that's not for this pr. It just looks a bit janky (not your fault).

image

This pull request groups the statically defined colors into a single record. This is the first step if we would want to support configurable colors at a later time. In addition it changes the fg color of selected text to black so there is a contrast to the bg color. This improves the readability and it looks nicer.

image

The colors of the menu and the highlighter have not been moved to the theme record. It is at least theoretically possible to have different menus and highlighters with different colors and I conservatively didn't want to ruin that.

@@ -97,22 +90,6 @@ pub trait Prompt: Send {
&self,
history_search: PromptHistorySearch,
) -> Cow<str>;
/// Get the default prompt color
fn get_prompt_color(&self) -> Color {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm just wondering if there's a way to do this without creating a breaking change. Removing these 4 functions will break everyone who's using reedline and making custom prompts, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't see a way to keep these functions.

These 4 functions have default implementations and are the current way to change the default colors of reedline. Looking at the reverse dependancies of reedline I picked a few to check if they have there own implementations ans so this would be a breaking change:

That don't:

That do:

Since changing the colors are already used by existing users, at the very least I would need to expose Theme record for diatom. If having a breaking change isn't a show stopper, I will add that.

Copy link
Collaborator

@fdncred fdncred Jul 6, 2024

Choose a reason for hiding this comment

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

of course, I'm most concerned about nushell with this change. I see you say that nu-cli doesn't break.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Glade this isn't a blocker. Added builder methods so diathom-cli (and other users) can still change the colors.

@fdncred
Copy link
Collaborator

fdncred commented Jun 23, 2024

I think this is cool and an interesting way to abstract the colors into a theme, but I worry about existing users as mentioned above. Also the "theme" name should probably be less generic.

@adaschma
Copy link
Contributor Author

I thought Theme was in line with Prompt. What would you prefer? ReedlineTheme or ColorTheme? I don't have strong opinions about the name and am open to change it.

missing use Prompt
@fdncred
Copy link
Collaborator

fdncred commented Jun 23, 2024

Maybe ReedlineTheme. I'm just thinking that everyone calls their theme things "Theme". When we're in nushell, I don't want to be confused about which theme we're talking about.

@fdncred
Copy link
Collaborator

fdncred commented Jul 6, 2024

Looks like there are some conflicts to resolve.

@adaschma
Copy link
Contributor Author

adaschma commented Jul 7, 2024

Looks like there are some conflicts to resolve.

Fixed.

@fdncred
Copy link
Collaborator

fdncred commented Jul 7, 2024

Thanks. Are you up for adding a PR to nushell with config settings in order to give this a thorough test?

@fdncred
Copy link
Collaborator

fdncred commented Jul 16, 2024

ping @adamschmalhofer

@adaschma
Copy link
Contributor Author

adaschma commented Jul 16, 2024 via email

@fdncred
Copy link
Collaborator

fdncred commented Jul 16, 2024

ok, i don't want to land this and then be stuck in a place where someone else has to implement something in nushell without fully understanding these changes. so we can wait on landing this until you're ready to land its counterpart in nushell. Thanks for pitching in!

@adaschma
Copy link
Contributor Author

ok, i don't want to land this and then be stuck in a place where someone else has to implement something in nushell without fully understanding these changes. so we can wait on landing this until you're ready to land its counterpart in nushell. Thanks for pitching in!

Well, if changes would be need to be done in nushell for this pull request, I would do them. Most projects that I know of (including myself) prefer small incremental changes rather than a large "dump". This reduces the problem of merge conflicts and helps the code reviews stay focused.

Does a pull request need a visible user facing feature in nushell to be considered? Or is the problem that it isn't properly tested, because nushell doesn't change the colors? In that case would a pull request for diatom-cli be sufficient? I'm just a bit confused and would like to know for this and future pull requests.

@fdncred
Copy link
Collaborator

fdncred commented Jul 17, 2024

Thanks for responding. I'm hyped about this PR. Here is my thinking/reasoning:

  1. we want this change in nushell because it's helpful to people. i.e. we don't like how it's working today in nushell.
  2. it's good to have code and tests in reedline but for a feature like this, we really need a test case that we can dogfood for a while. that's why i'm pushing for a pr in nushell as a counterpart to this pr.
  3. we 100% agree that we like bite-sized-prs too.
  4. does it "need" to be a visible facing feature in nushell just to be considered? hmm, thinking through this, maybe/probably? there are some prs that we allow and just land, but with things like ui features, we like to dogfood for a while. i assume your code works and i've tested it in reedline but i don't feel like that's a real use case. we feel that it needs to be in someone's daily driver so we can be sure it delivers on its promise. there are always so many edge cases to consider.

does all that help understand my position?

@adaschma
Copy link
Contributor Author

Thanks for taking the time to elaborate. I think to part where we disagree is where we cut the line on what counts as ui features. I wouldn't count these changes as that, as it really just groups the code differently which is an important step on supporting themes, but IMHO not a ui change itself. I would also argue that even a limited testing by merging is better than no testing until it is a larger change. We don't need to agree, I can accept that answer as is. Often there isn't really an objective place to draw a line, but it has to be done nonetheless.

How would you like to continue? Should I ping you here when each additional step is completed or would you prefer to only get an update when the reedline part is done? Or even only once the reedline and nushell parts are completed?

@fdncred
Copy link
Collaborator

fdncred commented Jul 17, 2024

Maybe start with a todo list and ping me on each item? I'm up for whatever is the easiest usually.

@fdncred fdncred marked this pull request as draft August 5, 2024 11:52
@fdncred
Copy link
Collaborator

fdncred commented Sep 6, 2024

@adaschma are you still in on this? i was testing this PR and don't see any problems right now.

@adaschma
Copy link
Contributor Author

Hi @fdncred I haven't worked on this since. I had started some work started on the vi-mode, but even that I stopped working on about two months ago. I had some urgent life todos and I haven't been in the right head space for programming on reedline, since. I have started some other work, that I plan on finishing next week before giving reedline my full attention again. I still think it can be merged as is.

@fdncred
Copy link
Collaborator

fdncred commented Sep 15, 2024

Sounds like a fine plan. Hope all is well on your urgent life todos. Glad to have you around.

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.

2 participants