Commit Graph

36 Commits

Author SHA1 Message Date
Garrett D'Amore 8b8ed1d164 go fmt compliance fixes 2023-08-14 18:36:19 -07:00
Garrett D'Amore c951371181 minor style fixup 2023-02-20 21:39:19 -08:00
Chris Bradbury 178ac4393a Enable paste support in `views.Application`
Pasting is not supported when using the `Application` view. This commit enables pasting support on an opt-in basis.

Fixes #552
2022-10-16 22:32:30 -07:00
Tim Culverhouse dbd182b6da widgets: lock access to WidgetWatchers internal map
The WidgetWatchers struct is designed to be embedded into custom widgets
in order to satisfy the WidgetWatcher interface. The implementation uses
an internal map for storing EventHandlers, but does not lock access to
the access of the map within each method. A race condition can occur if
Watch, Unwatch, or any event is Posted from separate goroutines.

Lock access to the internal map. When posting an event, create a deep
copy of the map for iterating. This prevents potential deadlocks from a
widget calling Unwatch while handling an event.
2022-10-16 22:31:04 -07:00
Chris Bradbury 96bb70f9ef
Invert comparison operators in `CellView.Size()` (#554)
Fixes #553

This function is supposed to return a minimum 2x2 square. However, as the comparison operators are the wrong way around a maximum 2x2 square is returned instead. Inverting the comparison operators fixes the issue.
2022-09-11 13:20:27 -07:00
Chris Bradbury eef35d4cfc
Remove redundant 'equal to' comparison in `ViewPort.ValidateView` methods. (#557)
The 'equal to' comparisons in the `ViewPort.ValidateViewX()` and `ViewPort.ValidateViewY()` methods are not required as the `ViewPort`s corresponding `view` attributes will be set equal to the right operand if the conditional resolves as true. The current behaviour results in the `view` attributes being set unnecessarily if it already equals the limit.
2022-09-11 13:16:51 -07:00
Garrett D'Amore d25117a2e5 Go fmt for the project. 2022-08-31 11:37:42 -07:00
Zaim Bakar e5a59254fc
fixes #543 Horizontal, Vertical should have type Orientation (#544) 2022-08-30 12:08:59 -07:00
Antonio Lassandro c3ed795e59
Enable mouse support in views.Application (#494) 2021-10-10 22:41:26 -07:00
Adam Bozanich beb254a9ac
viewport: truncate size to area avaiable in parent (#153)
* viewport: truncate size to area avaiable in parent

* boxlayout: handle widget removal
2021-09-26 09:38:46 -07:00
Garrett D'Amore 8a32d2b0c8 Version 2.0 work in progress. 2020-08-25 16:20:58 -07:00
VÖRÖSKŐI András b0084cc526 Remove SetCursor(0,0) from CellArea SetModel
Removing SetCursor makes it possible to add lines to the model on the fly,
while keeping the cursor in position.

Go also initializes them with 0, no need to set it manually.
2020-05-27 19:47:21 -07:00
VÖRÖSKŐI András e277d9c03b Fix TextArea SetContent method
SetContent should overwrite the model, not append to it.

Add a test to check model's width and height after SetContent calls.
2020-05-07 07:39:48 -07:00
VÖRÖSKŐI András 1f1f979c1b TextArea: use [][]rune instead of []string in linesModel
This way GetCell() will get full runes, not just bytes. Now accent characters will show properly

Adjust SetLines() and Init() to work on [][]rune instead of []string
2020-04-13 12:51:31 -07:00
Anatoly Rugalev 96a065d8ff Fixed text incorrect width calculation for multiline strings 2020-03-15 10:34:41 -07:00
VÖRÖSKŐI András b03a4607a4 Add GetModel() method to CellView
GetModel() returns CellView.model type CellModel
2020-02-28 11:53:41 -08:00
VÖRÖSKŐI András 66b1faf255 CeellView corsor remove
Do not store cursor info (cursorX, CursorY) in CellView, as it belongs to the model (CellModel)

Use GetCursor() to identify current cursor position from CellModel
2020-02-28 11:53:41 -08:00
Garrett D'Amore a24b9b6b1c fixes #238 views: BoxLayout.Draw does unnecessary filling 2018-09-23 19:54:34 -07:00
Garrett D'Amore 82b7404080 fix regression caused by #177 in cleaning up
The defer of the screen.Fini() needed to include the defer of the
app.wg.Done(), and the original wg.Done needed to be eliminated.
The problem was originally spotted by @thechriswalker, with a proposed
fix that was close but not quite correct.
2018-01-08 09:49:58 -08:00
Joshua T Corbin d400d66308 Defer screen finish in app run 2017-12-25 02:13:52 -08:00
Adam Bozanich 582c2db721 boxlayout: handle widget removal (#160) 2017-09-14 23:13:49 -07:00
Tomas Vik 57a866e10c Adding Widget Resize to BoxLayout function
- Widget might be using not just View but other mechanisms for rendering
  aware of the view size (e.g. ViewPort).
- By updating the view reference out of Widget, Widget doesn't have a
  chance to react on this layout algorithm
- That's an existing bug that happens when we try to use CellView inside
  of an BoxLayout
2017-08-06 10:31:10 -07:00
Frank Braun 1f66b72172 views: move method call out of the inner loop
No need to retrieve the same values multiple times.
2017-06-20 20:13:35 -07:00
Frank Braun b87161466d views: fix corner case for limitCursor()
If m.width and m.height have not been initialized yet m.x and m.y would
be set to -1. Changing the order fixes that.
2017-06-20 20:13:35 -07:00
Frank Braun 440aba81dc Remove unnecessary initialization
window.updatesKeys() is called anyway
2017-06-20 20:10:52 -07:00
Frank Braun 9b7bd5c526 Remove unused struct field 2017-06-20 20:10:52 -07:00
Garrett D'Amore ad43f8729b fixes #117 Add PGUP, PGDN, HOME, and END key handling to TextArea 2016-05-24 01:26:09 -07:00
Garrett D'Amore c3e5bc256f fixes #116 Various improvements to tcell Views API 2016-05-24 00:50:38 -07:00
Garrett D'Amore e05a300454 fixes #113 Create SimpleStyledTextBar (forgot git add) 2016-05-23 15:30:37 -07:00
Garrett D'Amore 91d5e748ae fixes #114 Add Fill() method View API
fixes #113 Create SimpleStyledTextBar
2016-05-23 14:55:11 -07:00
Garrett D'Amore 114688d248 fixes #112 SimpleStyledText could have simpler & more powerful API 2016-05-23 13:13:23 -07:00
Garrett D'Amore 43f9cc0d07 fixes #75 Add goreport and fix related issues 2015-11-04 17:05:24 -08:00
Garrett D'Amore b727b9f424 fixes #74 Make Application an object/class
fixes #73 Views package has many go lint issues
2015-11-04 14:26:57 -08:00
Garrett D'Amore ed2fa2d51c fixes #72 Make TextBar zero value usable 2015-11-04 11:24:20 -08:00
Garrett D'Amore ca965237d9 fixes #52 Begin integrating topsl components 2015-11-01 14:44:23 -08:00
Garrett D'Amore e7d14c2863 fixes #62 windows console may have FIFO hang
fixes #63 Initial views API integration
2015-10-30 12:18:06 -07:00