diff options
| author | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-14 03:45:57 +0200 |
|---|---|---|
| committer | jpbruyere <jp.bruyere@hotmail.com> | 2016-08-14 03:45:57 +0200 |
| commit | 854f2f732acc4c1d9fa4126962149cae14f4d4e9 (patch) | |
| tree | b9ed25c54bf261b6e22c755db86811a6ee12836f /src/GraphicObjects/TextBox.cs | |
| parent | 4f1128a8001b90e1d163056ef66763bc3b7b8576 (diff) | |
* 0.crow, 1.crow, 2.crow, 5.crow, 7.crow:
tests
* GraphicObject.cs:
enabled, code clean and naming conventions
* Label.cs, TextBox.cs:
debug
* Interface.cs:
keyboard repeat
Diffstat (limited to 'src/GraphicObjects/TextBox.cs')
| -rw-r--r-- | src/GraphicObjects/TextBox.cs | 41 |
1 files changed, 22 insertions, 19 deletions
diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs index 81fce3e2..2be9585a 100644 --- a/src/GraphicObjects/TextBox.cs +++ b/src/GraphicObjects/TextBox.cs @@ -76,14 +76,17 @@ namespace Crow switch (key) { case Key.Back: + if (CurrentPosition == 0) + return; this.DeleteChar(); break; case Key.Clear: break; case Key.Delete: - if (selectionIsEmpty) - CurrentColumn++; - else if (e.Shift) + if (selectionIsEmpty) { + if (!MoveRight ()) + return; + }else if (e.Shift) Interface.CurrentInterface.Clipboard = this.SelectedText; this.DeleteChar (); break; @@ -119,11 +122,11 @@ namespace Crow case Key.End: if (e.Shift) { if (selectionIsEmpty) - SelBegin = new Point (CurrentColumn, CurrentLine); + SelBegin = CurrentPosition; if (e.Control) CurrentLine = int.MaxValue; CurrentColumn = int.MaxValue; - SelRelease = new Point (CurrentColumn, CurrentLine); + SelRelease = CurrentPosition; break; } SelRelease = -1; @@ -134,7 +137,7 @@ namespace Crow case Key.Insert: if (e.Shift) this.Insert (Interface.CurrentInterface.Clipboard); - else if (e.Control) + else if (e.Control && !selectionIsEmpty) Interface.CurrentInterface.Clipboard = this.SelectedText; break; case Key.Left: @@ -143,40 +146,40 @@ namespace Crow SelBegin = new Point(CurrentColumn, CurrentLine); if (e.Control) GotoWordStart (); - else - CurrentColumn--; - SelRelease = new Point(CurrentColumn, CurrentLine); + else if (!MoveLeft ()) + return; + SelRelease = CurrentPosition; break; } SelRelease = -1; if (e.Control) GotoWordStart (); else - CurrentColumn--; + MoveLeft(); break; case Key.Right: if (e.Shift) { if (selectionIsEmpty) - SelBegin = new Point(CurrentColumn, CurrentLine); + SelBegin = CurrentPosition; if (e.Control) GotoWordEnd (); - else - CurrentColumn++; - SelRelease = new Point(CurrentColumn, CurrentLine); + else if (!MoveRight ()) + return; + SelRelease = CurrentPosition; break; } SelRelease = -1; if (e.Control) GotoWordEnd (); else - CurrentColumn++; + MoveRight (); break; case Key.Up: if (e.Shift) { if (selectionIsEmpty) - SelBegin = new Point(CurrentColumn, CurrentLine); + SelBegin = CurrentPosition; CurrentLine--; - SelRelease = new Point(CurrentColumn, CurrentLine); + SelRelease = CurrentPosition; break; } SelRelease = -1; @@ -185,9 +188,9 @@ namespace Crow case Key.Down: if (e.Shift) { if (selectionIsEmpty) - SelBegin = new Point(CurrentColumn, CurrentLine); + SelBegin = CurrentPosition; CurrentLine++; - SelRelease = new Point(CurrentColumn, CurrentLine); + SelRelease = CurrentPosition; break; } SelRelease = -1; |