<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/foot.git/commands.c, branch 1.12.0</title>
<subtitle>A fast, lightweight and minimalistic Wayland terminal emulator</subtitle>
<id>https://git.0x0f.dev/mirrors/foot.git/atom?h=1.12.0</id>
<link rel='self' href='https://git.0x0f.dev/mirrors/foot.git/atom?h=1.12.0'/>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/'/>
<updated>2022-02-23T18:03:35Z</updated>
<entry>
<title>commands: refactor scrollback up/down</title>
<updated>2022-02-23T18:03:35Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2022-02-23T17:59:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cb43c581508d8d597a54dd963c3a1989c57d585e'/>
<id>urn:sha1:cb43c581508d8d597a54dd963c3a1989c57d585e</id>
<content type='text'>
When moving the viewport in the scrollback (i.e. “scrolling”), we need
to ensure the viewport is not moved past the beginning, or end, of the
scrollback.

This was previously accomplish by first limiting the number of lines
to scroll to the number of visible rows (i.e the viewport _size_), and
by adjusting the viewport after moving it, to ensure it doesn’t point
into an uninitialized scrollback area etc.

I.e. the implementation was _reactive_.

This patch rewrites the logic to be _proactive_; we now calculate
_where_ the beginning (or end) of the scrollback is, and then how many
lines there is from there, to the viewport. This is our _maximum_
number of lines to scroll.

When done correctly (which I hope this patch does), this allows us to
remove _all_ checks after moving the viewport - we already _know_ it’s
correct, and valid.

As a bonus, we can remove the old limit, where scrolling was only
allowed to be at most a single page.
</content>
</entry>
<entry>
<title>input: clean up mouse scroll handling</title>
<updated>2021-10-27T15:09:26Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-10-25T17:39:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=0900d01ec9fce2e64384ef27111fe1a4d9d45068'/>
<id>urn:sha1:0900d01ec9fce2e64384ef27111fe1a4d9d45068</id>
<content type='text'>
* Allow scrolling on the normal (non-alt) screen, when application is
  grabbing the mouse (when user presses Shift).
* Use term_mouse_grabbed() instead of explicitly checking for
  MOUSE_NONE tracking.
* Remove mouse tracking check from cmd_scrollback_{up,down}. Caller is
  expected to have done the check.
* Don’t scroll down on mouse wheel tilt events.
</content>
</entry>
<entry>
<title>command: scrollback: don’t allow scrolling in URL mode</title>
<updated>2021-02-26T08:15:46Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-23T08:28:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=3c123425fbdf530c697096093268919e58221fb7'/>
<id>urn:sha1:3c123425fbdf530c697096093268919e58221fb7</id>
<content type='text'>
</content>
</entry>
<entry>
<title>url-mode: store absolute row numbers in start/end coordinates</title>
<updated>2021-02-07T15:33:34Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2021-02-06T10:47:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6726494f4c2836a5ed1c4611c181e4a57a4adbf1'/>
<id>urn:sha1:6726494f4c2836a5ed1c4611c181e4a57a4adbf1</id>
<content type='text'>
This allows us to update the jump label positions when the viewport
changes.

This in turn allows us to stay in URL mode while the user is using the
mouse to scroll in the scrollback history.

Scrolling with the keyboard is currently not possible, since input
handling in URL mode does not recognize “regular” key bindings. We
_could_ add scrollback up/down bindings to URL mode too, but lets not,
for the time being.

(Note: an alternative to this patch is to disallow mouse scrolling
too. Then we could have kept the URL start/end as viewport local
coordinates).
</content>
</entry>
<entry>
<title>debug: rename assert() to xassert(), to avoid clashing with &lt;assert.h&gt;</title>
<updated>2021-01-16T20:16:00Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2021-01-16T20:16:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=e56136ce1192d04a52b01ccb41284f0b7896430e'/>
<id>urn:sha1:e56136ce1192d04a52b01ccb41284f0b7896430e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Fix some spelling mistakes</title>
<updated>2020-08-15T18:39:00Z</updated>
<author>
<name>Craig Barnes</name>
<email>craigbarnes@protonmail.com</email>
</author>
<published>2020-08-15T18:39:00Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=104fe2fa55b113212899bea893a13fe7b3467156'/>
<id>urn:sha1:104fe2fa55b113212899bea893a13fe7b3467156</id>
<content type='text'>
</content>
</entry>
<entry>
<title>scrolling: fix crash when offset was exactly at the wrap-around</title>
<updated>2020-05-19T16:51:56Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-19T16:51:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=483ea4ae73658b61ff6f680b022533e5f88eddd2'/>
<id>urn:sha1:483ea4ae73658b61ff6f680b022533e5f88eddd2</id>
<content type='text'>
When making sure we don't scroll past the scrollback history, and the
current offset was exactly at the wrap around, the new view port was
set to offset+1, which in this particular case meant outside the valid
row numbers.
</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>util.h: new header file defining commonly used macros</title>
<updated>2020-05-01T09:46:24Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-05-01T09:46:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=69c3e744983e37662fa7b4f61482fb1d142e257c'/>
<id>urn:sha1:69c3e744983e37662fa7b4f61482fb1d142e257c</id>
<content type='text'>
</content>
</entry>
<entry>
<title>scroll-up: ensure view is valid after adjusting an overshot scrollback</title>
<updated>2020-02-21T22:35:43Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2020-02-21T22:35:43Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a1b5862db21ab0ae52ba2e8314be46432eac5225'/>
<id>urn:sha1:a1b5862db21ab0ae52ba2e8314be46432eac5225</id>
<content type='text'>
When we scroll up, we need to ensure that we don't scroll too far,
"past" the scrollback limit. I.e. we need to ensure we don't wrap
around.

The code did this. But, in certain scenarios, the resulting view
points into uninitialized scrollback history.

This happens when we haven't yet filled the entire scrollback, and
scroll up enough lines to wrap around the scrollback. The old code
would adjust the view for the wrap around, but doing so pointed the
view at the not-yet utilized scrollback.
</content>
</entry>
<entry>
<title>commands: scrollback: don't scrollback if mouse tracking is enabled</title>
<updated>2019-11-30T15:57:52Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-30T15:57:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5d2b2dc8a7af2bc5ce0d201a60f83b2a01714af1'/>
<id>urn:sha1:5d2b2dc8a7af2bc5ce0d201a60f83b2a01714af1</id>
<content type='text'>
</content>
</entry>
<entry>
<title>commands: scrollback: don't scrollback if mouse tracking is enabled</title>
<updated>2019-11-30T15:49:38Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-11-30T15:49:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=caee8db89a8c331a2d408ad6ebaea59020a7e597'/>
<id>urn:sha1:caee8db89a8c331a2d408ad6ebaea59020a7e597</id>
<content type='text'>
</content>
</entry>
<entry>
<title>scrollback: regression: fix rendering of scrollback diffs less than a screen</title>
<updated>2019-10-29T20:09:37Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-10-29T20:09:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=a42df2434b796f19ff729e194dd6a22f5128b89a'/>
<id>urn:sha1:a42df2434b796f19ff729e194dd6a22f5128b89a</id>
<content type='text'>
When doing "small" scrolls (typically done via mouse wheel or
similar), we render the scrolling by emitting a "scroll damage".

A recent commit changed how scroll damage is rendered; only when the
view is at the bottom ("following" the screen output) do we render the
damage.

To fix this, add a new type of scroll damage,
SCROLL_DAMAGE_IN_VIEW and SCROLL_DAMAGE_REVERSE_IN_VIEW.

These signal to the renderer that it should always render the damage.
</content>
</entry>
<entry>
<title>scrolling: optimize row access by assuming number of rows is a power of 2</title>
<updated>2019-08-22T15:33:23Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-08-22T15:33:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=7c7720a3ab314e471499194f114797ca7a40afde'/>
<id>urn:sha1:7c7720a3ab314e471499194f114797ca7a40afde</id>
<content type='text'>
With this assumption, we can replace 'a % b' with 'a &amp; (b - 1)'. In
terms of instructions, this means a fast 'and' instead of a slow
'div'.

Further optimize scrolling by:

* not double-initializing empty rows. Previously, grid_row_alloc()
  called calloc(), which was then followed by a memset() when
  scrolling. This is of course unnecessary.

* Don't loop the entire set of visible rows (this was done to ensure
  all visible rows had been allocated, and to prefetch the cell
  contents).

  This isn't necessary; only newly pulled in rows can be NULL. For
  now, don't prefetch at all.
</content>
</entry>
<entry>
<title>scrollback: use scroll damage to speed up scrolling</title>
<updated>2019-08-04T17:06:49Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-08-04T17:06:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=42fdb3653db7606ba4e4a442bce77d46ca46dec6'/>
<id>urn:sha1:42fdb3653db7606ba4e4a442bce77d46ca46dec6</id>
<content type='text'>
When scrolling through the scrollback lines, use scroll damage instead
of re-rendering the entire screen whenever it makes sense. I.e. when
the number of lines isn't a whole page or more.
</content>
</entry>
<entry>
<title>render: add render_refresh()</title>
<updated>2019-07-24T18:11:41Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-07-24T18:09:49Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=ebf0a11fa00465c142d0c98ea1f10c9cd39848ea'/>
<id>urn:sha1:ebf0a11fa00465c142d0c98ea1f10c9cd39848ea</id>
<content type='text'>
</content>
</entry>
<entry>
<title>scrollback: limit maximum number of lines one can scrollback at once</title>
<updated>2019-07-11T16:34:03Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-07-11T16:34:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=6e4c31960a8b3df56b6fe5e54ba1ef40c04247af'/>
<id>urn:sha1:6e4c31960a8b3df56b6fe5e54ba1ef40c04247af</id>
<content type='text'>
</content>
</entry>
<entry>
<title>scrollback: fix assertions in debug builds; need to wrap row number</title>
<updated>2019-07-11T16:25:46Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-07-11T16:25:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=cbac302ba122eeeec60b119beb58336f195448ca'/>
<id>urn:sha1:cbac302ba122eeeec60b119beb58336f195448ca</id>
<content type='text'>
</content>
</entry>
<entry>
<title>scrollback: in debug, verify all rows in the view are initialized</title>
<updated>2019-07-10T14:36:10Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-07-10T14:36:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=5a92202a49ef52d484b965317ce3722d088b4606'/>
<id>urn:sha1:5a92202a49ef52d484b965317ce3722d088b4606</id>
<content type='text'>
</content>
</entry>
<entry>
<title>grid: don't pre-allocate the entire grid (with all scrollback lines)</title>
<updated>2019-07-10T14:27:55Z</updated>
<author>
<name>Daniel Eklöf</name>
<email>daniel@ekloef.se</email>
</author>
<published>2019-07-10T14:27:55Z</published>
<link rel='alternate' type='text/html' href='https://git.0x0f.dev/mirrors/foot.git/commit/?id=1ff1b3a71e8edcad62c98a3c80b6e1d8a77bc26f'/>
<id>urn:sha1:1ff1b3a71e8edcad62c98a3c80b6e1d8a77bc26f</id>
<content type='text'>
The row array may now contain NULL pointers. This means the
corresponding row hasn't yet been allocated and initialized.

On a resize, we explicitly allocate the visible rows.

Uninitialized rows are then allocated the first time they are
referenced.
</content>
</entry>
</feed>
