Compare commits

..
Author SHA1 Message Date
dependabot[bot] 0ede943dd3 chore(deps): bump golang.org/x/sys from 0.48.0 to 0.49.0
Bumps [golang.org/x/sys](https://github.com/golang/sys) from 0.48.0 to 0.49.0.
- [Commits](https://github.com/golang/sys/compare/v0.48.0...v0.49.0)

---
updated-dependencies:
- dependency-name: golang.org/x/sys
  dependency-version: 0.49.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-10-30 00:25:19 +00:00
16 changed files with 30 additions and 144 deletions

No files matched your search

+1 -8
View File
@@ -10,10 +10,6 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
## Unreleased
### Changed
- The `mark-save` command now displays a list of existing marks (#2722).
### Added
- The `cd` command now supports `-` to change to the previous directory (#2693).
@@ -26,10 +22,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
- Readline markers in `promptfmt` are no longer rendered as visible characters (#2657).
- Selecting entries with the mouse no longer causes the file list to jump unexpectedly (#2664).
- A bug where executing the `quit` command multiple times in quick succession could cause `lf` to become unresponsive is now fixed (#2674).
- The home directory abbreviation `~` (#2679) and its expansion (#2687) no longer match partial path components.
- A bug where quitting `lf` required an additional key press on some platforms is now fixed (#2684).
- The terminal state is now restored when `lf` receives `SIGHUP`, `SIGQUIT`, or `SIGTERM` (#2701).
- Natural sorting now correctly compares numbers regardless of their length (#2714).
- The home directory abbreviation `~` no longer matches partial directory names (#2679).
## [r42](https://github.com/gokcehan/lf/releases/tag/r42)
-4
View File
@@ -12,10 +12,6 @@ If your feature can be implemented as a configuration option, **please add it to
For bug fixes, you can simply send a pull request.
## Automated contributions
Pull requests generated entirely by AI tools or submitted as part of mass-submission campaigns are not accepted. Such pull requests may be closed without review and labeled as spam.
## Code conventions
In addition to `gofmt` and friends (e.g. [go vet](https://pkg.go.dev/cmd/vet), [staticcheck](https://staticcheck.dev/), [golangci-lint](https://golangci-lint.run/)), we have a few conventions:
+1 -1
View File
@@ -553,7 +553,7 @@ func (app *app) runCmdSync(cmd *exec.Cmd, pauseAfter bool) {
app.ui.echoerrf("running shell: %s", err)
}
if pauseAfter {
app.ui.anyKey()
anyKey()
}
app.ui.loadFile(app, true)
-2
View File
@@ -187,8 +187,6 @@ func readExpr() <-chan expr {
p := newParser(strings.NewReader(s.Text()))
if p.parse() {
ch <- p.expr
} else if p.err != nil {
ch <- &callExpr{"echoerr", []string{p.err.Error()}, 1}
}
}
}
+2 -14
View File
@@ -201,18 +201,6 @@ func matchWord(s string, words []string) (matches []compMatch, longest string) {
return
}
func matchOpt(s string, words []string) (matches []compMatch, longest string) {
matches, longest = matchWord(s, words)
if strings.HasPrefix(s, "no") {
// Show negated options without their prefix in the menu.
// TODO: Update if a future option ever starts with "no".
for i := range matches {
matches[i].name = matches[i].name[2:]
}
}
return
}
func matchList(s string, words []string) (matches []compMatch, longest string) {
toks := strings.Split(s, ":")
@@ -396,7 +384,7 @@ func completeCmd(s string) (matches []compMatch, longest string) {
switch f[0] {
case "set":
if len(f) == 2 {
matches, longest = matchOpt(f[1], gOptWords)
matches, longest = matchWord(f[1], gOptWords)
break
}
if len(f) != 3 {
@@ -432,7 +420,7 @@ func completeCmd(s string) (matches []compMatch, longest string) {
break
}
if len(f) == 3 {
matches, longest = matchOpt(f[2], gLocalOptWords)
matches, longest = matchWord(f[2], gLocalOptWords)
break
}
if len(f) != 4 {
-2
View File
@@ -1282,8 +1282,6 @@ func (e *callExpr) eval(app *app, _ []string) {
app.ui.echoerrf("sync: %s", err)
}
case "draw":
// Input handlers return this no-op instead of nil to
// trigger the screen update performed by [app.loop].
case "redraw":
app.ui.screen.Sync()
app.ui.renew()
-37
View File
@@ -84,18 +84,6 @@ var gEvalTests = []struct {
[]expr{&callExpr{"echo", []string{"hello\101world"}, 1}},
},
{
`echo "hello\1011world"`,
[]string{"echo", "hello\1011world", "\n"},
[]expr{&callExpr{"echo", []string{"hello\1011world"}, 1}},
},
{
`tty-write "\0337\0338"`,
[]string{"tty-write", "\0337\0338", "\n"},
[]expr{&callExpr{"tty-write", []string{"\0337\0338"}, 1}},
},
{
`echo hello\ world`,
[]string{"echo", "hello world", "\n"},
@@ -673,28 +661,3 @@ func TestApplyLocalBoolOpt(t *testing.T) {
}
}
}
func TestParseErrors(t *testing.T) {
for _, test := range []struct{ inp, err string }{
{`set dupfilefmt %f.~%n~`, `set dupfilefmt: value starting with "%" must be quoted`},
{`setlocal /tmp info $x`, `setlocal /tmp info: value starting with "$" must be quoted`},
{"set", "set: expected option"},
{"setlocal", "setlocal: expected directory"},
{"setlocal /tmp", "setlocal /tmp: expected option"},
{"map x :{{ set hidden }}", `set hidden: unexpected "}}"`},
{"map x ${{ echo", `missing "}}"`},
{"map x :{{\n echo", `missing "}}"`},
{"}}", `unexpected "}}"`},
} {
p := newParser(strings.NewReader(test.inp))
if p.parse() || p.err == nil || p.err.Error() != test.err {
t.Errorf("parse(%q) got error %v, want %q", test.inp, p.err, test.err)
}
}
for _, inp := range []string{`set dupfilefmt "%f.~%n~"`, `set hidden!`, "set hidden", "map x :{{ set hidden; }}", "map x ${{ echo hi }}"} {
p := newParser(strings.NewReader(inp))
if !p.parse() || p.err != nil {
t.Errorf("parse(%q) rejected: %v", inp, p.err)
}
}
}
+2 -2
View File
@@ -7,8 +7,8 @@ require (
github.com/djherbis/times v1.6.0
github.com/fsnotify/fsnotify v1.10.1
github.com/gdamore/tcell/v3 v3.6.0
golang.org/x/sys v0.50.0
golang.org/x/term v0.47.0
golang.org/x/sys v0.49.0
golang.org/x/term v0.46.0
)
require (
+4 -4
View File
@@ -31,13 +31,13 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs=
golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA=
golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM=
golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY=
golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE=
golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
+1 -2
View File
@@ -350,8 +350,7 @@ Options:
if term.IsTerminal(int(os.Stdout.Fd())) {
lines := strings.Split(resp, "\n")
for i := range lines {
// using sanitizePreview instead of sanitizeName here to preserve tabs for printed tables
lines[i] = sanitizePreview(lines[i])
lines[i] = sanitizeName(lines[i])
}
resp = strings.Join(lines, "\n")
}
+4 -6
View File
@@ -1849,8 +1849,7 @@ func (nav *nav) readMarks() error {
for scanner.Scan() {
mark, path, found := strings.Cut(scanner.Text(), ":")
if !found {
err = fmt.Errorf("invalid marks file entry: %q", scanner.Text())
continue
return fmt.Errorf("invalid marks file entry: %s", scanner.Text())
}
if _, ok := nav.marks[mark]; !ok {
nav.marks[mark] = path
@@ -1861,7 +1860,7 @@ func (nav *nav) readMarks() error {
return fmt.Errorf("reading marks file: %w", err)
}
return err
return nil
}
func (nav *nav) writeMarks() error {
@@ -1909,8 +1908,7 @@ func (nav *nav) readTags() error {
ind := strings.LastIndex(text, ":")
if ind == -1 {
err = fmt.Errorf("invalid tags file entry: %q", text)
continue
return fmt.Errorf("invalid tags file entry: %s", text)
}
path := text[0:ind]
@@ -1924,7 +1922,7 @@ func (nav *nav) readTags() error {
return fmt.Errorf("reading tags file: %w", err)
}
return err
return nil
}
func (nav *nav) writeTags() error {
+4 -35
View File
@@ -231,21 +231,12 @@ func (p *parser) parseExpr() expr {
s.scan()
if s.typ != tokenIdent {
p.err = fmt.Errorf("set: expected option")
return nil
p.err = fmt.Errorf("expected identifier: %s", s.tok)
}
opt := s.tok
s.scan()
if s.typ != tokenSemicolon {
if s.typ == tokenPrefix || s.typ == tokenColon {
p.err = fmt.Errorf("set %s: value starting with %q must be quoted", opt, s.tok)
return nil
}
if s.typ != tokenIdent {
p.err = fmt.Errorf("set %s: unexpected %q", opt, s.tok)
return nil
}
val = s.tok
s.scan()
}
@@ -258,28 +249,18 @@ func (p *parser) parseExpr() expr {
s.scan()
if s.typ != tokenIdent {
p.err = fmt.Errorf("setlocal: expected directory")
return nil
p.err = fmt.Errorf("expected directory: %s", s.tok)
}
dir := s.tok
s.scan()
if s.typ != tokenIdent {
p.err = fmt.Errorf("setlocal %s: expected option", dir)
return nil
p.err = fmt.Errorf("expected identifier: %s", s.tok)
}
opt := s.tok
s.scan()
if s.typ != tokenSemicolon {
if s.typ == tokenPrefix || s.typ == tokenColon {
p.err = fmt.Errorf("setlocal %s %s: value starting with %q must be quoted", dir, opt, s.tok)
return nil
}
if s.typ != tokenIdent {
p.err = fmt.Errorf("setlocal %s %s: unexpected %q", dir, opt, s.tok)
return nil
}
val = s.tok
s.scan()
}
@@ -378,9 +359,6 @@ func (p *parser) parseExpr() expr {
for {
e := p.parseExpr()
if e == nil {
if p.err == nil {
p.err = fmt.Errorf(`missing "}}"`)
}
return nil
}
exprs = append(exprs, e)
@@ -413,10 +391,6 @@ func (p *parser) parseExpr() expr {
s.scan()
if s.typ == tokenLBraces {
s.scan()
if s.typ != tokenCommand {
p.err = fmt.Errorf(`missing "}}"`)
return nil
}
expr = s.tok
s.scan()
} else {
@@ -428,7 +402,7 @@ func (p *parser) parseExpr() expr {
result = &execExpr{prefix, expr}
default:
p.err = fmt.Errorf("unexpected %q", s.tok)
p.err = fmt.Errorf("unexpected token: %s", s.tok)
}
return result
@@ -436,10 +410,5 @@ func (p *parser) parseExpr() expr {
func (p *parser) parse() bool {
p.expr = p.parseExpr()
if p.err != nil {
// never evaluate an expression that produced a parse error
p.expr = nil
return false
}
return p.expr != nil
}
+1 -3
View File
@@ -237,10 +237,8 @@ scan:
case s.chr == 'v':
buf = append(buf, '\v')
case isDigit(s.chr):
// like C, an octal escape is at most three digits long
// so that "\0337" is read as "\033" followed by "7"
var oct []byte
for len(oct) < 3 && isDigit(s.chr) {
for isDigit(s.chr) {
oct = append(oct, s.chr)
s.next()
}
+1 -7
View File
@@ -162,7 +162,7 @@ loop:
st = st.Underline(false)
case "4", "4:1":
st = st.Underline(true)
case "4:2", "21":
case "4:2":
st = st.Underline(tcell.UnderlineStyleDouble)
case "4:3":
st = st.Underline(tcell.UnderlineStyleCurly)
@@ -205,8 +205,6 @@ loop:
}
st = st.Foreground(color)
i += offset
case "39":
st = st.Foreground(tcell.ColorDefault)
case "40", "41", "42", "43", "44", "45", "46", "47":
n, _ := strconv.Atoi(toks[i])
st = st.Background(tcell.PaletteColor(n - 40))
@@ -221,8 +219,6 @@ loop:
}
st = st.Background(color)
i += offset
case "49":
st = st.Background(tcell.ColorDefault)
case "58":
color, offset, err := parseColor(toks[i+1:])
if err != nil {
@@ -231,8 +227,6 @@ loop:
}
st = st.Underline(color)
i += offset
case "59":
st = st.Underline(tcell.ColorDefault)
default:
log.Printf("unknown ANSI code: %s", toks[i])
}
-4
View File
@@ -230,7 +230,6 @@ func TestApplySGR(t *testing.T) {
{"4:0", none.Underline(true), none},
{"4:1", none, none.Underline(true)},
{"4:2", none, none.Underline(tcell.UnderlineStyleDouble)},
{"21", none, none.Underline(tcell.UnderlineStyleDouble)},
{"4:3", none, none.Underline(tcell.UnderlineStyleCurly)},
{"4:4", none, none.Underline(tcell.UnderlineStyleDotted)},
{"4:5", none, none.Underline(tcell.UnderlineStyleDashed)},
@@ -245,11 +244,9 @@ func TestApplySGR(t *testing.T) {
{"31", none, none.Foreground(color.Maroon)},
{"31", none.Foreground(color.Green), none.Foreground(color.Maroon)},
{"31", none.Foreground(color.Green).Bold(true), none.Foreground(color.Maroon).Bold(true)},
{"39", none.Foreground(color.Maroon).Bold(true), none.Bold(true)},
{"41", none, none.Background(color.Maroon)},
{"41", none.Background(color.Green), none.Background(color.Maroon)},
{"49", none.Background(color.Maroon).Bold(true), none.Bold(true)},
{"1;31", none, none.Foreground(color.Maroon).Bold(true)},
{"1;31", none.Foreground(color.Green), none.Foreground(color.Maroon).Bold(true)},
@@ -279,7 +276,6 @@ func TestApplySGR(t *testing.T) {
{"38;2;5;102;8", none, none.Foreground(tcell.NewRGBColor(5, 102, 8))},
{"48;2;0;48;143", none, none.Background(tcell.NewRGBColor(0, 48, 143))},
{"59", none.Underline(true, color.Maroon), none.Underline(true)},
// Fixes color construction issue: https://github.com/gokcehan/lf/pull/439#issuecomment-674409446
{"38;5;34;1", none, none.Foreground(color.XTerm34).Bold(true)},
+9 -13
View File
@@ -1605,26 +1605,22 @@ func (ui *ui) exportSizes() {
os.Setenv("lf_height", strconv.Itoa(h))
}
func (ui *ui) anyKey() {
fd := int(os.Stdin.Fd())
oldState, err := term.MakeRaw(fd)
if err != nil {
ui.echoerrf("enabling raw mode: %s", err)
return
}
func anyKey() {
fmt.Fprint(os.Stderr, gOpts.waitmsg)
defer fmt.Fprintln(os.Stderr)
oldState, err := term.MakeRaw(int(os.Stdin.Fd()))
if err != nil {
panic(err)
}
defer func() {
if err := term.Restore(fd, oldState); err != nil {
ui.echoerrf("restoring terminal state: %s", err)
if err := term.Restore(int(os.Stdin.Fd()), oldState); err != nil {
panic(err)
}
}()
fmt.Fprint(os.Stderr, gOpts.waitmsg)
b := make([]byte, 8)
if _, err := os.Stdin.Read(b); err != nil {
ui.echoerrf("reading key press: %s", err)
log.Printf("reading key press: %s", err)
}
}