Fix ViewType refactor

This commit is contained in:
Zachary Yedidia
2017-12-03 17:19:51 -05:00
parent 09cab07352
commit 46c7437270
2 changed files with 4 additions and 4 deletions

View File

@@ -941,7 +941,7 @@ func (v *View) Save(usePlugin bool) bool {
return false return false
} }
if v.Type.scratch == true { if v.Type.Scratch == true {
// We can't save any view type with scratch set. eg help and log text // We can't save any view type with scratch set. eg help and log text
return false return false
} }

View File

@@ -463,7 +463,7 @@ func (v *View) ExecuteActions(actions []func(*View, bool) bool) bool {
for _, action := range actions { for _, action := range actions {
readonlyBindingsResult := false readonlyBindingsResult := false
funcName := ShortFuncName(action) funcName := ShortFuncName(action)
if v.Type.readonly == true { if v.Type.Readonly == true {
// check for readonly and if true only let key bindings get called if they do not change the contents. // check for readonly and if true only let key bindings get called if they do not change the contents.
for _, readonlyBindings := range readonlyBindingsList { for _, readonlyBindings := range readonlyBindingsList {
if strings.Contains(funcName, readonlyBindings) { if strings.Contains(funcName, readonlyBindings) {
@@ -566,7 +566,7 @@ func (v *View) HandleEvent(event tcell.Event) {
} }
if !isBinding && e.Key() == tcell.KeyRune { if !isBinding && e.Key() == tcell.KeyRune {
// Check viewtype if readonly don't insert a rune (readonly help and log view etc.) // Check viewtype if readonly don't insert a rune (readonly help and log view etc.)
if v.Type.readonly == false { if v.Type.Readonly == false {
for _, c := range v.Buf.cursors { for _, c := range v.Buf.cursors {
v.SetCursor(c) v.SetCursor(c)
@@ -593,7 +593,7 @@ func (v *View) HandleEvent(event tcell.Event) {
} }
case *tcell.EventPaste: case *tcell.EventPaste:
// Check viewtype if readonly don't paste (readonly help and log view etc.) // Check viewtype if readonly don't paste (readonly help and log view etc.)
if v.Type.readonly == false { if v.Type.Readonly == false {
if !PreActionCall("Paste", v) { if !PreActionCall("Paste", v) {
break break
} }