edbb81c136
feat(viewport)!: gutter column, soft wrap, search highlight ( #697 )
...
* horizontal scroll
* rebase branch
* add tests
* add tests with 2 cells symbols
* trimLeft, move to charmbracelete/x/ansi lib
* up ansi package
* Update viewport/viewport.go
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: do not navigate out to the right
* fix: cache line width on setcontent
* fix tests
* fix viewport tests
* add test for preventing right overscroll
* chore(viewport): increase horizontal step to 6
* chore(viewport): make horizontal scroll API better match vertical scroll API
* fix: nolint
* fix: use ansi.Cut
* perf: do not cut anything if not needed
* feat: expose HorizontalScrollPercent
* fix: do not scroll if width is 0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: visible lines take frame into account
* feat(viewport): column sign
* feat: gutter, soft wrap
* wip: search
* wip: search
* wip: search
* fix: perf
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: rename
* wip
* wip
* refactor: viewport highlight ranges
* fix: ligloss update
* doc: godoc
* feat: fill height optional
* fix: handle no content
* fix: empty lines
* wip
* wip
* Revert "wip"
This reverts commit 933f181e88405c21d65a08b816a88030806ca03e.
* Reapply "wip"
This reverts commit 0e3e31b70f53d93250a1474547cc5157d50e9237.
* fix: wide
* fix: wide, find
* still not quite there
* fix: grapheme width
* fix: cleanups
* fix: refactors, improves highlight visibility
* docs: godoc
* chore: lipgloss update
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* chore: x/ansi update
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: typos, godocs
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: rename
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: typo
* fix: scroll when soft-wrapping
* fix: soft wrap adjustments
* fix: update
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: deps
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
Co-authored-by: Roman Suvorov <suvorov83@gmail.com >
Co-authored-by: Roman Suvorov <tty2.rs@gmail.com >
Co-authored-by: Christian Rocha <christian@rocha.is >
2025-02-04 13:15:40 -03:00
Christian Rocha
421843b83b
chore(merge): branch 'master' into v2-exp
2025-01-28 09:31:01 -05:00
Carlos Alexandro Becker and GitHub
7ab08fb438
fix(viewport): scroll to last line when borders ( #706 )
...
If the viewport has borders, they are not currently taken into account
when calculating the viewport max y offset, which might cause the last
line to not be visible.
This is easily reproducible in `gum pager`.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
2025-01-21 19:31:03 -03:00
Carlos Alexandro Becker
fbe642df17
chore(deps): update
2025-01-14 15:34:37 -03:00
Carlos Alexandro Becker
f28e78e6ab
Merge remote-tracking branch 'origin/master' into v2-exp
2025-01-14 14:22:36 -03:00
2d53a618a9
feat(viewport): horizontal scroll ( #240 )
...
* horizontal scroll
* rebase branch
* add tests
* add tests with 2 cells symbols
* trimLeft, move to charmbracelete/x/ansi lib
* up ansi package
* Update viewport/viewport.go
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: do not navigate out to the right
* fix: cache line width on setcontent
* fix tests
* fix viewport tests
* add test for preventing right overscroll
* chore(viewport): increase horizontal step to 6
* chore(viewport): make horizontal scroll API better match vertical scroll API
* fix: nolint
* fix: use ansi.Cut
* perf: do not cut anything if not needed
* feat: expose HorizontalScrollPercent
* fix: do not scroll if width is 0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
* fix: visible lines take frame into account
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com >
Co-authored-by: Christian Rocha <christian@rocha.is >
2025-01-10 08:38:48 -03:00
Ayman Bagabas
812f74ffff
chore: remove unused YPosition field from viewport.Model
2024-11-06 18:26:15 -05:00
Christian Rocha
52bd03ed5b
feat!(viewport): use getters and setters for width and height
2024-10-31 15:02:05 -04:00
Christian Rocha
3b879e7694
feat!(viewport): width and height are now optional args in New()
2024-10-31 15:02:05 -04:00
Ayman Bagabas
db64e3cd78
feat: update lipgloss to v2
2024-10-29 15:54:24 -04:00
Christian Rocha
57ac102802
chore(merge): branch 'master' into v2-mini-tidy
2024-10-24 15:22:16 -04:00
Christian Rocha
358a6c58c8
chore(lint): fix and suppress all soft lint issues; update directives
2024-10-24 12:35:42 -04:00
Ayman Bagabas
95541c2f51
refactor!: viewport: remove deprecated HighPerformanceRendering
...
This breaks the API and removes high performance rendering and its
related methods from the viewport package. It changes the API and
makes the methods return nothing instead of lines to render.
2024-09-19 13:42:02 -04:00
Ayman Bagabas
f81fd5246a
fix: spacebar keybinding is now "space" instead of a literal space
2024-09-18 14:55:49 -04:00
Ayman Bagabas
a2602f8509
feat!: v2: move to v2 module
2024-09-18 14:12:55 -04:00
Ayman Bagabas
0fdf5f5be5
feat: use bubbletea/v2
2024-09-18 14:09:58 -04:00
Ayman Bagabas
488bef7c13
Merge branch 'master' into v2-exp
2024-09-18 14:09:05 -04:00
Christian Rocha
2caa9d4bdf
chore(viewport): deprecate performance rendering stuff
2024-09-12 10:43:36 -04:00
Ayman Bagabas
8972b56c9d
feat!: make Init return the model
2024-09-10 14:04:36 -04:00
Ayman Bagabas
a93bfef532
feat!: use bubbletea@v2-exp
2024-09-09 14:12:52 -04:00
Ayman Bagabas and GitHub
11a9fccd58
chore: fix lint issues ( #534 )
2024-05-31 16:48:29 -04:00
Moritz Biering and Christian Rocha
961c081347
Fix division by zero in viewport scrollpercentage calculation
2024-03-11 09:32:23 -04:00
Ivan Valdes and Maas Lalani
1ba1200c31
fix(viewport): pad width to contentWidth
2024-01-08 11:43:20 -05:00
Ayman Bagabas
330dd3fa5d
feat: upgrade bubbletea and remove deprecated code
...
Supersedes: https://github.com/charmbracelet/bubbles/pull/447
2023-12-13 10:37:00 -08:00
Glenn Gonda and Christian Rocha
3d3ed883d3
docs: fix typos and improve comment clarity
2023-02-16 17:49:32 -05:00
Christian Rocha and GitHub
4a71cee5a1
fix(viewport): performance scrolling ( #312 )
...
* fix(viewport): performance scroll behavior for line up/down
* fix(viewport): performance scrolling in multi-line operations
2023-01-20 10:51:00 -05:00
Adam Bull and GitHub
fac7a01329
feat(viewport): line count getters ( #283 )
2022-11-07 10:05:03 -05:00
Christian Muehlhaeuser
4ae575a4c5
chore: use latest gofmt
2022-09-26 08:13:03 +02:00
Raphael 'kena' Poss and GitHub
278edd1c2b
fix(viewport): properly truncate to size ( #228 )
...
There are many "interesting" cases:
- logical content is wider than display width (long lines).
In this case, we truncate.
- logical content is smaller than display height (fewer lines
than visible).
In this case, we pad with empty lines up to the specified height.
- logical content is higher than display height (more lines than
visible).
In this case, we truncate.
- style specifies a width wider than the display width.
In this case, we ignore the style width and
fit in the display width.
- style specifies a height higher than the display height.
Same as width, we ignore the style and fit in the display height.
- style specifies a narrower width or smaller height than the display.
In this case we obey the style.
2022-09-02 12:50:33 -07:00
Christian Rocha
d44e242f37
fix(viewport): honor width and height settings
2022-08-29 21:05:16 -07:00
Maas Lalani and GitHub
e32dcde62a
fix(viewport): Guard against negative string repetitions ( #196 )
2022-07-21 14:39:17 -04:00
Christian Rocha and Ayman Bagabas
2a8d463bd1
chore: shorten half page up/down help widths
2022-04-29 12:20:18 -04:00
Ayman Bagabas
c214837839
fix: add viewport keymap help
2022-04-29 12:20:18 -04:00
Christian Rocha
7ecce3fb97
Ignore width/height settings in viewport's style settings
...
The Lip Gloss width and height settings compete with the main
width/height settings and can result in funny rendering and generally
cause confusion.
2022-01-20 13:23:58 -05:00
Christian Rocha
daba232df4
Fix a bug where viewport y-offset could be negative
2022-01-19 12:32:05 -05:00
Christian Rocha
7a6d306889
Fix off-by-one error in viewport's GotoBottom()
...
This was most likely introduced by the fix for rendering final lines in
0ac5ecdf81 .
2022-01-19 12:32:05 -05:00
Christian Rocha
9401ebbb83
Viewport New() is now optional to ease the upgrade process
2022-01-10 21:21:04 -05:00
Christian Rocha
add13c8028
Add a lipgloss style to the viewport for borders, margins, and padding
2022-01-10 21:21:04 -05:00
Christian Rocha
4aed4e0a88
Viewport now has customizable keybindings
2022-01-10 21:21:04 -05:00
Christian Rocha
0ac5ecdf81
Fix bug where performance rendering could render one line too many
2021-09-17 16:25:25 -04:00
Christian Rocha
8c03905dbe
Fix bug where viewport wouldn't render final lines
...
This previously went unnoticed because we all seemed to have newlines at
the end of our viewport input.
This update introduces the Model.SetYOffset method.
2021-09-17 16:25:25 -04:00
Christian Rocha
158097df66
Keep y-offset in bounds when setting content
2021-04-19 19:47:50 -04:00
Christian Muehlhaeuser
a0d7cb77a1
Fix godocs for various types and functions
2021-03-12 02:06:30 +01:00
Christian Muehlhaeuser
490a599c05
Use a const for the mouse wheel delta in viewport
2021-03-12 01:33:51 +01:00
Christian Rocha and Christian Rocha
84f7b047bb
Make Viewport more idomatic BubbleTea (per v0.12.x)
2020-11-08 21:20:15 -05:00
Christian Rocha and Christian Rocha
5dbcf95877
Fix situation where short viewports would panic ( closes #20 )
2020-10-25 15:21:49 -04:00
Will Bradley and Christian Rocha
b08b3efa02
add a couple alternate key bindings to make the scrolling slightly more intuitive
2020-10-21 22:54:58 -04:00
Christian Rocha
82097a1c79
Remove unused function
2020-10-16 11:54:44 -04:00
Christian Rocha
cbafae84f9
Update mouse wheel stuff in paginator per last-minute Bubble Tea API change
2020-10-06 12:29:18 -04:00
Christian Muehlhaeuser
9a4fbb3be1
Make golint happy
2020-08-22 12:41:09 +02:00