SST 16.0.0
Structural Simulation Toolkit
CmdLineEditor Class Reference

The command line editor uses termios to detect key presses and perform auto-completions. More...

#include <cmdLineEditor.h>

Public Types

enum  TAB_STATE { FILL_COMMON , LIST_COMMON }

Public Member Functions

void redraw_line (const std::string &s)
void getline (const std::vector< std::string > &cmdHistory, std::string &newcmd)
void set_cmd_strings (const std::list< std::string > &sortedStrings)
void set_listing_callback (std::function< void(std::list< std::string > &)> callback)

Data Fields

const std::string arrow_up = "[A"
const std::string arrow_dn = "[B"
const std::string arrow_rt = "[C"
const std::string arrow_lf = "[D"
const std::map< std::string, std::string > arrowKeyMap
const std::string clear_line_ctl = "\x1B[2K"
const std::string move_left_ctl = "\x1B[1D"
const std::string move_right_ctl = "\x1B[1C"
const std::string esc_ctl = "\x1B["
const std::string move_up_ctl = "\x1B[1F"
const std::string prompt = "> "
const std::string prompt_clear = "\x1B[2K\r> "
std::ofstream dbgFile

Static Public Attributes

static constexpr char esc_char = '\x1B'
static constexpr char tab_char = '\x9'
static constexpr char lf_char = '\xa'
static constexpr char bs_char = '\x7f'
static constexpr char ctrl_a = '\x1'
static constexpr char ctrl_b = '\x2'
static constexpr char ctrl_d = '\x4'
static constexpr char ctrl_e = '\x5'
static constexpr char ctrl_f = '\x6'
static constexpr char ctrl_k = '\xb'
static constexpr int max_line_size = 2048

Detailed Description

The command line editor uses termios to detect key presses and perform auto-completions.

Upon entering the editor, the current terminal settings are saved and we enter a "raw" terminal mode. While in raw terminal mode it is critical to ensure that exclusivel use read and write commands for std:out access. Mixing iostream access can corrupt the buffers.

Field Documentation

◆ arrowKeyMap

const std::map<std::string, std::string> CmdLineEditor::arrowKeyMap
Initial value:
= {
{ arrow_up, "Up" },
{ arrow_dn, "Down" },
{ arrow_rt, "Right" },
{ arrow_lf, "Left" },
}

The documentation for this class was generated from the following files:
  • src/sst/core/impl/interactive/cmdLineEditor.h
  • src/sst/core/impl/interactive/cmdLineEditor.cc