forked from OctaForge/libcubescript
halfassed hint support in readline code
parent
78d7ab73bd
commit
1af9144656
|
@ -45,10 +45,32 @@ static char **ln_complete(char const *buf, int, int) {
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CS_REPL_HAS_HINTS
|
||||||
|
void ln_hint() {
|
||||||
|
CsCommand *cmd = get_hint_cmd(rl_line_buffer);
|
||||||
|
if (!cmd) {
|
||||||
|
rl_redisplay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ostd::String old = rl_line_buffer;
|
||||||
|
ostd::String args = old;
|
||||||
|
args += " [";
|
||||||
|
fill_cmd_args(args, cmd->get_args());
|
||||||
|
args += "] ";
|
||||||
|
rl_extend_line_buffer(args.size());
|
||||||
|
rl_replace_line(args.data(), 0);
|
||||||
|
rl_redisplay();
|
||||||
|
rl_replace_line(old.data(), 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
static void init_lineedit(ostd::ConstCharRange) {
|
static void init_lineedit(ostd::ConstCharRange) {
|
||||||
#ifdef CS_REPL_HAS_COMPLETE
|
#ifdef CS_REPL_HAS_COMPLETE
|
||||||
rl_attempted_completion_function = ln_complete;
|
rl_attempted_completion_function = ln_complete;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef CS_REPL_HAS_HINTS
|
||||||
|
rl_redisplay_function = ln_hint;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static ostd::Maybe<ostd::String> read_line(CsSvar *pr) {
|
static ostd::Maybe<ostd::String> read_line(CsSvar *pr) {
|
||||||
|
|
Loading…
Reference in New Issue