Add support for copy-paste via OSC 52

Ref #1754
This commit is contained in:
Zachary Yedidia
2020-07-04 20:00:39 -04:00
parent 67355337b3
commit f143418267
16 changed files with 403 additions and 61 deletions

View File

@@ -43,6 +43,7 @@ func init() {
// Options with validators
var optionValidators = map[string]optionValidator{
"autosave": validateNonNegativeValue,
"clipboard": validateClipboard,
"tabsize": validatePositiveValue,
"scrollmargin": validateNonNegativeValue,
"scrollspeed": validateNonNegativeValue,
@@ -322,6 +323,7 @@ func DefaultCommonSettings() map[string]interface{} {
// default values
var DefaultGlobalOnlySettings = map[string]interface{}{
"autosave": float64(0),
"clipboard": "external",
"colorscheme": "default",
"divchars": "|-",
"divreverse": true,
@@ -450,6 +452,22 @@ func validateColorscheme(option string, value interface{}) error {
return nil
}
func validateClipboard(option string, value interface{}) error {
val, ok := value.(string)
if !ok {
return errors.New("Expected string type for clipboard")
}
switch val {
case "internal", "external", "terminal":
default:
return errors.New(option + " must be 'internal', 'external', or 'terminal'")
}
return nil
}
func validateLineEnding(option string, value interface{}) error {
endingType, ok := value.(string)