Commit Graph

4913 Commits

Author SHA1 Message Date
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
5f0e4fc196 pkg/eval: Remove the bool return value of GetCompilationError.
This is done for consistency with parse.GetError.
2021-01-01 23:27:11 +00:00
Qi Xiao
7584319b69 pkg/parse: MultiError -> Error; add a GetError function. 2021-01-01 23:19:03 +00:00
Qi Xiao
973a7931de website: Remove link to old Matrix room.
This fixes #1194.
2020-12-29 14:38:38 +00:00
Qi Xiao
e4cebea152 pkg/eval: Simplify the tests for -source by running them in a temp dir. 2020-12-29 13:46:03 +00:00
Qi Xiao
3615988408 Change signature of "exec" and "fg" on Windows to match that on Unix.
This fixes #1195.
2020-12-26 22:59:18 +00:00
Qi Xiao
3e29266ee0 pkg/eval: Remove unused (*Evaler).InstallBundled. 2020-12-26 03:26:10 +00:00
Qi Xiao
719314c029 pkg/eval: Various cleanups for qname handling code. 2020-12-25 22:31:52 +00:00
Qi Xiao
8613527450 pkg/eval: Deduplicate code for command head resolution. 2020-12-25 21:30:57 +00:00
Qi Xiao
41bed735e7 pkg/shell: Install the edit module in the builtin namespace.
Installing it in the global namespace doesn't work, since modules may use the
edit namespace.
2020-12-25 21:01:47 +00:00
Qi Xiao
9a6d53e012 Fix Windows build. 2020-12-25 17:58: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
09829ae9cd pkg/eval: Update doc of the "not" command. 2020-12-25 17:46:09 +00:00
Qi Xiao
15d69f98ff pkg/ui: Clarify godoc comments for Concat and RConcat implementations. 2020-12-25 17:43:47 +00:00
Kurtis Rader
f94a0ec735 Trivial documentation consistency change
I noticed that most places in the documentation that emit a "note"
about Elvish behavior use `**Note**:`. There were two places that use
all uppercase. Make those consistent with the other uses. Also clarify
the note associated with the `not` builtin.
2020-12-25 17:43:32 +00:00
Kurtis Rader
d52aa03764 In prompts implicitly coerce float64 to string
Including the float64 data type in the prompt value stream causes an error.
This causes those values to be implicitly converted to a string as happens
everywhere else in Elvish.

I initially intended to modify the code to do the implicit string coercion
for any type not otherwise explicitly handled by the pkg/ui `Concat`
methods. I decided against that approach because doing so doesn't make
sense for some types that might appear in the value stream; e.g., Elvish
exceptions.

Fixes #1186
2020-12-25 17:34:49 +00:00
Qi Xiao
2bf7a5d8d1 Apply feedback for PR #1181. 2020-12-25 01:13:19 +00:00
Kurtis Rader
4df5e8e015 Use exported methods to access ports
Commit 734eb95 changed most uses of `fm.ports[x].` to a public method
that makes the intent clearer. This changes a couple of uses that were
overlooked by that prior change.
2020-12-25 01:11:33 +00:00
Kurtis Rader
9c7c9cf7d9 [cleanup] trivial golint suggested changes
As with commit #eb2a792 I acknowledge that `golint` recommendations are
controversial and should not automatically be acted on. Nonetheless,
this change fixes legitimate lint issues such as copy/paste cleanups,
style problems I introduced (`i += 1` versus `i++`) or method/var comments
that are not in the preferred form.
2020-12-25 01:11:33 +00:00
Qi Xiao
bd69facfb2 Add benchmarks for variable access.
Also change the benchmarks to only benchmark eval time, excluding parse and compile.
2020-12-25 00:44:26 +00:00
Qi Xiao
11751f87ac Address feedback in PR #1177. 2020-12-25 00:44:26 +00:00
Kurtis Rader
122ce3b7d1 allow binding to a literal control char
It should be possible to bind a key to a literal control character. For
example, it should be possible to write:

    edit:insert:binding["\e"] = $edit:command:start~

as a logically equivalent alternative to the preferred form:

    edit:insert:binding[Ctrl-'['] = $edit:command:start~

Resolves #1185
2020-12-25 00:39:43 +00:00
Kurtis Rader
3c29912b3f Improve test coverage
I noticed my prior change did not verify that symbolic key name `Ctrl-?`
was equivalent to `Backspace`.
2020-12-25 00:39:43 +00:00
Kurtis Rader
9edcb78050 Make key binding syntax more consistent
Document the format key of names and modifiers; albeit with a TODO
regarding the `Shift` modifier.

Make function key modifier matching case sensitive (`Alt` not `alt`)
to match key name matching (`Enter` not `enter`).

Implement `Ctrl-?` as the logical counterpart to `"\c?"`.

Resolves #1163
2020-12-25 00:39:43 +00:00
Qi Xiao
6f3b8a787b Minor fixup for last commit. 2020-11-07 19:02:44 +00:00
Kurtis Rader
b58b495d77 Fix hang reading value channel from a redirection
Fixes #600
Fixes #1010
2020-11-07 13:52:29 -05:00
Qi Xiao
b11fe9d257 pkg/cli: Treat Ctrl-H the same way as Backspace in CodeArea's default key handler.
This fixes #1178.
2020-11-07 18:44:18 +00:00
Qi Xiao
e919c53c8b Minor fixup for navigation mode. 2020-11-07 18:37:18 +00:00
Kurtis Rader
b5b73c6e3d Address PR feedback regarding testutil.ApplyDir 2020-11-07 13:17:00 -05:00
Kurtis Rader
a943dc764a Improve navigation mode corner cases
There are some Navigation mode corner cases whose current behavior is
surprising. Such as inserting a space before the filename when the space
isn't wanted or redundant. Also, selecting an empty directory and pressing
Enter should insert nothing rather than an empty string.

Fixes #1169
2020-11-07 13:17:00 -05:00
Kurtis Rader
f1baa70a78 Fix the $pwd tests
Not sure what happened but my fix for issue #1120 resulted in the core
unit test module not being executed due to a bogus "// +build wtf"
comment. Apparently I was experimenting with "+build" directives and
forgot to remove that line. This also improves the test coverage of the
$pwd code from 44% to 100%.
2020-10-28 19:36:01 -04:00
Qi Xiao
80208d3972 Remove stale go:generate lines.
This fixes #1175.
2020-10-28 23:12:56 +00:00
Qi Xiao
d27cee0724 pkg/edit: Update error message to refer to just "show" instead of "exc:show". 2020-10-23 12:36:24 +01:00
Kurtis Rader
784c4159d2 Minor documentation improvements
Fixing issue #857 will require some non-trivial work. But I noticed these
documentation cleanups when I started working on the issue so I'm making
them as an independent change.

Related #857
2020-10-22 15:28:06 +01:00
Kurtis Rader
0c30310167 Produce actual diffs when running make checkstyle
Resolves #1117
2020-10-22 15:26:51 +01:00
Qi Xiao
2cf7f8f0ec Small wording fix for Effective Elvish. 2020-10-10 22:47:56 +01:00
Qi Xiao
318efef553 Remove the "binding" bundled module.
It is some leftover code from the old editor and is no longer used.
2020-10-10 22:47:56 +01:00
Shengjing Zhu
6c08de0ff3 Fix typos found by codespell 2020-10-10 22:47:50 +01:00
Scott Reeves
864097a4ce Update elvdocs referencing deprecated splits 2020-10-10 22:44:00 +01:00
Scott Reeves
c5e2069e65 Update "Effective Elvish" for deprecated functions 2020-10-10 22:44:00 +01:00
Kurtis Rader
7bbf75756c Replace "kr" package dependency with "creack"
I was working on issue #661 and noticed that github.com/kr/pty was dead
when I ran into a problem with that module on macOS (GOARCH == darwin).
Replace that dependency with github.com/creack/pty which is ostensibly
being actively maintained.

I also chose to remove a couple of obsolete module signatures at the
same time.
2020-10-10 22:41:09 +01:00
Scott Reeves
3085870115 Try to resolve confusion around Alt-1 vs. Alt-, 2020-10-10 22:38:36 +01:00
Qi Xiao
04015806a6 website/learn/unique-semantics: add back comparison with &&. 2020-10-10 22:31:29 +01:00
Qi Xiao
672f097a2c pkg/eval: Break up value.go. 2020-10-10 22:28:13 +01:00
Qi Xiao
734eb955e2 pkg/eval: Use exported methods to access ports from builtin functions. 2020-10-10 22:28:13 +01:00
Kurtis Rader
10085080f2 Fix typos and clarify wording 2020-10-10 22:27:45 +01:00
Qi Xiao
5ec11cfe2b Update docs for $_ and $nil. 2020-09-04 22:45:04 +01:00
Qi Xiao
5cb2a83959 website/ref/language.md: Fix typo. 2020-09-04 22:41:32 +01:00
Qi Xiao
bd1348e6c8 pkg/fsutil: Add correct build tag to search_unix_test.go. 2020-09-04 22:36:52 +01:00
Qi Xiao
a88ac31b39 pkg/eval: De-export PwdVariable. 2020-09-04 22:32:41 +01:00