Skip to content

Commit

Permalink
UI: add command prefix to console input text
Browse files Browse the repository at this point in the history
  • Loading branch information
mgerhardy committed Feb 3, 2025
1 parent 2886666 commit eab7d7a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/modules/ui/IMGUIConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ bool IMGUIConsole::render(command::CommandExecutionListener &listener) {
ImGui::EndMenuBar();
}
const float footerHeight = ImGui::GetStyle().ItemSpacing.y + ImGui::GetFrameHeightWithSpacing();
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footerHeight), false, ImGuiWindowFlags_HorizontalScrollbar);
ImGui::BeginChild("ScrollingRegion", ImVec2(0, -footerHeight), ImGuiChildFlags_FrameStyle, ImGuiWindowFlags_HorizontalScrollbar);

ImGuiListClipper clipper;
clipper.Begin(_messages.size(), ImGui::GetTextLineHeightWithSpacing());
Expand All @@ -126,11 +126,9 @@ bool IMGUIConsole::render(command::CommandExecutionListener &listener) {
}

ImGui::EndChild();
ImGui::TextUnformatted(_consolePrompt.c_str());
ImGui::SameLine();
if (ImGui::InputText("##console-input-text", &_commandLine,
ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_CallbackCompletion |
ImGuiInputTextFlags_CallbackHistory,
if (ImGui::InputText(_("Command"), &_commandLine,
ImGuiInputTextFlags_EnterReturnsTrue | ImGuiInputTextFlags_EscapeClearsAll |
ImGuiInputTextFlags_CallbackCompletion | ImGuiInputTextFlags_CallbackHistory,
_priv::ConsoleInputTextCallback, this)) {
executeCommandLine(&imguiApp()->commandListener());
ImGui::SetKeyboardFocusHere(-1);
Expand Down
1 change: 0 additions & 1 deletion src/modules/util/Console.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ class Console : public core::IComponent {

const char *_historyFilename = "history";
core::String _consolePrompt = "> ";
core::String _consoleCursor = "_";

void printHistory();

Expand Down

0 comments on commit eab7d7a

Please sign in to comment.