Commit Graph

3 Commits

Author SHA1 Message Date
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
c30f877c36 Add back edit:styled as an alias for styled.
This is to keep backward compatibility for a period of time. It can be
removed after two releases.
2018-05-28 22:14:06 +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