mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-10-17 01:52:31 +02:00
Make sure selection is not null after buffer.resetCaret.
This commit is contained in:
1 parent
5aa365b7a9
commit
b9ecc8a1f0
1 file changed
+3
@@ -499,6 +499,7 @@ var Buffer = Module("Buffer", {
|
||||
}
|
||||
|
||||
let win = this.focusedFrame;
|
||||
let doc = win.document;
|
||||
let sel = win.getSelection();
|
||||
let { viewport } = DOM(win);
|
||||
|
||||
@@ -528,6 +529,8 @@ var Buffer = Module("Buffer", {
|
||||
let ranges = getRanges(rect);
|
||||
if (!ranges.length)
|
||||
ranges = getRanges({ x: 0, y: y, width: win.innerWidth, height: 0 });
|
||||
if (!ranges.length && !sel.rangeCount)
|
||||
ranges = [RangeFind.nodeContents(doc.body || doc.querySelector("body") || doc.documentElement)];
|
||||
if (!ranges.length)
|
||||
return;
|
||||
|
||||
|
||||
Reference in new issue
Block a user