Warn for readonly instead of setting option

Fixes #2106
This commit is contained in:
Zachary Yedidia
2021-05-19 14:58:00 -04:00
parent 6bc498e625
commit 0b0c99f1f5
3 changed files with 15 additions and 3 deletions

View File

@@ -252,8 +252,9 @@ func NewBufferFromFileAtLoc(path string, btype BufType, cursorLoc Loc) (*Buffer,
buf = NewBuffer(file, util.FSize(file), filename, cursorLoc, btype)
}
if readonly {
buf.SetOptionNative("readonly", true)
if readonly && prompt != nil {
prompt.Message("Warning: file is readonly - sudo will be attempted when saving")
// buf.SetOptionNative("readonly", true)
}
return buf, nil