Commit Graph

51 Commits

Author SHA1 Message Date
Qi Xiao
cc6e02d206 pkg/edit: Make smart-enter and completion:smart-start apply autofix. 2022-12-25 13:50:17 +00:00
Qi Xiao
94ab1b5390 Generalize parse.Errors and move it to diag.
This generalized type will be used to pack multiple compilation errors.
2022-11-30 01:05:16 +00:00
Qi Xiao
a3f4384495 Move all elvdocs into .d.elv files.
The elvdocs still use the old format (#elvdoc:fn or #elvdoc:var) for now, but
will be changed to "fn" and "var" forms soon.

Also remove the accidentally committed cmd/mvelvdoc. It has been used to perform
the conversion automatically but is not supposed to be committed.
2022-11-20 21:59:45 +00:00
Qi Xiao
27e2df9394 Remove edit:-dump-buf.
This used to be used for taking ttyshots but is now obsolete.
2022-09-11 15:33:59 +01:00
Kurtis Rader
2f21892e0c
Documentation fixups (#1584)
I noticed these functions didn't have a "usage" while working on a `help` command.

Co-authored-by: Qi Xiao <xiaq@users.noreply.github.com>
2022-09-11 15:28:32 +01:00
Kurtis Rader
14321f9e82 Make parse.Source naming more consistent
Fixes #1545
2022-05-29 17:36:29 +01:00
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +00:00
Qi Xiao
38d4553833 Update assignment syntax in docs.
- Also remove the section for the legacy assignment syntax.

- Also add a paragraph to "eval" about upvalues.
2022-01-03 19:45:39 +00:00
Qi Xiao
1ec9c95142 Fix the doc for ttyshots.
- Wrap the command in "print" to get byte output.

- Use global-binding to ensure that the key works in all modes.
2021-12-28 13:01:21 +00:00
Qi Xiao
8cbd39f006 Support calling edit:notify with a styled text.
This fixes #1438.
2021-12-08 00:26:17 +00:00
Qi Xiao
b6cf0a355f Fixup for #1417 2021-11-07 15:08:22 +00:00
Sauyon Lee
1b4f2b32df pkg/edit: Implement transpose-{alnum- small- ""}word 2021-11-07 14:50:57 +00:00
Sauyon Lee
66a3116451 pkg/edit: Implement transpose-char 2021-11-07 14:50:57 +00:00
Sauyon Lee
7ec375e583 pkg/edit: Add makeTransform helper for modifying content and dot 2021-11-07 14:50:57 +00:00
Sauyon Lee
56cfb06f9a pkg/edit: Factor out some word logic into helper functions 2021-11-07 14:50:57 +00:00
Qi Xiao
d71e52cbd7 Refactor the API of eval.NsBuilder to be completely based on methods. 2021-10-23 21:44:11 +01:00
Qi Xiao
64b52d08aa pkg/edit: Correct the elvdoc for edit:notify. 2021-10-03 22:58:45 +01:00
Qi Xiao
f011034c06 pkg/cli: Simplify the API for dismissing a widget.
- Rename the method from "Close" to "Dimiss" to avoid any conflict with the
  standard interface{ Close() error }

- Remove the "accept" parameter from the Dismiss method and App.PopAddon - it is
  false in most places, and the few places that pass accept=true has knowledge
  of how to accept the state in the particular widget.

- edit:history:accept has been removed as a consequence - it is never
  documented, and is not currently used by any Elvish code published on GitHub
  (https://github.com/search?q=%22edit%3Ahistory%3Aaccept%22+extension%3Aelv&type=Code)
2021-09-07 23:16:01 +01:00
Qi Xiao
db0b88f664 Rename pkg/cli/mode -> pkg/cli/modes. 2021-09-03 20:44:04 +01:00
Qi Xiao
9ca81b9954 Make editor builtins that operate on code area use the focused code area.
This will allow using all such builtins from the minibuf mode.
2021-09-01 22:41:39 +01:00
Qi Xiao
1bfcaeb218 Support a stack of addons in cli.App.
This is motivated by supporting a minibuf from any mode (even in minibuf mode
itself), but could have other applications too.
2021-08-30 00:55:09 +01:00
Qi Xiao
fc887b2466 Expand the elvdoc for edit:notify. 2021-06-28 15:10:58 +01:00
Qi Xiao
75a3d5bfb3 Add back edit:notify.
Also correct the doc for return-{line eof}.
2021-06-28 15:09:39 +01:00
Qi Xiao
657b73122f Change all builtin commands writing value output to surface ReaderGone.
Also replace (*Frame).OutputChan with (*Frame).ValueOutput, which returns a
small interface for writing to the value output that is also aware when the
reader is gone.
2021-06-18 00:14:59 +01:00
Kurtis Rader
663e04ff75 Fix when cursor is shown by edit:clear
Showing the cursor should only happen after the prompt is redrawn.

Fixes #1238
2021-03-19 21:12:21 +00:00
Qi Xiao
b2591e95a7 Add new edit:clear command.
This fixes #1238.
2021-02-26 00:36:09 +00:00
Qi Xiao
15af76a22e pkg/edit: Add edit:global-binding for global bindings.
The binding of Esc to close modes is now a default global binding, instead of in
every mode.
2021-02-14 02:05:13 +00:00
Qi Xiao
52dbfeea66 pkg/cli/mode: Expose the stub mode as a widget. 2021-02-12 23:14:25 +00:00
Qi Xiao
7f0463a156 pkg/cli: Pass the widget to binding bodies.
A new type, tk.Bindings is defined for bindings. It is always called with the
widget currently handling the event, in addition to the event being handled.
2021-02-12 21:34:47 +00:00
Qi Xiao
c2319fbf59 pkg/cli: Add a SetAddon method to App. 2021-02-12 18:43:34 +00:00
Qi Xiao
3767095544 pkg/cli: Further trim down the API
* Remove the utilities {'' Set}{CodeBuffer Addon}.

* De-export the Focuser interface.
2021-02-11 21:50:35 +00:00
Qi Xiao
0427c536d0 Simplify the API of pkg/cli.
* Move all widget types to a new pkg/cli/tk.

* Move Mode{Line Prompt} to a new pkg/cli/mode.

* Move all packages in pkg/cli/addons to pkg/cli/mode.

* Remove WriteListing.

* Remove StdTTY.

* Rename GetCodeBuffer to CodeBuffer.
2021-02-11 19:24:37 +00:00
Qi Xiao
699f5f45d2 pkg/edit: De-export MakeBindingMap too. 2021-02-11 01:53:28 +00:00
Qi Xiao
c96bfade21 pkg/parse: Small API tweak. 2021-02-01 14:20:56 +00:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
7584319b69 pkg/parse: MultiError -> Error; add a GetError function. 2021-01-01 23:19:03 +00:00
Qi Xiao
6419f4524a Implement namespaces using slices instead of maps.
More related improvements and cleanups will be done in followup commits.

This fixes #1139.
2020-12-25 17:46:46 +00:00
Qi Xiao
ee62608e88 pkg: Move string utilities from util/ to strutil/.
Also remove unused functions.

There were two (correct) implementations of deciding whether a string has
another string as a subsequence; keep the more performant one.
2020-09-03 05:08:01 +01:00
Kurtis Rader
d061a258ea
Add $edit:small-word-abbr, and document $edit:{small-word- ''}abbr (#980)
Augment the implementation by adding support for small word based
expansion to that mimics typical editor behavior. This also makes it
safer to create and use abbreviations that consist of alphanum sequences
without having them expanded in unexpected places.

Resolves #947
2020-06-13 23:51:12 +01:00
Qi Xiao
5d30ddb85f pkg/edit: Fix the heading of edit:redraw. 2020-05-18 00:09:16 +01:00
Qi Xiao
20979b44a2 pkg/parse: Use Source values, not pointers.
The Source type is small enough that using values is likely more efficient.
2020-04-25 19:22:38 +01:00
Qi Xiao
13f7b29707 pkg/parse: Add a new Parse function and a Tree type.
This replaces the AsChunk function. All current users of parse.AsChunk has been
changed to use parse.Parse instead.
2020-04-25 19:16:22 +01:00
Qi Xiao
3037f6c8bf pkg/util: Move the wcwidth utilities to a new package, and add more tests.
This addresses #944.
2020-04-06 12:00:01 +01:00
Qi Xiao
794c19e19f pkg/ui: Export ParseKey and move ToKey to pkg/edit. 2020-03-31 23:05:41 +01:00
Qi Xiao
d623dafd35 pkg/edit: Fix move-dot-left-small-word.
Noticed by @Xjs in pr.elv.sh/911.
2020-02-16 23:08:56 +00:00
Qi Xiao
e9a8d1be91 pkg/edit: Support a &full flag in edit:redraw.
Also use it in readline-binding. This fixes #883.
2019-12-30 23:45:30 +00:00
Qi Xiao
d4c434334f website: Use elvdoc for the ref/edit.md.
All existing docs that are not in elvdoc form are added to corresponding files
in pkg/edit.
2019-12-26 15:23:40 +00:00
Tw
93a6f11993 fix a kill-small-word-left typo (#880)
Signed-off-by: Tw <wei.tan@intel.com>

Co-authored-by: Wei Tan <wei.tan@intel.com>
2019-12-26 01:19:15 +00:00
Qi Xiao
8fd49cada9 Merge pkg/cli/el/* into pkg/cli. 2019-12-26 01:15:24 +00:00
Qi Xiao
7716c2603f pkg/cli/el/*: Rename symbols, preparing for package merge. 2019-12-24 16:00:55 +00:00