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" // CopySelection copies the user's selection to either "primary" or "clipboard"
func (c *Cursor) CopySelection(target string) { func (c *Cursor) CopySelection(target string) {
if c.HasSelection() { 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 // Note that colorscheme is a global only option
func DefaultGlobalSettings() map[string]interface{} { func DefaultGlobalSettings() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"autoindent": true, "autoindent": true,
"keepautoindent": false, "keepautoindent": false,
"autosave": false, "autosave": false,
"colorcolumn": float64(0), "colorcolumn": float64(0),
"colorscheme": "default", "colorscheme": "default",
"cursorline": true, "cursorline": true,
"eofnewline": false, "eofnewline": false,
"rmtrailingws": false, "rmtrailingws": false,
"ignorecase": false, "ignorecase": false,
"indentchar": " ", "indentchar": " ",
"infobar": true, "infobar": true,
"ruler": true, "ruler": true,
"savecursor": false, "savecursor": false,
"saveundo": false, "saveundo": false,
"scrollspeed": float64(2), "scrollspeed": float64(2),
"scrollmargin": float64(3), "scrollmargin": float64(3),
"softwrap": false, "softwrap": false,
"splitRight": true, "splitRight": true,
"splitBottom": true, "splitBottom": true,
"statusline": true, "statusline": true,
"syntax": true, "syntax": true,
"tabsize": float64(4), "tabsize": float64(4),
"tabstospaces": false, "tabstospaces": false,
"pluginchannels": []string{ "pluginchannels": []string{
"https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json", "https://raw.githubusercontent.com/micro-editor/plugin-channel/master/channel.json",
}, },
"pluginrepos": []string{}, "pluginrepos": []string{},
"useprimary": true,
} }
} }
@@ -209,28 +210,29 @@ func DefaultGlobalSettings() map[string]interface{} {
// Note that filetype is a local only option // Note that filetype is a local only option
func DefaultLocalSettings() map[string]interface{} { func DefaultLocalSettings() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"autoindent": true, "autoindent": true,
"keepautoindent": false, "keepautoindent": false,
"autosave": false, "autosave": false,
"colorcolumn": float64(0), "colorcolumn": float64(0),
"cursorline": true, "cursorline": true,
"eofnewline": false, "eofnewline": false,
"rmtrailingws": false, "rmtrailingws": false,
"filetype": "Unknown", "filetype": "Unknown",
"ignorecase": false, "ignorecase": false,
"indentchar": " ", "indentchar": " ",
"ruler": true, "ruler": true,
"savecursor": false, "savecursor": false,
"saveundo": false, "saveundo": false,
"scrollspeed": float64(2), "scrollspeed": float64(2),
"scrollmargin": float64(3), "scrollmargin": float64(3),
"softwrap": false, "softwrap": false,
"splitRight": true, "splitRight": true,
"splitBottom": true, "splitBottom": true,
"statusline": true, "statusline": true,
"syntax": true, "syntax": true,
"tabsize": float64(4), "tabsize": float64(4),
"tabstospaces": false, "tabstospaces": false,
"useprimary": true,
} }
} }

View File

@@ -103,17 +103,17 @@ Here are the options that you can set:
* `softwrap`: should micro wrap lines that are too long to fit on the screen * `softwrap`: should micro wrap lines that are too long to fit on the screen
default value: `off` default value: `off`
* `splitRight`: when a vertical split is created, should it be created to the right of * `splitRight`: when a vertical split is created, should it be created to the right of
the current split? the current split?
default value: `on` default value: `on`
* `splitBottom`: when a horizontal split is created, should it be created below the * `splitBottom`: when a horizontal split is created, should it be created below the
current split? current split?
default value: `on` default value: `on`
* `autosave`: micro will save the buffer every 8 seconds automatically. * `autosave`: micro will save the buffer every 8 seconds automatically.
Micro also will automatically save and quit when you exit without asking. Micro also will automatically save and quit when you exit without asking.
@@ -127,13 +127,18 @@ Here are the options that you can set:
metadata about the given plugin. See the `Plugin Manager` section of the `plugins` help topic metadata about the given plugin. See the `Plugin Manager` section of the `plugins` help topic
for more information. for more information.
default value: `https://github.com/micro-editor/plugin-channel` default value: `https://github.com/micro-editor/plugin-channel`
* `pluginrepos`: contains all the 'repositories' micro's plugin manager will search for * `pluginrepos`: contains all the 'repositories' micro's plugin manager will search for
plugins in. A repository consists of a `repo.json` file which contains metadata for a plugins in. A repository consists of a `repo.json` file which contains metadata for a
single plugin. single plugin.
default value: ` ` default value: ` `
* `useprimary` (only useful on Linux): defines whether or not micro will use the primary clipboard to copy selections
in the background. This does not affect the normal clipboard using Ctrl-C and Ctrl-V.
default value: `on`
--- ---