mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-17 14:27:12 +09:00
Use argument passed to OpenCmd without splitting (#3946)
"Split(args[0])" has been performed since "open" was added[1], but it may had been left by accident. It's unlikely desired when using the command prompt, and doesn't seem to have been added once to commands such as "vsplit" [2] which were implemented days before. [1]:5825353f64[2]:541daf212e
This commit is contained in:
@@ -290,20 +290,8 @@ func (h *BufPane) PwdCmd(args []string) {
|
||||
// OpenCmd opens a new buffer with a given filename
|
||||
func (h *BufPane) OpenCmd(args []string) {
|
||||
if len(args) > 0 {
|
||||
filename := args[0]
|
||||
// the filename might or might not be quoted, so unquote first then join the strings.
|
||||
args, err := shellquote.Split(filename)
|
||||
if err != nil {
|
||||
InfoBar.Error("Error parsing args ", err)
|
||||
return
|
||||
}
|
||||
if len(args) == 0 {
|
||||
return
|
||||
}
|
||||
filename = strings.Join(args, " ")
|
||||
|
||||
open := func() {
|
||||
b, err := buffer.NewBufferFromFile(filename, buffer.BTDefault)
|
||||
b, err := buffer.NewBufferFromFile(args[0], buffer.BTDefault)
|
||||
if err != nil {
|
||||
InfoBar.Error(err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user