# HG changeset patch
# User sheepluva
# Date 1425240387 -3600
# Node ID c76fd416eff6317ec930fa85c65d33a2e2c56274
# Parent  1dbd50690951bd1a150bc476c0870f4abe95ea25
attempt to move cursor now removes selection even if cursor cannot actually move in the specified direction

diff -r 1dbd50690951 -r c76fd416eff6 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