Add option to disable use of a the primary clipboard

Closes #544
This commit is contained in:
Zachary Yedidia
2017-02-07 19:21:25 -05:00
parent 28af256be0
commit 5dc8fe40ca
4 changed files with 59 additions and 50 deletions

View File

@@ -32,7 +32,9 @@ func (c *Cursor) Goto(b Cursor) {
// CopySelection copies the user's selection to either "primary" or "clipboard"
func (c *Cursor) CopySelection(target string) {
if c.HasSelection() {
clipboard.WriteAll(c.GetSelection(), target)
if target != "primary" || c.buf.Settings["useprimary"].(bool) {
clipboard.WriteAll(c.GetSelection(), target)
}
}
}

File diff suppressed because one or more lines are too long

View File

@@ -175,33 +175,34 @@ func GetOption(name string) interface{} {
// Note that colorscheme is a global only option
func DefaultGlobalSettings() map[string]interface{} {
return map[string]interface{}{
"autoindent": true,
"autoindent": true,
"keepautoindent": false,
"autosave": false,
"colorcolumn": float64(0),
"colorscheme": "default",
"cursorline": true,
"eofnewline": false,
"rmtrailingws": false,
"ignorecase": false,
"indentchar": " ",
"infobar": true,
"ruler": true,
"savecursor": false,
"saveundo": false,
"scrollspeed": float64(2),
"scrollmargin": float64(3),
"softwrap": false,
"splitRight": true,
"splitBottom": true,
"statusline": true,
"syntax": true,
"tabsize": float64(4),
"tabstospaces": false,
"autosave": false,
"colorcolumn": float64(0),
"colorscheme": "default",
"cursorline": true,
"eofnewline": false,
"rmtrailingws": false,
"ignorecase": false,
"indentchar": " ",
"infobar": true,
"ruler": true,
"savecursor": false,
"saveundo": false,
"scrollspeed": float64(2),
"scrollmargin": float64(3),
"softwrap": false,
"splitRight": true,
"splitBottom": true,
"statusline": true,
"syntax": true,
"tabsize": float64(4),
"tabstospaces": false,
"pluginchannels": []string{
"https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json",
},
"pluginrepos": []string{},
"useprimary": true,
}
}
@@ -209,28 +210,29 @@ func DefaultGlobalSettings() map[string]interface{} {
// Note that filetype is a local only option
func DefaultLocalSettings() map[string]interface{} {
return map[string]interface{}{
"autoindent": true,
"autoindent": true,
"keepautoindent": false,
"autosave": false,
"colorcolumn": float64(0),
"cursorline": true,
"eofnewline": false,
"rmtrailingws": false,
"filetype": "Unknown",
"ignorecase": false,
"indentchar": " ",
"ruler": true,
"savecursor": false,
"saveundo": false,
"scrollspeed": float64(2),
"scrollmargin": float64(3),
"softwrap": false,
"splitRight": true,
"splitBottom": true,
"statusline": true,
"syntax": true,
"tabsize": float64(4),
"tabstospaces": false,
"autosave": false,
"colorcolumn": float64(0),
"cursorline": true,
"eofnewline": false,
"rmtrailingws": false,
"filetype": "Unknown",
"ignorecase": false,
"indentchar": " ",
"ruler": true,
"savecursor": false,
"saveundo": false,
"scrollspeed": float64(2),
"scrollmargin": float64(3),
"softwrap": false,
"splitRight": true,
"splitBottom": true,
"statusline": true,
"syntax": true,
"tabsize": float64(4),
"tabstospaces": false,
"useprimary": true,
}
}