Commit Graph

17 Commits

Author SHA1 Message Date
Qi Xiao
35126799fb styled: Add a Text.TrimWcwidth method. 2019-03-02 23:12:06 +00:00
Qi Xiao
60169dfb35 styled: Add methods for counting runes and splitting by runes. 2019-03-02 23:12:06 +00:00
Qi Xiao
e57c037ca7 golint fixes. 2018-10-13 17:52:54 +01:00
Qi Xiao
cee01232ec Move eval/vals.Feed to util, and add a test. 2018-10-11 00:25:24 +08:00
Qi Xiao
aa3e87d47d gofmt -s 2018-09-25 23:24:38 +01:00
Qi Xiao
64d89b3340 styled: Simplify implementation of FindTransformer. 2018-07-18 00:25:09 +02:00
Qi Xiao
cc3ec74cca styled: Add more tests and helpers. 2018-07-18 00:25:08 +02:00
Qi Xiao
d037cea65d styled: Add more tests and helpers. 2018-07-17 23:55:05 +02:00
Qi Xiao
576362bede styled: Add a Transform function, add basic tests. 2018-07-17 23:35:57 +02:00
Qi Xiao
79fb0db574 styled: Clean up String implementation.
Text.String() now implemented in terms of a new Text.VTString(), which
is implemented in terms of (*Segment).VTString().
2018-07-15 15:11:41 +01:00
Qi Xiao
3cbe77cade styled: styled.go -> style.go. 2018-07-15 14:51:59 +01:00
Qi Xiao
6e5526acac styled: Clean up representation of Segment and Text.
Segment is now always used as a pointer and Text is always used as a
value.

Add test to make sure that the "styled" builtin does not modify its
arguments.

This fixes #719.
2018-07-15 14:50:06 +01:00
Qi Xiao
6bf94467d7 styled: Add Text.ToLegacyType. 2018-06-27 00:24:02 +01:00
Qi Xiao
278d297e0c styled: Add Text.Partition, with tests. 2018-06-27 00:23:24 +01:00
fehnomenal
0871c42d9d Validate passed options to styled-segment (#686) 2018-05-31 22:11:02 +01:00
Qi Xiao
7ba5938693 Quick fix to add support for the new styled type to prompts. 2018-05-28 22:32:42 +01:00
fehnomenal
e89fe48870 Add styled and styled-segment builtins (#674)
* Add compatibility test with old implementation

* Add color type

* Add basic style structs and utilities

* Add structs for styled segments and texts

* Add default style transformers to reimplement $edit:styled~

* Add builtins to manipulate styled segments and texts

* Rename style 'underline' -> 'underlined'

* Fix test case

* Add conversion from styled text to ansi sequences

* Return errors rather than throwing

* Validate the type of boolean options

* Delegate old to new styled function

* Rebase for new test framework api and expand test cases

* Remove old builtin function $edit:styled~

* Use strings to represent colors

* Convert bool pointers to simple bool values

* Validate color strings

* Do no longer expose builtin style transformers

* Fix confusion about pointers

* Make outputs more stable

* Expand tests

* Use pointers instead of passing setter functions

* Unexport and rename color check

* Use the empty string for default colors

* Expand tests

* Simplify styled transformers

Now there are three transformers for each boolean style attribute that
allow setting, unsetting and toggling the corresponding attribute.

* Rework and add doc comments
2018-05-28 21:24:09 +01:00