Closed JoshCheek closed 9 years ago
I'm afraid of the color choice not working well on all color schemes (light background, dark background, weird stuff like solarized). We could just use ack's choice (red), which is probably reasonable. But then someone is going to want to change it, and I'm not willing to support custom color configuration, which leads me back to "I don't want to do this"...
Some other changes on a branch made it easy to try this out, so I did:
I like it quite a bit. It certainly makes understanding the matching easier. Maybe I should get over the fear of colors not working. If it's good enough for ack, it's probably good enough for selecta. However, there may still be a nontrivial performance cost depending on what the algorithm ends up being, so we'll see.
For what it's worth, I implemented this a bit differently in Heatseeker: I've come to prefer the picking out of individual characters, because it can actually serve to highlight the non-matching portions of the strings, making it easier to see how matches are different. Here's another example:
I thought about doing that, but I'm almost positive that the allocations would kill performance. Welp!
I actually compute the scores a second time in order to render the matches. There's a separate scoring function that returns low-level details about matching character indices. And since there's a hard limit on the number of matches that will be displayed, the cost is essentially constant for each draw_screen
call.
Ahh, yeah, that crossed my mind as well, but I thought it would be gross to maintain. Maybe I'll make an attempt.
This is merged into master as of d874c99dd7f0f94225a95da06fc487b0fa5b9edc.
Favourite aspect of
ag
/ack
is how they colour the matched portion. Thoughts on adding this to selecta?