Commit graph

3124 commits

Author SHA1 Message Date
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
Daniel Eklöf
b59d695b2b
ime: add functions to enable/disable IME, simplify code that enables IME
We may want to be able to enable/disable IME run-time, even though we
have received an ‘enter’ IME event.

This enables us to do that.

Also add functions to enable/disable IME on a per-terminal instance
basis.

A terminal may have multiple seats focusing it, and enabling/disabling
IME in a terminal instance enables/disables IME on all those seats.

Finally, the code to enable IME is simplified; the *only* surface that
can ever receive ‘enter’ IME events is the main grid. All other
surfaces are sub-surfaces, without their own keyboard focus.
2020-12-07 20:44:11 +01:00
Daniel Eklöf
5c17b7f8e7
ime: expand cursor cell-end across multi-cell characters
This fixes an issue where the cursor ended in the middle of e.g double
width characters.
2020-12-07 20:44:11 +01:00
Daniel Eklöf
001c82fa54
ime: don’t adjust cursor’s cell-end if it’s equal to the cell-begin 2020-12-07 20:44:11 +01:00
Daniel Eklöf
552b9884b9
ime: set cursor end correctly when it ends *after* the pre-edit string 2020-12-07 20:44:11 +01:00
Daniel Eklöf
cc76f91c43
ime: use correct index when calculating number of *cells* to advance 2020-12-07 20:44:11 +01:00
Daniel Eklöf
83d3ae10ae
render: ime: don’t render cursor if cursor begin == end 2020-12-07 20:44:10 +01:00
Daniel Eklöf
e9f99df2ab
render: ime: calculate on-screen cursor position ourselves
The position calculated by render_grid() may be -1,-1 if the cursor is
currently hidden.

This fixes a crash when trying to input IME while the cursor is
hidden.
2020-12-07 20:44:10 +01:00
Daniel Eklöf
98bd798dae
ime: calculate wchar widths once 2020-12-07 20:44:10 +01:00
Daniel Eklöf
4d90b200f1
render: ignore IME preedit state when deciding which cursor style to render 2020-12-07 20:44:10 +01:00
Daniel Eklöf
05083110c3
ime: make IME compile-time optional 2020-12-07 20:44:10 +01:00
Daniel Eklöf
8c3d48c5cd
ime: render pre-edit text
This is done by allocating cells for the pre-edit text when receiving
the text-input::done() call, and populating them by converting the
utf-8 formatted pre-edit text to wchars.

We also convert the pre-edit cursor position to cell positions (it can
cover multiple cells).

When rendering, we simply render the pre-edit cells on-top off the
regular grid. While doing so, we also mark the underlying, “real”,
cells as dirty, to ensure they are re-rendered when the pre-edit text
is modified or removed.
2020-12-07 20:44:10 +01:00
Daniel Eklöf
5745c610ac
ime: wip: commit all changes in ‘done()’ 2020-12-07 20:44:10 +01:00
Daniel Eklöf
b85e2f40bb
ime: feed committed string to client application 2020-12-07 20:44:10 +01:00
Daniel Eklöf
e97024116e
ime: disable text-input on surface leave 2020-12-07 20:44:10 +01:00
Daniel Eklöf
148bb1ff13
ime: wip: add text-input object to seat 2020-12-07 20:44:09 +01:00
Daniel Eklöf
d58d0601f6
changelog: DECSET 27127 - modifies Esc to send \E[27127~ instead of \E 2020-12-07 20:43:32 +01:00
Daniel Eklöf
cbda2fb9c1
Merge branch 'allow-key-collision-if-action-is-the-same'
Closes #233
2020-12-07 19:11:50 +01:00
Daniel Eklöf
5e46672cf4
config: ignore “self” when detecting key binding collisions
Previously, foot would not accept the following:

  [key-bindings]
  minimize=Escape
  minimize=Escape

Now it does. I.e. key combos in the action being updated are ignored
when detecting collisions.

The example above is contrived; a real world example could be to
remove certain combos from an action with multiple combos; perhaps to
free up a combo for another action. Example:

  [search-bindings]
  cancel=Escape

This would previously cause an error since `cancel=Control+g Escape`
by default.

Closes #233
2020-12-05 11:21:17 +01:00
Daniel Eklöf
a58557af30
changelog: remove ‘crash when pasting non-textual clipboard content’
This crash doesn’t not exist in any release versions.
2020-12-05 11:19:03 +01:00
Daniel Eklöf
384ba4d30d
fdm: do *not* keep polling on EINTR
This fixes an issue where foot --server did not exit on SIGINT. This
happened because we never returned out from fdm_poll(), and thus we
never saw ‘aborted’ being set.
2020-12-04 18:36:53 +01:00
Daniel Eklöf
c1c42f047e
Merge branch 'releases/1.5' 2020-12-01 20:02:58 +01:00
Daniel Eklöf
3156db74ec
meson/pkgbuild: bump version to 1.5.4 2020-12-01 19:52:36 +01:00
Daniel Eklöf
f6aa1495d7
input: relax requirements for overriding keypad application mode
Don’t require NumLock to be locked. Foot has no idea _which_ modifier
the user has mapped NumLock to, meaning we really cannot require it to
be locked.
2020-12-01 19:47:16 +01:00
Daniel Eklöf
9a33559fda
keymap: add ‘CSI 27;<mod>;27~’ escapes for Esc with modifiers 2020-12-01 19:46:14 +01:00
Daniel Eklöf
86de007311
doc: foot.5: minor highlighting fixes 2020-12-01 19:45:08 +01:00
Daniel Eklöf
54e4f8e407
doc: foot.1: no need to say foot.ini twice 2020-12-01 19:45:05 +01:00
Daniel Eklöf
7430d03c6d
changelog: update contributors 2020-12-01 19:44:27 +01:00
Daniel Eklöf
8f785e5a0d
render: don’t call term_arm_blink_timer() from multiple threads
We call term_arm_blink_timer() from render_cell(), which runs in
multiple threads.

This caused multiple blink timer FDs to be created and registered with
the FDM, later causing read failures after one of those FDs had been
closed again.

This rarely happened under normal circumstances, but was easy to
trigger when the whole screen was full of blinking text.

As a small optimization, we don’t bother taking the lock if the timer
FD already is valid.

This is safe, because:

1) If the timer FD isn’t valid, we take the lock and then call
    term_arm_blink_timer(), which again checks if the FD is already
    valid.

2) The blink timer FD cannot be closed while we’re rendering cells. It
   is only disabled in the FDM callback, which cannot execute while
   we’re rendering.
2020-12-01 19:43:05 +01:00
Daniel Eklöf
ee3935c371
sixel: fix crash when an explicit sixel size had a height less than 6 pixels 2020-12-01 19:42:57 +01:00
Craig Barnes
20910abf36
client: fix handling of "-m" command-line flag 2020-12-01 19:42:19 +01:00
Daniel Eklöf
8bd711c33b
render: allow-overflow: require a space in the next cell
When checking if we should allow a single-width character double-width
glyph to overflow into the next cell, require the next cell to either
be empty, or contain a space.

Closes #203
2020-12-01 19:41:49 +01:00