Skip to content

Commit d38d837

Browse files
committed
fix for key repeat not working
1 parent c5f7dfb commit d38d837

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
/[Bb]uild/
55
/[Bb]uilds/
66
/[Aa]uto[Bb]uild/
7+
/[Pp]ackages/
78

89
/Assets/AssetStoreTools*
910
/Assets/Editor/GitHub.meta

Assets/DebugOverlay/Console.cs

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public void TickUpdate()
118118
return;
119119

120120
Scroll((int)Input.mouseScrollDelta.y);
121-
if (Input.anyKeyDown)
121+
if (Input.anyKey)
122122
{
123123
if (Input.GetKeyDown(KeyCode.LeftArrow) && m_CursorPos > 0)
124124
m_CursorPos--;
@@ -128,28 +128,32 @@ public void TickUpdate()
128128
m_CursorPos = 0;
129129
else if (Input.GetKeyDown(KeyCode.End) || (Input.GetKeyDown(KeyCode.E) && (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl))))
130130
m_CursorPos = m_InputFieldLength;
131-
else if (Input.GetKeyDown(KeyCode.Backspace))
132-
Backspace();
133131
else if (Input.GetKeyDown(KeyCode.Tab))
134132
TabComplete();
135133
else if (Input.GetKeyDown(KeyCode.UpArrow))
136134
HistoryPrev();
137135
else if (Input.GetKeyDown(KeyCode.DownArrow))
138136
HistoryNext();
139-
else if (Input.GetKeyDown(KeyCode.Return))
140-
{
141-
var s = new string(m_InputFieldBuffer, 0, m_InputFieldLength);
142-
HistoryStore(s);
143-
ExecuteCommand(s);
144-
m_InputFieldLength = 0;
145-
m_CursorPos = 0;
146-
}
147137
else
148138
{
149-
// TODO replace with garbage free alternative (perhaps impossible until new input system)
150-
var ch = Input.inputString;
151-
for (var i = 0; i < ch.Length; i++)
152-
Type(ch[i]);
139+
// TODO replace with garbage free alternative (perhaps impossible until new input system?)
140+
var inputString = Input.inputString;
141+
for (var i = 0; i < inputString.Length; i++)
142+
{
143+
var ch = inputString[i];
144+
if (ch == '\b')
145+
Backspace();
146+
else if (ch == '\n' || ch == '\r')
147+
{
148+
var s = new string(m_InputFieldBuffer, 0, m_InputFieldLength);
149+
HistoryStore(s);
150+
ExecuteCommand(s);
151+
m_InputFieldLength = 0;
152+
m_CursorPos = 0;
153+
}
154+
else
155+
Type(ch);
156+
}
153157
}
154158
}
155159
}

0 commit comments

Comments
 (0)