Commit graph

4413 commits

Author SHA1 Message Date
Daniel Eklöf
09eb0d1bbb
config: work around clang-11.0 issue
Clang-11.0 doesn’t seem to understand that our ‘static const’ key
modifiers are compile-time constant. Clang-11.1 doesn’t appear to have
this issue.
2021-06-18 15:35:59 +02:00
Daniel Eklöf
495c730487
config: don’t use tllist where it isn’t necessary
tllists are great when dealing with dynamically changing lists. They
are also very easy to use when building lists/arrays where the final
size is unknown.

However, this ease of use comes at a price: code size. tll-macros
expand to a lot of code.

Since things in the config are static, once the config has been
loaded, using tllists for configuration data structures doesn’t make
much sense.

This patch replaces nearly all tllists used by the configuration, with
dynamically allocated arrays.
2021-06-18 15:35:57 +02:00
Daniel Eklöf
31e10c1613
Merge branch 'footclient-dont-copy-conf-unless-necessary' 2021-06-18 15:34:11 +02:00
Daniel Eklöf
26b0e3d441
Merge branch 'underline-positioning'
Closes #490
2021-06-18 15:32:51 +02:00
Daniel Eklöf
7d2770f154
server: don’t clone the config unless we’re going to modify it 2021-06-17 18:11:16 +02:00
Daniel Eklöf
cf81fff062
config: add underline-offset option
This option allows the user to configure a custom underline
offset. That is, use the user provided offset instead of the font
provided one.

Closes #490
2021-06-17 17:54:21 +02:00
Daniel Eklöf
11829931a7
search: don’t crash when we don’t have any XKB compose state 2021-06-16 17:44:14 +02:00
Daniel Eklöf
ee2b0cb21f
Merge branch 'optimize-erase-cell-range' 2021-06-15 16:28:03 +02:00
Daniel Eklöf
45a04393c4
term: erase_cell_range: early break out from URI loop
URI ranges are sorted. This means we don’t have to check any more
ranges once we’ve seen one that starts *after* the erase range.

Closes #594
2021-06-15 16:26:43 +02:00
Daniel Eklöf
5caa87adaf
term: no need to set attrs.clean=0 right after copying the VT attrs struct
When printing a character to a cell, we copy the current VT state’s
attributes to the cell. And then clear the ‘clean’ bit.

But the ‘clean’ bit is part of the VT state, and is *always*
zero. Thus there’s no need to explicitly clear it right after copying
the VT state.
2021-06-15 12:38:35 +02:00
Daniel Eklöf
d1d145e7c1
Revert "gitignore: compile_commands.json + .ccls-cache"
This reverts commit 1dabc10494.
2021-06-15 11:29:07 +02:00
Daniel Eklöf
968f6c0738
Merge branch 'doc-cc1-to-c1' 2021-06-14 19:29:58 +02:00
nick black
80e780627f
[foot-ctlseqs] 8-bit control characters are C1 2021-06-14 06:21:20 -04:00
Daniel Eklöf
1dabc10494
gitignore: compile_commands.json + .ccls-cache 2021-06-13 20:05:51 +02:00
Daniel Eklöf
c3274fd97e
Merge branch 'xtversion'
Closes #359
2021-06-13 17:20:47 +02:00
Daniel Eklöf
772e376992
doc: ctlseq: add XTVERSION 2021-06-13 17:19:49 +02:00
Daniel Eklöf
3adc3367e6
csi: implement XTVERSION (CSI > 0q)
This is a fairly new XTerm extension. The reply is on the format:

  DCS > | text ST

XTerm replies with ‘text’ = “XTerm(366)”.

Foot replies with ‘text’ = “foot(1.6.4)”

Closes #359
2021-06-13 17:19:41 +02:00
Daniel Eklöf
efd023ad32
generate-version: add a define for “extra” version information
This will be set to “rrr-gNNNNNNN” when building from git, and the
empty string otherwise.
2021-06-13 17:19:35 +02:00
Craig Barnes
c32c206a37 doc: foot-ctlseqs: mention that SS2/SS3 only affect the next character 2021-06-12 12:45:03 +01:00
Craig Barnes
d85bd7084d doc: foot-ctlseqs: rename SS0/SS1 to SO/SI
There's no mention of SS0 or SS1 functions in ECMA-48 or ECMA-35.

0x0E/0x0F are SO/SI (Shift In/Out) in "7-bit environments" or LS0/LS1
(Locking Shift 0/1) in "8-bit environments". The former is the one
that applies to foot, since it generally follows "7-bit" conventions
due to its use of UTF-8.

See also: ECMA-35 §7.2 and §9.2.
2021-06-12 12:22:07 +01:00
Craig Barnes
02259f60a6 Replace tab indents with spaces in config.h 2021-06-12 10:33:33 +01:00
Daniel Eklöf
6a0a6b0b01
Merge branch 'config-cli-override'
Closes #554
2021-06-12 10:12:19 +02:00
Ryan Farley
f379ffb8ed Override options from command line
Allow any configuration option to be overridden with -o/--override
'section.key=value' arguments, as suggested in #554

update completitions for override

slight refactoring to ease footclient support
2021-06-12 03:05:15 -05:00
Daniel Eklöf
7ada4c0ab4
Merge branch 'no-conf-found-is-not-an-error' 2021-06-11 19:19:02 +02:00
Daniel Eklöf
955ecbd19a
config: demote “no configuration found, using defaults” to a mere warning
And don’t notify the user in the terminal window, only log it on
stderr.
2021-06-10 20:40:01 +02:00
Daniel Eklöf
41a223e1bd
config: change “no configuration found, using defaults” from error to warning 2021-06-10 20:37:17 +02:00
Daniel Eklöf
4a945ce466
Merge branch 'free-box-drawings-data'
Closes #586
2021-06-09 16:13:57 +02:00
Daniel Eklöf
cd37cdc940
term: free the data associated with the pixman image when destroying box-drawing glyphs
Closes #586
2021-06-09 11:27:08 +02:00
Daniel Eklöf
a3f6c8ac78
Merge branch 'clipboard-mime-types'
Closes #583
2021-06-09 11:24:37 +02:00
Daniel Eklöf
49bb00fb64
selection: add support for TEXT/STRING/UTF8_STRING mime-types in incoming offers
We were already offering these mime types for our own clipboard data,
but ignored them in incoming offers.

Fixes paste issues from Geany.

Closes #583
2021-06-09 11:23:55 +02:00
Craig Barnes
2a75da4143 Merge branch 'charset-shift-fixes' 2021-06-09 10:18:52 +01:00
Craig Barnes
e030a2ca08 terminal: add 'charset_designator' enum to make code more self-documenting
This commit also renames the term_set_single_shift_ascii_printer()
function to term_single_shift(), since the former is overly verbose
and not really even accurate.
2021-06-09 10:00:25 +01:00
Daniel Eklöf
1191f3f73a
Merge branch 'overlapping-sixels'
Closes #562
2021-06-09 10:36:39 +02:00
Craig Barnes
3c609771c5 changelog: add issue links for previous 2 entries 2021-06-09 09:30:34 +01:00
Daniel Eklöf
6d336fcadd
sixel: add support for overlapping sixels
Writing a sixel on top of an already existing sixel currently has the
following limitations in foot:

* The parts of the first sixel that is covered by the new sixel are
  removed, completely. Even if the new sixel has transparent
  areas. I.e. writing a transparent sixel on top of another
  sixel *replaces* the first sixel with the new sixel, instead of
  layering them on top of each other.

* The second sixel erases the first sixel cell-wise. That is, a sixel
  whose size isn’t a multiple of the cell dimensions will leave
  unsightly holes in the first sixel.

This patch takes care of both issues.

The first one is actually the easiest one: all we need to do is
calculate the intersection, and blend the two images. To keep things
relatively simple, we use the pixman image from the *new* image, and
use the ‘OVER_REVERSE’ operation to blend the new image over the old
one.

That is, the old image is still split into four tiles (top, left,
right, bottom), just like before. But instead of throwing away the
fifth middle tile, we blend it with the new image. As an optimization,
this is only done if the new image has transparency (P1=1).

The second problem is solved by detecting when we’re erasing an area
from the second image that is larger than the new image. In this case,
we enlarge the new image, and copy the old image into the new one.

Finally, when we enlarge the new image, there may be areas in the new
image that is *not* covered by the old image. These areas are made
transparent.

The end result is:

* Each cell is covered by at *most* 1 sixel image. I.e. the total
  numbers of sixels are finite. This is important for the ‘mpv
  --vo=sixel’ use case - we don’t want to end up with thousands of
  sixels layered on top of each other.

* Writing an opaque sixel on top of another sixel has _almost_ zero
  performance impact. Especially if the two sixels have the same size,
  so that we don’t have to resize the new image. Again, important for
  the ‘mpv --vo=sixel’ use case.

Closes #562
2021-06-09 10:00:19 +02:00
Daniel Eklöf
ed081f5f3c
Merge branch 'tabs'
Closes #508
2021-06-09 09:58:29 +02:00
Daniel Eklöf
fff75e082f
changelog: tabs are preserved 2021-06-09 09:57:20 +02:00
Craig Barnes
a2c9c56f19 vt: fix SS2/SS3 escape sequences to act correctly as single shifts
These sequences are supposed to affect the next printable ASCII
character and then reset to the previous character set, but before
this commit they were behaving like locking shifts.
2021-06-08 21:09:40 +01:00
Craig Barnes
e72e8b1b8e vt: add support for LS2 and LS3 locking shifts 2021-06-08 21:06:18 +01:00
Daniel Eklöf
9929a5ce0a
csi: CHT: don’t alter the LCF flag
This makes us pass the vttest 11.5.4 (Test non-VT100 -> Test ISO-6429
cursor-movement -> CHT) test.
2021-06-08 19:53:26 +02:00
Daniel Eklöf
9d3351472d
vt: TAB: don’t print a ‘\t’ to the grid if the *current* cell isn’t empty
If the cursor is already at the right edge, our logic that checked for
non-empty cells failed; it didn’t check the current cell.

Fix by initializing ‘emit_tab_char’ to true/false, depending on the
contents of the current cell.
2021-06-08 19:53:26 +02:00
Daniel Eklöf
4d56dd430b
extract: consume spaces following a tab
That is, we choose to copy the tab character, and not the spaces it
represents. Most importantly, we don’t copy *both* the tab and the
spaces.
2021-06-08 19:53:26 +02:00
Daniel Eklöf
94b549f93e
vt: emit a tab character if all cells between cursor and tab stop are empty
TAB (\t) move the cursor to the next tab stop. That’s it, according to
the specification.

However, many terminal emulators try to keep tabs in the grid, to be
able to e.g. copy them. That is, copying a text chunk containing tabs
should result in tabs being pasted, not spaces.

In order to do that, we need to print a tab character to the grid. To
improve text reflow of tabs, we also print spaces to the subsequent
cells, up until (but not including) the next tab stop.

However, we can only do this if all the cells between the cursor and
the next tab stop are empty, since (obviously), we cannot overwrite
pre-existing characters.

Finally, while some fonts render tabs as spaces (i.e. an empty glyph),
some use a glyph representing “unprintable” characters, or
similar. Thus, we need to exclude cells with tab characters when
rendering.
2021-06-08 19:53:26 +02:00
Daniel Eklöf
e77b7d7111
Merge branch 'il-dl-reset-cursor-col' 2021-06-08 19:52:40 +02:00
Daniel Eklöf
0febce9007
csi: IL+DL: move cursor to column 0
This fixes vttest 11.6.6.3

Test non-VT100 ->
Test ISO-6429 colors ->
Test of VT102-style features with BCE ->
Test Insert/Delete Char/Line
2021-06-08 19:52:35 +02:00
Daniel Eklöf
a2f54c810b
Merge branch 'reverse-video-only-affects-default-fg-bg' 2021-06-08 19:52:13 +02:00
Daniel Eklöf
39560a6ff1
render: reverse video only swaps *default* fg/bg
This matches XTerm behavior, and fixes vttest 11.6.6.2:

Test non-VT100 ->
Test ISO-6429 colors ->
Test of VT102-style features with BCE ->
Test of screen features
2021-06-08 19:51:13 +02:00
Craig Barnes
620fe8e764 vt: fix buggy chains of ternary expressions in action_esc_dispatch()
Only the first character in the chain was being compared with `priv`
and the rest were just being evaluated as simple expressions. This
was causing the G2 and G3 operations to erroneously use the G1 index.

Since the characters are a contiguous range, we can just subtract the
start of the range to get the appropriate index. The outer switch
statement already ensures the values are in range.
2021-06-08 16:52:00 +01:00
Craig Barnes
b34d76f711 terminal: fix compilation error when debug logging is enabled
Without this fix, setting LOG_ENABLE_DBG to 1 in terminal.c would
cause the following error:

> terminal.c:1787: 'struct terminal' has no member named 'font_scale'

The 'font_scale' member was removed in commit
2afc678236.
2021-06-08 13:10:46 +01:00
Daniel Eklöf
95c4a8ccfb
vt: \E#8: print ‘E’ using the default attributes 2021-06-07 21:35:17 +02:00