<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/selection.h, branch releases/1.25</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=releases%2F1.25</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=releases%2F1.25'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2023-10-08T08:38:37Z</updated>
<entry>
<title>search: add more key bindings to extend the current match</title>
<updated>2023-10-08T08:38:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2023-09-26T15:54:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=78665a7e809afd470e1236867761d51de9737eaa'/>
<id>urn:sha1:78665a7e809afd470e1236867761d51de9737eaa</id>
<content type='text'>
This patch adds the following new search key bindings:

* extend-char (shift+right)
* extend-line-down (shift+down)
* extend-backward-char (shift+left)
* extend-backward-to-word-boundary (ctrl+shift+left)
* extend-backward-to-next-whitespace (ctrl+shift+alt+left)
* extend-line-up (shift+up)

They can be used to extend the search match (i.e. the selection).

This patch also adds an initial set of key bindings to scroll in the
scrollback history:

* scrollback-up-page
* scrollback-down-page

These work just like the key bindings for the normal mode. Also note
that it was already possible to scroll using the mouse.

This patch also fixes a couple of search mode bugs:

* crashing when a search match ends in the last column
* grapheme clusters not being matched correctly
* Search match not being "extendable" after a pointer leave event
* A few others, related to either large matches, or extending matches
  after moving the viewport.

There are still a couple of (known) issues:

* A search match isn't correctly highlighted if its *starting* point
  is outside the viewport.
* Extending the match to end of the scrollback (i.e. the most recent
  output) is simply buggy.

Related to #419
</content>
</entry>
<entry>
<title>selection: selection_on_rows(): use scrollback relative coords</title>
<updated>2022-07-28T19:06:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-07-28T16:27:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a05eaf28bdeea793829bddb6cc99220b1adb1d6f'/>
<id>urn:sha1:a05eaf28bdeea793829bddb6cc99220b1adb1d6f</id>
<content type='text'>
When checking if the current selection intersects with the
region (passed as parameter to the function), use scrollback relative
coordinates.

This fixes an issue where selections crossing the scrollback
wrap-around being misdetected, resulting in either the selection being
canceled while scrolling, even though it wasn’t scrolled out, or the
selection _not_ being canceled, when it _was_ scrolled out.
</content>
</entry>
<entry>
<title>selection: find_word_boundary_right: add “stop-on-space-to-word-boundary”</title>
<updated>2022-04-27T16:44:57Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-27T16:44:57Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=76305104486a90c2320dd102c32fe26831ebb658'/>
<id>urn:sha1:76305104486a90c2320dd102c32fe26831ebb658</id>
<content type='text'>
When true, selection_find_word_boundary_right() behaves as before - it
stops as soon as it encounters a character that isn’t of the
same *type* as the “initial” character (the last character in the
selection).

Take this, for example:

  The Quick Brown Fox

The selection will first stop at the end of “the”, then just *before*
“quick”, then at the end of “quick”. Then just *before* “brown”, and
then at the end of “brown”, and so on.

This suits mouse selections pretty good. But when
selection_find_word_boundary_right() is used to extend a search match,
it’s better to ignore space-to-word character transitions. That is, we
want

  The Quick Brown Fox

to first extend to the end of “the”, then immediately to the end of
“quick”, then to the end of “brown”, and so on.

Setting the ‘stop_to_space_to_word_boundary’ argument to false results
in latter behavior.

This is now done by search, when executing the
“extend-to-word-boundary” and “extend-to-next-whitespace” key
bindings.
</content>
</entry>
<entry>
<title>selection: add start/end coordinate getters</title>
<updated>2022-04-25T17:59:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-04-25T17:59:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6316a5eb0cf2b1fe25ca0e9d60c4e11fce9c22d1'/>
<id>urn:sha1:6316a5eb0cf2b1fe25ca0e9d60c4e11fce9c22d1</id>
<content type='text'>
Internally, selection coordinates are *unbounded* (that is, the row
numbers may be larger than grid-&gt;num_rows) while a selection is
ongoing. Only after it has been finalized are the coordinates bounded.

This means it isn’t safe to use term-&gt;selection.coords.* directly.
</content>
</entry>
<entry>
<title>selection: expose find_word_boundary_{left,right}()</title>
<updated>2021-05-17T16:14:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-03-28T19:03:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=eab874eb06de11763683f312e6c1557319788cee'/>
<id>urn:sha1:eab874eb06de11763683f312e6c1557319788cee</id>
<content type='text'>
</content>
</entry>
<entry>
<title>selection: remove selection_enabled()</title>
<updated>2021-02-02T08:52:22Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-02T08:52:22Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=eff8481cdc6c37407faaa3167ea6f6897b12f544'/>
<id>urn:sha1:eff8481cdc6c37407faaa3167ea6f6897b12f544</id>
<content type='text'>
Its name did not reflect its semantics. Since it was only used in a
single place, “inline” it there, and get rid of it.
</content>
</entry>
<entry>
<title>config: add ‘select-extend-character-wise’ bind action</title>
<updated>2021-01-14T15:29:29Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-06T10:11:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=767bd4f1dbbb14d9d28acb22cf42a91e6305a69a'/>
<id>urn:sha1:767bd4f1dbbb14d9d28acb22cf42a91e6305a69a</id>
<content type='text'>
This forces the (new) selection mode to be character-wise when
extending a word- or line-wise selection.

Default key binding is ctrl+RMB.
</content>
</entry>
<entry>
<title>selection: combine enum selection_kind with selection_semantic</title>
<updated>2021-01-06T09:53:27Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-06T09:53:27Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3a9172342fd69c09d3fddfb26eba12dcbe1e5149'/>
<id>urn:sha1:3a9172342fd69c09d3fddfb26eba12dcbe1e5149</id>
<content type='text'>
</content>
</entry>
<entry>
<title>selection: use selection_start() to initialize word/row-based selection</title>
<updated>2021-01-04T18:48:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-02T22:00:54Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3afc5a723e10313f956234cfd4251ba7a5a7e99c'/>
<id>urn:sha1:3afc5a723e10313f956234cfd4251ba7a5a7e99c</id>
<content type='text'>
This removes the selection_mark_word() and selection_mark_row()
functions. To start a word/row-based selection, use selection_start()
with SELECTION_SEMANTIC_{WORD,ROW}
</content>
</entry>
<entry>
<title>selection: wip: update selection word-wise when initial selection was by word</title>
<updated>2021-01-04T18:48:26Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-01-02T20:20:41Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=30de262d29d703b0cc31799a4abf84239f3caf22'/>
<id>urn:sha1:30de262d29d703b0cc31799a4abf84239f3caf22</id>
<content type='text'>
</content>
</entry>
<entry>
<title>selection: add support for different mime-types</title>
<updated>2020-10-28T18:16:04Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-10-28T18:16:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=be22fefdc73c8b2ca8375a1b3f19c8d05de18e24'/>
<id>urn:sha1:be22fefdc73c8b2ca8375a1b3f19c8d05de18e24</id>
<content type='text'>
Add support for `text/plain`, `text/plain;charset=utf-8` and
`text/uri-list` to regular copy operations (both from clipboard and
primary selection) and drag-and-drop operations.
</content>
</entry>
<entry>
<title>selection: auto-scroll: selection keeps scrolling while mouse is outside grid</title>
<updated>2020-10-11T13:44:20Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-10-11T13:44:20Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7fedf2f80160d4cb96b77ae58137573b78cbfeee'/>
<id>urn:sha1:7fedf2f80160d4cb96b77ae58137573b78cbfeee</id>
<content type='text'>
Moving the mouse outside the grid while we have an on-going selection
now starts a timer. The interval of this timer depends on the mouse’s
distance from the grid - the further away the mouse is, the shorter
interval.

On each timer timeout, we scroll one line, and update the
selection. Thus, the shorter the interval, the faster we scroll.

The timer is canceled as soon as the mouse enters the grid again, or
the selection is either canceled or finalized.

The timer FD is created and destroyed on-demand.

Most of the logic is now in selection.c. The exception is the
calculation of the timer interval, which depends on the mouse’s
position. Thus, this is done in input.c.

The scroll+selection update logic needs to know a) which direction
we’re scrolling in, and b) which *column* the selection should be
updated with.

If the mouse is outside the grid’s left or right margins, the stored
mouse column will be -1. I.e. we don’t know whether the mouse is on
the left or right side of the grid. This is why the caller, that
starts the timer, must provide this value.

The same applies to top and bottom margins, but since we already have
the scroll *direction*, which row value to use can be derived from this.
</content>
</entry>
<entry>
<title>selection: add selection_&lt;type&gt;_has_data()</title>
<updated>2020-09-09T17:01:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-09-09T16:45:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=dec6f963cbedb093370f8d9559e357e72a31df90'/>
<id>urn:sha1:dec6f963cbedb093370f8d9559e357e72a31df90</id>
<content type='text'>
Returns true when there is data available for paste in the
clipboard/primary selection.
</content>
</entry>
<entry>
<title>selection: add selection_&lt;type&gt;_unset()</title>
<updated>2020-09-09T17:01:21Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-09-09T16:44:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=c3cacb470430f3a19db8e2442f1ed61887044373'/>
<id>urn:sha1:c3cacb470430f3a19db8e2442f1ed61887044373</id>
<content type='text'>
These functions clear the current selection.
</content>
</entry>
<entry>
<title>config: add 'pipe-selected' key binding</title>
<updated>2020-07-31T15:04:30Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-31T15:02:53Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=639a61abd86c7db3e47f2cd70fc16b7d6c6afaf4'/>
<id>urn:sha1:639a61abd86c7db3e47f2cd70fc16b7d6c6afaf4</id>
<content type='text'>
This works just like pipe-visible and pipe-scrollback, but pipes the
user-selected text, if any, to the external tool.

Closes #51
</content>
</entry>
<entry>
<title>seat: use separate 'enter' serials for keyboard and mouse</title>
<updated>2020-07-09T09:20:46Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-09T09:20:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=71584aed388935908588686e5df7ec42855f3698'/>
<id>urn:sha1:71584aed388935908588686e5df7ec42855f3698</id>
<content type='text'>
</content>
</entry>
<entry>
<title>multi-seat: improve handling of multiple (mouse) pointers</title>
<updated>2020-07-09T07:52:11Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-09T07:52:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4e48d550efba98ebecf4b60045004e52c585c52d'/>
<id>urn:sha1:4e48d550efba98ebecf4b60045004e52c585c52d</id>
<content type='text'>
* xcursor always set for all pointers
* xcursor sometimes not updated when it should be
* mouse grabbed state wasn't per seat, but global (i.e. "does at least
  one seat enable mouse grabbing")
* selection enabled state wasn't per seat
</content>
</entry>
<entry>
<title>multi-seat: re-enable selection support (excluding OSC 52)</title>
<updated>2020-07-08T16:41:09Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-07-08T16:41:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=4c7d29f7eb95b10a0fadc406924db537a18b12ca'/>
<id>urn:sha1:4c7d29f7eb95b10a0fadc406924db537a18b12ca</id>
<content type='text'>
</content>
</entry>
<entry>
<title>selection: handle viewport wrap around correctly</title>
<updated>2020-05-19T16:49:42Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-19T16:49:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=08588cd0fc25128a8ec013d65ca15d8e66d28e99'/>
<id>urn:sha1:08588cd0fc25128a8ec013d65ca15d8e66d28e99</id>
<content type='text'>
When the viewport wraps around, the selection points may be
"incorrect".
</content>
</entry>
<entry>
<title>term: scrolling: hopefully fix all selection/scrolling related crashes</title>
<updated>2020-05-17T13:34:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-17T13:34:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=96a4f1b9933756e7466132095ef7151c46db04ae'/>
<id>urn:sha1:96a4f1b9933756e7466132095ef7151c46db04ae</id>
<content type='text'>
When scrolling, there are a couple of cases where an existing
selection must be canceled because we cannot meaningfully represent it
after scrolling.

These are when the selection is (partly) inside:

* The top scrolling region
* The bottom scrolling region
* The new lines scrolled in. I.e. re-used lines

For the scrolling regions, the real problem is when the selection
crosses the scrolling region boundary; a selection that is completely
inside a scrolling regions _might_ be possible to keep, but we would
need to translate the selection coordinates to the new scrolling
region lines.

For simplicity, we cancel the selection if it touches the scrolling
region. Period.

The last item, newly scrolled in lines is when the selection covers
very old lines and we're now wrapping around the scrollback history.

Then there's a fourth problem case: when the user has started a
selection, but hasn't yet moved the cursor. In this case, we have no
end point.

What's more problematic is that when the user (after scrolling) moves
the cursor, we try to create a huge selection that covers mostly
empty (NULL) rows, causing us to crash.

This can happen e.g. when reverse scrolling in such a way that we wrap
around the scrollback history.

The actual viewport in this case is something like `-n - m`. But the
selection we'll end up trying to create will be `m - (rows - n)`. This
range may very well contain NULL rows.

To deal with this, we simply cancel the selection.
</content>
</entry>
</feed>
