OSDN Git Service

逆方向からぐりっぱーで選択したときの挙動がおかしかったので修正した
authorkonekoneko <test2214@hotmail.co.jp>
Thu, 28 Jul 2016 18:32:28 +0000 (03:32 +0900)
committerkonekoneko <test2214@hotmail.co.jp>
Thu, 28 Jul 2016 18:32:28 +0000 (03:32 +0900)
Core/Controller.cs
Metro/FooEditEngine/FooTextBox.cs

index 378faf3..f5011d9 100644 (file)
@@ -747,21 +747,10 @@ namespace FooEditEngine
                     tp = this.View.GetTextPointFromPostion(hittedGripper.AdjustPoint(p), searchRange);
                     if (tp == TextPoint.Null)
                         return false;
-                    if (this.IsReverseSelect())
-                    {
-                        if (Object.ReferenceEquals(hittedGripper, this.Document.SelectGrippers.BottomRight))
-                            this.MoveSelectBefore(tp);
-                        else
-                            this.MoveCaretAndSelect(tp);
-                    }
-                    else
-                    {
-                        if (Object.ReferenceEquals(hittedGripper, this.Document.SelectGrippers.BottomLeft))
-                            this.MoveSelectBefore(tp);
-                        else
-                            this.MoveCaretAndSelect(tp);
-                    }
-                    hittedGripper.Move(this.View, tp);
+                    if (Object.ReferenceEquals(hittedGripper, this.Document.SelectGrippers.BottomRight))
+                        this.MoveCaretAndSelect(tp);
+                    else if(Object.ReferenceEquals(hittedGripper, this.Document.SelectGrippers.BottomLeft))
+                        this.MoveSelectBefore(tp);
                 }
                 else
                 {
index 8057168..415166d 100644 (file)
@@ -752,11 +752,19 @@ namespace FooEditEngine.Metro
             //こうしないと選択できなくなってしまう
             this.nowCaretMove = true;
             SetValue(SelectedTextProperty, this._Controller.SelectedText);
-            SetValue(SelectionProperty, new TextRange(this._Controller.SelectionStart, this._Controller.SelectionLength));
             SetValue(CaretPostionPropertyKey, this.Document.CaretPostion);
             this.nowCaretMove = false;
-            this.Document.SelectGrippers.BottomLeft.MoveByIndex(this.View, this.Controller.SelectionStart);
-            this.Document.SelectGrippers.BottomRight.MoveByIndex(this.View, this.Controller.SelectionStart + this.Controller.SelectionLength);
+            System.Diagnostics.Debug.WriteLine("selected start:{0} len:{1}", this._Controller.SelectionStart, this._Controller.SelectionLength);
+            if (this._Controller.IsReverseSelect())
+            {
+                this.Document.SelectGrippers.BottomRight.MoveByIndex(this.View, this.Controller.SelectionStart);
+                this.Document.SelectGrippers.BottomLeft.MoveByIndex(this.View, this.Controller.SelectionStart + this.Controller.SelectionLength);
+            }
+            else
+            {
+                this.Document.SelectGrippers.BottomLeft.MoveByIndex(this.View, this.Controller.SelectionStart);
+                this.Document.SelectGrippers.BottomRight.MoveByIndex(this.View, this.Controller.SelectionStart + this.Controller.SelectionLength);
+            }
             if (this.textStore.IsLocked() == false)
                 this.textStore.NotifySelectionChanged();
         }