1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-01 14:32:25 +01:00

Fix some crufty old mode-change related bugginess.

This commit is contained in:
Kris Maglione
2010-10-04 14:17:13 -04:00
parent f141d3921b
commit af64937d55
7 changed files with 165 additions and 163 deletions

View File

@@ -16,6 +16,28 @@ const Editor = Module("editor", {
//
this._lastFindChar = null;
this._lastFindCharFunc = null;
// Hack?
dactyl.registerObserver("modeChange", function (oldMode, newMode, stack) {
switch (oldMode[0]) {
case modes.TEXTAREA:
case modes.INSERT:
editor.unselectText();
break;
case modes.VISUAL:
if (newMode[0] == modes.CARET) {
try { // clear any selection made; a simple if (selection) does not work
let selection = window.content.getSelection();
selection.collapseToStart();
}
catch (e) {}
}
else
editor.unselectText();
break;
}
});
},
line: function () {