diff --git a/src/Console/AutoCompleter.cs b/src/CSConsole/AutoCompleter.cs similarity index 98% rename from src/Console/AutoCompleter.cs rename to src/CSConsole/AutoCompleter.cs index 769e669..c690d64 100644 --- a/src/Console/AutoCompleter.cs +++ b/src/CSConsole/AutoCompleter.cs @@ -8,7 +8,7 @@ using UnityExplorer.Helpers; using UnityExplorer.UI; using UnityExplorer.UI.Modules; -namespace UnityExplorer.Console +namespace UnityExplorer.CSConsole { public class AutoCompleter { @@ -133,8 +133,12 @@ namespace UnityExplorer.Console try { var editor = ConsolePage.Instance.m_codeEditor; + + if (!editor.InputField.isFocused) + return; + var textGen = editor.InputText.cachedTextGenerator; - int caretPos = editor.InputField.caretPosition; + int caretPos = editor.m_lastCaretPos; if (caretPos == m_lastCaretPos) return; diff --git a/src/Console/CSharpLexer.cs b/src/CSConsole/CSharpLexer.cs similarity index 99% rename from src/Console/CSharpLexer.cs rename to src/CSConsole/CSharpLexer.cs index 479f207..4197f36 100644 --- a/src/Console/CSharpLexer.cs +++ b/src/CSConsole/CSharpLexer.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Text; using UnityEngine; -using UnityExplorer.Console.Lexer; +using UnityExplorer.CSConsole.Lexer; -namespace UnityExplorer.Console +namespace UnityExplorer.CSConsole { public struct LexerMatchInfo { diff --git a/src/Console/CodeEditor.cs b/src/CSConsole/CodeEditor.cs similarity index 98% rename from src/Console/CodeEditor.cs rename to src/CSConsole/CodeEditor.cs index b1687f2..9c18677 100644 --- a/src/Console/CodeEditor.cs +++ b/src/CSConsole/CodeEditor.cs @@ -2,7 +2,7 @@ using System.Linq; using System.Text; using UnityExplorer.Input; -using UnityExplorer.Console.Lexer; +using UnityExplorer.CSConsole.Lexer; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; @@ -13,7 +13,7 @@ using System.Reflection; using UnityExplorer.UI.Shared; using UnityExplorer.Helpers; -namespace UnityExplorer.Console +namespace UnityExplorer.CSConsole { // Handles most of the UI side of the C# console, including syntax highlighting. @@ -104,7 +104,10 @@ The following helper methods are available: if (m_fixCaretPos > 0) { if (!m_fixwanted) - m_fixwanted = true; + { + EventSystem.current.SetSelectedGameObject(ConsolePage.Instance.m_codeEditor.InputField.gameObject, null); + m_fixwanted = true; + } else { InputField.caretPosition = m_fixCaretPos; @@ -132,8 +135,6 @@ The following helper methods are available: public void UseAutocomplete(string suggestion) { - EventSystem.current.SetSelectedGameObject(ConsolePage.Instance.m_codeEditor.InputField.gameObject, null); - string input = InputField.text; input = input.Insert(m_lastCaretPos, suggestion); InputField.text = input; diff --git a/src/Console/Lexer/CommentMatch.cs b/src/CSConsole/Lexer/CommentMatch.cs similarity index 97% rename from src/Console/Lexer/CommentMatch.cs rename to src/CSConsole/Lexer/CommentMatch.cs index d096993..1a45558 100644 --- a/src/Console/Lexer/CommentMatch.cs +++ b/src/CSConsole/Lexer/CommentMatch.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -namespace UnityExplorer.Console.Lexer +namespace UnityExplorer.CSConsole.Lexer { public class CommentMatch : Matcher { diff --git a/src/Console/Lexer/KeywordMatch.cs b/src/CSConsole/Lexer/KeywordMatch.cs similarity index 98% rename from src/Console/Lexer/KeywordMatch.cs rename to src/CSConsole/Lexer/KeywordMatch.cs index b944526..5926652 100644 --- a/src/Console/Lexer/KeywordMatch.cs +++ b/src/CSConsole/Lexer/KeywordMatch.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -namespace UnityExplorer.Console.Lexer +namespace UnityExplorer.CSConsole.Lexer { // I use two different KeywordMatch instances (valid and invalid). // This class just contains common implementations. diff --git a/src/Console/Lexer/Matcher.cs b/src/CSConsole/Lexer/Matcher.cs similarity index 95% rename from src/Console/Lexer/Matcher.cs rename to src/CSConsole/Lexer/Matcher.cs index 9f626f8..fff017b 100644 --- a/src/Console/Lexer/Matcher.cs +++ b/src/CSConsole/Lexer/Matcher.cs @@ -3,7 +3,7 @@ using UnityExplorer.Unstrip; using UnityEngine; using System.Linq; -namespace UnityExplorer.Console.Lexer +namespace UnityExplorer.CSConsole.Lexer { public abstract class Matcher { diff --git a/src/Console/Lexer/NumberMatch.cs b/src/CSConsole/Lexer/NumberMatch.cs similarity index 96% rename from src/Console/Lexer/NumberMatch.cs rename to src/CSConsole/Lexer/NumberMatch.cs index 68b3d99..f4c6e22 100644 --- a/src/Console/Lexer/NumberMatch.cs +++ b/src/CSConsole/Lexer/NumberMatch.cs @@ -1,6 +1,6 @@ using UnityEngine; -namespace UnityExplorer.Console.Lexer +namespace UnityExplorer.CSConsole.Lexer { public class NumberMatch : Matcher { diff --git a/src/Console/Lexer/StringMatch.cs b/src/CSConsole/Lexer/StringMatch.cs similarity index 94% rename from src/Console/Lexer/StringMatch.cs rename to src/CSConsole/Lexer/StringMatch.cs index 04100df..8b9bace 100644 --- a/src/Console/Lexer/StringMatch.cs +++ b/src/CSConsole/Lexer/StringMatch.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using UnityEngine; -namespace UnityExplorer.Console.Lexer +namespace UnityExplorer.CSConsole.Lexer { public class StringMatch : Matcher { diff --git a/src/Console/Lexer/SymbolMatch.cs b/src/CSConsole/Lexer/SymbolMatch.cs similarity index 98% rename from src/Console/Lexer/SymbolMatch.cs rename to src/CSConsole/Lexer/SymbolMatch.cs index 3a9cc72..7a1b9e2 100644 --- a/src/Console/Lexer/SymbolMatch.cs +++ b/src/CSConsole/Lexer/SymbolMatch.cs @@ -2,7 +2,7 @@ using System.Linq; using UnityEngine; -namespace UnityExplorer.Console.Lexer +namespace UnityExplorer.CSConsole.Lexer { public class SymbolMatch : Matcher { diff --git a/src/Console/ScriptEvaluator.cs b/src/CSConsole/ScriptEvaluator.cs similarity index 98% rename from src/Console/ScriptEvaluator.cs rename to src/CSConsole/ScriptEvaluator.cs index 0f17905..8a8824a 100644 --- a/src/Console/ScriptEvaluator.cs +++ b/src/CSConsole/ScriptEvaluator.cs @@ -6,7 +6,7 @@ using Mono.CSharp; // Thanks to ManlyMarco for this -namespace UnityExplorer.Console +namespace UnityExplorer.CSConsole { public class ScriptEvaluator : Evaluator, IDisposable { diff --git a/src/Console/ScriptInteraction.cs b/src/CSConsole/ScriptInteraction.cs similarity index 97% rename from src/Console/ScriptInteraction.cs rename to src/CSConsole/ScriptInteraction.cs index ad235a7..78a8272 100644 --- a/src/Console/ScriptInteraction.cs +++ b/src/CSConsole/ScriptInteraction.cs @@ -4,7 +4,7 @@ using UnityExplorer.UI; using UnityExplorer.UI.Modules; using UnityExplorer.Inspectors; -namespace UnityExplorer.Console +namespace UnityExplorer.CSConsole { public class ScriptInteraction : InteractiveBase { diff --git a/src/Console/Suggestion.cs b/src/CSConsole/Suggestion.cs similarity index 98% rename from src/Console/Suggestion.cs rename to src/CSConsole/Suggestion.cs index bdb0965..caa632f 100644 --- a/src/Console/Suggestion.cs +++ b/src/CSConsole/Suggestion.cs @@ -5,7 +5,7 @@ using System.Reflection; using UnityEngine; using UnityExplorer.Helpers; -namespace UnityExplorer.Console +namespace UnityExplorer.CSConsole { public struct Suggestion { diff --git a/src/UI/MainMenu.cs b/src/UI/MainMenu.cs index 3a7692b..f0b9b2a 100644 --- a/src/UI/MainMenu.cs +++ b/src/UI/MainMenu.cs @@ -1,6 +1,6 @@ using System; using System.Collections.Generic; -using UnityExplorer.Console; +using UnityExplorer.CSConsole; using UnityEngine; using UnityEngine.UI; using UnityExplorer.UI.Modules; diff --git a/src/UI/Modules/ConsolePage.cs b/src/UI/Modules/ConsolePage.cs index 202bb82..548c02e 100644 --- a/src/UI/Modules/ConsolePage.cs +++ b/src/UI/Modules/ConsolePage.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; -using UnityExplorer.Console; +using UnityExplorer.CSConsole; namespace UnityExplorer.UI.Modules { diff --git a/src/UnityExplorer.csproj b/src/UnityExplorer.csproj index 5ddfb08..e0073a5 100644 --- a/src/UnityExplorer.csproj +++ b/src/UnityExplorer.csproj @@ -354,18 +354,18 @@ - - - - - - - - - - - - + + + + + + + + + + + +