wex v24.04.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
wex::ex Class Reference

Offers a class that adds ex editor to wex::syntax::stc. More...

#include <wex/ex/ex.h>

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

Public Types

enum class  mode_t { OFF , EX , VISUAL }
 The visual modes. More...
 

Public Member Functions

 ex (syntax::stc *stc, mode_t mode=mode_t::VISUAL)
 Constructor.
 
virtual ~ex ()
 Destructor.
 
virtual bool command (const std::string &command)
 Executes ex: command that was entered on the command line, or present as modeline command inside a file.
 
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.
 
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.
 

Static Public Member Functions

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

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 adds ex editor to wex::syntax::stc.

Member Enumeration Documentation

◆ mode_t

enum class wex::ex::mode_t
strong

The visual modes.

Enumerator
OFF 

not using ex or vi mode

EX 

ex mode, without vi keys, for reading large files

VISUAL 

normal vi mode

Constructor & Destructor Documentation

◆ ex()

wex::ex::ex ( syntax::stc * stc,
mode_t mode = mode_t::VISUAL )
explicit

Constructor.

Provide stc cpomponent and ex mode.

Member Function Documentation

◆ command()

virtual bool wex::ex::command ( const std::string & command)
virtual

Executes ex: command that was entered on the command line, or present as modeline command inside a file.

Returns true if the command was executed.

Reimplemented in wex::vi.

◆ marker_add()

bool wex::ex::marker_add ( char marker,
int line = -1 )

Adds marker at the specified line.

Returns true if marker could be added.

Parameters
markermarker
lineline to add marker, default current line

◆ marker_delete()

bool wex::ex::marker_delete ( char marker)

Deletes specified marker.

Returns true if marker was deleted.

◆ marker_goto()

bool wex::ex::marker_goto ( char marker)

Goes to specified marker.

Returns true if marker exists.

◆ marker_line()

int wex::ex::marker_line ( char marker) const

Returns line for specified marker.

Returns LINE_NUMBER_UNKNOWN if marker does not exist.

◆ set_register()

void wex::ex::set_register ( char name)
inlineprotected

Sets register name.

Setting register 0 results in disabling current register.

◆ yank()

bool wex::ex::yank ( char name = '0') const

Yanks selected text to yank register, default to yank register.

Returns false if no text was selected.