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:
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user