Bug 105813

Summary: the caret in the text editor doesn't update when the viewport is scrolled
Product: [Tools] GEF Reporter: Takahiro Kato <takahiro.kato>
Component: GEF-Legacy GEF (MVC)Assignee: Pratik Shah <ppshah>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: kevinlo2, nyssen
Version: unspecified   
Target Milestone: 3.2.0 (Callisto) M4   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
patch for scrolling problem in the text example
none
patch that only contains the fix for this bug none

Description Takahiro Kato CLA 2005-08-02 12:02:02 EDT
When the viewport is scrolled by mouse wheel or the scroll bars, the caret moves
with the viewport.  The caret should not move when the viewport is scrolled.
Comment 1 Takahiro Kato CLA 2005-08-02 12:12:53 EDT
Created attachment 25565 [details]
patch for scrolling problem in the text example

The caret should be redrawn when the viewport is scrolled.  The patch listens
to the scrolling and redraws the caret.
Comment 2 Pratik Shah CLA 2005-08-02 16:58:16 EDT
Takahiro-san, are all these changes in your patch really necessary?  Can't you 
just invoke refreshCaret() (or queueCaretRefresh()) when the range model 
changes?

Also, you don't need the configureViewer() method.  You can add the listeners 
to the viewport's range models in hookControl() (and remove them in 
unhookControl()).

One other option to fix this bug might be to invoke queueCaretRefresh() when 
update manager paints, rather than when it validates (see the update listener 
added in hookControl()).  But that's probably too agressive, so it's better to 
stick with your approach of adding listeners for scroll changes.

A couple of things to keep in mind about submitting patches.  You should 
mention whether it is to be applied to a class, package or a project.  And you 
should also add yourself to the copyright section (under contributors) of any 
classes that you modify.  Something like:
Takahiro Kato - Added code to update caret during scrolling (Bug 105813)
Comment 3 Takahiro Kato CLA 2005-08-03 18:31:14 EDT
It does contain unnecessary code.  Sorry about that, I realized that after I
submitted.  It contains a fix to some other bugs related to moving the caret
around with the arrow keys.  I'll post the better patch as soon as possible.

BTW, configureViewer() is needed because registering listeners must occur after
GraphicalTextViewer.createControl(Composite) because the
ScrollingGraphicalViewer.installRootFigure() somehow creates a new set of range
models.  I tried registering listeners in hookControl(), but because this method
is called before installRootFigure(), liteners listen to the range models that
are stale.
Comment 4 Takahiro Kato CLA 2005-08-04 12:26:50 EDT
Created attachment 25687 [details]
patch that only contains the fix for this bug

the same as the previous one except that it only contains the necessary code to
fix this bug.

again, we haven't figured out what to put in the copyright section, so I left
it as it is.
Comment 5 Pratik Shah CLA 2005-12-20 15:18:38 EST
Fixed.  The caret is refreshed when painting occurs.
Comment 6 Randy Hudson CLA 2005-12-20 15:34:44 EST
This should probably be just when validation occurs. If we change where the caret is managed, this should be revisited.
Comment 7 Alexander Nyßen CLA 2014-05-22 01:53:33 EDT
Comment on attachment 25565 [details]
patch for scrolling problem in the text example

As this patch does not seem to have been applied, marking it as obsolete.
Comment 8 Alexander Nyßen CLA 2014-05-22 03:04:00 EDT
Comment on attachment 25687 [details]
patch that only contains the fix for this bug

This patch does not seem to have been applied, thus marking as obsolete.