"Highlight Color in buffer" is not work correctly with softwrap.
Revison: 20370
I write patch.
--- src\gatchan\highlight\color\FlexColorPainter.java Fri Apr 27 21:49:40 2012
+++ src\gatchan\highlight\color\FlexColorPainter.new Fri Apr 27 21:53:03 2012
@@ -81,7 +81,7 @@
ColorToken token = flexColor.yylex();
while (token != null)
{
- paint(token, gfx, physicalLine, y);
+ paint(token, gfx, screenLine, physicalLine, start, end, y);
try
{
token = flexColor.yylex();
@@ -101,10 +101,16 @@
private void paint(ColorToken token,
Graphics2D gfx,
+ int screenLine,
int physicalLine,
+ int start,
+ int end,
int y)
{
- Point p = textArea.offsetToXY(physicalLine, token.getStart(), point);
+ int phycialLineStartOffset = textArea.getLineStartOffset(physicalLine);
+ int screenStartOffset = start + token.getStart();
+ int screenEndOffset = start + token.getEnd();
+ Point p = textArea.offsetToXY(physicalLine, screenStartOffset - phycialLineStartOffset, point);
if (p == null)
{
// The start offset was not visible
@@ -112,7 +118,7 @@
}
int startX = p.x;
- p = textArea.offsetToXY(physicalLine, token.getEnd(), point);
+ p = textArea.offsetToXY(physicalLine, screenEndOffset - phycialLineStartOffset, point);
if (p == null)
{
// The end offset was not visible
Hi, do you have an example where it fails with softwrap ?
example text
// #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000 #FFFFFF #000000
Screenshot
https://docs.google.com/open?id=0B9kFNkqCuc_ZeTdoZEN6aWxUTTQ
OH I see now, thanks, I'll try your patch as soon as possible
Hi, thanks for your patch, sorry for the long time.
I think you don't use the new arguments
int screenLine, and
int end
so I removed them, but your patch work so I applied it, it will be in next release soon.