public void ToggleState(TerminalReplState new_state) { if (state == new_state) { SetState(TerminalReplState.Close); } else { SetState(new_state); } }
public void SetState(TerminalReplState new_state) { input_fix = true; cached_command_text = command_text; command_text = ""; switch (new_state) { case TerminalReplState.Close: { open_target = 0; break; } case TerminalReplState.OpenSmall: { open_target = Screen.height * MaxHeight * SmallTerminalRatio; if (current_open_t > open_target) { // Prevent resizing from OpenFull to OpenSmall if window y position // is greater than OpenSmall's target open_target = 0; state = TerminalReplState.Close; return; } real_window_size = open_target; scroll_position.y = int.MaxValue; break; } case TerminalReplState.OpenFull: default: { real_window_size = Screen.height * MaxHeight; open_target = real_window_size; break; } } state = new_state; }