aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/PositionCache.cxx
diff options
context:
space:
mode:
authorMitchell Foral <unknown>2021-10-22 15:58:17 +1100
committerMitchell Foral <unknown>2021-10-22 15:58:17 +1100
commit1c2f3fb6ce528add154abce1791d56ce7a94271c (patch)
tree113769c983cb307b9ba44873b0f9d4fdcaff76ab /src/PositionCache.cxx
parent67759806434b36d47d5f08810854a661f2e992d1 (diff)
downloadscintilla-mirror-1c2f3fb6ce528add154abce1791d56ce7a94271c.tar.gz
Add CARETSTYLE_CURSES to draw more than 1 caret on curses terminal.
Diffstat (limited to 'src/PositionCache.cxx')
-rw-r--r--src/PositionCache.cxx15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/PositionCache.cxx b/src/PositionCache.cxx
index 13e4ab2b2..587ffdd3b 100644
--- a/src/PositionCache.cxx
+++ b/src/PositionCache.cxx
@@ -696,6 +696,21 @@ BreakFinder::BreakFinder(const LineLayout *ll_, const Selection *psel, Range lin
Insert(portion.end.Position() - posLineStart);
}
}
+ // On the curses platform, the terminal is drawing its own caret, so add breaks around the
+ // caret in the main selection in order to help prevent the selection from being drawn in
+ // the caret's cell.
+ if (pvsDraw && FlagSet(pvsDraw->caret.style, CaretStyle::Curses) && !psel->RangeMain().Empty()) {
+ const Sci::Position caretPos = psel->RangeMain().caret.Position();
+ const Sci::Position anchorPos = psel->RangeMain().anchor.Position();
+ if (caretPos < anchorPos) {
+ const Sci::Position nextPos = pdoc->MovePositionOutsideChar(caretPos + 1, 1);
+ Insert(nextPos - posLineStart);
+ } else if (caretPos > anchorPos && pvsDraw->DrawCaretInsideSelection(false, false)) {
+ const Sci::Position prevPos = pdoc->MovePositionOutsideChar(caretPos - 1, -1);
+ if (prevPos > anchorPos)
+ Insert(prevPos - posLineStart);
+ }
+ }
}
if (pvsDraw && pvsDraw->indicatorsSetFore) {
for (const IDecoration *deco : pdoc->decorations->View()) {