Readonly should only apply to default buffers

Ref #1298
This commit is contained in:
Zachary Yedidia 2020-01-15 20:09:17 -05:00
parent 7c90f4d6f1
commit 17f0eb80cd
3 changed files with 3 additions and 3 deletions

View file

@ -211,7 +211,7 @@ func NewBuffer(r io.Reader, size int64, path string, startcursor Loc, btype BufT
b.EventHandler = NewEventHandler(b.SharedBuffer, b.cursors)
}
if b.Settings["readonly"].(bool) {
if b.Settings["readonly"].(bool) && b.Type == BTDefault {
b.Type.Readonly = true
}

View file

@ -35,7 +35,7 @@ func (b *Buffer) SetOptionNative(option string, nativeValue interface{}) error {
}
} else if option == "encoding" {
b.isModified = true
} else if option == "readonly" {
} else if option == "readonly" && b.Type == BTDefault {
b.Type.Readonly = nativeValue.(bool)
}

View file

@ -15,7 +15,7 @@ rules:
# Numbers (hexadecimal + decimal)
- constant.number: "\\b(0x[A-F0-9]+|[0-9]+)\\b"
# Primitive Types / Derived Data Types
- type: "([A-Z][a-z]+|(i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float))"
- type: "\\b([A-Z][a-z]+|(i8|u8|i16|u16|i32|u32|i64|u64|i128|u128|isize|usize|c_short|c_ushort|c_int|c_uint|c_long|c_ulong|c_longlong|c_ulonglong|c_longdouble|c_void|f16|f32|f64|f128|bool|void|noreturn|type|anyerror|comptime_int|comptime_float))\\b"
- constant.string:
start: "\""