[rkward-cvs] SF.net SVN: rkward:[3700] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Fri Jun 24 18:32:55 UTC 2011
Revision: 3700
http://rkward.svn.sourceforge.net/rkward/?rev=3700&view=rev
Author: tfry
Date: 2011-06-24 18:32:55 +0000 (Fri, 24 Jun 2011)
Log Message:
-----------
Add enter-and-submit action (not visible in the menu)
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
trunk/rkward/rkward/windows/rkcommandeditorwindow.h
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2011-06-24 13:46:29 UTC (rev 3699)
+++ trunk/rkward/ChangeLog 2011-06-24 18:32:55 UTC (rev 3700)
@@ -1,3 +1,4 @@
+- Add shortcut Ctrl+Enter to insert a linebreak and submit from a script editor
- Reduce CPU usage while idle
- Pareto-plot plugin gains more tabulation options TODO: also use in piechart, barplot
- rk.results() now prints rownames, where appropriate TODO: test
Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp 2011-06-24 13:46:29 UTC (rev 3699)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.cpp 2011-06-24 18:32:55 UTC (rev 3700)
@@ -193,6 +193,10 @@
action_run_selection = RKStandardActions::runSelection (this, this, SLOT (runSelection()));
action_run_selection->setEnabled (false);
action_run_line = RKStandardActions::runLine (this, this, SLOT (runLine()));
+ // NOTE: enter_and_submit is not currently added to the menu
+ KAction *action = ac->addAction ("enter_and_submit", this, SLOT (enterAndSubmit()));
+ action->setText (i18n ("Insert linebreak and run"));
+ action->setShortcuts (KShortcut (Qt::ControlModifier + Qt::Key_Return, Qt::ControlModifier + Qt::Key_Enter));
action_help_function = RKStandardActions::functionHelp (this, this, SLOT (showHelp()));
@@ -623,6 +627,16 @@
m_view->setCursorPosition (c);
}
+void RKCommandEditorWindow::enterAndSubmit () {
+ RK_TRACE (COMMANDEDITOR);
+
+ KTextEditor::Cursor c = m_view->cursorPosition ();
+ int line = c.line ();
+ m_doc->insertText (c, "\n");
+ QString command = m_doc->line (line);
+ if (!command.isEmpty ()) RKConsole::pipeUserCommand (command + '\n');
+}
+
void RKCommandEditorWindow::copyLinesToOutput () {
RK_TRACE (COMMANDEDITOR);
Modified: trunk/rkward/rkward/windows/rkcommandeditorwindow.h
===================================================================
--- trunk/rkward/rkward/windows/rkcommandeditorwindow.h 2011-06-24 13:46:29 UTC (rev 3699)
+++ trunk/rkward/rkward/windows/rkcommandeditorwindow.h 2011-06-24 18:32:55 UTC (rev 3700)
@@ -205,6 +205,8 @@
void runLine ();
/** run the entire script */
void runAll ();
+/** insert line break and run the (previous) line */
+ void enterAndSubmit ();
void copyLinesToOutput ();
/** selection has changed. Enable / disable actions accordingly */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list