Commit Graph

56 Commits

Author SHA1 Message Date
Adam Bull
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
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
e32dcde62a
fix(viewport): Guard against negative string repetitions (#196) 2022-07-21 14:39:17 -04:00
Christian Rocha
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
84f7b047bb Make Viewport more idomatic BubbleTea (per v0.12.x) 2020-11-08 21:20:15 -05:00
Christian Rocha
5dbcf95877 Fix situation where short viewports would panic (closes #20) 2020-10-25 15:21:49 -04:00
Will Bradley
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
Christian Rocha
dbd40713ce
Remove extraneous methods 2020-07-29 20:04:09 -04:00
Christian Rocha
5357dd61bd
Fix bug where scroll wheel could create duplicate lines on top and bottom 2020-07-20 17:46:15 -04:00
Christian Rocha
88469a499e
Tidy up the key case switch in viewport 2020-07-20 11:56:35 -04:00
Christian Rocha
b130d96434
Add methods for jumping to the tom and bottom of the viewport 2020-07-17 19:22:08 -04:00
Christian Rocha
185a19e56f
Fix cases where pager would add blank lines to bottom of document 2020-07-17 18:38:38 -04:00
Christian Rocha
dbb1d93970
Remove redundant viewport commands 2020-07-17 18:22:51 -04:00
Christian Rocha
2f909886c1
Be more consistent with max() argument order 2020-07-17 18:13:48 -04:00
Christian Rocha
5720cfb35a
Correct scroll percentage reporting 2020-07-17 18:13:05 -04:00
Christian Rocha
3c07b97d37
Correct typo, add potential TODO 2020-07-17 17:02:37 -04:00
Christian Rocha
f341e3c896
Correct mouse wheel behavior 2020-06-23 13:10:50 -04:00
Christian Rocha
c9196e5407
Add basic mouse wheel support to viewport 2020-06-23 12:00:17 -04:00
Christian Rocha
7cef3a6f59
Document comments 2020-06-20 13:59:13 -04:00
Christian Rocha
1cdc2045c7
Fix a potential out of bounds panic 2020-06-19 19:46:51 -04:00
Christian Rocha
cc480dd2f3
Comments 2020-06-19 19:02:14 -04:00
Christian Rocha
0c1781fbb3
Clamp scroll percentage 2020-06-19 15:04:23 -04:00
Christian Rocha
5255143e87
Rework high performance half-view up/down 2020-06-19 13:23:14 -04:00
Christian Rocha
1629afe087
Rework high-performance pgup/pgdown 2020-06-19 12:20:35 -04:00
Christian Rocha
da3150ded7
Rework high performance line-up/line-down 2020-06-19 11:51:44 -04:00
Christian Rocha
b82cf5071d
Send newlines instead of cursor-downs in performance viewport 2020-06-18 18:31:30 -04:00
Christian Rocha
d095a6554c
Retire the internal viewport renderer 2020-06-18 18:25:57 -04:00
Christian Rocha
34ac608122
Correct slice bounding 2020-06-18 16:29:05 -04:00
Christian Rocha
09ae5da7c3
Don't get/set size in viewport; that should happen in the parent 2020-06-18 14:14:21 -04:00
Christian Rocha
5572542e2e
Add command to sync initial high performance view 2020-06-18 13:42:11 -04:00
Christian Rocha
3688351ddf
Viewport now can use Bubble Tea high performance scroll renderer (ish) 2020-06-17 20:55:49 -04:00
Christian Rocha
d9c03fc0b0
Add cursor positioning functions to viewport renderder 2020-06-16 16:10:34 -04:00
Christian Rocha
3321ac12a9
Renderer comments 2020-06-16 14:34:46 -04:00