FACT++  1.0
void Readline::EventHook ( bool  newline = false)
protectedvirtual

The default is to redisplay the prompt which is gotten from GetUpdatePrompt(). If GetUpdatePrompt() returns an empty string the prompt is kept untouched. This can be used to keep a prompt updated with some information (e.g. time) just by overwriting GetUpdatePrompt()

Reimplemented in RemoteControl< Console >, RemoteControl< ConsoleStream >, RemoteControl< Shell >, Console, and ReadlineWindow.

Definition at line 315 of file Readline.cc.

References fExternalInput, GetUpdatePrompt(), and UpdatePrompt().

Referenced by ReadlineWindow::EventHook(), Console::EventHook(), Console::GetStreamIn(), and rl_ncurses_event_hook().

316 {
317  const string cpy = fExternalInput;
318  fExternalInput = "";
319 
320  if (!cpy.empty())
321  {
322  rl_replace_line(cpy.c_str(), 1);
323  rl_done = 1;
324  }
325 
326  string p = GetUpdatePrompt();
327  if (p.empty())
328  p = rl_prompt;
329 
330  if (newline)
331  rl_on_new_line();
332 
333  if (rl_prompt==p && !newline)
334  return;
335 
336  UpdatePrompt(p);
337 
338  int w, h;
339  rl_get_screen_size(&h, &w);
340  cout << '\r' << string(w+1, ' ') << '\r';
341  rl_forced_update_display();
342 }
void UpdatePrompt() const
Definition: Readline.h:98
virtual std::string GetUpdatePrompt() const
Definition: Readline.h:102
static std::string fExternalInput
Definition: Readline.h:35

+ Here is the call graph for this function:

+ Here is the caller graph for this function: