aboutsummaryrefslogtreecommitdiffstatsci
path: root/src/GraphicObjects/TextBox.cs
diff options
context:
space:
mode:
authorj-p <jp.bruyere@live.be>2016-08-15 20:55:55 +0200
committerGitHub <noreply@github.com>2016-08-15 20:55:55 +0200
commitea5ba40d536aa80b56db118c3e8e077790c24359 (patch)
tree194329bce587f3f7035f9d4d6258728ac45f3d2b /src/GraphicObjects/TextBox.cs
parented815a31113235890cf6c902c754fb3dc7536708 (diff)
parent6c5120d8108af9ed53e7205d221cf96a281a28a4 (diff)
Merge pull request #19 from jpbruyere/TemplatesPathes
Default Templates searched among resources finishing with .template Textbox and label debug Keyboard repeat Double click Wrapper
Diffstat (limited to 'src/GraphicObjects/TextBox.cs')
-rw-r--r--src/GraphicObjects/TextBox.cs47
1 files changed, 25 insertions, 22 deletions
diff --git a/src/GraphicObjects/TextBox.cs b/src/GraphicObjects/TextBox.cs
index 81fce3e2..44690342 100644
--- a/src/GraphicObjects/TextBox.cs
+++ b/src/GraphicObjects/TextBox.cs
@@ -76,15 +76,18 @@ 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)
- Interface.CurrentInterface.Clipboard = this.SelectedText;
+ if (selectionIsEmpty) {
+ if (!MoveRight ())
+ return;
+ }else if (e.Shift)
+ CurrentInterface.Clipboard = this.SelectedText;
this.DeleteChar ();
break;
case Key.Enter:
@@ -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;
@@ -133,9 +136,9 @@ namespace Crow
break;
case Key.Insert:
if (e.Shift)
- this.Insert (Interface.CurrentInterface.Clipboard);
- else if (e.Control)
- Interface.CurrentInterface.Clipboard = this.SelectedText;
+ this.Insert (CurrentInterface.Clipboard);
+ else if (e.Control && !selectionIsEmpty)
+ CurrentInterface.Clipboard = this.SelectedText;
break;
case Key.Left:
if (e.Shift) {
@@ -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;