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

Elision with escape seq #1494

Closed
wants to merge 2 commits into from

Conversation

mathstuf
Copy link
Contributor

@mathstuf mathstuf commented Nov 13, 2018

Fixes #713.


Cc: @jhasse

@mathstuf mathstuf mentioned this pull request Nov 13, 2018
@jhasse
Copy link
Collaborator

jhasse commented Nov 14, 2018

Fixes #713.

@mathstuf mathstuf force-pushed the elision-with-escape-seq branch 2 times, most recently from 3b85c01 to bb5782e Compare November 14, 2018 14:55

TEST(ElideMiddle, ElideMiddleWithEscape) {
string input = "0\33[m1234567890123456789";
EXPECT_EQ("0\33[m123...\33[m789", ElideMiddle(input, 10));
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens when the ANSI escape is inside the elided part?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All ANSI escapes are always output.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hence the duplicate \33[m part on the second half.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hm ... why duplicate it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It grabs the escape sequences from the elided part. I haven't dug into the issue I'm seeing here yet, but fixing it will probably make doing it better easier.

This will be reused in order to do proper elision with ANSI sequences.
@mathstuf mathstuf force-pushed the elision-with-escape-seq branch from bb5782e to 9580168 Compare November 14, 2018 18:08
@mathstuf
Copy link
Contributor Author

I'm seeing some issues with this when using it on projects locally. Will debug and figure out what's missing and add a testcase for it.

@jhasse
Copy link
Collaborator

jhasse commented Aug 2, 2019

What do you think about #1600?

@jhasse jhasse removed this from the 1.10.0 milestone Aug 2, 2019
@mathstuf
Copy link
Contributor Author

mathstuf commented Aug 2, 2019

Sure, that offers another frontend to be able to do what I want, but the thing is that today elision logic in ninja itself is broken with color (though this is also related to #1584). If #1600 is accepted, should color just be outright rejected from NINJA_STATUS? Or is it "basic" enough that having the support is worthwhile to to require some other frontend for color?

@jhasse
Copy link
Collaborator

jhasse commented Aug 2, 2019

Good questions. We probably should also fix this in Ninja itself.

Btw: Did you have a look at my take on ANSI-aware elide_middle (in Python though)? https://github.com/jhasse/ja/blob/da264576a85d4d8b1de4517487bfe501b6337915/ja/native.py#L258

@mathstuf
Copy link
Contributor Author

mathstuf commented Aug 2, 2019

Yes, I had looked at it. I started the code from my old %0-based algorithm though. I should probably just try and redo this code from scratch (using that as a template) rather than trying to adapt the older logic which wasn't span-based.

@jhasse
Copy link
Collaborator

jhasse commented Aug 2, 2019

Or consider using my frontend, comes with other awesome features, too ;)

@jhasse
Copy link
Collaborator

jhasse commented Apr 27, 2024

I had another go at it in #2428.

@mathstuf mathstuf closed this May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support color in NINJA_STATUS
2 participants