]> git.lizzy.rs Git - micro.git/commitdiff
Use abspath for local glob settings
authorZachary Yedidia <zyedidia@gmail.com>
Tue, 23 Nov 2021 02:45:19 +0000 (18:45 -0800)
committerZachary Yedidia <zyedidia@gmail.com>
Tue, 23 Nov 2021 02:45:19 +0000 (18:45 -0800)
Ref #2276

internal/buffer/buffer.go

index dc4c6544be0bbddb0ec4b151f04732050edffa87..f33b24389b225425bdcf2b61503cae3e4b1e79db 100644 (file)
@@ -296,7 +296,10 @@ func NewBufferFromString(text, path string, btype BufType) *Buffer {
 // Places the cursor at startcursor. If startcursor is -1, -1 places the
 // cursor at an autodetected location (based on savecursor or :LINE:COL)
 func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufType) *Buffer {
-       absPath, _ := filepath.Abs(path)
+       absPath, err := filepath.Abs(path)
+       if err != nil {
+               absPath = path
+       }
 
        b := new(Buffer)
 
@@ -334,7 +337,7 @@ func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufT
                                b.Settings[k] = v
                        }
                }
-               config.InitLocalSettings(settings, path)
+               config.InitLocalSettings(settings, absPath)
                b.Settings["readonly"] = settings["readonly"]
                b.Settings["filetype"] = settings["filetype"]
                b.Settings["syntax"] = settings["syntax"]