libcubescript/tools/edit_fallback.hh

24 lines
589 B
C++
Raw Normal View History

#ifndef CS_REPL_HAS_EDIT
/* use nothing (no line editing support) */
#include <ostd/string.hh>
#include <ostd/maybe.hh>
2016-09-11 23:33:02 +02:00
static void init_lineedit(CsState &, ostd::ConstCharRange) {
}
2017-01-30 01:18:55 +01:00
static ostd::Maybe<std::string> read_line(CsState &, CsSvar *pr) {
ostd::write(pr->get_value());
2017-01-30 01:18:55 +01: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 01:57:33 +01:00
return std::move(ret);
}
2016-09-11 23:33:02 +02:00
static void add_history(CsState &, ostd::ConstCharRange) {
}
#endif