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

[freqtbl-] Default disp_histogram to U+25A0 BLACK SQUARE (■) #1949

Merged
merged 2 commits into from
Jul 6, 2023

Conversation

daviewales
Copy link
Contributor

@daviewales daviewales commented Jul 5, 2023

See discussion here:
#1807 (reply in thread)

Copying my comment from the discussion above below:

So there I was, innocently reading through the Notcurses book, when I encountered the following paragraph in section 7.6 Stupid Unicode Tricks:

Those readers who remember Code Page 437 might recall 0xFD, a “middle half block”. Given a constant
background, this can be used with the other two half blocks to increase “vertical resolution” by a factor of 3
(imagine a tank drawn with upper, middle, and lower half blocks moving on a monochromatic background).
Well, that character was actually “Solid Square/Histogram/Square Bullet” in the CP437 definitions[31], and
lives on as U+25A0 BLACK SQUARE (■). Despite its name, it will take on the foreground color.

I was already thinking of the visidata histogram, and when I read the words "middle half block", I had to try it.
Here is the result:

Before:
Screen Shot 2023-07-05 at 10 56 58 pm

After:
Screen Shot 2023-07-05 at 10 29 29 pm

It's not perfect, because the block is not quite in the vertical middle, and there's a small gap between each character.
But I think it's pretty close to the best we can get for default visidata, because there's vertical space both above and below which avoids problems with the reverse video line highlight.
And it's a solid improvement over *.

@saulpw, would you consider making this the default character for options.disp_histogram?
(Bonus points if we can squeeze it into 2.11.1!)

@saulpw
Copy link
Owner

saulpw commented Jul 6, 2023

I like it!! Nice find. Please add the old * to the ascii8 theme and then I think it's reasonable to take it for 2.11.1.
https://github.com/saulpw/visidata/blob/develop/visidata/themes/ascii8.py

@anjakefala anjakefala merged commit 7ddee16 into saulpw:develop Jul 6, 2023
12 checks passed
@daviewales daviewales deleted the disp-histogram-symbol branch July 6, 2023 06:12
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