| Commit message (Collapse) | Author | Age | Lines |
| | |
|
| | |
|
| |\
| |
| |
| | |
Closes #10
|
| |/
|
|
|
|
|
| |
* use toe for terminfo, thanks Craig.
* adds optional dependency on bash-completion for positional arguments
Co-authored-by: Craig Barnes <craigbarnes@protonmail.com>
|
| |\ |
|
| | |
| |
| |
| |
| | |
This is necessary since switching screen may change how many sixels we
have in the scrollback.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
term_print() is called whenever the client application “prints”
something to the grid. It is called for both ASCII and UTF-8
characters, and needs to handle sixels, insert mode and ASCII
vs. graphical charsets.
Since it’s on the hot path, this becomes unnecessarily slow.
This patch adds a “fast” version of term_print(), tailored for the
common case: ASCII characters in non-insert mode, without any sixels
and non-graphical charsets.
A new function, term_update_ascii_printer(), has been added, and must
be called whenever:
* The currently selected charset *index* changes
* The currently selected charset changes (from ASCII to graphical, or
vice verse)
* Sixels are added to the grid
* Sixels are removed from the grid
* Insert mode is enabled/disabled
|
| |/ |
|
| |\ |
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
That is, assume we can, and should, increment the cursor column.
This changes the emitted assembly from:
518fb: 8b 8b f8 05 00 00 mov 0x5f8(%rbx),%ecx
51901: ff c9 dec %ecx
51903: 39 d1 cmp %edx,%ecx
51905: 7e 11 jle 51918 <term_print.constprop.0+0x78>
51907: ff c2 inc %edx
51909: 89 50 10 mov %edx,0x10(%rax)
5190c: 5b pop %rbx
5190d: 5d pop %rbp
5190e: 41 5c pop %r12
51910: c3 ret
51911: 0f 1f 80 00 00 00 00 nopl 0x0(%rax)
51918: c6 40 18 01 movb $0x1,0x18(%rax)
5191c: 5b pop %rbx
5191d: 5d pop %rbp
5191e: 41 5c pop %r12
51920: c3 ret
To:
5191c: 41 8d 50 01 lea 0x1(%r8),%edx
51920: 89 50 10 mov %edx,0x10(%rax)
51923: 3b 93 f8 05 00 00 cmp 0x5f8(%rbx),%edx
51929: 0f 8d 21 01 00 00 jge 51a50 <term_print.constprop.0+0x190>
5192f: 5b pop %rbx
51930: 5d pop %rbp
51931: 41 5c pop %r12
51933: c3 ret
...
51a50: c6 40 18 01 movb $0x1,0x18(%rax)
51a54: 44 89 40 10 mov %r8d,0x10(%rax)
51a58: 5b pop %rbx
51a59: 5d pop %rbp
51a5a: 41 5c pop %r12
51a5c: c3 ret
I.e. it cuts the normal path from 10 instructions down to 8. It
increases the "bad" path with one extra instruction.
|
| |
|
|
|
|
|
|
| |
This avoids a call to sixel_overwrite_by_row() (where we also exit
early if the image list is empty).
This saves a couple of instructions to set up the arguments for
sixel_overwrite_by_row().
|
| |\ |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
“current geometry” will report whatever value is the smallest; the max
geometry or the current window size.
But “max geometry” always returns the configured max geometry.
This aligns foot’s behavior with XTerm.
|
| |\ \
| |/
|/|
| | |
Closes #395
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| | |
After emitting multiple color bands for each sixel row, the increased
amount of sixel data shifted the balance in the profiling data,
causing a performance regression in regular ASCII handling.
|
| |\ \
| |/
|/| |
|
| |/
|
|
|
|
|
|
|
| |
Closing it as soon as we detect that the client has died, means we may
not have drained it completely.
The PTY is either closed _by_ the client application, or by us when we
shutdown the terminal. Thus, leaving it open (until we call
term_shutdown()) is fine.
|
| | |
|
| | |
|
| | |
|
| |\
| |
| |
| | |
Closes #391
|
| | | |
|
| | | |
|
| |/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When P2=1, empty pixels are transparent.
This patch also changes the behavior of P2=0|2, from setting empty
pixels to the default background color, to instead use the *current*
background color.
To implement this, a couple of changes are needed:
* Sixel pixels always use alpha=1.0, except for *empty* cells when
P2=1 (i.e. transparent pixels).
* The renderer draws sixels with the OVER operator, instead of the SRC
operator.
* The renderer *must* now render the cells beneath the sixel. As an
optimization, this is only done for sixels where P2=1. I.e. for
fully opaque sixels, there’s no need to render the cells beneath.
The sixel renderer isn’t yet hooked into the multi-threaded
renderer. This means *rows* (not just the cells) beneath
maybe-transparent sixels are rendered single-threaded.
Closes #391.
|
| |\ |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This ensures we don’t trim off bottom rows in unhook().
This could happen either because the application used “Set Raster
Attributes” to configure an image size larger than the sixels later
emitted.
Or, the last sixel row contains empty pixel rows.
In either case, the size set with “Set Raster Attributes” defines
the *minimum* image size; the image may still end up being larger.
|
| | |
| |
| |
| |
| |
| | |
This fixes an issue where there was a relatively high chance of not
emitting any color bands at all, causing the final image size to be
too small.
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| | |
This ensures we’re getting the ‘$’ command PGO:d
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
DECGRI, i.e. repeat sixel character, only need to do image resizing,
and updating the current ‘column’ value *once*.
By adding sixel_add_many(), and doing the size/resize checking there,
the performance of sixel_add() is made much simpler.
This boosts performance quite noticeably when the application is
emitting many and/or long repeat sequences.
|
| | |
| |
| |
| |
| |
| | |
This results in the same number of instructions inside the loop, with
a ‘lea’ instead of a ‘mov’, but simplifies the post-loop logic to
update the global state.
|
| | |
| |
| |
| |
| | |
Same ‘add’ instruction to increase the offset, but simpler ‘mov’
instruction when writing the pixel data.
|
| | | |
|
| | |
| |
| |
| |
| | |
The resize operations performed in the “hot” path either change the
width, or the height, but not both at the same time.
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
All-empty pixels rows in the last sixel row should not be included in
the final sixel image.
This allows applications to emit sixels whose height is not a multiple
of 6, and is how XTerm works.
This is done by tracking the largest row number that contains
non-empty pixels.
In unhook, when emitting the image, the image height is adjusted based
on this value.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is to optimize sixel_add(). It already checks ‘pos’, to see if it
needs to resize the image, and if the resize fails (either due to
allocation failures, or because we’ve reached the maximum width), we
bail out.
We need to do the same thing for height. But, we don’t want to add
another check to sixel_add() since its’s performance critical.
By setting ‘col’ outside the image boundaries when ‘row’ reaches the
maximum image height, we can “re-use” the existing code in
sixel_add().
|
| | |
| |
| |
| | |
The image width *is* the maximum number of columns we’ve seen.
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This reverts commit 5a9d70da837c20a9641d6cbadccc962a8e5a4283.
This broke jexer.
Comparing with what XTerm does, we can see that it updates its image
height for *each* pixel in *each* sixel. I.e. empty pixels at the
bottom of a sixel will not increase the image size.
Foot currently bumps the image height 6 pixels at a time, i.e. always
a whole pixel.
Given this, always rounding up the height to the nearest multiple of
6 (say, for example, when responding to a DECGRA command), is wrong.
Now, we use the image size specified in DECGRA as is, while still
allowing the image to grow beyond that if necessary.
What’s left to do, if we want to behave *exactly* like XTerm, is stop
growing the image with 6 pixels at a time when dynamically adjusting
the image size.
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
By storing the current row’s byte offset into the backing image in the
terminal struct.
This replaces the ‘imul’ with a load, which can potentially be
slow. But, this data should already be in the cache.
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| | |
When we allocate the backing buffer, the number of allocated rows is a
multiple of 6.
When persisting the image, make sure its height does not exceed the
current maximum height.
|
| | | |
|
| | |
| |
| |
| |
| | |
Since the image height is always a multiple of 6, there’s no need to
round up the image height.
|
| | |
| |
| |
| | |
Sixels are always a multiple of six.
|
| | | |
|
| | |
| |
| |
| |
| | |
Calculate color, with alpha, when updating the palette instead of
every time we *use* the palette.
|
| | |
| |
| |
| |
| | |
This improves performance of DECGRI, since we now only need to
calculate the color once for the entire repeat sequence.
|
| | | |
|
| | | |
|
| |/ |
|
| |
|
|
|
|
|
| |
But appears to have been allowed in older versions of meson.
Fixes an issue where foot’s version was always reported as the last
stable release, even though it was a git build.
|
| |\
| |
| |
| | |
Closes #376
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Shift+Tab is an odd bird in XKB; it produces a shifted variant of tab,
ISO_Left_Tab, with Shift being a consumed modifier.
From a terminal perspective, Tab and ISO_Left_Tab are the same key,
with Shift+Tab generating ‘CSI Z’, and all other combos generating a
‘CSI 27;mods;9~’ escape.
Before, when we didn’t filter out consumed modifiers, we could simply
re-use the keymap for Tab when translating ISO_Left_Tab.
This is no longer possible, since shift has been filtered out. As a
result, Shift+Tab no longer generated ‘CSI Z’, but ‘\t’. I.e as if
shift wasn’t being pressed.
This patch adds a separate keymap table for ISO_Left_Tab. It’s MOD_ANY
entry corresponds to Shift+Tab, and emits ‘CSI Z’. All its other
entries *exclude* shift (since it has been consumed), *but*, the
encoded modifier (in the escape sequences) *include* shift.
|
| |/
|
|
|
|
|
| |
When sending a key escape sequence to the client application, do not
include consumed modifiers.
Fixes part of #376
|
| |\
| |
| |
| | |
Closes #389
|
| |/
|
|
|
|
|
| |
This requirement is due to the recently added maybe_repair_key_combo()
function, which is making use of xkb_keymap_key_get_mods_for_level().
See also: commit a5b554761a8b376657be2a7e613b37fd5803920c.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Foot has, up until now, used a fixed image size when the application
used DECGRA (Raster Attributes) to “configure” the image size.
This was based on a misunderstanding, that this was how you emitted
sixels where the height was *not* a multiple of 6.
This isn’t the case. The VT340 documentation is actually pretty clear
about this:
Ph and Pv do not limit the size of the image defined by the sixel
data. However, Ph and Pv let you omit background sixel data from the
image definition and still have a color background. They also
provide a concise way for the application or terminal to encode the
size of an image.
This is also how XTerm behaves. Test image:
\EPq
"1;1;1;1
#0;2;0;0;0#1;2;100;100;0#2;2;0;100;0
#1~~@@vv@@~~@@~~$
#2??}}GG}}??}}??-
#1!14@
\E\
This uses DECGRA to set the image size to 1x1. The sixel however
is *not* clipped to 1x1, but is resized to 14x12
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The ‘proto_chars’ variable is kind of like a FIFO, where characters
from the grid is pushed to the back of it. I.e. the last <n> bytes are
at the *end* of the array.
This was what the protocol matching logic expected. However, it was
only true after reading ‘max_prot_len’ characters from the
grid. Before that, the last <n> bytes from the grid was in
the *beginning* of ‘proto_chars’.
This meant we did not detect URLs starting in the top left corner of
the viewport. Test case:
foot sh -c "echo http://test.com && sleep 9999"
|
| |\
| |
| |
| | |
Closes #376
|
| | | |
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
If a user-provided key combo contains both an explicit modifier, and
the shifted symbol it produces, replace the symbol with its un-shifted
version.
Example: Control+Shift+U contains both ‘Shift’, and ‘U’, where ‘Shift’
is the modifier that shifts ‘u’ to ‘U’.
Such modifiers are “consumed”, i.e. filtered out, when matching key
combos. As such, Control+Shift+U will never trigger since we’ll never
be able to match the consumed modifier ‘Shift’.
The above combo can be written in two ways:
- Control+U
- Control+Shift+u
To be able to detect that Control+Shift+U is an invalid combination,
we need to check all *shifted* symbols for all key *codes*.
Once we’ve detected a shifted symbol (and where it differs from the
un-shifted symbol), we loop all modifier sets that produce the shift
level where our shifted symbol is. For each such set, check if it
intersects with the user-provided key combo’s modifier set.
If there is an intersection, it means the user provided a key combo
containing a modifier and symbol, such that the modifier is consumed
when the symbol is produced.
In this case, we replace the symbol with its un-shifted version.
|
| | |
| |
| |
| | |
tolower() is locale dependent, something we do not want in this case.
|
| | | |
|
| | |
| |
| |
| | |
Bindings now use lower-cased keys
|
| | | |
|
| | |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Bindings are matched in one out of three ways:
* By translated (by XKB) symbols
* By untranslated symbols
* By raw key codes
A translated symbol is affected by pressed modifiers, some of which
can be “consumed”. Consumed modifiers to not partake in the comparison
with the binding’s modifiers. In this mode, ctrl+shift+2 maps to
ctrl+@ on a US layout.
Untranslated symbols, or un-shifted symbols refer to the “base” symbol
of the pressed key, i.e. it’s unaffected by modifiers. In this mode,
consumed modifiers *do* partake in the comparison with the binding’s
modifiers, and ctrl+shift+2 maps to ctrl+shift+2 on a US layout.
More examples: ctrl+shift+u maps to ctrl+U in the translated lookup,
while ctrl+shift+u maps to ctrl+shift+u in the untranslated lookup.
Finally, we also match raw key codes. This allows our bindings to work
using the same physical keys when the user switches between latin and
non-latin layouts.
This means key bindings in foot.ini *must* not include both +shift+
and a *shifted* key. I.e. ctrl+shift+U is not a valid combo as it
cannot be triggered. Unfortunately, this was how you were supposed to
write bindings up until now... so, we try to detect such bindings, log
a deprecation warning and then “fix” the binding for the user.
When specifying bindings in foot.ini, both ctrl+U and ctrl+shift+u are
valid, and will work. The latter is preferred though, since we cannot
detect the raw key code for the former variant. Personally, I also
prefer the latter one because it is more explicit; it’s more obvious
which keys are involved.
However, in some cases it makes more sense to use the other
variant. Typically for non-letter combos.
|
| |/ |
|
| |
|
|
|
|
|
| |
This reverts commit e5cd09bf3f3b78b408052688645321e99ae2dc5e.
This needs to be applied on the consume-modifiers-for-key-bindings
branch.
|
| |\
| |
| |
| | |
Closes #384
|
| | |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes log spamming in Sway:
00:54:07.780 [DEBUG] [wlr] [types/wlr_text_input_v3.c:181] Text input commit received without focus
00:54:07.780 [INFO] [sway/input/text_input.c:127] Inactive text input tried to commit an update
Closes #384
|
| | | |
|
| | |
| |
| |
| | |
This makes URLs mode behave like scrollback search mode.
|
| | | |
|
| | | |
|
| | |
| |
| |
| |
| | |
No need to a changelog entry for fixing something that hasn’t yet been
released.
|
| |\ \
| |/
|/| |
|
| | | |
|
| | | |
|
| |\ \
| |/
|/| |
|
| |/
|
|
|
|
|
|
| |
In a recent Debian build from master, Lintian complained about a bad
whatis entry for this manual page. The tag description [1] says a NAME
section is required. It is added here.
[1] https://lintian.debian.org/tags/bad-whatis-entry.html
|
| |\
| |
| |
| | |
Closes #361
|