Skip to content

Commit

Permalink
fix(InputFieldDriver): DisplayText now ACTUALLY follows intended beha…
Browse files Browse the repository at this point in the history
…viour when text is null
  • Loading branch information
Computerdores committed Apr 8, 2024
1 parent d73af78 commit e6003fb
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions AdvancedTerminalAPI/InputFieldDriver.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using BepInEx;
using Computerdores.patch;
using JetBrains.Annotations;
using TMPro;
Expand Down Expand Up @@ -81,11 +82,16 @@ public class InputFieldDriver {
/// <summary>
/// Change the Text that is displayed in the console.
/// </summary>
/// <param name="text">The new text to be displayed. If text is null, the Input will be reset.</param>
/// <param name="text">The new text to be displayed. If text is null or whitespace,
/// this parameter won't affect the displayed text, but the Input will be reset.</param>
/// <param name="clearScreen">Whether the text should added after or instead of the current text.</param>
public void DisplayText([CanBeNull] string text, bool clearScreen) {
if (text != null || clearScreen) {
_displayedText = (clearScreen ? "\n" : _inputField.text) + (text != null ? $"\n\n{text}" : "");
if (clearScreen) {
_displayedText = "\n";
}
if (!text.IsNullOrWhiteSpace()) {
if (!clearScreen) _displayedText += Input;
_displayedText += $"\n\n{text}";
}
Input = "";
_renderToInputField();
Expand Down

0 comments on commit e6003fb

Please sign in to comment.