Commit Graph

29 Commits

Author SHA1 Message Date
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +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
d71e52cbd7 Refactor the API of eval.NsBuilder to be completely based on methods. 2021-10-23 21:44:11 +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
b6cc46e13f pkg/edit: Simplify some code that accesses the active widget. 2021-09-01 23:17:21 +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
Kurtis Rader
12980c2719 Some golint cleanups 2021-04-05 15:31:53 +01:00
Qi Xiao
c7dc4d93d3 pkg/cli/mode: Add back the "Mode" prefix to ModeLine and ModePrompt. 2021-02-12 22:37:46 +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
278e7d7191 Improve API of pkg/edit.
* De-export BindingMap, as it is only used within the package.

* Improve the godoc of the Editor type.
2021-02-11 01:50:45 +00:00
Qi Xiao
196eea21d4 Change module import path to src.elv.sh 2021-01-27 01:30:25 +00:00
Qi Xiao
2033600881 pkg/eval: Clean up Port related code. 2021-01-05 05:23:17 +00:00
Qi Xiao
dc59cbfeb4 pkg/eval: Make (*Evaler).Eval accept a Source instead of an Op.
Most callers can now call it with the source to evaluate, without having to call
ParseAndCompile first themselves.
2021-01-02 00:10:26 +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
c53c094e78 pkg/edit: Save exceptions in $edit:exceptions.
This fixes #945.
2020-05-02 23:29:55 +01:00
Qi Xiao
90d212abe6 pkg/edit: Change the notifier interface to be implemented by *Editor.
This is preparing for the work of saving exceptions in a variable (#945).
2020-05-02 23:28:42 +01:00
Qi Xiao
c767f92d01 Support compile-time deprecation.
This fixes #898.
2020-04-26 13:14:51 +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
b8505c7065 pkg/eval/source.go -> pkg/parse/source.go. 2020-04-25 18:26:17 +01:00
Qi Xiao
53a1eca9af pkg/eval: Remove New*Source functions.
All call sites of such functions are replaced with simple &Source{...}
expressions.
2020-04-25 13:22:07 +01:00
Qi Xiao
0c50e93ebd pkg/eval: Remove (*Evaler).EvalInTTY.
This is so that pkg/program/shell can get rid of the dependency on the standard
streams and can dependency-inject the files.
2020-04-16 00:11:23 +01:00
Qi Xiao
d77ad829b6 pkg/eval: Add Evaler.ParseAndCompile.
Also require a name argument in NewInteractiveSource.
2020-04-14 23:54:45 +01: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
Qi Xiao
e45fdf7228 Move all libraries to new pkg/. 2019-12-23 20:00:59 +00:00