Changeset 16869


Ignore:
Timestamp:
06/19/13 17:09:29 (12 years ago)
Author:
tbretz
Message:
When we output something ourselves before the event hook is called in readline, we have to signal readline that we have started a new row, so that readline can properly update the prompt. I hope this finally solves the flickering issue on my laptop and/or the problematic display in the fadctrl.
Location:
trunk/FACT++/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/FACT++/src/Console.cc

    r14083 r16869  
    149149//! EventHook to update the prompt.
    150150//
    151 void Console::EventHook()
     151void Console::EventHook(bool)
    152152{
    153153    // If the output is continous and we are going to output something
     
    155155    // doesn't work well if the input line is already two lines)
    156156    // and then flush the buffer.
    157     if (fContinous && fLogO.GetSizeBacklog()>0)
     157    const bool newline = fContinous && fLogO.GetSizeBacklog()>0;
     158    if (newline)
    158159    {
    159160        // Clear the line we are going to overwrite
     
    163164
    164165    // Call Readline's EventHook to update the prompt
    165     Readline::EventHook();
     166    Readline::EventHook(newline);
    166167}
    167168
  • trunk/FACT++/src/Console.h

    r14083 r16869  
    6969
    7070    void Startup();
    71     void EventHook();
     71    void EventHook(bool);
    7272    void Run(const char * = 0);
    7373};
  • trunk/FACT++/src/Readline.cc

    r16868 r16869  
    310310//! with some information (e.g. time) just by overwriting GetUpdatePrompt()
    311311//!
    312 void Readline::EventHook()
     312void Readline::EventHook(bool newline)
    313313{
    314314    const string cpy = fExternalInput;
     
    325325        p = rl_prompt;
    326326
    327     const string line_buffer = rl_line_buffer;
    328     const int    point       = rl_point;
    329 
    330     rl_replace_line("", 1);
    331     UpdatePrompt("");
    332     Redisplay();
    333 
    334     rl_replace_line(line_buffer.c_str(), 1);
    335     rl_point = point;
     327    if (newline)
     328        rl_on_new_line();
    336329
    337330    UpdatePrompt(p);
  • trunk/FACT++/src/Readline.h

    r15104 r16869  
    66#include <vector>
    77#include <fstream>
     8#include <iostream>
    89
    910class Readline
     
    5051    virtual int  Getc(FILE *);
    5152    virtual void Startup();
    52     virtual void EventHook();
     53    virtual void EventHook(bool newline=false);
    5354    virtual void Shutdown(const char *buf);
    5455    virtual void Redisplay();
     
    99100    virtual bool PreProcess(const std::string &str);
    100101    virtual bool Process(const std::string &str);
    101     virtual std::string GetUpdatePrompt() const { return ""; }
     102    virtual std::string GetUpdatePrompt() const { std::cout << "**********" << std::endl; return ""; }
    102103    virtual bool PromptEOF(std::string &str);
    103104    virtual std::string Prompt(const std::string &prompt);
  • trunk/FACT++/src/ReadlineWindow.h

    r10183 r16869  
    2020    void Startup();
    2121    void Redisplay();
    22     void EventHook();
     22    void EventHook(bool = false);
    2323    void CompletionDisplay(char **matches, int num, int max);
    2424
Note: See TracChangeset for help on using the changeset viewer.