Commit Graph

23 Commits

Author SHA1 Message Date
Qi Xiao
a0c53d4c40 eval: BuiltinFn -> GoFn. 2019-04-18 22:58:06 +01:00
Qi Xiao
65508e728f parse: Name chain shift: ErrorEntry -> Error -> MultiError.
The Error type now implements the error interface.
2018-11-19 23:05:05 +00:00
Qi Xiao
6f3b0663c8 edit: Convert tabs into four spaces in nav mode preview. 2018-11-17 18:17:31 +01:00
Qi Xiao
f9c873487f edit: Don't filter out newlines in nav mode preview. 2018-11-17 18:03:37 +01:00
Xuanwo
c93642bb3a edit: Hide contrl characters for not break preview (#767)
Signed-off-by: Xuanwo <xuanwo.cn@gmail.com>
2018-10-16 10:22:19 +01:00
Qi Xiao
980bc4792d parse: Cleanups.
* Unexport the Parser type, and remove an unused field.

* parse.ParseAs -> parse.As; parse.Parse -> parse.AsChunk.
2018-10-13 17:27:39 +01:00
Qi Xiao
217ed4b9e0 eval: Refactor Evaler API.
EvalWithStdPorts and Eval have been merged into EvalInTTY; the original
eval method is renamed Eval.

Also factor the logic for relaying interrupts.
2018-10-13 14:04:13 +01:00
Qi Xiao
187980ebbf Migrate all users of RawOptions.Scan to declaring options as parameter. 2018-09-27 18:08:35 +01:00
Qi Xiao
aa3e87d47d gofmt -s 2018-09-25 23:24:38 +01:00
Kye W. Shi
f9ef4e6236 edit/edcore: Implement functions for word-based movement. (#721)
* edit/edcore: Implement some insert-mode functions for word-based movement.

Implemented `kill-word-right`, `kill-small-word-right`, `move-dot-left-small-word`, and `move-dot-right-small-word`.

* eval/bundled: Create default bindings for `kill-word-left` and `kill-word-right`.

* edit/edcore: Fix a dumb arithmetic error in `kill-word-right`.

* edit/edcore: Purify move- and kill- buffer commands.

* Implement category-based movement, per discussions in #696

* edit/edcore: Design unit tests for moveDot functions.

* edit/edcore: Revise categorizer-based movement for clarity; rewrite some comments.
2018-08-07 12:03:29 +02:00
Christian Muehlhaeuser
e94c00748f Added 'edit:move-dot-left-small-word' and 'edit:move-dot-right-small-word' (#696)
Following the examples of 'kill-small-word-left' and the 'move-dot-*-word'
functions, I added two new functions to move the cursor left or right,
stopping at the next "small word".

This would typically be used for Ctrl+Left & Right, e.g.:

edit:insert:binding[Ctrl+Left]=$edit:move-dot-left-small-word~
edit:insert:binding[Ctrl+Right]=$edit:move-dot-right-small-word~
2018-07-29 21:16:22 +01:00
Qi Xiao
99687f3374 edit/edcore: Save the terminal restore callback once and reuse.
This fixes #706.
2018-07-08 22:30:05 +01:00
Qi Xiao
3b1139a492 edit/ui: Remove Write* and Extend* methods from *Buffer. 2018-07-06 02:40:40 +01:00
Qi Xiao
38701785f2 edit: ui.Renderer takes *ui.BufferBuilder. 2018-07-06 02:33:26 +01:00
zhsj
35eabd3f0b edit: skip test when pty open failed (#711)
Closes: #708
Signed-off-by: Shengjing Zhu <i@zhsj.me>
2018-07-03 00:05:58 +01:00
Qi Xiao
4f58670a21 edit/edcore: More log message. 2018-06-27 00:25:14 +01:00
Qi Xiao
0e6d944139 edit/edcore: Remove an unneeded field from Editor. 2018-06-27 00:24:45 +01:00
Qi Xiao
c5ccdcdab4 Restore edit:styled to old legacy version (temporarily). 2018-05-28 22:36:40 +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
Qi Xiao
cd87e234e1 Finish up moving editor core to edit/edcore. 2018-05-24 23:40:55 +01:00
Qi Xiao
7fb83e7658 edit/edcore: Remove one unneeded dependency on eval.Evaler. 2018-05-24 23:37:08 +01:00
Qi Xiao
c103f99e18 edit: Reorganize: move implementation into edit/edcore. 2018-05-24 22:56:30 +01:00