From: <kp...@us...> - 2011-12-09 12:24:28
|
Revision: 20591 http://jedit.svn.sourceforge.net/jedit/?rev=20591&view=rev Author: kpouer Date: 2011-12-09 12:24:22 +0000 (Fri, 09 Dec 2011) Log Message: ----------- When highlighting current word, the word under the caret is not filled with color but has only a square around it to help readability Modified Paths: -------------- plugins/Highlight/trunk/docs/Highlight.html plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java Modified: plugins/Highlight/trunk/docs/Highlight.html =================================================================== --- plugins/Highlight/trunk/docs/Highlight.html 2011-12-09 10:13:18 UTC (rev 20590) +++ plugins/Highlight/trunk/docs/Highlight.html 2011-12-09 12:24:22 UTC (rev 20591) @@ -11,7 +11,7 @@ <tr> <td valign="top" style="font-weight:bold;font-size:x-large">Highlight</td> <td align="right" valign="top" style="font-size:small"> - <span style="font-weight:bold">Version 1.9.8 (Dec 04, 2011)</span><br> + <span style="font-weight:bold">Version 1.9.9 (Dec 09, 2011)</span><br> Matthieu Casanova <cho...@gm...> </td> </tr> </table> @@ -42,6 +42,11 @@ </p> <h2>History</h2> <ul> + <li>1.9.9 (Dec 9, 2011)</li> + <ul> + <li>When highlighting current word, the word under the caret is not filled with color but has only + a square around it to help readability</li> + </ul> <li>1.9.8 (Dec 4, 2011)</li> <ul> <li>Fixed a regression preventing from adding new highlights (patch from Shozo Fukuda)</li> Modified: plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java =================================================================== --- plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2011-12-09 10:13:18 UTC (rev 20590) +++ plugins/Highlight/trunk/src/gatchan/highlight/Highlighter.java 2011-12-09 12:24:22 UTC (rev 20591) @@ -188,12 +188,24 @@ false); if (match == null || match.end == match.start) break; - Selection selectionAtOffset = textArea.getSelectionAtOffset(match.start + i + - screenToPhysicalOffset + textArea.getLineStartOffset(physicalLine)); + int offset = match.start + i + + screenToPhysicalOffset + textArea.getLineStartOffset(physicalLine); + Selection selectionAtOffset = textArea.getSelectionAtOffset(offset); if (selectionAtOffset == null) { - _highlight(highlight.getColor(), gfx, physicalLine, match.start + i + - screenToPhysicalOffset, match.end + i + screenToPhysicalOffset, y); + int caretOffsetInLine = textArea.getCaretPosition() - textArea.getLineStartOffset(textArea.getCaretLine()); + int endOffset = match.end + i + screenToPhysicalOffset; + int startOffset = match.start + i + screenToPhysicalOffset; + if (highlight != HighlightManagerTableModel.currentWordHighlight || + textArea.getCaretLine() != physicalLine || + caretOffsetInLine < startOffset || caretOffsetInLine > endOffset) + { + _highlight(highlight.getColor(), gfx, physicalLine, startOffset, endOffset, y, true); + } + else + { + _highlight(highlight.getColor(), gfx, physicalLine, startOffset, endOffset, y, false); + } } highlight.updateLastSeen(); i += match.end; @@ -217,7 +229,8 @@ int physicalLine, int startOffset, int endOffset, - int y) + int y, + boolean filled) { Point p = textArea.offsetToXY(physicalLine, startOffset, point); if (p == null) @@ -238,13 +251,18 @@ Composite oldComposite = gfx.getComposite(); gfx.setColor(highlightColor); gfx.setComposite(blend); - gfx.fillRoundRect(startX, y, endX - startX, fm.getHeight() - 1, 5, 5); + if (filled) + gfx.fillRoundRect(startX, y, endX - startX, fm.getHeight() - 1, 5, 5); if (square) { gfx.setColor(squareColor); gfx.drawRoundRect(startX, y, endX - startX, fm.getHeight() - 1,5,5); } + else if (!filled) + { + gfx.drawRoundRect(startX, y, endX - startX, fm.getHeight() - 1,5,5); + } gfx.setColor(oldColor); gfx.setComposite(oldComposite); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |