mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2025-12-20 08:37:59 +01:00
Closes issue #449.
This commit is contained in:
@@ -942,12 +942,9 @@ var CommandLine = Module("commandline", {
|
||||
if (/^\s*$/.test(str))
|
||||
return;
|
||||
this.store = this.store.filter(function (line) (line.value || line) != str);
|
||||
try {
|
||||
dactyl.trapErrors(function () {
|
||||
this.store.push({ value: str, timestamp: Date.now()*1000, privateData: this.checkPrivate(str) });
|
||||
}
|
||||
catch (e) {
|
||||
dactyl.reportError(e);
|
||||
}
|
||||
}, this);
|
||||
this.store = this.store.slice(-options["history"]);
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -514,7 +514,8 @@ var Buffer = Module("Buffer", {
|
||||
rect = { x: rect.left, y: 0, width: rect.width, height: win.innerHeight };
|
||||
}
|
||||
else {
|
||||
rect = { x: win.innerWidth / 2, y: 0, width: 0, height: 0 };
|
||||
let w = win.innerWidth;
|
||||
rect = { x: w / 2 - w / 10, y: 0, width: w / 5, height: win.innerHeight };
|
||||
}
|
||||
|
||||
var reduce = function (a, b) DOM(a).rect.top < DOM(b).rect.top ? a : b;
|
||||
@@ -529,11 +530,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;
|
||||
|
||||
if (ranges.length) {
|
||||
range = ranges.reduce(reduce);
|
||||
|
||||
if (range) {
|
||||
@@ -552,6 +550,11 @@ var Buffer = Module("Buffer", {
|
||||
|
||||
sel.modify("move", reverse ? "forward" : "backward", "lineboundary");
|
||||
}
|
||||
}
|
||||
|
||||
if (!sel.rangeCount)
|
||||
sel.collapse(doc.body || doc.querySelector("body") || doc.documentElement,
|
||||
0);
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
@@ -95,7 +95,7 @@ var RangeFinder = Module("rangefinder", {
|
||||
|
||||
this.options["findflags"].forEach(function (f) replacer(f, f));
|
||||
|
||||
str = str.replace(/\\(.|$)/g, replacer);
|
||||
let pattern = str.replace(/\\(.|$)/g, replacer);
|
||||
|
||||
// It's possible, with :tabdetach for instance, for the rangeFind to
|
||||
// actually move from one window to another, which breaks things.
|
||||
@@ -114,7 +114,9 @@ var RangeFinder = Module("rangefinder", {
|
||||
this.rangeFind.highlighted = highlighted;
|
||||
this.rangeFind.selections = selections;
|
||||
}
|
||||
return this.lastFindPattern = str;
|
||||
if (str)
|
||||
this.lastFindPattern = str;
|
||||
return pattern;
|
||||
},
|
||||
|
||||
find: function (pattern, backwards) {
|
||||
@@ -168,6 +170,12 @@ var RangeFinder = Module("rangefinder", {
|
||||
},
|
||||
|
||||
onSubmit: function (command) {
|
||||
if (!command && this.lastFindPattern) {
|
||||
this.find(this.lastFindPattern, this.backward);
|
||||
this.findAgain();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.options["incfind"] || !this.rangeFind || !this.rangeFind.found) {
|
||||
this.clear();
|
||||
this.find(command || this.lastFindPattern, this.backward);
|
||||
|
||||
Reference in New Issue
Block a user