Changeset 20016 for trunk/FACT++/src


Ignore:
Timestamp:
12/28/20 15:03:19 (4 years ago)
Author:
tbretz
Message:
Readline 8 behaves differently. The best fix is to use the readline functions themselves and don't interfere... this does not work well for resizing for older readline libraries, but that neither worked proprly before.
Location:
trunk/FACT++/src
Files:
2 edited

Legend:

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

    r18833 r20016  
    139139    rl_getc_function                   = rl_ncurses_getc;
    140140    rl_startup_hook                    = rl_ncurses_startup;
    141     rl_redisplay_function              = rl_ncurses_redisplay;
     141    // rl_redisplay_function              = rl_ncurses_redisplay;
    142142    rl_event_hook                      = rl_ncurses_event_hook;
    143143    rl_completion_display_matches_hook = rl_ncurses_completion_display;
     
    247247//! contents of the editing buffer.
    248248//
     249/*
    249250void Readline::rl_ncurses_redisplay()
    250251{
    251252    This->Redisplay();
    252253}
     254*/
    253255
    254256// --------------------------------------------------------------------------
     
    331333        rl_on_new_line();
    332334
    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();
     335    if (newline || rl_display_prompt!=p)
     336    {
     337        UpdatePrompt(p);
     338        rl_forced_update_display();
     339    }
    342340}
    343341
     
    359357//! Default: call rl_redisplay()
    360358//
    361 
     359/*
    362360void Readline::Redisplay()
    363361{
     
    379377    rl_forced_update_display();
    380378}
     379*/
    381380
    382381// --------------------------------------------------------------------------
     
    782781// --------------------------------------------------------------------------
    783782//
    784 //! return strlen(rl_display_prompt) + rl_point
     783//! return rl_visible_prompt_length + rl_point
     784//! (the current position within the line)
    785785//
    786786int Readline::GetAbsCursor()
    787787{
    788     return strlen(rl_display_prompt) + rl_point;
     788    extern int rl_visible_prompt_length;
     789    return /*strlen(rl_display_prompt)*/rl_visible_prompt_length + rl_point;
    789790}
    790791
     
    802803// --------------------------------------------------------------------------
    803804//
    804 //! return the length of the prompt plus the length of the line buffer
     805//! return rl_visible_prompt_length + rl_end
     806//! (the length of the prompt plus the length of the line buffer)
    805807//
    806808int Readline::GetLineLength()
    807809{
    808     return strlen(rl_display_prompt) + rl_end;
     810    extern int rl_visible_prompt_length;
     811    return /*strlen(rl_display_prompt)*/rl_visible_prompt_length + rl_end;
    809812}
    810813
  • trunk/FACT++/src/Readline.h

    r16877 r20016  
    3838    static int    rl_ncurses_getc(FILE *);
    3939    static int    rl_ncurses_startup();
    40     static void   rl_ncurses_redisplay();
     40    //static void   rl_ncurses_redisplay();
    4141    static int    rl_ncurses_event_hook();
    4242    static void   rl_ncurses_completion_display(char **matches, int num, int max);
     
    5353    virtual void EventHook(bool newline=false);
    5454    virtual void Shutdown(const char *buf);
    55     virtual void Redisplay();
     55    //virtual void Redisplay();
    5656    virtual void CompletionDisplay(char **matches, int num, int max);
    5757
Note: See TracChangeset for help on using the changeset viewer.