This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 159122 - DiffContentPanel.getHighlights doesn't respect startOffset and endOffset
Summary: DiffContentPanel.getHighlights doesn't respect startOffset and endOffset
Status: RESOLVED FIXED
Alias: None
Product: utilities
Classification: Unclassified
Component: Diff (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: diff-issues@utilities
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-25 09:43 UTC by emi
Modified: 2009-03-28 20:38 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Screenshot of the diff repaint bug (12.79 KB, image/png)
2009-02-25 09:44 UTC, emi
Details
Video showing the highlighting bug in real time happening due to the mouse movement which trigers repaint request (604.58 KB, application/octet-stream)
2009-02-25 09:46 UTC, emi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description emi 2009-02-25 09:43:55 UTC
Take a look at the attached picture and swf movie.

The swf file is a flash recording of the interaction with a diff pane while having portions of the text selected. You'll
note at the end of the movie how the text gets selected. The reason is that my mouse movement trigers the repaint for
discrete regions of the editor view which requests for highlights only for pieces of the document (startOffset !=0).

The bug is that DiffContentPanel.getHighlights doesn't respect the given start and end offset. More exactly, the
returned sequence might have the first startOffset smaller than the requested offset.

The bug will show up only when you have some layers on top of this layer -- like the text selection layer.

The patch for this is trivial, just change DiffContentPanel.DiffHighlightsSequence.getStartOffset and getEndOffset to
return Math.max respectively Math.min values compared to the this.startOffset and this.endOffset.
Comment 1 emi 2009-02-25 09:44:59 UTC
Created attachment 77342 [details]
Screenshot of the diff repaint bug
Comment 2 emi 2009-02-25 09:46:52 UTC
Created attachment 77343 [details]
Video showing the highlighting bug in real time happening due to the mouse movement which trigers repaint request
Comment 3 Ondrej Vrabec 2009-03-27 14:31:34 UTC
applying emi's patch (cdev repo)
changeset   : 123904:ba155f93e74b
author      : Ondrej Vrabec <ovrabec@netbeans.org>
date        : Fri Mar 27 14:28:10 CET 2009
summary     : #159122 - DiffContentPanel.getHighlights doesn't respect startOffset and endOffset
applying suggested patch

thanks to emi, hope it would work
Comment 4 Quality Engineering 2009-03-28 20:38:39 UTC
Integrated into 'main-golden', will be available in build *200903281400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/ba155f93e74b
User: Ondrej Vrabec <ovrabec@netbeans.org>
Log: #159122 - DiffContentPanel.getHighlights doesn't respect startOffset and endOffset
applying suggested patch