Commit Graph

186 Commits

Author SHA1 Message Date
Qi Xiao
e105493ac8 pkg/cli: Fix the height distribution algorithm to match the comment. 2023-12-31 21:19:32 +00:00
Qi Xiao
7c429c70d4 Fix the rendering of listboxes when height = 1.
Fix the division by 0, and special-case this condition to show one row of
content and hide the scrollbar.

This supersedes #1736.
2023-12-31 21:16:28 +00:00
Kurtis Rader
0e9c21e8bf Fix typos
I recently upgraded my `codespell` command to version 2.2.6 which caused
creating a pull-request to catch the typos fixed by this change.
2023-11-19 21:44:44 -08:00
Qi Xiao
ad691e7812 Fix lscolors test on Windows. 2023-07-18 12:35:15 +01:00
Qi Xiao
a743f959a2 Add regression test for #1710. 2023-07-17 23:51:11 +01:00
Alexandr Shavykin
2e1a1e1d38
Update stat_unix.go
Fixes multihardlink directory styling on unix
2023-07-16 18:46:17 +03:00
Qi Xiao
5edb915d1a Fix build tag of Unix-only test file. 2023-07-13 22:21:36 +01:00
Qi Xiao
34cc3653f9 pkg/cli/modes: Fix the handling of named pipes in nav previews. 2023-07-13 22:12:12 +01:00
Qi Xiao
0adf0ec147 Use the unix build tag.
The unix build tag is supported by Go 1.19.
2023-03-03 00:01:26 +00:00
Qi Xiao
4187d41da4 pkg/cli: Notify about unbound keys.
This gives the user some useful feedback that a key was received but not bound.

The feature was present in the original implementation of the line editor but
was lost during the rewrite.
2023-03-03 00:01:26 +00:00
Qi Xiao
eea5312e22 Fixup for #1638. 2023-02-26 20:42:10 +00:00
rok
df8642ee69 pkg/edit: implement edit:history:accept
It's api to and update codebuffer with current entry in histwalk mode.

Resolves #1636
2023-02-14 15:53:06 +00:00
Qi Xiao
de3a7fd1b3 Standardize spelling: UNIX -> Unix.
https://en.wikipedia.org/wiki/Unix#Branding contains a history of the spelling.
Follow Wikipedia in using Unix instead of UNIX.
2023-01-04 18:09:11 +00:00
Qi Xiao
9f7312a802 pkg/ui: Improve API for Text.
- Add a TextBuilder for building a Text efficiently.

- Remove NormalizeText, and make functionsn this package always return already
  normal Text instances.

- Rename Style.{Foreground Background} to Fg and Bg.

- Fix the Repr output of both Text and Segment.
2023-01-02 01:00:26 +00:00
Qi Xiao
49b7c0c464 pkg/cli: Change highlighter API to return general "tips" rather than errors.
This is to prepare for displaying autofix code snippets in the REPL.
2022-12-11 12:47:48 +00:00
Qi Xiao
1acc45cfc2 pkg/edit: Show dedup binding in history listing mode.
Also fix a lot of elvdoc.
2022-12-06 22:51:15 +00:00
Qi Xiao
ad021cc708 pkg/cli: Hide errors in final redraw. 2022-11-29 22:38:14 +00:00
Qi Xiao
3847235a14 pkg/diag: Split Errors into another package.
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.
2022-11-29 22:13:02 +00:00
Qi Xiao
1c4052f83e pkg/edit: Show bindings for toggling filter and hidden files in nav mode.
This fixes #1529.
2022-11-26 16:57:53 +00:00
Qi Xiao
464c555038 Move cmd/examples into pkg/cli. 2022-11-12 22:49:44 +00:00
Qi Xiao
89063ab095 Manually cherry-pick codespell changes from #1613. 2022-10-23 23:57:01 +01:00
Kurtis Rader
c6e10f12a2 Some minor documentation fixes
Mostly elimination of duplicated words but also a few other fixes such
as the output of commands such as `%`.
2022-08-29 12:04:59 +01:00
Qi Xiao
2e788c846d Run gofmt.
https://tip.golang.org/doc/go1.19#go-doc
2022-08-07 22:30:11 +01:00
Qi Xiao
7855bc0fd7 pkg/cli/modes: Improve nav mode test coverage. 2022-06-21 23:27:36 +01:00
Qi Xiao
75c230f5eb pkg/cli/lscolors: Increase test coverage. 2022-06-20 23:24:11 +01:00
Qi Xiao
98ee4aebdd pkg/cli/histutil: Ignore coverage of testDB. 2022-06-20 23:06:07 +01:00
Qi Xiao
4afbb71c07 Move pkg/testutil/must.go to a new pkg/must. 2022-06-20 20:29:14 +01:00
Qi Xiao
5bf0290741 pkg/cli/term: Support surrogate pairs on Windows.
This fixes #1502.
2022-06-06 23:12:54 +01:00
Qi Xiao
2c30cf9806 Fix staticcheck errors on Windows. 2022-06-05 22:46:24 +01:00
Qi Xiao
f043bd33fb Fixup for #1549. 2022-06-05 22:37:52 +01:00
Kurtis Rader
fa704d6ac6 Implement edit:command-abbr
It turns out that the "small word" abbreviation mechanism I added isn't
really what I, or most users, want. What users really want, at least
most of the time, is the Fish shell abbreviation behavior of expanding
an abbreviation only in the command head position.

Resolves #1472
2022-06-05 22:15:07 +01:00
Qi Xiao
8b0c7fdb36 Fix some lint warnings found on Windows. 2022-06-05 22:01:16 +01:00
Kurtis Rader
345c5c66dd Don't dot import pkg/ui
Qualified imports of pkg/ui outnumber unqualified (82 to 1). Improve
consistency, and clarity, by changing the dot (unqualified) imports of
that package symbols to qualified.
2022-06-04 23:39:19 +01:00
Kurtis Rader
71cd3835bc Don't dot import pkg/tt
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.
2022-06-04 23:39:19 +01:00
Qi Xiao
8519085327 clitest: Make failures in TestBuffer and TestNotesBuffer fatal.
If a buffer (or notes buffer) hasn't appeared, it means that the app is not in
some intended state. Subsequent tests are unlikely to be meaningful, and may run
into race conditions.

A lot of existing code already uses TestBuffer to ensure that a certain state is
reached, and making failures fatal also suits this usage better.

This fixes #1507.
2022-04-09 14:40:52 +01:00
Qi Xiao
51e4d97568 interface{} -> any now that Elvish requires Go 1.18. 2022-03-20 16:17:19 +00:00
Qi Xiao
f7cb556d9b Require Go 1.18.
- Run "go fix" to remove legacy build tags

- Use staticcheck@master until it has a release that supports Go 1.18

- Turn off autocrlf for Windows tasks
2022-03-20 15:28:23 +00:00
Qi Xiao
e2901118a5 Simplify terminal setup functions.
Remove SetupGlobal and Sanitize and replace them with a SetupForEval, which is
similar to Setup, but called before evaluating code and returns a function to
call after evaluating code.
2022-03-18 10:54:01 +00:00
Qi Xiao
e85afa2cbe Fixup for PR #1499.
- Use filepath.Ext instead of path.Ext

- Use cmp.Diff to generate test failure messages

- Misc stylistic changes
2022-03-12 23:22:34 +00:00
Kurtis Rader
603aae077d Improve searching PATH on Windows for completions
This was extracted from https://github.com/elves/elvish/pull/1326. It
augments that change by honoring $E:PATHEXT and some other
minor improvements.  This matches the behavior of the Go stdlib
os/exec.LookPath() function that is used to decide if what has been typed
(in a non-completion context) represents an external command.
2022-03-12 22:49:52 +00:00
moko256
c8f678d2a5 On Windows, implement sanitize in pkg/cli/term/setup_windows to cleanup console modes that external command changed 2022-03-06 23:33:17 +00:00
Qi Xiao
84b72af4ca Support using styled text in &display to edit:complex-candidate.
This fixes #1011.
2022-01-03 20:30:00 +00:00
Qi Xiao
c46fd60270 Properly clear the filter when ascending or descending in nav mode.
Also add regression tests for this behavior.
2021-12-30 12:58:34 +00:00
Qi Xiao
46774d7078 Use (*Evaler).Chdir for changing directory in navigation mode.
This will run the hooks and update $E:PWD correctly.
2021-12-28 17:52:09 +00:00
moko256
c054b0a24d pkg/cli/term: Use ENABLE_WRAP_AT_EOL_OUTPUT on Windows. 2021-12-16 22:20:44 +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
5b490475e7 pkg/testutil: ScaledMs -> Scaled, takes a time.Duration instead. 2021-10-05 01:02:54 +01:00
Qi Xiao
3f418dfd5c pkg/cli/term: Fix test on Windows. 2021-10-03 00:35:32 +01:00
Qi Xiao
00c26410cc pkg/cli/term: Increase coverage of buffer.go and reader.go. 2021-10-03 00:29:55 +01:00
Qi Xiao
0219b99add pkg/cli/term: More tests for convertEvent in reader_windows.go. 2021-10-03 00:03:02 +01:00