#386 wgnuplot: new implemenation of text console

closed-accepted
nobody
None
6
2011-04-12
2008-05-26
No

The text console of wgnuplot offers a fixed line length
and a fixed number of lines only. This patch aims to implement a more flexible approach. It offers dynamic line wrapping, i.e. wrapping is changed automatically according to the current window width. Optionally wrapping of long lines can be turned of completely. The size of the circular buffer used to store the text can be changed via wgnuplot.ini (a user interface for this hasn't been implemented yet). This adresses feature request 992352.

Currently no support for different text attributes (e.g. colours) has been implemented. This means the user can no longer distinguish between gnuplot output (black by default) and user input (blue by default), if "System Colors" is not selected.

Parts of the current implementation could be sped up considerably by caching the results of calculations which are performed during every redraw. But it's probably not really worth the effort since I do not experience slow redraws on the almost "antique" laptop I am working on right now. ;-)

Comments and suggestions greatly appreciated.

Discussion

1 2 > >> (Page 1 of 2)
  • Petr Mikulik

    Petr Mikulik - 2008-06-01

    Logged In: YES
    user_id=31505
    Originator: NO

    Applying of the patch fails, can you please update it?
    Further, try using the diff program which outputs "/" and not "\" in the diff file so that it is possible to apply the patch on unixes.

     
  • Bastian Märkisch

    version with slashes instead of backslahes, modifications to win,trm and makefile.nt included

     
  • Bastian Märkisch

    Logged In: YES
    user_id=1180072
    Originator: YES

    I couldn't persuade my diff to actually do that, so I simply did
    it by hand. Please note that the appended patch may not apply
    to current CVS, but to CVS downloaded at 2008-04-28 (will clash with
    the buffer fix included on 2008-05-27).
    Since I am not using MinGW I haven't updated it's makefile yet, should
    be trivial though.
    File Added: screenbuf-20080602-slash.patch

     
  • Petr Mikulik

    Petr Mikulik - 2008-06-02

    Logged In: YES
    user_id=31505
    Originator: NO

    I've managed to fix slashes in your previous patch, but I thought I would prefer to test it against the current cvs, after that latest windows patches. Could you please update your patch?

    BTW, I was using diff from Mingw and it using forward slashes; I don't know about Cygwin's diff.

     
  • Bastian Märkisch

    Logged In: YES
    user_id=1180072
    Originator: YES

    I understand that. I, too, would prefer that. Right now I am
    on the road and do not have time and tools to do it.
    I would have guessed that there's only one hunk rejected
    (in wtext.c, TextInit()) anyway. I will try to find some time soon.
    That said, please understand that this patch is rather
    large and I would prefer not to update it with every CVS
    version.

     
  • Petr Mikulik

    Petr Mikulik - 2008-06-03

    Logged In: YES
    user_id=31505
    Originator: NO

    Blue colour is visible until the first redrawn of zoomed windows. Then the cursor behaves strangely -- it is several pages above where it should be, so you cannot see what you type.

    I'm enclosing modifications for makefile.mgw.

    The patch is very useful, please continue fixing it.
    File Added: makefile-4screenbuf.mgw.diff

     
  • Bastian Märkisch

    Logged In: YES
    user_id=1180072
    Originator: YES

    Thanks for having a look at it.
    Are you testing this with Wine? It works just fine
    here with Win XP.

    The blue colour may be related to the order the
    window receives certain messages. wtext.c claims to
    erase the background itself. Could you try and comment
    out the WM_ERASEBKGND case in WndTextProc()? This might
    be a leftover from debugging anyway.

    In the context menu you can disable text wrapping. Does
    this change the cursor problem? Could you also try to save
    this setting to wgnuplot.ini and restart wgnuplot? Does
    that change anything? What if you resize (not maximize)
    the window first? What if move some other window over it?
    Does the repainting fix it?

    Looking forward to your feedback.

     
  • Bastian Märkisch

    Logged In: YES
    user_id=1180072
    Originator: YES

    I just tried my MSVC2005 build on Linux using wine-1.0-rc3.
    I do not see any difference in behaviour from Windows, which
    means I cannot reproduce the bugs you see and will depend on
    your feedback for finding them.

    You can find my build
    www . physi . uni - heidelberg . de / ~ bmaerk / tmp / gnuplot . exe
    It has the resizing code in WM_CREATE and the WM_ERASEBKGND code
    disabled and is based on yesterday's CVS. Could you please try if it
    also fails on your system?

     
  • Petr Mikulik

    Petr Mikulik - 2008-06-04

    Logged In: YES
    user_id=31505
    Originator: NO

    I have tried your executable on wine-rc3 and W2K. In both cases, vertical positioning is broken after resize: the scrollbar square is somewhere in the bar middle, cursor is moving and writing nothing in that vertical position or in the middle of the window but seemingly not at the end of the buffer, but actually the text is written in the correct bottom window place and thus the user cannot see it.

    Well, now I can reproduce both correct and incorrect behaviour:
    1. correct: run wgnuplot, resize window, write is OK
    2. incorrect: run wgnuplot, write, resize window, now write is wrong

    I hope you can reproduce this as well.

     
  • Bastian Märkisch

    Logged In: YES
    user_id=1180072
    Originator: YES

    Ok. Now I see it, too. Seems to be related to scrolling
    and to the positioning of the cursor only.
    Also, I noticed that the window doesn't scroll when text
    typed by the user wraps. I probably won't have time to look
    into this until next week, though.

    Do you still get the blue window at startup?

    Have you tested copying text? It's always copied to clipboard
    as shown on screen, i.e. wrapped. Should this stay that way?

    The implementation currently does not support colors (whereas)
    the previous code did. Do you think it is worth adding this?

     
  • Petr Mikulik

    Petr Mikulik - 2008-06-05

    Logged In: YES
    user_id=31505
    Originator: NO

    > Do you still get the blue window at startup?
    > The implementation currently does not support colors (whereas)
    > the previous code did. Do you think it is worth adding this?

    No, all is as usual: text black, user's input blue.
    Only when writing, resizing, writing, then everything gets black + there are those problems with scrolling.
    It look nicer if the blue stays.

    > Have you tested copying text? It's always copied to clipboard
    > as shown on screen, i.e. wrapped. Should this stay that way?

    I think it's OK.

     
  • Bastian Märkisch

    Logged In: YES
    user_id=1180072
    Originator: YES

    Here's an update of the patch based on CVS 2008-06-02.
    It includes:
    * Petr's mingw makefile additions
    * fix to TextToCursor() such that it takes line wrapping
    fully into account
    * removal of remnants of attribute support (blue user text)
    * removal of WM_ERASEBKGND code
    * removal of automatic window resize on WM_CREATE

    I have uploaded a new version of my build, too.
    Petr: Do you still experience the cursor problems with this
    version?

    This version always draws black on white text (or uses system
    colors). The support for attribute (i.e. blue user input) can
    be added again once later.
    File Added: screenbuf-20080609.patch

     
  • Petr Mikulik

    Petr Mikulik - 2008-06-10

    Logged In: YES
    user_id=31505
    Originator: NO

    I have tried it, it works fine except for the problem I've reported earlier.

    I think it's more clear: if you switch on "Wrap long lines" while there is scroll bar in the window and some lines are wrapped (e.g. from the gnuplot's introductory message), then the scroll bar is always in a wrong position. I think that's because the total number of lines in the window changes due to wrapping but this number is not updated in the scroll bar extension.

    Reproduced on Wine and W2K.

     
  • Petr Mikulik

    Petr Mikulik - 2008-06-10

    Logged In: YES
    user_id=31505
    Originator: NO

    I forgotten to mention: there are two problems in the patched "win.trm":
    1. line 1026: "." => ","
    2. line 1117: "`" to be deleted

     
  • Bastian Märkisch

    Logged In: YES
    user_id=1180072
    Originator: YES

    Here's another update. It includes the following changes:
    * the scrolling/cursor bug should be fixed
    * speed up drawing of wrapped text (caching)
    * changed scrolling behaviour on resize and toggle of wrapping
    * several small bug fixes
    * layout changes

    There remains an issue with marking text and scrolling if long
    lines are not wrapped.

    File Added: screenbuf-20080616.patch

     
  • Petr Mikulik

    Petr Mikulik - 2008-09-04

    Logged In: YES
    user_id=31505
    Originator: NO

    Can you please update the patch? It has currently several FAILs in both 4.2 and cvs versions.
    Do you think the patch should go to both, or only to the cvs version?

     
  • Bastian Märkisch

    This is a lot of new code. It should only go into CVS where we can test it for a while.

    I'll try and find the time to update the patch soon.

     
  • Petr Mikulik

    Petr Mikulik - 2008-11-22

    Can you please update the patch?

     
  • Ethan Merritt

    Ethan Merritt - 2010-10-02
    • status: open --> closed-out-of-date
     
  • Ethan Merritt

    Ethan Merritt - 2011-01-19

    [sfeam] Re-activated tracker item because Bastian has now updated the patchset to current CVS.

    Please test and commnet.

     
  • Ethan Merritt

    Ethan Merritt - 2011-01-19
    • priority: 5 --> 6
    • status: closed-out-of-date --> open
     
1 2 > >> (Page 1 of 2)

Log in to post a comment.