attempt to move cursor now removes selection even if cursor cannot actually move in the specified direction
authorsheepluva
Sun, 01 Mar 2015 21:06:27 +0100
changeset 10846 c76fd416eff6
parent 10845 1dbd50690951
child 10847 b68e35d6e376
attempt to move cursor now removes selection even if cursor cannot actually move in the specified direction
hedgewars/uChat.pas
--- a/hedgewars/uChat.pas	Sun Mar 01 20:38:52 2015 +0100
+++ b/hedgewars/uChat.pas	Sun Mar 01 21:06:27 2015 +0100
@@ -771,8 +771,11 @@
                 begin
                 HandleSelection(selMode);
                 cursorPos:= 0;
-                UpdateCursorCoords();
-                end;
+                end
+            else if (not selMode) then
+                ResetSelection();
+
+            UpdateCursorCoords();
             end;
         SDLK_END:
             begin
@@ -781,8 +784,11 @@
                 begin
                 HandleSelection(selMode);
                 cursorPos:= i;
-                UpdateCursorCoords();
-                end;
+                end
+            else if (not selMode) then
+                ResetSelection();
+
+            UpdateCursorCoords();
             end;
         SDLK_LEFT:
             begin
@@ -807,8 +813,11 @@
                 if ctrl then
                     SkipInputChars(skip, true);
 
-                UpdateCursorCoords();
-                end;
+                end
+            else if (not selMode) then
+                ResetSelection();
+
+            UpdateCursorCoords();
             end;
         SDLK_RIGHT:
             begin
@@ -829,8 +838,11 @@
                 if ctrl then
                     SkipInputChars(GetInputCharSkipClass(cursorPos), false);
 
-                UpdateCursorCoords();
-                end;
+                end
+            else if (not selMode) then
+                ResetSelection();
+
+            UpdateCursorCoords();
             end;
         SDLK_PAGEUP, SDLK_PAGEDOWN:
             begin
@@ -842,9 +854,9 @@
             if ctrl then
                 begin
                 ResetSelection();
-                cursorPos:= Length(InputStr.s);
+                cursorPos:= 0;
                 HandleSelection(true);
-                cursorPos:= 0;
+                cursorPos:= Length(InputStr.s);
                 UpdateCursorCoords();
                 end
             else