Commit Graph

295 Commits

Author SHA1 Message Date
Jakub Sobon 91ae185022
Merge pull request #212 from donaldww/master
Change MaxUint32 to MaxInt32 in scroll.go
2019-05-21 16:04:50 -04:00
Donald Wilson ceea79f7ce Change MaxUint32 to MaxInt32
This change was implemented to address the following message, reported by the raspberry pi golang compiler (v1.12):

/home/pi/go/pkg/mod/github.com/mum4k/termdash@v0.9.0/widgets/text/scroll.go:119:29: constant 4294967295 overflows int
2019-05-21 05:20:19 -04:00
Jakub Sobon 5c94e7ca53 Merge branch 'devel' of ssh://github.com/mum4k/termdash into devel 2019-05-15 23:24:46 -04:00
Jakub Sobon 947b563927
Merge branch 'master' into devel 2019-05-15 23:24:34 -04:00
Jakub Sobon 6980f88810
Release widget's mutex before activating external callback.
Fixes #205.
2019-05-13 22:28:41 -04:00
Xabier Larrakoetxea 79ede36653
Use strings.Replace instead strings.ReplaceAll to have support for go >=1.10
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-08 05:50:57 +02:00
Xabier Larrakoetxea bef8ea3773
Merge remote-tracking branch 'upstream/devel' into y-axis-label-formatter 2019-05-06 07:58:28 +02:00
Xabier Larrakoetxea a5c7363f43
Add round and suffix based value formatter for the Y-axis label representation
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-06 07:56:04 +02:00
Xabier Larrakoetxea 38f40428a1
Move time duration value formatter NaN check
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-05 10:27:48 +02:00
Xabier Larrakoetxea 7d5c78059c
Rename linechart value formatters and check more corner cases
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-05 10:07:15 +02:00
Xabier Larrakoetxea 059c72807f
Add single unit duration value formatter for the Y-axis
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-04 11:06:08 +02:00
Xabier Larrakoetxea 150b7e26e2
Allow empty Y-axis labels on linechart using a value formatter that returns empty strings
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-04 08:08:55 +02:00
Xabier Larrakoetxea e152366a5c
Fix comment
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-04 08:07:33 +02:00
Xabier Larrakoetxea b0f8079a94
Add linechart custom formatter testcases for long strings, non-printable characters and unicode value formatter results
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-03 07:18:49 +02:00
Xabier Larrakoetxea 36f116d9fc
Make axes labels length finder compatible with unicode runes
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-03 07:15:49 +02:00
Xabier Larrakoetxea c1bf776dba
Use variadic args for Value factory options
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-05-03 07:14:01 +02:00
Jakub Sobon e6a00d5685
Merge pull request #198 from mum4k/dot-display
Support displaying the dot character in SegmentDisplay.
2019-04-30 23:14:41 -04:00
Jakub Sobon f13f732a66
More test coverage for dotseg.
Also the demo of segment display now uses a colon.
2019-04-30 23:02:14 -04:00
Jakub Sobon 6159007466
The SegmentDisplay now uses dot segment for dots and colons. 2019-04-30 00:00:37 -04:00
Jakub Sobon 57b9e78dc8
Refactoring sixteen.
Moving out code that is common to all segment display types.
2019-04-28 23:08:34 -04:00
Jakub Sobon 0ef875039b
Fixing lint issues found on Go report card. 2019-04-28 22:44:44 -04:00
Jakub Sobon 98b23ec3bd
Text area no longer needs to be adjusted.
Since we are no longer removing one line of cells from the top of the
canvas.
2019-04-28 22:32:15 -04:00
Jakub Sobon 3dce1b3bab
Undo changes to the donut demo. 2019-04-28 22:05:31 -04:00
Jakub Sobon e9b4ba3613
Guarantee some spacing between donut and its label. 2019-04-28 22:03:57 -04:00
Jakub Sobon 0c68b3d745
The donut widget can optionally display a text label. 2019-04-28 21:17:07 -04:00
Jakub Sobon d105df4413
Refactoring the Draw method for readability. 2019-04-27 01:58:37 -04:00
Jakub Sobon 304c59f211
Mouse support for the text input field. 2019-04-27 01:45:15 -04:00
Xabier Larrakoetxea 7571889bec
Use the y-axis value formatter option on y-axis internal properties
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-04-26 07:04:03 +02:00
Xabier Larrakoetxea 135edd42fa
Add formatted values creation if the scale has a value formatter asigned
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-04-26 07:01:24 +02:00
Xabier Larrakoetxea 7157a07457
Add formatter support to linechart internal Value type
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-04-26 06:46:58 +02:00
Jakub Sobon 886f970586
Completing test coverage and most of the functionality.
Mouse support is outstanding.
2019-04-25 23:44:14 -04:00
Xabier Larrakoetxea 560aef66d5
Add linechart y-axis value formatter option API
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-04-25 06:17:01 +02:00
Jakub Sobon 1df5298809
Test coverage for basic functionality of the text input field.
Tests without any input text for now.
2019-04-24 23:44:44 -04:00
Jakub Sobon c2f5326954
Polishing the editor code.
Some helper functions and better comments.
2019-04-22 23:46:36 -04:00
Jakub Sobon 22c89bc2a7
Finishing test coverage for the field editor. 2019-04-22 21:44:00 -04:00
Jakub Sobon 32c9c724f2
Enhancing the editor to correctly handle unicode. 2019-04-21 23:58:35 -04:00
Jakub Sobon e49a4438b1
Fixing lint issues. 2019-04-20 17:37:45 -04:00
Jakub Sobon c0c9727c80
Working proof-of-concept of the textinput field. 2019-04-20 17:33:23 -04:00
Jakub Sobon 23c4ced3b0
Function that splits canvas to parts for label and text input. 2019-04-20 00:50:46 -04:00
Jakub Sobon da70101c28 Merge branch 'devel' into text-input 2019-04-19 00:03:15 -04:00
Jakub Sobon afe70553e5 Merge branch 'devel' into text-input 2019-04-18 23:57:35 -04:00
Jakub Sobon c890f0be5f
Editor can delete runes before the cursor. 2019-04-18 23:57:24 -04:00
Jakub Sobon 5dd1aff803
Advancing to Go1.10.
- switching to math.Round and deleting out clone.
- switching all bytes.Buffer instances to strings.Builder.
2019-04-18 22:55:05 -04:00
Xabier Larrakoetxea 53abc10da3
Remove not required constants from linechart minMax wrapper
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-04-18 20:33:53 +02:00
Jakub Sobon 72989e7e39
Editor: support for insertion and scrolling. 2019-04-17 23:59:33 -04:00
Xabier Larrakoetxea b54694ed12
LineChart defaults to 0 mix and max when these are NaN
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-04-17 13:42:05 +02:00
Xabier Larrakoetxea 42c2731286
Allow 'no values' on linechart represented by NaN float64 that will be displayed as empty cells
Signed-off-by: Xabier Larrakoetxea <slok69@gmail.com>
2019-04-14 10:16:44 +02:00
Jakub Sobon b33c3d2eec
Logic that returns number of cells before and after. 2019-04-10 23:42:49 -04:00
Jakub Sobon beb37775b8
Intermediate commit. 2019-04-10 00:09:46 -04:00
Jakub Sobon 2e7d295af7
Planning out the editing algorithm. 2019-04-08 23:32:00 -04:00
Jakub Sobon 2cfaf25b9b
Initial functionality and tests for the field editor. 2019-04-07 23:31:41 -04:00
Jakub Sobon b031be6046
Adding a type that holds data in the text input field. 2019-04-07 22:37:28 -04:00
Jakub Sobon bf72b5ddc2
Skeleton of the TextInput widget. 2019-04-07 00:41:09 -04:00
Jakub Sobon 2de4a9a865
SegmentDisplay now reports its capacity. 2019-04-06 23:57:22 -04:00
Jakub Sobon 10d4a55348
Provide metadata to widgets when drawing. 2019-04-03 23:13:18 -04:00
Jakub Sobon 4237512047
Merge pull request #177 from mum4k/release-0-8-0
Release v0.8.0
2019-03-30 02:35:15 -04:00
Jakub Sobon 3587cb9d76
Improving test coverage for scale. 2019-03-20 23:31:31 -04:00
Jakub Sobon 68fb7606d9
Prevent external mutation of data passed into widgets.
Fixes #174.
2019-03-20 23:20:16 -04:00
Jakub Sobon cd44225552
Fixing a typo. 2019-03-09 00:13:41 -05:00
Jakub Sobon 62c56c5e58
Adding the ValueCapacity method to SparkLine. 2019-03-03 18:13:17 -05:00
Jakub Sobon 5018a08b1f
Adding ValueCapacity method to BarChart. 2019-03-03 17:59:30 -05:00
Jakub Sobon b020770733
Moving widgetapi out of internal.
This will allow external users to develop their own widgets.
2019-03-02 22:00:07 -05:00
Jakub Sobon 2742487fc0
The text widget now wraps at words. 2019-03-02 17:56:37 -05:00
Jakub Sobon c43e453038
Text validation moved to the wrap package. 2019-03-02 17:46:03 -05:00
Jakub Sobon 87cab66617
Simplifying the text widget.
This results in a better line wrapping abstraction which now works on
cells. Cells contain both the rune and the cell options which were
awkward to track separately.
2019-02-28 00:50:16 -05:00
Jakub Sobon 61aca3fb62
Removing Text's dependency on wrap.Needed.
It was rune based and thus incompatible with word wrapping.
2019-02-25 00:33:27 -05:00
Jakub Sobon 54c5dff63e
Factoring the line wrapping logic out of the text widget.
It will be needed for the Table too.
2019-02-24 23:10:52 -05:00
Jakub Sobon 80843ae031
Merge pull request #157 from mum4k/api-docs
Moving fakewidget to the internal subdirectory.
2019-02-24 22:42:39 -05:00
Jakub Sobon 50c00a2c8f
Moving fakewidget to the internal subdirectory. 2019-02-24 22:36:09 -05:00
Jakub Sobon cc460d43b7
Fixing one typo and adding two missing error checks. 2019-02-24 18:42:10 -05:00
Jakub Sobon 0938ae91d8
Refactoring internal functions from align to internal/alignfor. 2019-02-24 15:44:13 -05:00
Jakub Sobon 85902cf11a
Button is internal. 2019-02-24 02:09:27 -05:00
Jakub Sobon b25d20c8ae
Mouse and keyboard are also public. 2019-02-24 02:08:48 -05:00
Jakub Sobon 98394c921a
Moving draw back to internal.
Adding test for linestyle.
2019-02-24 01:54:37 -05:00
Jakub Sobon e4726e4240
Changing all call sites to linestyle. 2019-02-24 01:51:50 -05:00
Jakub Sobon b74f46509b
Moving runewidth, segdisp and testdraw to internal. 2019-02-24 01:27:17 -05:00
Jakub Sobon bf61ca1479
Moving draw out of internal. 2019-02-24 01:20:03 -05:00
Jakub Sobon 97ec73069f
Moving align, cell and terminalapi back from internal. 2019-02-24 01:13:26 -05:00
Jakub Sobon 6a7f3ff886
Fixing lint issue in button. 2019-02-24 01:10:29 -05:00
Jakub Sobon 8df9e3307c
Moving faketerm to internal. 2019-02-24 01:09:23 -05:00
Jakub Sobon bf38f10d25
Moving terminal back to public. 2019-02-24 01:04:57 -05:00
Jakub Sobon f0438f5f78
Moving linechart's zoom into internal subdirectory. 2019-02-23 21:22:52 -05:00
Jakub Sobon 24f608f708
Adding README under linechart's internal subdirectory. 2019-02-23 21:22:11 -05:00
Jakub Sobon 9517bd49e3
Moving linechart's axes to internal subdirectory. 2019-02-23 21:21:52 -05:00
Jakub Sobon 5ac468c10a
Moving terminal, terminalapi and widgetapi to internal subdirectory.
And adding a README under internal.
2019-02-23 21:19:16 -05:00
Jakub Sobon 55efbe07fe
Moving numbers to internal subdirectory. 2019-02-23 21:16:13 -05:00
Jakub Sobon 2ff1818c0e
Moving keyboard and mouse to internal. 2019-02-23 21:11:50 -05:00
Jakub Sobon 6c03991fb9
Moving draw and event to internal. 2019-02-23 21:10:51 -05:00
Jakub Sobon 7ee222ac58
Moving private libraries into internal subdirectory. 2019-02-23 21:09:38 -05:00
Jakub Sobon e7e8b29396
Fixing LineChart tests. 2019-02-23 20:50:29 -05:00
Jakub Sobon a2642ea039
The LineChart now continuous to accept mouse events after terminal resize.
And allowing it to receive global mouse events to be able to cancel
highlight on clicks outside of the widget.
2019-02-23 20:48:41 -05:00
Jakub Sobon b2a1f30fe1
Complete test coverage for button and tweaks to the demo. 2019-02-23 19:38:47 -05:00
Jakub Sobon e9cf1e1af7
Partially completed tests for button. 2019-02-23 02:18:06 -05:00
Jakub Sobon 0490734d1e
Running gofmt. 2019-02-23 00:42:47 -05:00
Jakub Sobon 22946f2f65
Allowing widgets to select the scope for mouse events too. 2019-02-23 00:41:58 -05:00
Jakub Sobon 4b4e245d60
The button in an intermediate dev state. 2019-02-23 00:07:54 -05:00
Jakub Sobon a16d908b5e
Adding options for global keyboard. 2019-02-22 01:07:53 -05:00
Jakub Sobon 8b3f1a146f Merge branch 'devel' into button 2019-02-22 00:49:26 -05:00
Jakub Sobon 495eaa4ee5
Merge pull request #146 from mum4k/widgets-global-keys
Allow widgets to subscribe to global keyboard events
2019-02-22 00:48:42 -05:00
Jakub Sobon 0df7387862
Widgets can now register for global keyboard events. 2019-02-22 00:33:55 -05:00