This reduces the memory cost of reflowing text, as we no longer needs
to hold both the old and the new grid, in their entirety, in memory at
the same time.
We’re going to write to it immediately anyway. In most cases, *all*
newly allocated, and zero-initialized, cells are overwritten.
So let’s skip the zero-initialization of the new cells.
There are two cases where we need to explicitly clear cells now:
* When inserting a hard line break - erase the remaining cells
* When done, the *last* row may not have been completely written -
erase the remaining cells
We only needed term->font_scale to be able to detect scaling factor
changes (term->font_scale != term->scale).
But, we already have the old scaling factor in all places where
term_font_dpi_changed() is called, so let’s pass the old scaling
factor as an argument instead.
get_font_scale() was used to get the new scaling factor when loading
fonts. This was then compared to the last seen font scaling factor. If
there was no difference, the fonts were not reloaded.
The problem was, the initial term->scale was set differently. This
sometimes led to term->scale=2, while get_font_scale() return 1. That
meant, fonts were initially scaled by 2 (when dpi-aware=no). Later,
when mapped on an output (and thus term->scale being set to 1), the
fonts weren’t reloaded with the correct scaling factor since the
cached term->font_scale value was already 1.
Since term->scale always reflects the *new* scaling factor when
term_font_dpi_changed() is called, use that directly, and remove
get_font_scale().
Also rename the following functions:
* font_should_size_by_dpi() -> font_size_by_dpi_for_scale()
* font_size_by_dpi() -> font_sized_by_dpi()
* font_size_by_scale() -> font_sized_by_scale()
If the image was accompanied with a “Set Raster Attributes” (SRA)
command, make sure we *never* shrink the image below the size
specified in the SRA.
Images are normally shrunk when their bottom rows are fully
transparent. This enables sixels that aren’t a multiple of 6 to be
emitted, without also emitting an SRA command.
But if there *is* an SRA command, obey it.
Verified against XTerm-367
The row numbers in the tracking points are in absolute
numbers. However, when we walk the old grid, we do so starting in the
beginning of the scrollback history.
We must ensure the tracking points are sorted such that the *first*
one we see is the “oldest” one. I.e. the one furthest back in the
scrollback history.
Instead of iterating a linked list of tracking points, for *each and
every* cell in the old grid, use a sorted array.
This allows us to step through the array of tracking points as we walk
the old grid; each time we match a tracking point, we move to the next
one.
This means we only have to check a single tracking point for each cell.
Calling wcwidth() on every character in the entire scrollback history
is slow.
We already have the character width encoded in the grid; it’s in the
CELL_SPACERs following a multi-column character.
Thus, when we see a non-SPACER character, that isn’t in the last
column, peek the next character. If it’s a SPACER, get the current
characters width from it.
The only thing we need the width for, is to be able to print padding
SPACERS in the right margin, if the there isn’t enough space on the
current row for the current character.
Instead of using CELL_SPACER for *all* cells that previously used
CELL_MULT_COL_SPACER, include the remaining number of spacers
following, and including, itself. This is encoded by adding to the
CELL_SPACER value.
So, a double width character will now store the character itself in
the first cell (just like before), and CELL_SPACER+1 in the second
cell.
A three-cell character would store the character itself, then
CELL_SPACER+2, and finally CELL_SPACER+1.
In other words, the last spacer is always CELL_SPACER+1.
CELL_SPACER+0 is used when padding at the right margin. I.e. when
writing e.g. a double width character in the last column, we insert a
CELL_SPACER+0 pad character, and then write the double width character
in the first column on the next row.
Only enable XDG activation when compiling against wayland-protocols
1.21. Older versions don’t have this protocol.
When available, define HAVE_XDG_ACTIVATION.
Make all usages of xdg_activation_v1 and xdg_activation_token_v1
conditional.
While skimming this doc, I noticed that "-Dterminfo" wasn't rendering
properly as it was lacking its closing backquote.
While at it, tweak the Arch wiki link, as it redirects to replace
/index.php with /title.
In some cases, the underline position (typically provided by the font,
mind you), end up below the cell, making it visible.
Note that below the cell here means below the line. I.e. the font
provided underline position is below the font provided line height...
Oh well.
Doing this in foot rather than fcft, since other applications
typically don’t have to clip the rendered text.
Closes#503
Older version of Plasma/KWin had an issue where buffer damage recorded
before the buffer was attached were ignored. This appears to have been
fixed now.