MCPcopy Create free account
hub / github.com/FastFlowLM/FastFlowLM / read_escape_sequence

Function read_escape_sequence

src/runner/cli_wide_posix.cpp:96–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96std::string read_escape_sequence() {
97 std::string seq;
98 seq.push_back('\x1b');
99
100 auto deadline = std::chrono::steady_clock::now() + std::chrono::milliseconds(40);
101 while (std::chrono::steady_clock::now() < deadline) {
102 if (!stdin_has_pending_input(0)) {
103 std::this_thread::sleep_for(std::chrono::milliseconds(1));
104 continue;
105 }
106
107 unsigned char next = 0;
108 if (!read_single_byte(next)) {
109 break;
110 }
111
112 seq.push_back(static_cast<char>(next));
113 if ((next >= 'A' && next <= 'Z') || (next >= 'a' && next <= 'z') || next == '~') {
114 break;
115 }
116 }
117
118 return seq;
119}
120
121void redraw_input_line(const std::string& prompt, const std::string& line) {
122 std::cout << "\r" << prompt << line << "\x1b[K" << std::flush;

Callers 1

get_interactive_inputMethod · 0.85

Calls 4

nowFunction · 0.85
stdin_has_pending_inputFunction · 0.85
read_single_byteFunction · 0.85
push_backMethod · 0.80

Tested by

no test coverage detected