aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2007-07-25 02:45:37 +0000
committernyamatongwe <devnull@localhost>2007-07-25 02:45:37 +0000
commit340983e94342aaf907025ba84c32f7017ceed579 (patch)
tree8bfbeda92365295ea35c52ca32bf6ceb3df8f00a /src
parent5c8d9997e79ce61adbe653e639b7cfe22555a42d (diff)
downloadscintilla-mirror-340983e94342aaf907025ba84c32f7017ceed579.tar.gz
Fixed bugs where caret was not shown at start of wrapped lines or was shown
at both the start of one line and the end of the previous line.
Diffstat (limited to 'src')
-rw-r--r--src/Editor.cxx5
-rw-r--r--src/PositionCache.cxx5
-rw-r--r--src/PositionCache.h1
3 files changed, 8 insertions, 3 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index 3373424da..b27775750 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -2915,8 +2915,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
// Draw the Caret
if (lineDoc == lineCaret) {
int offset = Platform::Minimum(posCaret - rangeLine.start, ll->maxLineLength);
- if ((offset >= ll->LineStart(subLine)) &&
- ((offset < ll->LineStart(subLine + 1)) || offset == ll->numCharsInLine)) {
+ if (ll->InLine(offset, subLine)) {
int xposCaret = ll->positions[offset] - ll->positions[ll->LineStart(subLine)] + xStart;
if (actualWrapVisualStartIndent != 0) {
@@ -2945,7 +2944,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
if (widthOverstrikeCaret < 3) // Make sure its visible
widthOverstrikeCaret = 3;
- if (offset > 0)
+ if (offset > ll->LineStart(subLine))
caretWidthOffset = 1; // Move back so overlaps both character cells.
if (posDrag >= 0) {
/* Dragging text, use a line caret */
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 13140b779..354dddd1a 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -126,6 +126,11 @@ int LineLayout::LineLastVisible(int line) const {
}
}
+bool LineLayout::InLine(int offset, int line) const {
+ return ((offset >= LineStart(line)) && (offset < LineStart(line + 1)) ||
+ ((offset == numCharsInLine) && (line == (lines-1))));
+}
+
void LineLayout::SetLineStart(int line, int start) {
if ((line >= lenLineStarts) && (line != 0)) {
int newMaxLines = line + 20;
diff --git a/src/PositionCache.h b/src/PositionCache.h
index ec1014c96..764702fce 100644
--- a/src/PositionCache.h
+++ b/src/PositionCache.h
@@ -59,6 +59,7 @@ public:
void Invalidate(validLevel validity_);
int LineStart(int line) const;
int LineLastVisible(int line) const;
+ bool InLine(int offset, int line) const;
void SetLineStart(int line, int start);
void SetBracesHighlight(Range rangeLine, Position braces[],
char bracesMatchStyle, int xHighlight);