mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-16 09:13:50 +00:00
- Extract ChatPanel monolith into 15+ focused modules under ui/chat/ (ChatInput, ChatTabManager, ChatTabCompleter, ChatMarkupParser, ChatMarkupRenderer, ChatCommandRegistry, ChatBubbleManager, ChatSettings, MacroEvaluator, GameStateAdapter, InputModifierAdapter) - Split 2700-line chat_panel_commands.cpp into 11 command modules - Add GM command handling: 190-command data table, dot-prefix interception, tab-completion, /gmhelp with category filter - Fix ChatType enum to match WoW wire protocol (SAY=0x01 not 0x00); values 0x00-0x1B shared across Vanilla/TBC/WotLK - Fix BG_SYSTEM_* values from 82-84 (UB in bitmask shifts) to 0x24-0x26 - Fix infinite Enter key loop after teleport (disable TOGGLE_CHAT repeat, add 2-frame input cooldown) - Add tests: chat_markup_parser, chat_tab_completer, gm_commands, macro_evaluator Signed-off-by: Pavel Okhlopkov <pavel.okhlopkov@flant.com>
53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
// ChatTabCompleter — cycling tab-completion state machine.
|
|
// Extracted from scattered vars in ChatPanel (Phase 5.1).
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
namespace wowee {
|
|
namespace ui {
|
|
|
|
/**
|
|
* Stateful tab-completion engine.
|
|
*
|
|
* The caller gathers candidates and calls startCompletion() or cycle().
|
|
* The completer stores the prefix, sorted matches, and current index.
|
|
*/
|
|
class ChatTabCompleter {
|
|
public:
|
|
/**
|
|
* Start a new completion session with the given candidates.
|
|
* Resets the index to 0.
|
|
*/
|
|
void startCompletion(const std::string& prefix, std::vector<std::string> candidates);
|
|
|
|
/**
|
|
* Cycle to the next match. Returns true if there are matches.
|
|
* If the prefix changed, the caller should call startCompletion() instead.
|
|
*/
|
|
bool next();
|
|
|
|
/** Get the current match, or "" if no matches. */
|
|
std::string getCurrentMatch() const;
|
|
|
|
/** Get the number of matches in the current session. */
|
|
size_t matchCount() const { return matches_.size(); }
|
|
|
|
/** Check if a completion session is active. */
|
|
bool isActive() const { return matchIdx_ >= 0; }
|
|
|
|
/** Get the current prefix. */
|
|
const std::string& getPrefix() const { return prefix_; }
|
|
|
|
/** Reset the completer (e.g. on text change or arrow key). */
|
|
void reset();
|
|
|
|
private:
|
|
std::string prefix_;
|
|
std::vector<std::string> matches_;
|
|
int matchIdx_ = -1;
|
|
};
|
|
|
|
} // namespace ui
|
|
} // namespace wowee
|