libcubescript/tools/edit_fallback.hh

25 lines
587 B
C++
Raw Normal View History

#ifndef CS_REPL_HAS_EDIT
/* use nothing (no line editing support) */
2017-01-30 18:38:11 +00:00
#include <optional>
#include <ostd/string.hh>
2016-09-11 21:33:02 +00:00
static void init_lineedit(CsState &, ostd::ConstCharRange) {
}
2017-01-30 18:38:11 +00:00
static std::optional<std::string> read_line(CsState &, CsSvar *pr) {
ostd::write(pr->get_value());
2017-01-30 00:18:55 +00:00
std::string ret;
/* i really need to implement some sort of get_line for ostd streams */
for (char c = ostd::in.getchar(); c && (c != '\n'); c = ostd::in.getchar()) {
ret += c;
}
2017-01-25 00:57:33 +00:00
return std::move(ret);
}
2016-09-11 21:33:02 +00:00
static void add_history(CsState &, ostd::ConstCharRange) {
}
#endif