Skip to content

Modernize server console - #5288

Open
MohabCodeX wants to merge 2 commits into
multitheftauto:masterfrom
MohabCodeX:feat/server-console-modernization
Open

Modernize server console#5288
MohabCodeX wants to merge 2 commits into
multitheftauto:masterfrom
MohabCodeX:feat/server-console-modernization

Conversation

@MohabCodeX

Copy link
Copy Markdown
Contributor

Modernizes the server console with line editing, mouse-wheel scrolling, clipboard pasting, and command history.
image

Changes

  • Decouple the cursor position from the input buffer length to allow natural character insertion and navigation (Home, End, Delete, Insert, Ctrl+Left/Right word jumps, Ctrl+Backspace word erase, Esc).
  • Add keyboard clipboard paste (Ctrl+V and Shift+Insert) using Windows clipboard APIs without enabling QuickEdit mode (avoiding server freeze deadlocks).
  • Increase the console buffer height to 5000 lines on Windows and disable mouse input trapping to restore smooth mouse-wheel scrollback.
  • Route the live server status tag to the console window title bar (SetConsoleTitleW) with sync / logic / fps limit labels instead of drawing over buffer cells.
  • Save and load command history across server restarts in mods/deathmatch/priv/history.txt (capped at 128 entries, matching client behavior), with deduplication and sanitization of sensitive password arguments.
  • Preserve and cleanly redraw typed input during background log streaming, ensuring multi-part log messages remain properly formatted without visual drift.
  • Add Tab command and resource name auto-completion.
  • Add cls and clear commands, Ctrl+L shortcut, and semicolon (;) command chaining.
  • Replace $O(N)$ linear command lookups in CConsole with an unordered_map hash table and remove the fixed 256-byte input truncation.
  • Optimize log formatting in CLogger to reduce heap allocations.

Test plan

  • Test cursor navigation (Home, End, Delete, Insert, Ctrl+Arrows) and insert text mid-string.
  • Paste text via Ctrl+V and Shift+Insert.
  • Scroll up with mouse wheel through past log output.
  • Verify window/tab title updates live with player count, resources, and sync / logic / fps limit metrics.
  • Run commands, restart server, and cycle through history with Up/Down arrows.
  • Verify sensitive commands (login, register, chgpass) have sensitive arguments sanitized in history.
  • Type commands while streaming background logs (console_spam_test) and verify logs stay left-aligned while input continues smoothly underneath.
  • Test Tab auto-completion on commands and resource names.
  • Test cls, clear, Ctrl+L, and chained commands (refresh; start admin).

…e and scrollback

- Decouple cursor position from buffer length to prevent destructive overwrite
- Support Home, End, Delete, Insert, word jumps (Ctrl+Left/Right), word erase (Ctrl+Backspace) and Esc
- Add keyboard clipboard paste (Ctrl+V, Shift+Insert) via Win32 API without QuickEdit freeze
- Expand vertical screen buffer height to 5000 lines and fix mouse-wheel scrolling
- Route live server status tag to Console Window Title, eliminating scroll buffer overwrite
- Clarify live status header metrics to show sync rate, logic rate, and configured fps limit
- Add Tab auto-completion for console commands and resource names
- Add cls/clear console commands, Ctrl+L shortcut, and semicolon (;) command chaining
- Add persistent command history across server restarts (128 entries) with deduplication
- Filter sensitive commands (login, register, passwords) from persistent disk history
- Atomic prompt-preserving multi-part log streaming to eliminate drift and caret shutter
- Optimize console command lookup with O(1) unordered_map hash table
- Safe command tokenization without 256-byte truncation and thread-unsafe strtok
- Eliminate heap thrashing in CLogger by pre-allocating exact capacities
- Bound command history and enable Virtual Terminal processing on Windows
@Fernando-A-Rocha

Copy link
Copy Markdown
Contributor

Wow, thank you!

@omar-o22

Copy link
Copy Markdown
Contributor

Cool.

@Kinimel

Kinimel commented Aug 30, 2026

Copy link
Copy Markdown

Interesting, good work.

@guibzo

guibzo commented Aug 30, 2026

Copy link
Copy Markdown

nice one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants