Commit Graph
84 Commits
Author SHA1 Message Date
Carlos Alexandro Becker 4aff9daeed fix: visible lines take frame into account 2025-01-07 15:18:30 -03:00
Carlos Alexandro Becker 36be8b62a6 fix: do not scroll if width is 0
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2025-01-07 12:50:54 -03:00
Carlos Alexandro Becker fa28725f44 feat: expose HorizontalScrollPercent 2025-01-07 11:59:22 -03:00
Carlos Alexandro Becker fa3238403c perf: do not cut anything if not needed 2025-01-07 11:59:08 -03:00
Carlos Alexandro Becker 36a216e5a1 fix: use ansi.Cut 2025-01-07 11:59:00 -03:00
Carlos Alexandro Becker d1132a4512 fix: nolint 2025-01-07 11:30:44 -03:00
Christian Rocha 4acc392e42 chore(viewport): make horizontal scroll API better match vertical scroll API 2025-01-06 16:45:46 -05:00
Christian Rocha c9d33f9296 chore(viewport): increase horizontal step to 6 2025-01-06 16:30:08 -05:00
Roman Suvorov 9c0bc5c7da add test for preventing right overscroll 2024-12-18 22:35:57 +01:00
Roman Suvorov f6b7762e47 fix viewport tests 2024-12-18 22:16:01 +01:00
RomanandGitHub 51e92a172f Merge pull request #1 from charmbracelet/feature/i236-viewport-horizontal-scroll
Feature/i236 viewport horizontal scroll
2024-12-18 21:28:34 +01:00
Roman Suvorov 5dd53e52c1 fix tests 2024-12-18 21:25:35 +01:00
Carlos Alexandro Becker d7137bb8ce fix: cache line width on setcontent 2024-12-18 16:05:48 -03:00
Carlos Alexandro Becker 4a8cae34fa fix: do not navigate out to the right 2024-12-18 16:03:28 -03:00
f1307e54de Update viewport/viewport.go
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
2024-12-18 19:40:01 +01:00
Roman Suvorov b718451d96 trimLeft, move to charmbracelete/x/ansi lib 2024-12-14 19:01:21 +01:00
Roman SuvorovandRoman Suvorov 11c5170a19 add tests with 2 cells symbols 2024-12-14 18:43:45 +01:00
Roman SuvorovandRoman Suvorov fd905dfdbf add tests 2024-12-14 18:43:45 +01:00
Roman SuvorovandRoman Suvorov fe8d41e8bb rebase branch 2024-12-14 18:43:36 +01:00
Roman SuvorovandRoman Suvorov 98ba87b817 horizontal scroll 2024-12-14 18:29:44 +01:00
Christian Rocha 358a6c58c8 chore(lint): fix and suppress all soft lint issues; update directives 2024-10-24 12:35:42 -04:00
Christian Rocha 2caa9d4bdf chore(viewport): deprecate performance rendering stuff 2024-09-12 10:43:36 -04:00
Ayman BagabasandGitHub 11a9fccd58 chore: fix lint issues (#534) 2024-05-31 16:48:29 -04:00
Moritz BieringandChristian Rocha 961c081347 Fix division by zero in viewport scrollpercentage calculation 2024-03-11 09:32:23 -04:00
Ivan ValdesandMaas 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 GondaandChristian Rocha 3d3ed883d3 docs: fix typos and improve comment clarity 2023-02-16 17:49:32 -05:00
Christian RochaandGitHub 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 BullandGitHub 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' PossandGitHub 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 LalaniandGitHub e32dcde62a fix(viewport): Guard against negative string repetitions (#196) 2022-07-21 14:39:17 -04:00
Christian RochaandAyman 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 RochaandChristian Rocha 84f7b047bb Make Viewport more idomatic BubbleTea (per v0.12.x) 2020-11-08 21:20:15 -05:00
Christian RochaandChristian Rocha 5dbcf95877 Fix situation where short viewports would panic (closes #20) 2020-10-25 15:21:49 -04:00
Will BradleyandChristian 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