[rkward-cvs] SF.net SVN: rkward: [1146] branches/release_branch_0.4.5/rkward/rkward/ rkconsole.cpp

tfry at users.sourceforge.net tfry at users.sourceforge.net
Sun Jan 14 17:46:30 UTC 2007


Revision: 1146
          http://svn.sourceforge.net/rkward/?rev=1146&view=rev
Author:   tfry
Date:     2007-01-14 09:46:30 -0800 (Sun, 14 Jan 2007)

Log Message:
-----------
Merge 1143, 1144, 1145 from trunk

Modified Paths:
--------------
    branches/release_branch_0.4.5/rkward/rkward/rkconsole.cpp

Modified: branches/release_branch_0.4.5/rkward/rkward/rkconsole.cpp
===================================================================
--- branches/release_branch_0.4.5/rkward/rkward/rkconsole.cpp	2007-01-14 17:45:02 UTC (rev 1145)
+++ branches/release_branch_0.4.5/rkward/rkward/rkconsole.cpp	2007-01-14 17:46:30 UTC (rev 1146)
@@ -176,29 +176,26 @@
 
 bool RKConsole::handleKeyPress (QKeyEvent *e) {
 
-	uint para=0; uint p=0;
-	view->cursorPosition (&para, &p);
-	uint pos = p;
-	
-	
-	if (para < doc->numLines() - 1 || pos < prefix.length ()){
-		int t=(int)pos;if(prefix.length()>pos) t=prefix.length();
-		view->setCursorPosition (doc->numLines() -1, t);
-		return(true);
+	uint para=0; uint pos=0;
+	view->cursorPosition (&para, &pos);
+
+	if (para < doc->numLines() - 1 || pos < prefix.length ()) {	// not inside the last line?
+		int t = (int) pos;					// adjust position before interpreting keystroke
+		if (prefix.length()>pos) t=prefix.length ();
+		view->setCursorPosition (doc->numLines () -1, t);
 	}
-	
-	if (current_command) {
-		e->ignore ();
+
+	if (hasSelectedText () && (selectionInterfaceExt(doc)->selStartCol () < (int) prefix.length () || selectionInterfaceExt (doc)->selStartLine () < (int) doc->numLines () -1)) { // There is a selection outside the command line
+		// Eat the key and beep (unless it's just a modifier key). Otherwise it might overwrite or delete the selection
+		if (e->state () == e->stateAfter ()) {
+			KApplication::kApplication ()->beep ();
+			e->ignore ();
+		}
 		return true;
 	}
 
-	if (hasSelectedText() 
-		   && (selectionInterfaceExt(doc)->selStartCol () < (int)prefix.length() 
-		   ||selectionInterfaceExt(doc)->selStartLine ()< (int)doc->numLines() -1)){ // The selection is wider than the current command
-		if (e->key () == Qt::Key_C && e->state () == Qt::ControlButton){ // We only allow to copy
-			copy();
-		}
-		
+	if (current_command) {
+		e->ignore ();
 		return true;
 	}
 


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