wex v24.10.0
Public Types | Public Member Functions | List of all members
wex::vi Class Reference

Offers a class that extends ex class with vi behaviour. More...

#include <wex/vi/vi.h>

Inheritance diagram for wex::vi:
Inheritance graph
[legend]

Public Types

typedef std::function< size_t(const std::string &commandfunction_t)
 function type.
 
typedef std::vector< std::pair< const std::string, function_t > > commands_t
 commands to be used in lambda
 
- Public Types inherited from wex::ex
enum class  mode_t { OFF , EX , VISUAL }
 The visual modes. More...
 

Public Member Functions

 vi (wex::syntax::stc *stc, mode_t mode=mode_t::VISUAL)
 Constructor.
 
void append_insert_command (const std::string &s)
 Appends string to executed insert command.
 
void append_insert_text (const std::string &s)
 Appends string to insert text.
 
bool command (const std::string &command) final
 Executes vi command.
 
bool command_finish (bool user_input)
 Finishes vi command.
 
const auto & inserted_text () const
 Returns inserted text.
 
const auto & last_command () const
 Returns last entered command.
 
const auto & mode () const
 Returns the mode we are in.
 
auto & mode ()
 Returns writeable mode.
 
const auto & motion_commands () const
 Returns motion commands.
 
bool on_char (const wxKeyEvent &event)
 Handles char events.
 
bool on_key_down (const wxKeyEvent &event)
 Handles keydown events.
 
const auto & other_commands () const
 Returns other commands.
 
void visual_extend (int start_pos, int end_pos) const
 Extend visual selection.
 
- Public Member Functions inherited from wex::ex
 ex (syntax::stc *stc, mode_t mode=mode_t::VISUAL)
 Constructor.
 
virtual ~ex ()
 Destructor.
 
std::optional< int > calculator (const std::string &text)
 Returns calculated value of text.
 
void copy (const ex *ex)
 Copies data from other component.
 
auto & ctags ()
 Returns the ctags.
 
void cut ()
 Cuts selected text to yank register, and updates delete registers.
 
auto ex_stream ()
 The ex stream (used if in ex mode).
 
auto * frame ()
 Returns the frame.
 
const auto & get_command () const
 Returns command.
 
const auto & get_print_text () const
 Returns last printed text.
 
syntax::stcget_stc () const
 Returns stc component.
 
void info_message (const std::string &text, info_message_t type) const
 Shows info message.
 
auto is_active () const
 Returns whether ex is active.
 
bool is_address (const std::string &text)
 Returns whether text specifies an address.
 
const auto & line_data () const
 Returns line data.
 
bool marker_add (char marker, int line=-1)
 Adds marker at the specified line.
 
bool marker_delete (char marker)
 Deletes specified marker.
 
bool marker_goto (char marker)
 Goes to specified marker.
 
int marker_line (char marker) const
 Returns line for specified marker.
 
bool print (const addressrange &ar, const std::string &flags=std::string(), bool separator=false)
 Prints address range.
 
void print (const std::string &text)
 Prints text in the dialog.
 
const std::string register_text () const
 Returns text from current register (or yank register if no register active).
 
void reset_search_flags ()
 Resets search flags, to what is available in config.
 
auto search_flags () const
 Returns search flags.
 
void search_whole_word ()
 Sets the whole word flag in search flags.
 
void set_line_data (const wex::line_data &data)
 Sets data.
 
void use (mode_t mode)
 Set mode.
 
mode_t visual () const
 Returns current visual mode.
 
bool yank (char name='0') const
 Yanks selected text to yank register, default to yank register.
 

Additional Inherited Members

- Static Public Member Functions inherited from wex::ex
static auto & get_macros ()
 Returns the macros.
 
static const std::string register_insert ()
 Returns text to be inserted.
 
static void set_registers_delete (const std::string &value)
 Sets delete registers 1 - 9.
 
static void set_register_insert (const std::string &value)
 Sets insert register.
 
static void set_register_yank (const std::string &value)
 Sets yank register.
 
- Protected Member Functions inherited from wex::ex
bool auto_write ()
 If autowrite is on and document is modified, save the document.
 
auto register_name () const
 Returns current register name.
 
void set_register (char name)
 Sets register name.
 

Detailed Description

Offers a class that extends ex class with vi behaviour.

Member Function Documentation

◆ command()

bool wex::vi::command ( const std::string & command)
finalvirtual

Executes vi command.

Returns true if the command was executed.

Reimplemented from wex::ex.

◆ on_char()

bool wex::vi::on_char ( const wxKeyEvent & event)

Handles char events.

Returns true if event is allowed to be skipped. This means that the char is not handled by vi, e.g. vi mode is not active, or we are in insert mode, so the char should be handled by stc.

◆ on_key_down()

bool wex::vi::on_key_down ( const wxKeyEvent & event)

Handles keydown events.

See on_char.