Commit graph

3155 commits

Author SHA1 Message Date
Daniel Eklöf
9f321e6030
csi: fix sub-parameter versions of 38/48 SGR escapes
Well this is embarrassing; the sub-parameter versions of the 38/48 SGR
escapes all required an extra ‘:2’ that wasn’t supposed to be there,
causing all the other sub-parameters to be shifted one step to the
right.

That is, foot expected e.g. 38:2:2:r:g:b, or 38:2:5:idx when the
correct sequences are 38:2:cs:r:g:b and 38:5:idx.

I.e. I mixed up the color-space ID (cs) of 38:2 with *type* of color:
RGB or indexed.

In addition to fixing this, this patch also adds support for a
“bastard” version of the sub-parameter based RGB escapes, where the
color-space identifier has been left out: e.g. 38:2:r:g:b. This
sequence is invalid, but applications tend to “forget” the color-space
ID...
2020-12-12 20:55:31 +01:00
Daniel Eklöf
ff96ce1e91
input: rework mouse button/motion handling
Store a list of currently pressed buttons, and which surface they
belong to (i.e. which surface that received the press).

Then, in motion events (with a button pressed, aka drag operations),
send the event to the “original” surface (that received the press).

Also send release events to the originating surface.

This means a surface receiving a press will always receive a
corresponding release. And no one will receive a release event without
a corresponding press event.

Motion events with a button pressed will *always* use the *first*
button that was pressed. I.e. if you press a button, start dragging,
and then press another button, we keep generating motion events for
the *first* button.
2020-12-12 19:05:24 +01:00
Daniel Eklöf
a1a0b489ee
input: report mouse drag events also when the pointer is outside the grid
As long as the mouse button was *pressed* while the pointer was inside
the grid, we want to keep reporting motion events until the button is
released.

Even when the pointer moves outside the grid (but in this case, the
reported coordinates are bounded by the grid size).

This patch also tries to improve multi-button handling (i.e. multiple
buttons pressed at the same time), and the events we report to the
client for these, in the following ways:

* Motion events now report the *initial* button. That is, if you start
  a drag operation with the LEFT button, then press RIGHT (before
  releasing LEFT), keep reporting LEFT in the motion events.
* Mouse release events are reported for *any* button, as long as the
  pointer is *inside* the grid, *or*, the button released was the
  button used to start a drag operation.

The last point is important; if we have reported a button press
followed by motion events (i.e. a drag operation), we need to report
the button release, *even* if the pointer is outside the grid.

Note that the client may receive unbalanced button press/release
events in the following ways if the user pressed one, and then a
second button *inside* the grid, then releases the *first*
button (possibly outside the grid), and finally releases the *second*
button *outside* the grid.

In this case, both buttons will report press events. The first button
will report a release event since it is the initial button in the drag
operation.

However, we don’t track the fact that the second button is being
pressed, and thus if it is released outside the grid, it wont generate
a release event.
2020-12-11 21:01:00 +01:00
Daniel Eklöf
975e70dae1
csi: ‘CSI s’ and ‘CSI u’ now saves/restores attributes and charsets 2020-12-11 20:01:19 +01:00
Daniel Eklöf
934466bc84
Merge branch 'osc777-notify'
Closes #224
2020-12-11 19:44:32 +01:00
Daniel Eklöf
15d20af2a2
config: add ‘notify’ to possible values for ‘bell’ in foot.ini
When `bell=notify`, foot will trigger a desktop notification when it
receives a BEL in an unfocused window.
2020-12-10 18:22:48 +01:00
Daniel Eklöf
1d8410b7ae
notify: don’t emit notification when we’re focused 2020-12-10 18:07:50 +01:00
Daniel Eklöf
03cbb6ad90
notify: break out desktop notifications from osc.c 2020-12-10 18:06:24 +01:00
Daniel Eklöf
21cc68d49e
osc: implement urxvt’s “OSC 777;notify”
OSC 777 is URxvt’s generic escape to send commands to its perl
extensions. The first parameter is the name of the extension, followed
by its arguments.

OSC 777;notify is a, if not well established, at least a fairly well
known escape sequence to request a (desktop) notification. The syntax
is:

  \e]777;notify;<title>;<body>\e\\

Neither title nor body is escaped in any way, meaning they should not
contain a ‘;’.

Foot will split title from body at the *first* ‘;’. Any remaining ‘;’
characters are treated as part of ‘body’.

Instead of adding built-in support for the freedesktop notification
specification (which would require us to link against at least dbus),
add a new config option to foot.ini: ‘notify’.

This option specifies the command to execute when a notification is
received. ‘${title}’ and ‘${body}’ can be used anywhere, in any
combination, and as many times as you want, in any of the command
arguments.

The default value is ‘notify-send -a foot -i foot ${title} ${body}’
2020-12-09 20:54:51 +01:00
Daniel Eklöf
3e25faeae7
Merge branch 'remove-deprecated-things' 2020-12-09 20:53:05 +01:00
Daniel Eklöf
e42fd0f87f
changelog: don’t repeat ‘IME’ 2020-12-08 20:31:48 +01:00
Daniel Eklöf
3d14d79c01
changelog: add missing space in escape sequence 2020-12-08 20:31:22 +01:00
Daniel Eklöf
251026800f
changelog: consistently use ‘CSI ? X h/l’ instead of \E[?Xh/l 2020-12-08 20:29:44 +01:00
Daniel Eklöf
0263a152d4
Merge branch 'input-method-editor'
Closes #134
2020-12-08 20:06:22 +01:00
Daniel Eklöf
5020366bf5
config: remove support for scrollback-up and scrollback-down 2020-12-08 19:58:02 +01:00
Daniel Eklöf
386796cec6
config: remove support for default.geometry 2020-12-08 19:53:55 +01:00
Daniel Eklöf
6ec63eae00
config: remove support for default.scrollback 2020-12-08 19:52:28 +01:00
Daniel Eklöf
7b16802972
config: remove support for loading configuration from footrc 2020-12-08 19:52:22 +01:00
Daniel Eklöf
e7c56b0b29
completions: zsh: foot: fix default path of foot.ini 2020-12-08 19:49:14 +01:00
Daniel Eklöf
6494ba24c9
install: simplify sentence 2020-12-08 19:19:09 +01:00
Daniel Eklöf
ae01caee8c
render: ime: ensure cursor is visible 2020-12-08 19:17:46 +01:00
Daniel Eklöf
2ac520b958
changelog: DECSET 737769 - enable/disable IME 2020-12-07 20:44:15 +01:00
Daniel Eklöf
b270f221d0
render: search: render IME pre-edit text correctly, hopefully 2020-12-07 20:44:15 +01:00
Daniel Eklöf
a6ed9a9773
ime: don’t underline characters inside the cursor-box 2020-12-07 20:44:15 +01:00
Daniel Eklöf
fc2bcf9bc0
search: reset IME state when entering/exiting search mode 2020-12-07 20:44:15 +01:00
Daniel Eklöf
bcfc468fd0
render: ime: adjust cursor cell index when adjusting glyph offset 2020-12-07 20:44:15 +01:00
Daniel Eklöf
d46dcd8ef5
render: ime: wip: pre-edit 2020-12-07 20:44:14 +01:00
Daniel Eklöf
fd42a0bc23
ime: call render_refresh_search() instead of render_refresh()
When scrollback search is active
2020-12-07 20:44:14 +01:00
Daniel Eklöf
194fbff883
ime: store wchar version of pre-edit string in terminal struct 2020-12-07 20:44:14 +01:00
Daniel Eklöf
7c420004fb
render: search: don’t access term->search.buf[] directly 2020-12-07 20:44:14 +01:00
Daniel Eklöf
1ea3674029
render: codespell: cound -> count 2020-12-07 20:44:13 +01:00
Daniel Eklöf
b4a0f5b13b
render: search: glyph_offset is in *cells*, cursor position in *characters*
When calculating the offset into the search string, from where to
start rendering, take into account that the cursor position is
in *characters*, and the glyph-offset is in *cells*.
2020-12-07 20:44:13 +01:00
Daniel Eklöf
5ffa65a2e3
render: search: wcsnlen() -> wcswidth() 2020-12-07 20:44:13 +01:00
Daniel Eklöf
a552610fdb
render: search: handle multi-column characters 2020-12-07 20:44:13 +01:00
Daniel Eklöf
dca35215d0
render: search: render colorized glyphs (emojis) correctly 2020-12-07 20:44:13 +01:00
Daniel Eklöf
d87160e5f6
ime: commit text using search_add_chars() while in scrollback search mode 2020-12-07 20:44:12 +01:00
Daniel Eklöf
f51ce34753
search: new function: search_add_chars()
This function inserts a string into the search buffer, at the current
insertion point (i.e. where the cursor is).
2020-12-07 20:44:12 +01:00
Daniel Eklöf
7eea6f94ed
ime: don’t commit to the slave while scrollback searching 2020-12-07 20:44:12 +01:00
Daniel Eklöf
9ce0edc8bb
render: ime: don’t render pre-edit string in grid while searching
While doing a scrollback search, the pre-edit string should be
rendered in the search box, not in the grid.

Note that we don’t yet support IME in scrollback search mode. This
patch simply prevents the pre-edit text being rendered in the grid,
in the “background”, while searching.
2020-12-07 20:44:12 +01:00
Daniel Eklöf
fe6cf547f1
install: highlight option default value in options list 2020-12-07 20:44:12 +01:00
Daniel Eklöf
ab699338b3
install: highlight option name in options list 2020-12-07 20:44:12 +01:00
Daniel Eklöf
725d17d21d
changelog: ime: add link to INSTALL.md 2020-12-07 20:44:12 +01:00
Daniel Eklöf
559c87b84a
install: add ‘options’ section, describing compile-time options 2020-12-07 20:44:12 +01:00
Daniel Eklöf
3df4ec1c8e
changelog: IME support 2020-12-07 20:44:12 +01:00
Daniel Eklöf
0536bc41f4
csi: add DECSET 737769 - enables/disables IME input
73 77 69 = I M E
2020-12-07 20:44:12 +01:00
Daniel Eklöf
e3b5a98ade
codespell: currenly -> currently, second instance 2020-12-07 20:44:11 +01:00
Daniel Eklöf
0fc2a1188c
codespell: currenly -> currently 2020-12-07 20:44:11 +01:00
Daniel Eklöf
77bc7c8b2c
features: include compile-time enable/disable state of features when printing version 2020-12-07 20:44:11 +01:00
Daniel Eklöf
2078e1675d
render: ime: draw a ‘bar’ cursor when the pre-edit cursor’s begin == end 2020-12-07 20:44:11 +01:00
Daniel Eklöf
85cdc66ff2
shm: fix badly indented function return type 2020-12-07 20:44:11 +01:00