[Sciviews-commits] r328 - komodo/SciViews-K/content/js
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Oct 4 22:58:00 CEST 2010
Author: prezez
Date: 2010-10-04 22:57:59 +0200 (Mon, 04 Oct 2010)
New Revision: 328
Modified:
komodo/SciViews-K/content/js/commands.js
Log:
sv.commands: Workaround for an apparent bug in Komodo 6.0.0-rc1, causing that some commands become inactive when _setControllers are run immediately on load event (e.g. Save, Find)
Modified: komodo/SciViews-K/content/js/commands.js
===================================================================
--- komodo/SciViews-K/content/js/commands.js 2010-10-04 19:56:17 UTC (rev 327)
+++ komodo/SciViews-K/content/js/commands.js 2010-10-04 20:57:59 UTC (rev 328)
@@ -118,7 +118,7 @@
// make sure to redefine reasonable default values here
var isWin = navigator.platform.indexOf("Win") === 0;
// Default preferredRApp on Windows is r-gui
- var preferredRApp = sv.prefs.getString("svRApplicationId",
+ var preferredRApp = sv.prefs.getString("svRApplicationId",
isWin? "r-gui" : "r-terminal");
var env = ["koId=" + sv.prefs.getString("sciviews.client.id",
@@ -246,6 +246,9 @@
// sv.command.openHelp - returns reference to the RHelpWindow
//FIXME: help in tab still buggy
this.openHelp = function (uri) {
+
+ //sv.cmdout.append("openHelp" + uri); // DEBUG
+
var RHelpWin = _this.RHelpWin;
// We will need special treatment in windows
@@ -359,7 +362,7 @@
// intelligent" and can be used to run code step by step because it
// moves the cursor to the next line each time...
'cmd_svRRunLineOrSelection': [ 'sv.r.run();', XisRDoc | XRRunning ],
- 'cmd_svRSourceLineOrSelection': [ 'sv.r.source("line/sel");',XisRDoc | XRRunning ],
+ 'cmd_svRSourceLineOrSelection': [ 'sv.r.source("line/sel");', XisRDoc | XRRunning ],
'cmd_svRRunSelection': [ 'sv.r.send("sel");',XisRDoc | XRRunning | XHasSelection ],
'cmd_svRSourceSelection': [ 'sv.r.source("sel");', XisRDoc | XRRunning | XHasSelection ],
'cmd_viewrtoolbar': [ 'ko.uilayout.toggleToolbarVisibility(\'RToolbar\')', 0 ]
@@ -377,7 +380,7 @@
return false;
return(view.document.language == 'R');
/*
-// This would be useful if Komodo had event for language change at cursor position,
+// This would be useful if Komodo had event for language change at cursor position,
// and lexers allowed for R as sub-language
if (!view || !view.koDoc || !view.scimoz)
return (false);
@@ -403,9 +406,10 @@
svController.prototype.isCommandEnabled = function(command) {
if(!command in handlers) return(false);
- // TODO: Clean up the mess here.
+
return(true);
+ // TODO: Clean up the mess here.
//var test = handlers[command][1];
// PhG: since _isRRunning() returns always true, we are currently
// NOT able to start R!
@@ -421,14 +425,16 @@
// Thus, for the nth time, I don't want this restriction on commands
// running code to R: I want them available EVERYWHERE!
- // KB: the reasons for that were: (1) I do not like feeding R with lots of text pressing an F-key accidentally
- // (2) I want to use e.g. F5 for running currently active code in an appropriate interpreter (like in SciTe),
- // Unfortunately, Komodo does not allow for defining multiple commands for a single key combination
+ // KB: the reasons for that were: (1) I do not like feeding R with
+ // lots of text pressing an F-key accidentally (2) I want to use
+ // e.g. F5 for running currently active code in an appropriate
+ // interpreter (like in SciTe), Unfortunately, Komodo does not allow
+ // for defining multiple commands for a single key combination
//&& (((test & XisRDoc) != XisRDoc) || true) //_isRCurLanguage())
//&& (((test & XisRDoc) != XisRDoc) || _isRCurLanguage())
// && (((test & XHasSelection) != XHasSelection) || _hasSelection());
// && (((test & XHasSelection) != XHasSelection) || _hasSelection()));
-//
+
//return true;
}
@@ -443,6 +449,7 @@
//sv.log.debug("Controllers has been set.");
}
+
// Code below is for extra items in editor context menu (eg. "run selection"),
// Commented out because it is still buggy
// function editorContextMenuOnShowing (event) {
@@ -550,10 +557,16 @@
// "ko.commands.doCommandAsync('cmd_svRTriggerCompletion',
// event);"].join(";"));
//sv.log.debug("Keybindings has been applied.");
+ }
+ // Workaround for an apparent bug in Komodo 6.0.0-rc1, causing that some
+ // commands become inactive when _setControllers are run immediately
+ // "on load" (e.g. Save)
+ function _delayedSetControllers () {
+ window.setTimeout(_setControllers, 100);
}
- addEventListener("load", _setControllers, false);
+ addEventListener("load", _delayedSetControllers, false);
addEventListener("load", _setKeybindings, false);
}).apply(sv.command);
More information about the Sciviews-commits
mailing list