1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-02-22 09:25:45 +01:00

Utilise object destructuring in parameter lists of stray map definitions.

This commit is contained in:
Doug Kearns
2013-08-24 21:54:28 +10:00
parent acb6805646
commit e0a0388382
5 changed files with 90 additions and 90 deletions

View File

@@ -1158,15 +1158,15 @@ var Editor = Module("editor", XPCOM(Ci.nsIEditActionListener, ModuleBase), {
// text edit mode // text edit mode
bind(["u"], "Undo changes", bind(["u"], "Undo changes",
function (args) { function ({ count }) {
editor.editor.undo(Math.max(args.count, 1)); editor.editor.undo(Math.max(count, 1));
editor.deselect(); editor.deselect();
}, },
{ count: true, noTransaction: true }); { count: true, noTransaction: true });
bind(["<C-r>"], "Redo undone changes", bind(["<C-r>"], "Redo undone changes",
function (args) { function ({ count }) {
editor.editor.redo(Math.max(args.count, 1)); editor.editor.redo(Math.max(count, 1));
editor.deselect(); editor.deselect();
}, },
{ count: true, noTransaction: true }); { count: true, noTransaction: true });

View File

@@ -2012,17 +2012,17 @@ var Buffer = Module("Buffer", {
mappings.add([modes.NORMAL], mappings.add([modes.NORMAL],
["<C-a>", "<increment-url-path>"], "Increment last number in URL", ["<C-a>", "<increment-url-path>"], "Increment last number in URL",
function (args) { buffer.incrementURL(Math.max(args.count, 1)); }, function ({ count }) { buffer.incrementURL(Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], mappings.add([modes.NORMAL],
["<C-x>", "<decrement-url-path>"], "Decrement last number in URL", ["<C-x>", "<decrement-url-path>"], "Decrement last number in URL",
function (args) { buffer.incrementURL(-Math.max(args.count, 1)); }, function ({ count }) { buffer.incrementURL(-Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["gu", "<open-parent-path>"], mappings.add([modes.NORMAL], ["gu", "<open-parent-path>"],
"Go to parent directory", "Go to parent directory",
function (args) { buffer.climbUrlPath(Math.max(args.count, 1)); }, function ({ count }) { buffer.climbUrlPath(Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["gU", "<open-root-path>"], mappings.add([modes.NORMAL], ["gU", "<open-root-path>"],
@@ -2031,9 +2031,9 @@ var Buffer = Module("Buffer", {
mappings.add([modes.COMMAND], [".", "<repeat-key>"], mappings.add([modes.COMMAND], [".", "<repeat-key>"],
"Repeat the last key event", "Repeat the last key event",
function (args) { function ({ count }) {
if (mappings.repeat) { if (mappings.repeat) {
for (let i in util.interruptibleRange(0, Math.max(args.count, 1), 100)) for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
mappings.repeat(); mappings.repeat();
} }
}, },
@@ -2050,22 +2050,22 @@ var Buffer = Module("Buffer", {
// scrolling // scrolling
mappings.add([modes.NORMAL], ["j", "<Down>", "<C-e>", "<scroll-down-line>"], mappings.add([modes.NORMAL], ["j", "<Down>", "<C-e>", "<scroll-down-line>"],
"Scroll document down", "Scroll document down",
function (args) { buffer.scrollVertical("lines", Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollVertical("lines", Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["k", "<Up>", "<C-y>", "<scroll-up-line>"], mappings.add([modes.NORMAL], ["k", "<Up>", "<C-y>", "<scroll-up-line>"],
"Scroll document up", "Scroll document up",
function (args) { buffer.scrollVertical("lines", -Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollVertical("lines", -Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], dactyl.has("mail") ? ["h", "<scroll-left-column>"] : ["h", "<Left>", "<scroll-left-column>"], mappings.add([modes.NORMAL], dactyl.has("mail") ? ["h", "<scroll-left-column>"] : ["h", "<Left>", "<scroll-left-column>"],
"Scroll document to the left", "Scroll document to the left",
function (args) { buffer.scrollHorizontal("columns", -Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollHorizontal("columns", -Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], dactyl.has("mail") ? ["l", "<scroll-right-column>"] : ["l", "<Right>", "<scroll-right-column>"], mappings.add([modes.NORMAL], dactyl.has("mail") ? ["l", "<scroll-right-column>"] : ["l", "<Right>", "<scroll-right-column>"],
"Scroll document to the right", "Scroll document to the right",
function (args) { buffer.scrollHorizontal("columns", Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollHorizontal("columns", Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["0", "^", "<scroll-begin>"], mappings.add([modes.NORMAL], ["0", "^", "<scroll-begin>"],
@@ -2078,21 +2078,21 @@ var Buffer = Module("Buffer", {
mappings.add([modes.NORMAL], ["gg", "<Home>", "<scroll-top>"], mappings.add([modes.NORMAL], ["gg", "<Home>", "<scroll-top>"],
"Go to the top of the document", "Go to the top of the document",
function (args) { buffer.scrollToPercent(null, args.count != null ? args.count : 0, function ({ count }) { buffer.scrollToPercent(null, count != null ? count : 0,
args.count != null ? 0 : -1); }, count != null ? 0 : -1); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["G", "<End>", "<scroll-bottom>"], mappings.add([modes.NORMAL], ["G", "<End>", "<scroll-bottom>"],
"Go to the end of the document", "Go to the end of the document",
function (args) { function ({ count }) {
if (args.count) if (count)
var elem = options.get("linenumbers") var elem = options.get("linenumbers")
.getLine(buffer.focusedFrame.document, .getLine(buffer.focusedFrame.document,
args.count); count);
if (elem) if (elem)
elem.scrollIntoView(true); elem.scrollIntoView(true);
else if (args.count) else if (count)
buffer.scrollToPosition(null, args.count); buffer.scrollToPosition(null, count);
else else
buffer.scrollToPercent(null, 100, 1); buffer.scrollToPercent(null, 100, 1);
}, },
@@ -2100,91 +2100,91 @@ var Buffer = Module("Buffer", {
mappings.add([modes.NORMAL], ["%", "<scroll-percent>"], mappings.add([modes.NORMAL], ["%", "<scroll-percent>"],
"Scroll to {count} percent of the document", "Scroll to {count} percent of the document",
function (args) { function ({ count }) {
dactyl.assert(args.count > 0 && args.count <= 100); dactyl.assert(count > 0 && count <= 100);
buffer.scrollToPercent(null, args.count); buffer.scrollToPercent(null, count);
}, },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["<C-d>", "<scroll-down>"], mappings.add([modes.NORMAL], ["<C-d>", "<scroll-down>"],
"Scroll window downwards in the buffer", "Scroll window downwards in the buffer",
function (args) { buffer._scrollByScrollSize(args.count, true); }, function ({ count }) { buffer._scrollByScrollSize(count, true); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["<C-u>", "<scroll-up>"], mappings.add([modes.NORMAL], ["<C-u>", "<scroll-up>"],
"Scroll window upwards in the buffer", "Scroll window upwards in the buffer",
function (args) { buffer._scrollByScrollSize(args.count, false); }, function ({ count }) { buffer._scrollByScrollSize(count, false); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["<C-b>", "<PageUp>", "<S-Space>", "<scroll-up-page>"], mappings.add([modes.NORMAL], ["<C-b>", "<PageUp>", "<S-Space>", "<scroll-up-page>"],
"Scroll up a full page", "Scroll up a full page",
function (args) { buffer.scrollVertical("pages", -Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollVertical("pages", -Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["<Space>"], mappings.add([modes.NORMAL], ["<Space>"],
"Scroll down a full page", "Scroll down a full page",
function (args) { function ({ count }) {
if (isinstance((services.focus.focusedWindow || buffer.win).document.activeElement, if (isinstance((services.focus.focusedWindow || buffer.win).document.activeElement,
[Ci.nsIDOMHTMLInputElement, [Ci.nsIDOMHTMLInputElement,
Ci.nsIDOMHTMLButtonElement, Ci.nsIDOMHTMLButtonElement,
Ci.nsIDOMXULButtonElement])) Ci.nsIDOMXULButtonElement]))
return Events.PASS; return Events.PASS;
buffer.scrollVertical("pages", Math.max(args.count, 1)); buffer.scrollVertical("pages", Math.max(count, 1));
}, },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["<C-f>", "<PageDown>", "<scroll-down-page>"], mappings.add([modes.NORMAL], ["<C-f>", "<PageDown>", "<scroll-down-page>"],
"Scroll down a full page", "Scroll down a full page",
function (args) { buffer.scrollVertical("pages", Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollVertical("pages", Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["]f", "<previous-frame>"], mappings.add([modes.NORMAL], ["]f", "<previous-frame>"],
"Focus next frame", "Focus next frame",
function (args) { buffer.shiftFrameFocus(Math.max(args.count, 1)); }, function ({ count }) { buffer.shiftFrameFocus(Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["[f", "<next-frame>"], mappings.add([modes.NORMAL], ["[f", "<next-frame>"],
"Focus previous frame", "Focus previous frame",
function (args) { buffer.shiftFrameFocus(-Math.max(args.count, 1)); }, function ({ count }) { buffer.shiftFrameFocus(-Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["["], mappings.add([modes.NORMAL], ["["],
"Jump to the previous element as defined by 'jumptags'", "Jump to the previous element as defined by 'jumptags'",
function (args) { buffer.findJump(args.arg, args.count, true); }, function ({ arg, count }) { buffer.findJump(arg, count, true); },
{ arg: true, count: true }); { arg: true, count: true });
mappings.add([modes.NORMAL], ["g]"], mappings.add([modes.NORMAL], ["g]"],
"Jump to the next off-screen element as defined by 'jumptags'", "Jump to the next off-screen element as defined by 'jumptags'",
function (args) { buffer.findJump(args.arg, args.count, false, true); }, function ({ arg, count }) { buffer.findJump(arg, count, false, true); },
{ arg: true, count: true }); { arg: true, count: true });
mappings.add([modes.NORMAL], ["]"], mappings.add([modes.NORMAL], ["]"],
"Jump to the next element as defined by 'jumptags'", "Jump to the next element as defined by 'jumptags'",
function (args) { buffer.findJump(args.arg, args.count, false); }, function ({ arg, count }) { buffer.findJump(arg, count, false); },
{ arg: true, count: true }); { arg: true, count: true });
mappings.add([modes.NORMAL], ["{"], mappings.add([modes.NORMAL], ["{"],
"Jump to the previous paragraph", "Jump to the previous paragraph",
function (args) { buffer.findJump("p", args.count, true); }, function ({ count }) { buffer.findJump("p", count, true); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["}"], mappings.add([modes.NORMAL], ["}"],
"Jump to the next paragraph", "Jump to the next paragraph",
function (args) { buffer.findJump("p", args.count, false); }, function ({ count }) { buffer.findJump("p", count, false); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["]]", "<next-page>"], mappings.add([modes.NORMAL], ["]]", "<next-page>"],
"Follow the link labeled 'next' or '>' if it exists", "Follow the link labeled 'next' or '>' if it exists",
function (args) { function ({ count }) {
buffer.findLink("next", options["nextpattern"], (args.count || 1) - 1, true); buffer.findLink("next", options["nextpattern"], (count || 1) - 1, true);
}, },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["[[", "<previous-page>"], mappings.add([modes.NORMAL], ["[[", "<previous-page>"],
"Follow the link labeled 'prev', 'previous' or '<' if it exists", "Follow the link labeled 'prev', 'previous' or '<' if it exists",
function (args) { function ({ count }) {
buffer.findLink("prev", options["previouspattern"], (args.count || 1) - 1, true); buffer.findLink("prev", options["previouspattern"], (count || 1) - 1, true);
}, },
{ count: true }); { count: true });
@@ -2198,10 +2198,10 @@ var Buffer = Module("Buffer", {
mappings.add([modes.NORMAL], ["gi", "<focus-input>"], mappings.add([modes.NORMAL], ["gi", "<focus-input>"],
"Focus last used input field", "Focus last used input field",
function (args) { function ({ count }) {
let elem = buffer.lastInputField; let elem = buffer.lastInputField;
if (args.count >= 1 || !elem || !events.isContentNode(elem)) { if (count >= 1 || !elem || !events.isContentNode(elem)) {
let xpath = ["frame", "iframe", "input", "xul:textbox", "textarea[not(@disabled) and not(@readonly)]"]; let xpath = ["frame", "iframe", "input", "xul:textbox", "textarea[not(@disabled) and not(@readonly)]"];
let frames = buffer.allFrames(null, true); let frames = buffer.allFrames(null, true);
@@ -2225,7 +2225,7 @@ var Buffer = Module("Buffer", {
}); });
dactyl.assert(elements.length > 0); dactyl.assert(elements.length > 0);
elem = elements[Math.constrain(args.count, 1, elements.length) - 1]; elem = elements[Math.constrain(count, 1, elements.length) - 1];
} }
buffer.focusElement(elem); buffer.focusElement(elem);
DOM(elem).scrollIntoView(); DOM(elem).scrollIntoView();
@@ -2281,52 +2281,52 @@ var Buffer = Module("Buffer", {
// zooming // zooming
mappings.add([modes.NORMAL], ["zi", "+", "<text-zoom-in>"], mappings.add([modes.NORMAL], ["zi", "+", "<text-zoom-in>"],
"Enlarge text zoom of current web page", "Enlarge text zoom of current web page",
function (args) { buffer.zoomIn(Math.max(args.count, 1), false); }, function ({ count }) { buffer.zoomIn(Math.max(count, 1), false); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["zm", "<text-zoom-more>"], mappings.add([modes.NORMAL], ["zm", "<text-zoom-more>"],
"Enlarge text zoom of current web page by a larger amount", "Enlarge text zoom of current web page by a larger amount",
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, false); }, function ({ count }) { buffer.zoomIn(Math.max(count, 1) * 3, false); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["zo", "-", "<text-zoom-out>"], mappings.add([modes.NORMAL], ["zo", "-", "<text-zoom-out>"],
"Reduce text zoom of current web page", "Reduce text zoom of current web page",
function (args) { buffer.zoomOut(Math.max(args.count, 1), false); }, function ({ count }) { buffer.zoomOut(Math.max(count, 1), false); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["zr", "<text-zoom-reduce>"], mappings.add([modes.NORMAL], ["zr", "<text-zoom-reduce>"],
"Reduce text zoom of current web page by a larger amount", "Reduce text zoom of current web page by a larger amount",
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, false); }, function ({ count }) { buffer.zoomOut(Math.max(count, 1) * 3, false); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["zz", "<text-zoom>"], mappings.add([modes.NORMAL], ["zz", "<text-zoom>"],
"Set text zoom value of current web page", "Set text zoom value of current web page",
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, false); }, function ({ count }) { buffer.setZoom(count > 1 ? count : 100, false); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["ZI", "zI", "<full-zoom-in>"], mappings.add([modes.NORMAL], ["ZI", "zI", "<full-zoom-in>"],
"Enlarge full zoom of current web page", "Enlarge full zoom of current web page",
function (args) { buffer.zoomIn(Math.max(args.count, 1), true); }, function ({ count }) { buffer.zoomIn(Math.max(count, 1), true); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["ZM", "zM", "<full-zoom-more>"], mappings.add([modes.NORMAL], ["ZM", "zM", "<full-zoom-more>"],
"Enlarge full zoom of current web page by a larger amount", "Enlarge full zoom of current web page by a larger amount",
function (args) { buffer.zoomIn(Math.max(args.count, 1) * 3, true); }, function ({ count }) { buffer.zoomIn(Math.max(count, 1) * 3, true); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["ZO", "zO", "<full-zoom-out>"], mappings.add([modes.NORMAL], ["ZO", "zO", "<full-zoom-out>"],
"Reduce full zoom of current web page", "Reduce full zoom of current web page",
function (args) { buffer.zoomOut(Math.max(args.count, 1), true); }, function ({ count }) { buffer.zoomOut(Math.max(count, 1), true); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["ZR", "zR", "<full-zoom-reduce>"], mappings.add([modes.NORMAL], ["ZR", "zR", "<full-zoom-reduce>"],
"Reduce full zoom of current web page by a larger amount", "Reduce full zoom of current web page by a larger amount",
function (args) { buffer.zoomOut(Math.max(args.count, 1) * 3, true); }, function ({ count }) { buffer.zoomOut(Math.max(count, 1) * 3, true); },
{ count: true }); { count: true });
mappings.add([modes.NORMAL], ["zZ", "<full-zoom>"], mappings.add([modes.NORMAL], ["zZ", "<full-zoom>"],
"Set full zoom value of current web page", "Set full zoom value of current web page",
function (args) { buffer.setZoom(args.count > 1 ? args.count : 100, true); }, function ({ count }) { buffer.setZoom(count > 1 ? count : 100, true); },
{ count: true }); { count: true });
// page info // page info

View File

@@ -1764,9 +1764,9 @@ var Commands = Module("commands", {
mappings.add([modes.COMMAND], mappings.add([modes.COMMAND],
["@:"], "Repeat the last Ex command", ["@:"], "Repeat the last Ex command",
function (args) { function ({ count }) {
if (commands.repeat) { if (commands.repeat) {
for (let i in util.interruptibleRange(0, Math.max(args.count, 1), 100)) for (let i in util.interruptibleRange(0, Math.max(count, 1), 100))
dactyl.execute(commands.repeat); dactyl.execute(commands.repeat);
} }
else else

View File

@@ -715,7 +715,7 @@ const Player = Module("player", {
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["z"], "Previous track", ["z"], "Previous track",
function (args) { ex.playerprev({ "#": args.count }); }, function ({ count }) { ex.playerprev({ "#": count }); },
{ count: true }); { count: true });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
@@ -724,7 +724,7 @@ const Player = Module("player", {
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["b"], "Next track", ["b"], "Next track",
function (args) { ex.playernext({ "#": args.count }); }, function ({ count }) { ex.playernext({ "#": count }); },
{ count: true }); { count: true });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
@@ -753,22 +753,22 @@ const Player = Module("player", {
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["h", "<Left>"], "Seek -10s", ["h", "<Left>"], "Seek -10s",
function (args) { player.seekBackward(Math.max(1, args.count) * 10000); }, function ({ count} ) { player.seekBackward(Math.max(1, count) * 10000); },
{ count: true }); { count: true });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["l", "<Right>"], "Seek +10s", ["l", "<Right>"], "Seek +10s",
function (args) { player.seekForward(Math.max(1, args.count) * 10000); }, function ({ count} ) { player.seekForward(Math.max(1, count) * 10000); },
{ count: true }); { count: true });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["H", "<S-Left>"], "Seek -1m", ["H", "<S-Left>"], "Seek -1m",
function (args) { player.seekBackward(Math.max(1, args.count) * 60000); }, function ({ count }) { player.seekBackward(Math.max(1, count) * 60000); },
{ count: true }); { count: true });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],
["L", "<S-Right>"], "Seek +1m", ["L", "<S-Right>"], "Seek +1m",
function (args) { player.seekForward(Math.max(1, args.count) * 60000); }, function ({ count }) { player.seekForward(Math.max(1, count) * 60000); },
{ count: true }); { count: true });
mappings.add([modes.PLAYER], mappings.add([modes.PLAYER],

View File

@@ -518,47 +518,47 @@ var Mail = Module("mail", {
mappings.add(myModes, ["j", "<Right>"], mappings.add(myModes, ["j", "<Right>"],
"Select next message", "Select next message",
function (args) { mail.selectMessage(function (msg) true, false, false, false, args.count); }, function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["gj"], mappings.add(myModes, ["gj"],
"Select next message, including closed threads", "Select next message, including closed threads",
function (args) { mail.selectMessage(function (msg) true, false, true, false, args.count); }, function ({ count }) { mail.selectMessage(function (msg) true, false, true, false, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["J", "<Tab>"], mappings.add(myModes, ["J", "<Tab>"],
"Select next unread message", "Select next unread message",
function (args) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, args.count); }, function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, false, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["k", "<Left>"], mappings.add(myModes, ["k", "<Left>"],
"Select previous message", "Select previous message",
function (args) { mail.selectMessage(function (msg) true, false, false, true, args.count); }, function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["gk"], mappings.add(myModes, ["gk"],
"Select previous message", "Select previous message",
function (args) { mail.selectMessage(function (msg) true, false, true, true, args.count); }, function ({ count }) { mail.selectMessage(function (msg) true, false, true, true, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["K"], mappings.add(myModes, ["K"],
"Select previous unread message", "Select previous unread message",
function (args) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, args.count); }, function ({ count }) { mail.selectMessage(function (msg) !msg.isRead, true, true, true, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["*"], mappings.add(myModes, ["*"],
"Select next message from the same sender", "Select next message from the same sender",
function (args) { function ({ count }) {
let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase(); let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, args.count); mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, false, count);
}, },
{ count: true }); { count: true });
mappings.add(myModes, ["#"], mappings.add(myModes, ["#"],
"Select previous message from the same sender", "Select previous message from the same sender",
function (args) { function ({ count }) {
let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase(); let author = gDBView.hdrForFirstSelectedMessage.mime2DecodedAuthor.toLowerCase();
mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, args.count); mail.selectMessage(function (msg) msg.mime2DecodedAuthor.toLowerCase().indexOf(author) == 0, true, true, true, count);
}, },
{ count: true }); { count: true });
@@ -593,22 +593,22 @@ var Mail = Module("mail", {
// SCROLLING // SCROLLING
mappings.add(myModes, ["<Down>"], mappings.add(myModes, ["<Down>"],
"Scroll message down", "Scroll message down",
function (args) { buffer.scrollLines(Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollLines(Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add(myModes, ["<Up>"], mappings.add(myModes, ["<Up>"],
"Scroll message up", "Scroll message up",
function (args) { buffer.scrollLines(-Math.max(args.count, 1)); }, function ({ count }) { buffer.scrollLines(-Math.max(count, 1)); },
{ count: true }); { count: true });
mappings.add([modes.MESSAGE], ["<Left>"], mappings.add([modes.MESSAGE], ["<Left>"],
"Select previous message", "Select previous message",
function (args) { mail.selectMessage(function (msg) true, false, false, true, args.count); }, function ({ count }) { mail.selectMessage(function (msg) true, false, false, true, count); },
{ count: true }); { count: true });
mappings.add([modes.MESSAGE], ["<Right>"], mappings.add([modes.MESSAGE], ["<Right>"],
"Select next message", "Select next message",
function (args) { mail.selectMessage(function (msg) true, false, false, false, args.count); }, function ({ count }) { mail.selectMessage(function (msg) true, false, false, false, count); },
{ count: true }); { count: true });
// UNDO/REDO // UNDO/REDO
@@ -657,29 +657,29 @@ var Mail = Module("mail", {
mappings.add(myModes, ["]s"], mappings.add(myModes, ["]s"],
"Select next starred message", "Select next starred message",
function (args) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, args.count); }, function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, false, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["[s"], mappings.add(myModes, ["[s"],
"Select previous starred message", "Select previous starred message",
function (args) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, args.count); }, function ({ count }) { mail.selectMessage(function (msg) msg.isFlagged, true, true, true, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["]a"], mappings.add(myModes, ["]a"],
"Select next message with an attachment", "Select next message with an attachment",
function (args) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, args.count); }, function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, false, count); },
{ count: true }); { count: true });
mappings.add(myModes, ["[a"], mappings.add(myModes, ["[a"],
"Select previous message with an attachment", "Select previous message with an attachment",
function (args) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, args.count); }, function ({ count }) { mail.selectMessage(function (msg) gDBView.db.HasAttachments(msg.messageKey), true, true, true, count); },
{ count: true }); { count: true });
// FOLDER SWITCHING // FOLDER SWITCHING
mappings.add(myModes, ["gi"], mappings.add(myModes, ["gi"],
"Go to inbox", "Go to inbox",
function (args) { function ({ count }) {
let folder = mail.getFolders("Inbox", false, true)[(args.count > 0) ? (args.count - 1) : 0]; let folder = mail.getFolders("Inbox", false, true)[(count > 0) ? (count - 1) : 0];
if (folder) if (folder)
SelectFolder(folder.URI); SelectFolder(folder.URI);
else else
@@ -689,8 +689,8 @@ var Mail = Module("mail", {
mappings.add(myModes, ["<C-n>"], mappings.add(myModes, ["<C-n>"],
"Select next folder", "Select next folder",
function (args) { function ({ count }) {
let newPos = mail._getCurrentFolderIndex() + Math.max(1, args.count); let newPos = mail._getCurrentFolderIndex() + Math.max(1, count);
if (newPos >= gFolderTreeView.rowCount) { if (newPos >= gFolderTreeView.rowCount) {
newPos = newPos % gFolderTreeView.rowCount; newPos = newPos % gFolderTreeView.rowCount;
commandline.echo(_("finder.atBottom"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES); commandline.echo(_("finder.atBottom"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES);
@@ -701,15 +701,15 @@ var Mail = Module("mail", {
mappings.add(myModes, ["<C-N>"], mappings.add(myModes, ["<C-N>"],
"Go to next mailbox with unread messages", "Go to next mailbox with unread messages",
function (args) { function ({ count }) {
mail._selectUnreadFolder(false, args.count); mail._selectUnreadFolder(false, count);
}, },
{ count: true }); { count: true });
mappings.add(myModes, ["<C-p>"], mappings.add(myModes, ["<C-p>"],
"Select previous folder", "Select previous folder",
function (args) { function ({ count }) {
let newPos = mail._getCurrentFolderIndex() - Math.max(1, args.count); let newPos = mail._getCurrentFolderIndex() - Math.max(1, count);
if (newPos < 0) { if (newPos < 0) {
newPos = (newPos % gFolderTreeView.rowCount) + gFolderTreeView.rowCount; newPos = (newPos % gFolderTreeView.rowCount) + gFolderTreeView.rowCount;
commandline.echo(_("finder.atTop"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES); commandline.echo(_("finder.atTop"), commandline.HL_WARNINGMSG, commandline.APPEND_TO_MESSAGES);
@@ -720,8 +720,8 @@ var Mail = Module("mail", {
mappings.add(myModes, ["<C-P>"], mappings.add(myModes, ["<C-P>"],
"Go to previous mailbox with unread messages", "Go to previous mailbox with unread messages",
function (args) { function ({ count }) {
mail._selectUnreadFolder(true, args.count); mail._selectUnreadFolder(true, count);
}, },
{ count: true }); { count: true });
@@ -769,7 +769,7 @@ var Mail = Module("mail", {
// tagging messages // tagging messages
mappings.add(myModes, ["l"], mappings.add(myModes, ["l"],
"Label message", "Label message",
function (arg) { function ({ arg }) {
if (!GetSelectedMessages()) if (!GetSelectedMessages())
return void dactyl.beep(); return void dactyl.beep();