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

Method get_interactive_input

src/runner/cli_wide_posix.cpp:157–345  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

155}
156
157std::string CLIWide::get_interactive_input() {
158#ifdef FASTFLOWLM_USE_READLINE
159 std::vector<std::string> lines;
160 bool paste_mode = false;
161
162 while (true) {
163 const char* prompt = lines.empty() ? ">>> " : "... ";
164 char* line = readline(prompt);
165 if (!line) {
166 if (lines.empty()) {
167 return "/bye";
168 }
169 std::cout << std::endl;
170 break;
171 }
172
173 std::string input(line);
174 free(line);
175
176 if (lines.empty() && !input.empty() && input[0] == '/') {
177 add_to_history(input);
178 return input;
179 }
180
181 bool has_continuation = !input.empty() && input.back() == '\\';
182 if (has_continuation) {
183 input.pop_back();
184 }
185
186 lines.push_back(input);
187
188 if (has_continuation) {
189 continue;
190 }
191
192 if (paste_mode) {
193 if (wait_for_pending_input(5, 15)) {
194 continue;
195 }
196 paste_mode = false;
197 trim_trailing_empty_lines(lines);
198 break;
199 }
200
201 if (wait_for_pending_input(1, 30)) {
202 paste_mode = true;
203 continue;
204 }
205
206 if (lines.size() == 1 && lines[0].empty()) {
207 return std::string();
208 }
209
210 trim_trailing_empty_lines(lines);
211 break;
212 }
213
214 std::string merged = join_lines(lines);

Callers

nothing calls this directly

Calls 12

wait_for_pending_inputFunction · 0.85
join_linesFunction · 0.85
read_single_byteFunction · 0.85
read_escape_sequenceFunction · 0.85
pop_last_utf8_charFunction · 0.85
redraw_input_lineFunction · 0.85
push_backMethod · 0.80
is_activeMethod · 0.80
clearMethod · 0.80
emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected