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 19:38:11 +01:00
#include <optional>
#include <ostd/string.hh>
2017-02-16 19:07:22 +01:00
static void init_lineedit(cs_state &, ostd::string_range) {
}
2017-02-13 18:10:40 +01:00
static std::optional<std::string> read_line(cs_state &, cs_svar *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);
}
2017-02-16 19:07:22 +01:00
static void add_history(cs_state &, ostd::string_range) {
}
#endif