From abc8370a61db6c4cbd3084d69abc179f03c9913c Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Mon, 2 Jul 2007 10:29:02 +0000 Subject: [PATCH] move global beep() command to a vimperator slot --- chrome/content/vimperator/commands.js | 20 ++++++++++---------- chrome/content/vimperator/hints.js | 2 +- chrome/content/vimperator/ui.js | 8 ++++---- chrome/content/vimperator/vimperator.js | 8 ++++---- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/chrome/content/vimperator/commands.js b/chrome/content/vimperator/commands.js index 36f6e89c..19394716 100644 --- a/chrome/content/vimperator/commands.js +++ b/chrome/content/vimperator/commands.js @@ -268,7 +268,7 @@ function Commands() //{{{ } )); addDefaultCommand(new Command(["beep"], - /*vimperator.*/beep, + function() { vimperator.beep(); }, { usage: ["beep"], short_help: "Play a system beep" @@ -930,7 +930,7 @@ function stepInHistory(steps) } else { - beep(); + vimperator.beep(); if(index < 0) vimperator.echo("Cannot go past beginning of history"); else @@ -1402,20 +1402,20 @@ function scrollBufferRelative(right, down) // beep if we can't go there if (down > 0) { - if (win.scrollY == win.scrollMaxY) beep(); + if (win.scrollY == win.scrollMaxY) vimperator.beep(); } else if (down < 0) { - if (win.scrollY == 0) beep(); + if (win.scrollY == 0) vimperator.beep(); } if (right > 0) { - if (win.scrollX == win.scrollMaxX) beep(); + if (win.scrollX == win.scrollMaxX) vimperator.beep(); } else if (right < 0) { - if (win.scrollX == 0) beep(); + if (win.scrollX == 0) vimperator.beep(); } win.scrollBy(vimperator.input.count * right * 20, vimperator.input.count * down * 20); @@ -1455,12 +1455,12 @@ function zoom_in(factor) if (zoomMgr.textZoom == 25 && factor < 0) { vimperator.echoerr("Minimum zoom level of 25% reached"); - beep(); + vimperator.beep(); } else if (zoomMgr.textZoom == 500 && factor > 0) { vimperator.echoerr("Maximum zoom level of 500% reached"); - beep(); + vimperator.beep(); } else { @@ -1499,7 +1499,7 @@ function zoom_to(value) if (value < 25 || value > 500) { vimperator.echoerr("Zoom value must be between 25% and 500%"); - beep(); + vimperator.beep(); return; } @@ -1521,7 +1521,7 @@ function copyToClipboard(str) clipboardHelper.copyString(str); } -function beep() +Vimperator.prototype.beep = function() { if (!vimperator.options["beep"]) return; diff --git a/chrome/content/vimperator/hints.js b/chrome/content/vimperator/hints.js index 5e5c4dce..34e718c0 100644 --- a/chrome/content/vimperator/hints.js +++ b/chrome/content/vimperator/hints.js @@ -213,7 +213,7 @@ function Hints() //{{{ //if (linkCount == 0 && hintmode != HINT_MODE_ALWAYS) if (linkCount == 0 && !vimperator.hasMode(vimperator.modes.ALWAYS_HINT)) { - beep(); + vimperator.beep(); //alert('h'); this.disableHahMode(win); //alert('g'); diff --git a/chrome/content/vimperator/ui.js b/chrome/content/vimperator/ui.js index 1226de6f..53e69e38 100644 --- a/chrome/content/vimperator/ui.js +++ b/chrome/content/vimperator/ui.js @@ -361,13 +361,13 @@ function CommandLine() //{{{ if (history_index <= -1) { history_index = 0; - beep(); + vimperator.beep(); break; } if (history_index >= history.length + 1) { history_index = history.length; - beep(); + vimperator.beep(); break; } @@ -377,7 +377,7 @@ function CommandLine() //{{{ return; } } - beep(); + vimperator.beep(); } /* user pressed TAB to get completions of a command */ @@ -416,7 +416,7 @@ function CommandLine() //{{{ if (completions.length == 0) { - beep(); + vimperator.beep(); // prevent tab from moving to the next field event.preventDefault(); event.stopPropagation(); diff --git a/chrome/content/vimperator/vimperator.js b/chrome/content/vimperator/vimperator.js index 26f36342..918e6a7b 100644 --- a/chrome/content/vimperator/vimperator.js +++ b/chrome/content/vimperator/vimperator.js @@ -558,7 +558,7 @@ function Events() //{{{ // no mapping found, beep() if (vimperator.hints.currentState() == 1) { - beep(); + vimperator.beep(); vimperator.hints.disableHahMode(); vimperator.input.buffer = ""; vimperator.statusline.updateInputBuffer(vimperator.input.buffer); @@ -570,7 +570,7 @@ function Events() //{{{ var res = vimperator.hints.processEvent(event); if (res < 0) // error occured processing this key { - beep(); + vimperator.beep(); //if(vimperator.hints.currentMode() == HINT_MODE_QUICK) if(vimperator.hasMode(vimperator.modes.QUICK_HINT)) vimperator.hints.disableHahMode(); @@ -656,7 +656,7 @@ function Events() //{{{ { vimperator.input.buffer = ""; vimperator.input.pendingMap = null; - beep(); + vimperator.beep(); } } vimperator.statusline.updateInputBuffer(vimperator.input.buffer); @@ -1003,7 +1003,7 @@ function Tabs() //{{{ var index = indexFromSpec(spec, wrap); if (index === false) { - beep(); // XXX: move to ex-handling? + vimperator.beep(); // XXX: move to ex-handling? return false; } getBrowser().mTabContainer.selectedIndex = index;