aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples/DebugLogAnalyzer/src/Editor.cs
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-04-02 07:54:52 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2021-04-02 07:54:52 +0200
commit8c0f9d6b02eac97b7a45780f82f5683771745cf0 (patch)
tree7c638b9ace3bf6b86669eebaa8b4c9638f941f17 /Samples/DebugLogAnalyzer/src/Editor.cs
parent89a58fbf483a4b08309c640dfd07ddf8a58e8bd1 (diff)
DebugLog, event bindings resolutions, enumSelector bitfields, wip
Diffstat (limited to 'Samples/DebugLogAnalyzer/src/Editor.cs')
-rw-r--r--Samples/DebugLogAnalyzer/src/Editor.cs44
1 files changed, 44 insertions, 0 deletions
diff --git a/Samples/DebugLogAnalyzer/src/Editor.cs b/Samples/DebugLogAnalyzer/src/Editor.cs
new file mode 100644
index 00000000..315a5a9d
--- /dev/null
+++ b/Samples/DebugLogAnalyzer/src/Editor.cs
@@ -0,0 +1,44 @@
+// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+
+using System;
+using Glfw;
+using Crow.Text;
+
+namespace Crow
+{
+ public class Editor : TextBox {
+ public override void onKeyDown(object sender, KeyEventArgs e)
+ {
+ TextSpan selection = Selection;
+ if (e.Key == Key.Tab && !selection.IsEmpty) {
+ int lineStart = lines.GetLocation (selection.Start).Line;
+ int lineEnd = lines.GetLocation (selection.End).Line;
+
+ if (IFace.Shift) {
+ for (int l = lineStart; l <= lineEnd; l++) {
+ if (Text[lines[l].Start] == '\t')
+ update (new TextChange (lines[l].Start, 1, ""));
+ else if (Char.IsWhiteSpace (Text[lines[l].Start])) {
+ int i = 1;
+ while (i < lines[l].Length && i < Interface.TAB_SIZE && Char.IsWhiteSpace (Text[i]))
+ i++;
+ update (new TextChange (lines[l].Start, i, ""));
+ }
+ }
+
+ }else{
+ for (int l = lineStart; l <= lineEnd; l++)
+ update (new TextChange (lines[l].Start, 0, "\t"));
+ }
+
+ selectionStart = new CharLocation (lineStart, 0);
+ CurrentLoc = new CharLocation (lineEnd, lines[lineEnd].Length);
+
+ return;
+ }
+ base.onKeyDown(sender, e);
+ }
+ }
+} \ No newline at end of file