mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-13 09:15:59 -04:00
GUI: Avoid duplicate entries in input log, to simplify navigation through input history
This commit is contained in:
parent
4fd0868a29
commit
cfd98807d7
@ -109,15 +109,22 @@ namespace MCGalaxy.Gui {
|
|||||||
main_txtInput.SelectionLength = 0;
|
main_txtInput.SelectionLength = 0;
|
||||||
main_txtInput.SelectionStart = main_txtInput.Text.Length;
|
main_txtInput.SelectionStart = main_txtInput.Text.Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddInputLog(string text) {
|
||||||
|
// Simplify navigating through input history by not logging duplicate entries
|
||||||
|
if (inputLog.Count > 0 && text == inputLog[0]) return;
|
||||||
|
|
||||||
|
inputLog.Insert(0, text);
|
||||||
|
if (inputLog.Count > 20)
|
||||||
|
inputLog.RemoveAt(20);
|
||||||
|
}
|
||||||
|
|
||||||
void InputText() {
|
void InputText() {
|
||||||
string text = main_txtInput.Text;
|
string text = main_txtInput.Text;
|
||||||
if (text.Length == 0) return;
|
if (text.Length == 0) return;
|
||||||
|
AddInputLog(text);
|
||||||
inputLog.Insert(0, text);
|
|
||||||
if (inputLog.Count > 20)
|
|
||||||
inputLog.RemoveAt(20);
|
|
||||||
|
|
||||||
if (text == "/") {
|
if (text == "/") {
|
||||||
UIHelpers.RepeatCommand();
|
UIHelpers.RepeatCommand();
|
||||||
} else if (text[0] == '/' && text.Length > 1 && text[1] == '/') {
|
} else if (text[0] == '/' && text.Length > 1 && text[1] == '/') {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user