@@ -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