gizak / termui

Golang terminal dashboard
MIT License
13.06k stars 783 forks source link

Wip/input widget - Add Text() and RawText() functions to textbox widget #232

Closed andre-l-mm closed 5 years ago

andre-l-mm commented 5 years ago

Hello @cjbassi,

Here is the pull request to add Text() and RawText() functions to textbox widget as discussed in the other thread.

I added regular unit test file textbox_test.go which includes unit tests for these new functions only. I am not sure if you like that idea. Please let me know and I can remove it if required.

The conversion from [][]Cell to a styled text only takes styles that are different from StyleClear and TextStyle (the default style for the given input box).

I am relatively new to golang, if there is anything that does not look ok to you please let me know and I am happy to do some refactoring.

cjbassi commented 5 years ago

Sorry for the delay. Thanks for this! All the logic looked good, including the testing. I added one commit that reformatted things, and changed a few function names, but that was it. Oh and I removed the CellsToText function since it was a duplicate of CellsToString.