[rkward-cvs] SF.net SVN: rkward:[3213] trunk/rkward/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Tue Nov 23 17:26:13 UTC 2010


Revision: 3213
          http://rkward.svn.sourceforge.net/rkward/?rev=3213&view=rev
Author:   tfry
Date:     2010-11-23 17:26:13 +0000 (Tue, 23 Nov 2010)

Log Message:
-----------
Fix some double- and triple-line-spacing issues, and make code slightly simpler at the same time.

Modified Paths:
--------------
    trunk/rkward/rkward/rkconsole.cpp
    trunk/rkward/rkward/rkconsole.h

Modified: trunk/rkward/rkward/rkconsole.cpp
===================================================================
--- trunk/rkward/rkward/rkconsole.cpp	2010-11-23 17:14:15 UTC (rev 3212)
+++ trunk/rkward/rkward/rkconsole.cpp	2010-11-23 17:26:13 UTC (rev 3213)
@@ -119,7 +119,6 @@
 	nprefix = "> ";
 	iprefix = "+ ";
 	prefix = nprefix;
-	output_continuation = false;
 // KDE4: a way to do this?
 //	doc->setUndoSteps (0);
 	clear ();
@@ -567,13 +566,13 @@
 
 	skip_command_display_lines = incomplete_command.count ('\n') + 1;	// incomplete command, and first line have already been shown.
 
+	doc->insertLine (doc->lines (), QString ());
 	if (!command.isEmpty ()) {
-		doc->insertLine (doc->lines (), QString ());
 		current_command = new RCommand (command, RCommand::User | RCommand::Console, QString (), this);
 		RKGlobals::rInterface ()->issueCommand (current_command);
 		interrupt_command_action->setEnabled (true);
 	} else {
-		showPrompt (true);
+		showPrompt ();
 		tryNextInBuffer ();
 	}
 }
@@ -658,10 +657,8 @@
 		incomplete_command.clear ();
 	}
 
-	if (output_continuation) doc->insertLine (doc->lines (), "");
-	output_continuation = false;
 	commands_history_position = commands_history.constEnd ();
-	showPrompt (true);
+	showPrompt ();
 	tryNextInBuffer ();
 }
 
@@ -669,11 +666,8 @@
 	RK_TRACE (APP);
 
 	int start_line = doc->lines () -1;
-	if (output_continuation) {
-		doc->insertText (doc->documentEnd (), output->output);
-	} else {
-		doc->insertText (KTextEditor::Cursor (doc->lines () -1, 0), output->output);
-	}
+	doc->insertText (doc->documentEnd (), output->output);
+
 	int end_line = doc->lines () -1;
 	if (output->type != ROutput::Output) {
 		KTextEditor::MarkInterface *markiface = qobject_cast<KTextEditor::MarkInterface*> (doc);
@@ -694,7 +688,6 @@
 		}
 	}
 	cursorAtTheEnd ();
-	output_continuation = true;
 }
 
 void RKConsole::userCommandLineIn (RCommand* cmd) {
@@ -709,7 +702,7 @@
 	if (line.length () < 2) return;		// omit empty lines (esp. the trailing newline of the command!)
 
 	prefix = iprefix;
-	showPrompt (!doc->line (doc->lines ()-1).isEmpty ());
+	showPrompt ();
 	setCurrentEditingLine (line);
 }
 
@@ -729,10 +722,10 @@
 	if (!current_command) tryNextInBuffer ();
 }
 
-void RKConsole::showPrompt (bool add_new_line) {
+void RKConsole::showPrompt () {
 	RK_TRACE (APP);
 
-	if (add_new_line || (!doc->lines ())) {
+	if ((!doc->lines ()) || (!doc->line (doc->lines () - 1).isEmpty ())) {
 		if (RKSettingsModuleConsole::maxConsoleLines ()) {
 			uint c = doc->lines();
 			if (c > RKSettingsModuleConsole::maxConsoleLines ()) {
@@ -843,7 +836,7 @@
 		prefix = nprefix;
 		incomplete_command.clear ();
 
-		showPrompt (true);
+		showPrompt ();
 	}
 }
 

Modified: trunk/rkward/rkward/rkconsole.h
===================================================================
--- trunk/rkward/rkward/rkconsole.h	2010-11-23 17:14:15 UTC (rev 3212)
+++ trunk/rkward/rkward/rkconsole.h	2010-11-23 17:26:13 UTC (rev 3213)
@@ -114,7 +114,7 @@
 	void setCurrentEditingLine (const QString &line);
 /** Try to submit the next chunk of the input buffer. */
 	void tryNextInBuffer ();
-	void showPrompt (bool add_new_line = false);
+	void showPrompt ();
 /** Add given command to command history. Also checks, wether the history is longer than max length, and chops it if so. */
 	void addCommandToHistory (const QString &command);
 
@@ -132,8 +132,6 @@
 
 	QString cleanedSelection ();
 
-	bool output_continuation;
-
 	RCommand *current_command;
 	KTextEditor::Document *doc;
 	KTextEditor::View *view;


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