The Battle for Wesnoth  1.19.0-dev
Public Member Functions | Private Attributes | List of all members
gui2::dialogs::lua_interpreter::input_model Class Reference

The input_model keeps track of what commands were executed before, and figures out what should be displayed when the user presses up / down arrows in the input. More...

Public Member Functions

 input_model ()
 
void add_to_history ([[maybe_unused]] const std::string &str)
 
void maybe_update_prefix (const std::string &text)
 
std::string search ([[maybe_unused]] int direction)
 
std::string clear_history ()
 
std::string list_history ()
 
bool do_history_expansion ([[maybe_unused]] std::string &cmd)
 

Private Attributes

std::string prefix_
 
bool end_of_history_
 

Detailed Description

The input_model keeps track of what commands were executed before, and figures out what should be displayed when the user presses up / down arrows in the input.

It is essentially part of the model, but it isn't connected to the lua kernel so I have implemented it separately. Putatively it could all be refactored so that there is a single model with private subclass "lua_model" and also a "command_history_model" but I have decided simply to not implement it that way.

Definition at line 178 of file lua_interpreter.cpp.

Constructor & Destructor Documentation

◆ input_model()

gui2::dialogs::lua_interpreter::input_model::input_model ( )
inline

Definition at line 187 of file lua_interpreter.cpp.

References filename_.

Member Function Documentation

◆ add_to_history()

void gui2::dialogs::lua_interpreter::input_model::add_to_history ( [[maybe_unused] ] const std::string &  str)
inline

Definition at line 215 of file lua_interpreter.cpp.

References end_of_history_, and prefix_.

◆ clear_history()

std::string gui2::dialogs::lua_interpreter::input_model::clear_history ( )
inline

Definition at line 283 of file lua_interpreter.cpp.

References filename_.

◆ do_history_expansion()

bool gui2::dialogs::lua_interpreter::input_model::do_history_expansion ( [[maybe_unused] ] std::string &  cmd)
inline

Definition at line 322 of file lua_interpreter.cpp.

◆ list_history()

std::string gui2::dialogs::lua_interpreter::input_model::list_history ( )
inline

Definition at line 293 of file lua_interpreter.cpp.

References i.

◆ maybe_update_prefix()

void gui2::dialogs::lua_interpreter::input_model::maybe_update_prefix ( const std::string &  text)
inline

Definition at line 224 of file lua_interpreter.cpp.

References end_of_history_, LOG_LUA, and prefix_.

◆ search()

std::string gui2::dialogs::lua_interpreter::input_model::search ( [[maybe_unused] ] int  direction)
inline

Definition at line 234 of file lua_interpreter.cpp.

References e, end_of_history_, LOG_LUA, and prefix_.

Member Data Documentation

◆ end_of_history_

bool gui2::dialogs::lua_interpreter::input_model::end_of_history_
private

Definition at line 181 of file lua_interpreter.cpp.

Referenced by add_to_history(), maybe_update_prefix(), and search().

◆ prefix_

std::string gui2::dialogs::lua_interpreter::input_model::prefix_
private

Definition at line 180 of file lua_interpreter.cpp.

Referenced by add_to_history(), maybe_update_prefix(), and search().


The documentation for this class was generated from the following file: