Commit graph

139 commits

Author SHA1 Message Date
423dd100c1 Add unicode-based grapheme width estimation method 2025-02-23 18:36:42 +01:00
be7eff0979 Bump version to 0.3.1 2025-02-21 00:36:39 +01:00
77a02116a6 Fix grapheme width estimation
I'm pretty sure it still breaks in lots of terminal emulators, but it
works far better than what recent versions of the unicode_width crate
were doing.
2025-02-20 22:10:11 +01:00
1618264cb7 Fix newlines causing bad rendering artifacts
The unicode-width crate has started to consider newlines to have a width
of 1 instead of 0.
2025-02-20 22:08:37 +01:00
73a0268dfd Bump version to 0.3.0 2024-11-06 22:21:20 +01:00
65f31a2697 Update dependencies 2024-11-06 22:17:28 +01:00
3a5ce3832b Add Terminal::mark_dirty 2024-11-06 22:16:48 +01:00
b1d7221bae Bump version to 0.2.3 2024-04-25 20:14:26 +02:00
0f7505ebb4 Update dependencies 2024-04-25 20:13:42 +02:00
ef6d75c23a Fix suspend sequence
In my kitty-based setup, I observed the following bug:

1. Run cove[1], a toss-based application, in a kitty tab
2. Exit cove
3. Start lazygit[2]
4. Stage some files and enter a commit message
5. Try to press enter and observe garbage appearing in the text box

The bug occurred reliably after running cove, but never occurred if cove
was not run in that tab.

This commit fixes the bug by making the suspend sequence undo the
unsuspend sequence's steps in reverse order.
2024-04-25 20:07:48 +02:00
8556fd8176 Fix control character width measurement 2024-04-25 19:46:10 +02:00
94052c5a65 Fix formatting 2024-03-04 00:08:33 +01:00
761e8baeba Bump version to 0.2.2 2024-01-14 12:38:33 +01:00
2d604d606c Fix crash when drawing Predrawn with width 0 2024-01-14 12:32:21 +01:00
b01ee297d5 Bump version to 0.2.1 2024-01-05 13:54:42 +01:00
44512f1088 Update dependencies 2024-01-05 13:53:13 +01:00
b757f1be03 Add Title widget 2024-01-05 13:52:25 +01:00
2714deeafb Add support for setting window title 2024-01-05 13:33:08 +01:00
77b4f825c9 Fix clippy warning 2024-01-05 13:23:18 +01:00
2c7888fa41 Bump version to 0.2.0 2023-08-31 13:23:00 +02:00
f6cbba5231 Update dependencies 2023-08-31 13:20:54 +02:00
87723840df Bump version to 0.1.0 2023-05-14 15:57:25 +02:00
a4ec64aa57 Update dependencies 2023-05-14 15:57:19 +02:00
6eb853e313 Reduce tearing when redrawing screen 2023-05-10 19:35:56 +02:00
3b9ffe8715 Fix full redraws always using stdout 2023-05-10 19:25:46 +02:00
f005ec10fe Fix editor panicking sometimes when hidden 2023-04-29 01:23:50 +02:00
8bfb4b2dc3 Fix Join panicking in some situations 2023-04-28 14:40:53 +02:00
f414db40d5 Add BoxedSencSync which is Send + Sync 2023-04-17 20:30:24 +02:00
968dbe501f Remove AsyncWidget impls replaceable by Desync 2023-04-17 19:46:40 +02:00
4179e7f56c Add Desync widget to turn Widgets into AsyncWidgets 2023-04-17 19:46:40 +02:00
57788a9dd9 Apply Resize's max size to available size too
I'm not sure if the input max size and the output max size should be
separate, and I'm not sure whether the min size should also have an
effect on the input. For now, this works well enough, but I may need to
adjust it in the future as I stumble across new edge cases.

This change was made because I was using Resize as a way to set the size
of widgets containing text that were rendered inside Predraw widgets.
After this change, setting a max_width but no max_height has the desired
effect of making the inner widgets perform word wrapping. The resulting
Predrawn is then as high as it needs to be to contain the wrapped text.
2023-04-17 16:48:13 +02:00
59710c8162 Fix Predrawn not drawing cursor 2023-04-17 09:38:00 +02:00
242a1aed29 Add option to stretch Padding 2023-04-14 13:57:09 +02:00
d0b3b9edd4 Fix Predrawn size calculations
Previously, Predrawn would use its parent frame's size. Now, it uses the
size requested by the widget. Because of this, it no longer requires a
full &mut Frame, but only a &mut WidthDb.

To set a maximum size, the widget can be wrapped inside a Resize.
2023-04-14 01:51:40 +02:00
810524325e Fix hidden placeholder appearing in empty editor 2023-04-13 02:18:43 +02:00
35aa70de4b Fix editor cursor 2023-04-12 19:16:29 +02:00
7c6e651f88 Add Boxed and BoxedAsync widgets 2023-04-08 16:00:04 +02:00
007493f136 Derive more traits for widgets 2023-04-08 15:40:14 +02:00
77e72de9ad Make Layer* more like Join* 2023-04-08 15:21:51 +02:00
88e66e17ec Add Predrawn widget 2023-04-06 03:00:37 +02:00
ea6be7bf32 Simplify editor cursor handling and rendering 2023-04-06 00:18:56 +02:00
542ea7bc66 Simplify Join* implementation 2023-02-26 14:57:34 +01:00
0573fcec77 Only provide WidthDb in [Async]Widget::size 2023-02-26 14:42:48 +01:00
417f33cc24 Differentiate between growing and shrinking segments
Also uses the new with_* naming scheme for segments
2023-02-20 16:57:35 +01:00
607c11fea4 Use new with_* naming scheme
All builder-like functions are now named with_*. There is also now a way
to set each property imperatively with only a mutable reference.

The only widgets I haven't yet converted to this style are the Join*
widgets; they're a bit harder to figure out an appropriate API for.
2023-02-20 15:53:49 +01:00
cb483431cc Make widget submodules public
This will make the generated documentation more readable once I add
module docstrings. I'm still reexporting the module contents to keep
imports nice and tidy.
2023-02-19 14:24:28 +01:00
397d3a6eac Add Editor widget 2023-02-19 14:18:45 +01:00
783e57a9ab Allow join segments to be fixed
I'm not sure if this is a good abstraction, or if I should instead
re-think the algorithm.
2023-02-19 02:31:58 +01:00
8f155dc6a2 Fix join widgets not handling large sizes 2023-02-19 02:09:41 +01:00
b1c276ec38 Fix panic with zero-weighted segments 2023-02-19 02:02:27 +01:00