Commit graph

4403 commits

Author SHA1 Message Date
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
Daniel Eklöf
0de55182ac
selection: reset ‘empty_count’ after we’ve emitted the empty cells
When marking and unmarking cells, we don’t highlight trailing empty
cells. We do however highlight empty cells if they are followed by
non-empty cells.

I think this was an intentional choice. If one row ended with trailing
empty cells, but *no* hard linebreak, then we’d continue on the next
row, and emit all the empty cells once we hit a non-emtpy cell on the
second row.

But this is something that shouldn’t happen in any real-world use
cases.
2021-06-05 13:41:17 +02:00
Daniel Eklöf
dfbe8297f7
Merge branch 'scrollback-key-bindings-pass-through-alt-screen'
Closes #573
2021-06-05 10:33:55 +02:00
Daniel Eklöf
a7e2e4bfa9
input: pass through scrollback-* key bindings when alt screen is activw
Since the alt screen have no scrollback, all scrollback-* actions are
effectively no-ops when the alt screen is active.

Make them available to the client application instead.

Closes #573
2021-06-04 23:25:45 +02:00
Daniel Eklöf
b5515a414a
Merge branch 'osc-9' 2021-06-04 07:44:07 +02:00
Daniel Eklöf
405b887a82
osc: implement iTerm2’s OSC-9 - desktop notifications 2021-06-04 07:44:00 +02:00
Daniel Eklöf
dd43afd754
Merge branch 'chunked-reflow'
Closes #504
2021-06-04 07:43:18 +02:00
Daniel Eklöf
354de2b8ee
changelog: text reflow performance 2021-06-04 07:42:53 +02:00
Daniel Eklöf
3292bb5b8e
grid: reflow: ‘amount’ has already been added to ‘from’ 2021-06-02 20:13:52 +02:00
Daniel Eklöf
cb83d60089
selection: fix bad assertion
When there are multiple multi-column characters back-to-back, the cell
before the pivot end point may in fact be a SPACER+1 cell.
2021-06-02 20:13:52 +02:00
Daniel Eklöf
a003e56fdc
grid: reflow: URI range start: take over ownership of URI string
Instead of strdup:ing the URI, take over ownership. This is ok since
the old URI range will be free:d anyway.
2021-06-02 20:13:52 +02:00