Commit Graph

750 Commits

Author SHA1 Message Date
Qi Xiao
724cd15f6b Don't use tokens when completing. 2017-02-11 23:51:38 -05:00
Qi Xiao
7f2b310fd1 Fix rendering of history when prefix is empty. 2017-02-11 23:28:36 -05:00
Qi Xiao
d2a28b1a58 Fix error message at end of history. 2017-02-11 23:26:13 -05:00
Qi Xiao
f40c911d08 Remove eval.IncIndent. 2017-02-11 23:25:19 -05:00
Qi Xiao
916da7de7b Allow arbitrary spaces after = in map pairs.
Use this to pretty-print maps.
2017-02-11 23:23:36 -05:00
Qi Xiao
6eb6829443 Break up editorRenderer. 2017-02-11 23:04:31 -05:00
Qi Xiao
3b00dd8f16 Move edit/reader.go to edit/tty. 2017-02-11 22:34:47 -05:00
Qi Xiao
6f47909c20 Move edit.Key to a new edit/uitypes package. 2017-02-11 22:29:18 -05:00
Qi Xiao
75a9d1f908 Move edit.AsyncReader to a new edit/tty package. 2017-02-11 22:16:18 -05:00
Qi Xiao
5751809b94 Fix empty leading line in editor in a hacky way. 2017-02-11 18:52:16 -05:00
Qi Xiao
b31b803a0e Move the rendering of the editor into a renderer. 2017-02-11 16:33:25 -05:00
Qi Xiao
53c11b745e Let modes decide whether the cursor is on the modeline. 2017-02-10 04:53:24 -05:00
Qi Xiao
d26ee04d79 Let the editor re-lex the line iff it has changed. 2017-02-10 04:43:36 -05:00
Qi Xiao
3816d774a7 edit.FixCandidates -> quoteCandidates. 2017-02-10 04:33:15 -05:00
Qi Xiao
d9343fbc00 Always populate candidate.display instead of fixing it later. 2017-02-10 04:31:23 -05:00
Qi Xiao
ec75b97802 Guard against too few arguments to builtin arg completers. 2017-02-10 04:23:57 -05:00
Qi Xiao
088b233e69 Name completers le:complete-* instead of le:compl-*. 2017-02-10 03:58:29 -05:00
Qi Xiao
311918120a Ditch edit.CompleterTable. 2017-02-10 03:57:06 -05:00
Qi Xiao
62a0e767c6 Unify and fix handling of $le:{before,after}-readline. 2017-02-09 17:24:22 -08:00
Qi Xiao
5f3c41de5d Rename a validator. 2017-02-09 16:59:32 -08:00
Qi Xiao
b44b91242a Remove unused edit.StringExposer. 2017-02-09 16:57:22 -08:00
Qi Xiao
450867eb17 Ditch eval.BoolExposer in favor of a variable with validator. 2017-02-09 16:54:37 -08:00
Qi Xiao
2f9f28f296 edit.MustBeFn -> eval.ShouldBeFn 2017-02-09 16:49:44 -08:00
Qi Xiao
382c9442dd Renames and comments. 2017-02-09 16:40:53 -08:00
Qi Xiao
3e15c064a6 Let completers depend on Evaler instead of Editor. 2017-02-09 16:27:55 -08:00
Qi Xiao
5b48662204 Don't use Editor.isExternal when completing. 2017-02-09 16:09:04 -08:00
Qi Xiao
16bc9c5a81 util.AllExecutables -> EachExecutable; callback instead of channel. 2017-02-09 15:57:16 -08:00
Qi Xiao
308eb188a3 In edit.listingProvider.Show, separate header and content. 2017-02-09 14:01:37 -08:00
Qi Xiao
4b1b6992ab Test edit/histlist.go (incomplete). 2017-02-04 16:45:40 -08:00
Qi Xiao
7c9dcf8cf9 Test edit/location.go. 2017-02-04 16:26:56 -08:00
Qi Xiao
1c23fed977 Abstract the logic of testing Filter method of listing modes. 2017-02-04 16:26:22 -08:00
Qi Xiao
f3162a24af Oraganize all listing modes uniformally. 2017-02-04 15:52:56 -08:00
Qi Xiao
b62af093ab Test edit/bang.go. 2017-02-04 15:44:01 -08:00
Qi Xiao
3fda76f99f Let the editor not stutter when reporting errors in tip. 2017-02-04 15:08:00 -08:00
Qi Xiao
a63f74b501 Cleanups. 2017-02-04 14:07:19 -08:00
Qi Xiao
1cd7e00939 Use white-on-red for error style. 2017-02-04 09:39:51 -08:00
Qi Xiao
dc2dd00bb0 Use bg-red for error styles.
The current style, styles{"red", "italic"} was translated from "31;3".
However, the "3" in it was actually intended as "inverse" instead of "italic",
since my terminal emulator emulates italics using inverse video. Mea culpa.
2017-02-04 09:34:14 -08:00
Qi Xiao
7c5cb2dc2f Test edit/token.go. 2017-02-03 23:51:30 -08:00
Qi Xiao
3dda4d968c Alt-. and Alt-, now use the parser to break last line into words. 2017-02-03 21:38:17 -08:00
Qi Xiao
3828475f77 Dead code elimination. 2017-02-03 20:47:42 -08:00
Qi Xiao
673cbb312f edit.OldLister -> ListRenderer 2017-02-03 20:47:26 -08:00
Qi Xiao
dbce8a211f Meaningless renames. 2017-02-03 20:36:55 -08:00
Qi Xiao
cfe742f62f More renderers. 2017-02-03 20:34:12 -08:00
Qi Xiao
5e12df7b8b Add one level of abstraction to make ModeLine methods testable. 2017-02-03 15:36:01 -08:00
Qi Xiao
b7a2e7d0df Add a spacey assignment syntax.
This fixes #294.
2017-02-03 10:06:11 -08:00
Qi Xiao
af13837047 Don't write padding for rprompt when there is no rprompt.
Having a lot of spaces at the end of line is different from having a short
line, at least for the macOS terminal. This fix makes terminal transcripts
much nicer.
2017-02-02 23:24:26 -08:00
Qi Xiao
03bb85db00 Ditch extra margins for completion mode. 2017-02-02 16:03:53 -08:00
Qi Xiao
78237bc7b8 Go back to yellow for string styles. 2017-02-01 16:28:48 -08:00
Qi Xiao
ee81f0680c Use specific error types for parse, compile and eval.
Generic error types in util are ditched.
2017-01-28 14:39:52 +00:00
Christian Muehlhaeuser
5dad0ec9c7 Fixed background color in styleForMode (#315) 2017-01-16 23:05:50 +00:00
Christian Muehlhaeuser
66c79bb594 Use proper styles for completion, and use listing-like styles. 2017-01-15 02:21:32 +00:00
Christian Muehlhaeuser
0468c259bb Allow histlist to be filtered case-insensitive (#313)
* Allow histlist to be filtered case-insensitive. Press Ctrl+F to toggle mode

* Ctrl-G for toggling case sensitivity in histlist
2017-01-15 02:03:07 +00:00
Qi Xiao
a0116c61a8 Use dashes instead of underscores in style names. 2017-01-13 01:34:31 +01:00
Christian Muehlhaeuser
fb5b3689cf Make [enter] in histlist or nav-mode return to insert-mode. Alt+Enter keeps you in the current mode 2017-01-12 01:32:56 +00:00
Christian Muehlhaeuser
421d7cc498 Added 'italic' to styleTranslationTable 2017-01-11 19:50:29 +00:00
Christian Muehlhaeuser
94e0275898 Added styles type, which translates human-readable values to ANSI codes 2017-01-11 19:50:29 +00:00
Qi Xiao
df1d28216e Add $le:after-readline. 2016-10-26 18:30:20 +08:00
Qi Xiao
05069da92f Fix Editor.nextHistory.
This fixes #286.
2016-10-22 21:06:09 +08:00
Qi Xiao
d44b3154f7 Separate e: and E:.
This fixes #285.
2016-10-18 22:17:15 +08:00
Qi Xiao
5d5cd8ee91 Support completing environment variables.
This fixes #284.
2016-10-17 21:46:19 +08:00
Qi Xiao
6b67404f25 Read at most 64K for file preview in nav mode.
This fixes #283.
2016-10-17 00:00:26 +08:00
Qi Xiao
defc4f7df7 Show navColumn.err correctly. 2016-10-16 23:47:26 +08:00
Qi Xiao
a80e6d15fa Only preview regular file < 1MB in nav mode. 2016-10-16 22:00:28 +08:00
Qi Xiao
2620318968 Show index in histlist. 2016-10-16 20:10:01 +08:00
Qi Xiao
34e785ce02 Fix panic when histlist is empty. 2016-10-16 19:50:41 +08:00
Qi Xiao
02a38a7ac3 Support file preview in nav mode.
This fixes #282.
2016-10-16 19:45:39 +08:00
Qi Xiao
73169308e2 Support deduplication in history listing mode.
Deduplication can be toggled by Ctrl-D.
2016-10-16 17:56:01 +08:00
Qi Xiao
4762acd258 Implement deduplication in history mode. 2016-10-16 17:12:20 +08:00
Qi Xiao
d8c187cbdc Remove database-based history deduplication. 2016-10-16 16:59:44 +08:00
Qi Xiao
e351113063 edit: listing.List now collects lines instead of entries. 2016-10-15 22:55:05 +08:00
Qi Xiao
fb0731558a Add a blackhole; renames.
This fixes #276.
2016-10-13 23:44:28 +08:00
Qi Xiao
7054a4f0fe Store a util.Traceback in util.PosError. 2016-10-13 23:03:17 +08:00
Qi Xiao
f0f8467fe3 Remove dead code.
Dead code was discovered by github.com/remyoudompheng/go-misc/deadcode.
2016-10-13 21:58:59 +08:00
Qi Xiao
9892f13493 Put edit.buffer in its own file. 2016-10-13 18:21:07 +08:00
Qi Xiao
ec80bc7a80 Improve performance of $le:history.
Slicing and iteration now only costs one database query.
2016-10-13 15:35:33 +08:00
Qi Xiao
7efd489df3 splice -> explode
The author just found out that he had a terrible misunderstanding of the
word "splice".
2016-10-13 14:12:14 +08:00
Qi Xiao
66122b3025 edit: Only drop ASCII control chars when writing.
This fixes #270.
2016-10-13 14:00:52 +08:00
Qi Xiao
3f987e2867 Support completing namespaces.
This fixes #251.
2016-10-12 07:55:03 +08:00
Qi Xiao
f07792c6ee Style x in "except x" as variable. Revamp the stylist. 2016-10-12 01:31:03 +08:00
Qi Xiao
22dcc4780f Fix inaccuracy in the scollbar of completion mode.
This fixes #252.
2016-10-12 00:34:48 +08:00
Qi Xiao
fc9a56f350 In (*completion).List, guard against perLine == 0.
This happens when there are candidates whose texts are very long.
2016-10-11 21:43:40 +08:00
Qi Xiao
c643b6d514 Display one traceback entry correctly.
The traceback displayed is the innermost frame.
2016-10-11 21:37:27 +08:00
Qi Xiao
5ef652c414 Enter in nav mode now inserts selected and quit nav mode. 2016-10-11 21:26:04 +08:00
Qi Xiao
e59e0babb5 Cache result of getLsColor. 2016-10-11 00:04:30 +08:00
Shengjing Zhu
e6c642d99c honor LS_COLORS env (#248)
fix #237
2016-10-10 23:58:53 +08:00
Qi Xiao
7d6c656e71 Move edit.NullClosedInput to eval. 2016-10-10 22:54:58 +08:00
Qi Xiao
c38e22a6a0 When tokenizing, ignore empty node.
This eliminates "bad leaf type *parse.Chunk" in logs.
2016-10-10 19:56:03 +08:00
huiyiqun
4715b96de3 fix #231: Node of next token may be nil, check it (#234) 2016-10-09 16:23:22 +08:00
Qi Xiao
b873d7ec7a Move Wcwidth from edit to util; Wcwidths -> Wcswidth 2016-10-07 19:21:01 +08:00
Qi Xiao
10a5f0bde7 Refresh dir preview when changing filter in nav mode. 2016-10-04 00:50:50 +08:00
Qi Xiao
1dae07a181 Use a transactio for adding command; report possible error. 2016-10-03 23:26:05 +08:00
Qi Xiao
ad969f08be Polish completion listing rendering. 2016-10-03 23:00:22 +08:00
Qi Xiao
aed4820f6d Split the completion column margin to both sides. 2016-10-03 22:45:52 +08:00
Qi Xiao
3e7ed66964 Use black-on-white for completion listing.
This addresses #184.
2016-10-03 22:06:36 +08:00
Qi Xiao
614f929918 Don't make completion listing needlessly tall. 2016-09-27 21:09:21 +02:00
Qi Xiao
a9123a53c6 Don't use SQL "LIKE" for filtering in loc mode.
This fixes #218.
2016-09-19 16:24:16 +02:00
Qi Xiao
7bdca02695 Normalize Ctrl-{a-z} to upper case; Ctrl-{I,J} to {Tab,Enter}. 2016-09-16 16:01:22 +02:00
Qi Xiao
66473a0ce2 edit: Reorganize. 2016-09-16 13:43:49 +02:00
Qi Xiao
6d2b42c4d3 edit: Reorganize. 2016-09-15 22:54:32 +02:00
Qi Xiao
4fa61a44e5 Move the getopt package into tree. 2016-09-15 15:48:56 +02:00