Tab is one of the keys included in our "otherModifierKeys"
implementation. However, since the key sym falls outside the checks
required to trigger it, special case it and implement its sequences as
a table.
Backspace now emits DEL for all non-ctrl modifier combos, and BS for
all ctrl modifier combos.
The alt modifier prefixes DEL/BS with ESC.
This also removes my own hack of mapping ctrl+backspace to
alt+backspace.
Describe backspace behavior in both the README and the man page.
TODO: implement DECBKM to allow applications to toggle the backspace
behavior.
This function reloads the font *if* the DPI has changed. To handle
user run-time adjusted font sizes, we record the number of adjustments
made.
Then, when re-loading the font, we first load the font as specified in
the configuration. Then, we re-apply the size adjustment using
font_size_adjust().
Note that this means we end up loading the fonts twice; first using
the default size (but with adjusted DPI), and then again with the
adjusted size. This can probably be improved upon.
The existing font code has been refactored to avoid code
duplication. For example, term_init() now calls
term_font_dpi_changed() to load the initial fonts, instead of directly
instantiating them.
Finally, the way we calculate the DPI to use has changed: instead of
using the highest DPI of all available outputs, we use the highest DPI
of the output's we're actually mapped on. If we're not mapped at all,
we use the globally highest DPI.
Doing it this way means we usually only have to load the fonts
once. Otherwise, we'd end up using the default DPI of 96 when the
terminal is first instantiated (since it's not mapped at that time).
On a single monitor system, we'll use the globally highest DPI at
first, before being mapped. Then when we get mapped, we re-load the
fonts using the highest mapped DPI. But since they'll be the same,
we can skip actually reloading the fonts.
xdg_output_handle_logical_size() reports _logical_ output size. That
is, it is scaled by the output's scale factor.
We want the _actual_ DPI. The _real_ output size is reported by
output_mode(), so use that instead.
Apparently, a frame callback for the cursor surface is *never*
triggered if we get a pointer-leave event *before* the callback is
triggered. At least on Sway 1.4.
This caused the cursor being stuck, and never updating once this state
was reached.
Fix by destroying the cursor frame callback on pointer-leave.
The 'last-row' variable points to the last row the cursor is *on*,
thus it's not a counter, and we need to add one when calculating the
new grid offsets, or we get an off-by-one error.
With this, there's no longer any need to scroll the reflowed text.
To do text reflow, we only need to know if a line has been explicitly
linebreaked or not. If not, that means it wrapped, and that we
should *not* insert a linebreak when reflowing text.
When reflowing text, when reaching the end of a row in the old grid,
only insert a linebreak in the new grid if the old row had been
explicitly linebreaked.
Furthermore, when reflowing text and wrapping a row in the new grid,
mark the previous row as linebreaked if either the last cell was
(the last column in the last row) empty, or the current cell (the
first column in the new row) is empty. If both are non-empty, then we
assume a linewrap.
A window resize doesn't necessarily mean the grid layout changes. When
it doesn't, don't reflow text.
This fixes a slowness issue on Sway, when swapping positions of two
~equally sized windows.