This fixes#1668, because the crashing listbox rendering code uses "len(line) >
0" (where line is a ui.Text) to test whether it is non-empty. This test doesn't
work with the ui.Text constructed using "styled ''", which creates a ui.Text
with one empty segment.
The functions from the ui package are guaranteed to never return such ui.Text
instances, so switching the implementation of the styled builtin to functions
from the ui package fixes this.
* Correct slice indexing convention in code comment
A colon is not supported.
* Add more key slices tests
* Unify `has-key` tests with those from `pkg/eval/vals/has_key_test.go`
* Fix key slice format in documentation
Fixes#1646.
* Fix missing bracket
* Fix indexing
* Add more key slices `has-key` tests
* Fix `has-key` test expected value
For example, [`put`]() links to the elvdoc for "put".
Also remove the @cf macro now that implicit targets make it easier to link to
other elvdoc sections.
For example, a link to language.html#number is converted to point to
https://elv.sh/ref/language.html#number instead. Such links are quite common in
elvdocs.
Also convert all link destinations that use ./language.html to use language.html
instead, and add a check in tools/check-disallowed.sh to ensure that remains the
case.
The Error methods used to show the start and end indices, while the Show methods
used to show line ranges.
Showing line:col of the start position seems to be pretty standard; both Go and
Rust do that.
I tried including the line:col of the end position too, but can't find a good
enough format.
The Errors function is not related to diag.Error, so keeping it in the same
package is confusing.
Also unexport the MultiError type. This allows its Error method to be
simplified, as it can assume that it always contains at least 2 errors.
We are no longer using Pandoc, so this limitation can be lifted.
Also make @cf generate internal links where applicable in non-builtin modules:
"@cf mod:fn" in the doc of "mod" now links to just "#mod:fn" instead of
"mod.html#mod:fn".
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.
* Allow $nil for Callable options
Related #1570
* Add a `&key` option to the `order` command.
Resolves#1570
Co-authored-by: Qi Xiao <xiaq@users.noreply.github.com>
A year ago I submitted a change to replace AnyError with tests for specific
errors (see https://github.com/elves/elvish/commit/87656c99). This does
something similar for DoesNotCompile. This ensures the test does what
is implied and makes correlating specific unit tests with compilation
errors easier.
This includes a couple of changes to compilation error messages to improve
readability (IMHO) but those are not the primary purpose of this change.
Related #1560
- Let file:is-tty always take one argument.
- Revert change to eval.ByteOutput.
- Make sys.IsATTY take a FD instead, to avoid the need to use os.NewFile. Using
os.NewFile can cause the Go runtime to start polling the file, which
interferes with Elvish's terminal reader.
- Keep more metrics than just the minimal duration.
- Change default &min-time to 1s.
- Don't allow unitless value as &min-time.
- Rename &on-run to &on-run-end, and &min-iters to &min-runs.
The method returns a message saying that there is no valid value if ValidHigh <
ValidLow. This was useful when these fields were numbers, but since they are now
strings this no longer works.
I noticed this when testing my `help` command and noticed that
`help builtin:` produced three lines of "usage" text that did not
include a function or variable name.
This is used in ttyshots to get deterministic outputs.
This command is prefixed with - since I'd like to eventually move rand and
randint into their own module, so this command will be moved too.
Styled text is not supposed to "inherit" the current SGR styling context when
written to the terminal. This has always been the intention, but not correctly
implemented. This commit fixes that for both styled segments and styled texts.
Tests are amended to account for the difference in the output.
With context insensitivity correctly implemented, there is now no need for a
"default" color. It is functionally equivalent to a lack of color.
The parsing of SGR still needs to be aware of the codes 39 (default foreground)
and 49 (default background), but these codes are now translated into FgDefault
and BgDefault, which resets the foreground and background color fields.
In addition to fixing the encoding bugs standardize on \xNN notation for
bytes rather than \uNNNN; e.g., \x00 rather than \u0000.
Also, update the documentation for double-quoted strings to include the
\e sequence.
Fixes#1528
Qualified imports of pkg/tt outnumber unqualified (27 to 24). Improve
consistency, and clarity, by changing the dot (unqualified) imports of
that package symbols to qualified.
Qualified imports of pkg/testutil outnumber unqualified (55 to 7). Improve
consistency, and clarity, by changing the dot (unqualified) imports of
that package symbols to qualified.