zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
24.39k stars 1.16k forks source link

Micro 2.0.13 (Windows only) crashes when selecting a directory with "open" #3296

Closed vkiefel closed 1 month ago

vkiefel commented 1 month ago

Description of the problem or steps to reproduce

After issueing "open" at the micro command line and selecting a directory instead of a text file, micro crashes (Windows only, this does not occur with the Linux version) with the message:

Micro encountered an error: runtime.boundsError runtime error: index out of range [0] with length 0 runtime/panic.go:114 (0xe0a2dc) github.com/kballard/go-shellquote@v0.0.0-20180428030007-95032a82bc51/unquote.go:88 (0x12363af) github.com/kballard/go-shellquote@v0.0.0-20180428030007-95032a82bc51/unquote.go:59 (0x1235b85) github.com/zyedidia/micro/v2/internal/action/command.go:963 (0x126be9d) github.com/zyedidia/micro/v2/internal/action/actions.go:1504 (0x125d389) github.com/zyedidia/micro/v2/internal/info/infobuffer.go:152 (0x1238305) github.com/zyedidia/micro/v2/internal/action/infopane.go:206 (0x126ff7f) github.com/zyedidia/micro/v2/internal/action/infopane.go:54 (0x126f151) github.com/zyedidia/micro/v2/internal/action/infopane.go:129 (0x126f8ef) github.com/zyedidia/micro/v2/internal/action/infopane.go:93 (0x126f5ce) github.com/zyedidia/micro/v2/cmd/micro/micro.go:474 (0x12a76f4) github.com/zyedidia/micro/v2/cmd/micro/micro.go:394 (0x12a6fac) runtime/internal/atomic/types.go:194 (0xe0f112) runtime/asm_amd64.s:1650 (0xe3ea21)

If you can reproduce this error, please report it at https://github.com/zyedidia/micro/issues

Specifications

Commit hash: 68d88b57 OS: Windows 11 Terminal: Windows terminal

JoeKar commented 1 month ago

Duplicate of #2666 and a proposal with PR zyedidia/go-shellquote#1 exists.