Add mouse option to allow disabling mouse support

This commit is contained in:
Zachary Yedidia 2017-09-06 15:50:50 -04:00
parent 404e5d206d
commit 90977fb4e1
5 changed files with 21 additions and 2 deletions

View File

@ -184,6 +184,10 @@ func NewBuffer(reader io.Reader, size int64, path string) *Buffer {
file.Close()
}
if b.Settings["mouse"].(bool) {
screen.EnableMouse()
}
b.cursors = []*Cursor{&b.Cursor}
return b

View File

@ -198,7 +198,6 @@ func InitScreen() {
}
screen.SetStyle(defStyle)
screen.EnableMouse()
}
// RedrawAll redraws everything -- all the views and the messenger

File diff suppressed because one or more lines are too long

View File

@ -222,6 +222,7 @@ func DefaultGlobalSettings() map[string]interface{} {
"pluginrepos": []string{},
"useprimary": true,
"fileformat": "unix",
"mouse": true,
}
}
@ -254,6 +255,7 @@ func DefaultLocalSettings() map[string]interface{} {
"tabstospaces": false,
"useprimary": true,
"fileformat": "unix",
"mouse": true,
}
}
@ -380,6 +382,14 @@ func SetLocalOption(option, value string, view *View) error {
}
}
if option == "mouse" {
if !nativeValue.(bool) {
screen.DisableMouse()
} else {
screen.EnableMouse()
}
}
return nil
}

View File

@ -155,6 +155,12 @@ Here are the options that you can set:
default value: `off`
* `mouse`: whether to enable mouse support. When mouse support is disabled, usually the terminal will be able
to access mouse events which can be useful if you want to copy from the terminal instead of from micro (if
over ssh for example, because the terminal has access to the local clipboard and micro does not).
default value: `on`
---
Default plugin options: