[Haiku-commits] r26389 - haiku/trunk/src/apps/terminal

bonefish at mail.berlios.de bonefish at mail.berlios.de
Sat Jul 12 04:36:29 CEST 2008


Author: bonefish
Date: 2008-07-12 04:36:26 +0200 (Sat, 12 Jul 2008)
New Revision: 26389
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=26389&view=rev

Modified:
   haiku/trunk/src/apps/terminal/TermView.cpp
Log:
Fixed small selection problems:
* When selecting character-wise backwards the initially selected char
  was deselected.
* When first extending a selection and then moving the mouse back into
  the initial selection region (char, word, or line), the previously
  selected additional char/word/line would not be deselected (only when
  moving the mouse in the other direction out of the initial selection).


Modified: haiku/trunk/src/apps/terminal/TermView.cpp
===================================================================
--- haiku/trunk/src/apps/terminal/TermView.cpp	2008-07-12 01:39:45 UTC (rev 26388)
+++ haiku/trunk/src/apps/terminal/TermView.cpp	2008-07-12 02:36:26 UTC (rev 26389)
@@ -1933,8 +1933,19 @@
 
 	switch (fSelectGranularity) {
 		case SELECT_CHARS:
+		{
+			// If we just start selecting, we first select the initially
+			// hit char, so that we get a proper initial selection -- the char
+			// in question, which will thus always be selected, regardless of
+			// whether selecting forward or backward.
+			if (fInitialSelectionStart == fInitialSelectionEnd) {
+				_Select(fInitialSelectionStart, fInitialSelectionEnd, true,
+					true);
+			}
+
 			_ExtendSelection(_ConvertToTerminal(where), true, true);
       		break;
+		}
 		case SELECT_WORDS:
 			_SelectWord(where, true, true);
       		break;
@@ -2056,6 +2067,8 @@
 		_Select(pos, end, false, !useInitialSelection);
 	else if (pos > end)
 		_Select(start, pos, false, !useInitialSelection);
+	else if (useInitialSelection)
+		_Select(start, end, false, false);
 }
 
 
@@ -2098,6 +2111,8 @@
 			_ExtendSelection(start, false, useInitialSelection);
 		else if (end > (useInitialSelection ? fInitialSelectionEnd : fSelEnd))
 			_ExtendSelection(end, false, useInitialSelection);
+		else if (useInitialSelection)
+			_Select(start, end, false, false);
 	} else
 		_Select(start, end, false, !useInitialSelection);
 }
@@ -2114,7 +2129,8 @@
 			_ExtendSelection(start, false, useInitialSelection);
 		else if (end > (useInitialSelection ? fInitialSelectionEnd : fSelEnd))
 			_ExtendSelection(end, false, useInitialSelection);
-		
+		else if (useInitialSelection)
+			_Select(start, end, false, false);
 	} else
 		_Select(start, end, false, !useInitialSelection);
 }




More information about the Haiku-commits mailing list