34 Commits

Author SHA1 Message Date
Kovid Goyal
266746c96e
Implement the trim_whitespace option
Needed for help text formatting
2023-03-29 21:28:47 +05:30
Kovid Goyal
34526517de
Allow passing multiple options to control how wrapping is done 2023-03-29 20:56:24 +05:30
Kovid Goyal
cb99fbd83c
Dont remove leading and trailing spaces when wrapping
Without this we lose some spaces and also there was a case where the
line could end up longer than the specified width.
2023-03-29 20:47:31 +05:30
Kovid Goyal
4c9efb6ff2
Fix bold/dim handling when wrapping 2023-03-27 07:53:56 +05:30
Kovid Goyal
4bc9cf84a3
Micro-optimization 2023-03-27 07:53:56 +05:30
Kovid Goyal
88bd3ee9ca
New SGR codes to turn off bold/dim independently
Allows for robust patching of formatting into already formatted
text. Without this it is not possible to turn off bold without
affecting existing dim and vice versa.
2023-03-27 07:53:55 +05:30
Kovid Goyal
c2e549b79c
Implement syntax highlighting 2023-03-27 07:53:55 +05:30
Kovid Goyal
924cd4cadd
Do not add a trailing newline when wrapping 2023-03-27 07:53:55 +05:30
Kovid Goyal
e42b4fd9a6
Decrease allocs when wrapping 2023-03-27 07:53:54 +05:30
Kovid Goyal
18b58c5cf9
Ensure wrapping never results in lines longer than the specified word 2023-03-27 07:53:54 +05:30
Kovid Goyal
648925e83a
More work on porting diff kitten 2023-03-27 07:53:54 +05:30
Kovid Goyal
e2fda5d1c4
... 2023-03-15 15:32:04 +05:30
Kovid Goyal
c4731771ac
Make style cache thread safe 2023-03-14 12:29:44 +05:30
Kovid Goyal
c877b2a5cb
Code to dump basic colors from a theme as escape codes 2023-02-27 08:02:22 +05:30
Kovid Goyal
1aa9f1e62d
Allow faint as an alias for dim 2023-02-14 21:33:21 +05:30
Kovid Goyal
5ad2ac259b
When truncating descriptions for completion truncate at word boundaries 2022-11-17 08:29:01 +05:30
Kovid Goyal
8d76cf8d32
Import the google shlex package as we need more sophisticated parsing 2022-11-14 15:42:08 +05:30
Kovid Goyal
ef49634353
Fix some issues reported by staticcheck 2022-11-14 15:42:01 +05:30
Kovid Goyal
2cacd7a64a
get rid of interface{} since we now require Go 1.18 2022-11-14 15:42:00 +05:30
Kovid Goyal
3d79eb5730
more tests for indent and wrap 2022-11-14 15:41:56 +05:30
Kovid Goyal
af7f4e97cf
More work on the new formatter 2022-11-14 15:41:56 +05:30
Kovid Goyal
40a9ab8929
Allow ignoring lines containing a sentinel 2022-11-14 15:41:56 +05:30
Kovid Goyal
e433b90297
Dont drop trailing escape codes when stripping trailing whitespace 2022-11-14 15:41:56 +05:30
Kovid Goyal
1ac7d9c10d
Basic wrap is working 2022-11-14 15:41:56 +05:30
Kovid Goyal
ef5f0025e1
Start work on more sophisticated indent+wrap implementation 2022-11-14 15:41:56 +05:30
Kovid Goyal
61094c6bfb
Add strikethrough formatting 2022-11-14 15:41:55 +05:30
Kovid Goyal
6f4968305a
more work on porting rc command parsing to Go 2022-11-14 15:41:54 +05:30
Kovid Goyal
249df69ac9
Use the new styling API for CLI infra 2022-11-14 15:41:53 +05:30
Kovid Goyal
4a4500d56b
Dont make urls part of styling, instead have a dedicated UrlFunc API
Since urls can potentially change a lot, caching them makes no sense
2022-11-14 15:41:53 +05:30
Kovid Goyal
be22f49012
Fix usage of numbered colors for underlines 2022-11-14 15:41:53 +05:30
Kovid Goyal
f9695a7947
Add url support to styling 2022-11-14 15:41:53 +05:30
Kovid Goyal
29d9b70f0c
More ansi styling tests 2022-11-14 15:41:53 +05:30
Kovid Goyal
42a8ca0842
Write some tests for the style wrapper 2022-11-14 15:41:53 +05:30
Kovid Goyal
91c61478dd
Start work on easily generating ANSI formatted strings 2022-11-14 15:41:53 +05:30