Render Private Use Unicode symbols using two cells if the second cell contains a non-breaking space as well as a normal space

There is some software out there that uses nbsp as a separator,
presumably as some kind of hack.

https://github.com/ibhagwan/fzf-lua/issues/916
This commit is contained in:
Kovid Goyal 2023-10-24 17:38:49 +05:30
parent 539a8706dc
commit ce583ea460
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 7 additions and 4 deletions

View File

@ -76,6 +76,8 @@ Detailed list of changes
- When pasting, if the text contains terminal control codes ask the user for permission. See :opt:`paste_actions` for details. Thanks to David Leadbeater for discovering this.
- Render Private Use Unicode symbols using two cells if the second cell contains a non-breaking space as well as a normal space
0.30.1 [2023-10-05]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

View File

@ -19,9 +19,9 @@ use Unicode characters from the private use area to represent symbols. Often
these symbols are wide and should be rendered in two cells. However, since
private use area symbols all have their width set to one in the Unicode
standard, |kitty| renders them either smaller or truncated. The exception is if
these characters are followed by a space or empty cell in which case kitty
makes use of the extra cell to render them in two cells. This behavior can be
turned off for specific symbols using :opt:`narrow_symbols`.
these characters are followed by a space or non-breaking space in which case
kitty makes use of the extra cell to render them in two cells. This behavior
can be turned off for specific symbols using :opt:`narrow_symbols`.
Using a color theme with a background color does not work well in vim?

View File

@ -534,6 +534,7 @@ START_ALLOW_CASE_RANGE
switch(cpu_cell->ch) {
case 0:
case ' ':
case 0xa0: // nbsp
case '\t':
case IMAGE_PLACEHOLDER_CHAR:
return BLANK_FONT;
@ -1325,7 +1326,7 @@ render_line(FONTS_DATA_HANDLE fg_, Line *line, index_type lnum, Cursor *cursor,
unsigned int num_spaces = 0;
while (
i + num_spaces + 1 < line->xnum
&& line->cpu_cells[i+num_spaces+1].ch == ' '
&& (line->cpu_cells[i+num_spaces+1].ch == ' ' || line->cpu_cells[i+num_spaces+1].ch == 0xa0) // space or nbsp
&& num_spaces < MAX_NUM_EXTRA_GLYPHS_PUA
&& num_spaces + 1 < desired_cells
) {