mirror of
https://github.com/gryf/pentadactyl-pm.git
synced 2026-01-29 19:05:46 +01:00
Use table tags in :addons and :downloads to better support :yank.
This commit is contained in:
@@ -15,24 +15,25 @@ var RangeFinder = Module("rangefinder", {
|
||||
Local: function (dactyl, modules, window) ({
|
||||
init: function () {
|
||||
this.dactyl = dactyl;
|
||||
this.commandline = modules.commandline;
|
||||
this.modes = modules.modes;
|
||||
this.modules = modules;
|
||||
this.window = window;
|
||||
this.options = modules.options;
|
||||
this.lastFindPattern = "";
|
||||
},
|
||||
|
||||
get commandline() this.modules.commandline,
|
||||
get modes() this.modules.modes,
|
||||
get options() this.modules.options,
|
||||
|
||||
get rangeFind() modules.buffer.localStore.rangeFind,
|
||||
set rangeFind(val) modules.buffer.localStore.rangeFind = val
|
||||
}),
|
||||
|
||||
openPrompt: function (mode) {
|
||||
let backwards = mode == this.modes.FIND_BACKWARD;
|
||||
this.commandline.open(backwards ? "?" : "/", "", mode);
|
||||
this.CommandMode(mode).open();
|
||||
|
||||
if (this.rangeFind && this.rangeFind.window.get() === this.window)
|
||||
this.rangeFind.reset();
|
||||
this.find("", backwards);
|
||||
this.find("", mode === this.modes.FIND_BACKWARD);
|
||||
},
|
||||
|
||||
bootstrap: function (str, backward) {
|
||||
@@ -119,8 +120,12 @@ var RangeFinder = Module("rangefinder", {
|
||||
this.rangeFind.focus();
|
||||
},
|
||||
|
||||
// Called when the user types a key in the find dialog. Triggers a find attempt if 'incfind' is set
|
||||
onKeyPress: function (command) {
|
||||
onCancel: function () {
|
||||
if (this.rangeFind)
|
||||
this.rangeFind.cancel();
|
||||
},
|
||||
|
||||
onChange: function (command) {
|
||||
if (this.options["incfind"]) {
|
||||
command = this.bootstrap(command);
|
||||
this.rangeFind.find(command);
|
||||
@@ -138,13 +143,6 @@ var RangeFinder = Module("rangefinder", {
|
||||
this.rangeFind.focus();
|
||||
},
|
||||
|
||||
// Called when the find is canceled - for example if someone presses
|
||||
// escape while typing a find
|
||||
onCancel: function () {
|
||||
if (this.rangeFind)
|
||||
this.rangeFind.cancel();
|
||||
},
|
||||
|
||||
/**
|
||||
* Highlights all occurrences of the last sought for string in the
|
||||
* current buffer.
|
||||
@@ -163,12 +161,12 @@ var RangeFinder = Module("rangefinder", {
|
||||
}
|
||||
}, {
|
||||
}, {
|
||||
/* Must come before commandline. */
|
||||
modes: function (dactyl, modules, window) {
|
||||
const { modes } = modules;
|
||||
const { commandline, modes } = modules;
|
||||
modes.addMode("FIND", {
|
||||
extended: true,
|
||||
description: "Find mode, active when typing search input",
|
||||
bases: [modes.COMMAND_LINE],
|
||||
input: true
|
||||
});
|
||||
modes.addMode("FIND_FORWARD", {
|
||||
@@ -184,15 +182,6 @@ var RangeFinder = Module("rangefinder", {
|
||||
input: true
|
||||
}, { history: "search" });
|
||||
},
|
||||
commandline: function (dactyl, modules, window) {
|
||||
const { commandline, modes, rangefinder } = modules;
|
||||
commandline.registerCallback("change", modes.FIND_FORWARD, rangefinder.closure.onKeyPress);
|
||||
commandline.registerCallback("submit", modes.FIND_FORWARD, rangefinder.closure.onSubmit);
|
||||
commandline.registerCallback("cancel", modes.FIND_FORWARD, rangefinder.closure.onCancel);
|
||||
commandline.registerCallback("change", modes.FIND_BACKWARD, rangefinder.closure.onKeyPress);
|
||||
commandline.registerCallback("submit", modes.FIND_BACKWARD, rangefinder.closure.onSubmit);
|
||||
commandline.registerCallback("cancel", modes.FIND_BACKWARD, rangefinder.closure.onCancel);
|
||||
},
|
||||
commands: function (dactyl, modules, window) {
|
||||
const { commands, rangefinder } = modules;
|
||||
commands.add(["noh[lfind]"],
|
||||
@@ -200,6 +189,22 @@ var RangeFinder = Module("rangefinder", {
|
||||
function () { rangefinder.clear(); },
|
||||
{ argCount: "0" });
|
||||
},
|
||||
commandline: function (dactyl, modules, window) {
|
||||
this.CommandMode = Class("CommandFindMode", modules.CommandMode, {
|
||||
init: function init(mode) {
|
||||
this.mode = mode;
|
||||
init.supercall(this);
|
||||
},
|
||||
|
||||
historyKey: "find",
|
||||
|
||||
get prompt() this.mode === modules.modes.FIND_BACKWARD ? "?" : "/",
|
||||
|
||||
onCancel: this.closure.onCancel,
|
||||
onChange: this.closure.onChange,
|
||||
onSubmit: this.closure.onSubmit
|
||||
});
|
||||
},
|
||||
mappings: function (dactyl, modules, window) {
|
||||
const { buffer, config, mappings, modes, rangefinder } = modules;
|
||||
var myModes = config.browserModes.concat([modes.CARET]);
|
||||
|
||||
Reference in New Issue
Block a user