summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWu Cheng-Han2016-08-02 10:54:50 +0800
committerWu Cheng-Han2016-08-02 10:54:50 +0800
commitf49fc192f64a7fb86baa8eae5717ea87de43c8e5 (patch)
tree7ef878bd9baf1da471d1ac25d75a05feb7bdfb79
parent4de73477b48c08444f0ba83d48d3c84fda2d3dbc (diff)
Workaround vim mode might overwrite copy keyMap on Windows
Diffstat (limited to '')
-rw-r--r--public/js/index.js7
1 files changed, 6 insertions, 1 deletions
diff --git a/public/js/index.js b/public/js/index.js
index ca4f0958..7f9c8ad8 100644
--- a/public/js/index.js
+++ b/public/js/index.js
@@ -1,5 +1,6 @@
var defaultTextHeight = 20;
var viewportMargin = 20;
+var mac = CodeMirror.keyMap["default"] == CodeMirror.keyMap.macDefault;
var defaultExtraKeys = {
"F10": function (cm) {
cm.setOption("fullScreen", !cm.getOption("fullScreen"));
@@ -45,7 +46,11 @@ var defaultExtraKeys = {
}
},
"Cmd-Left": "goLineLeftSmart",
- "Cmd-Right": "goLineRight"
+ "Cmd-Right": "goLineRight",
+ "Ctrl-C": function (cm) {
+ if (!mac && cm.getOption('keyMap').substr(0, 3) === 'vim') document.execCommand("copy");
+ else return CodeMirror.Pass;
+ }
};
var idleTime = 300000; //5 mins