aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Editor.cxx
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2007-07-25 02:53:19 +0000
committernyamatongwe <devnull@localhost>2007-07-25 02:53:19 +0000
commitaaa03c79d3f42fb8bb603bce476af6838be02a4e (patch)
tree3d764bf555181cb56f3a0a180b60a816a51cdc49 /src/Editor.cxx
parent340983e94342aaf907025ba84c32f7017ceed579 (diff)
downloadscintilla-mirror-aaa03c79d3f42fb8bb603bce476af6838be02a4e.tar.gz
Fix bug #1404276 by wrapping the line which just had the character added
before ensuring the caret is visible. Also sets scroll bar in case line added by wrapping.
Diffstat (limited to 'src/Editor.cxx')
-rw-r--r--src/Editor.cxx26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/Editor.cxx b/src/Editor.cxx
index b27775750..a8b6d6509 100644
--- a/src/Editor.cxx
+++ b/src/Editor.cxx
@@ -1264,6 +1264,16 @@ void Editor::NeedWrapping(int docLineStart, int docLineEnd) {
}
}
+bool Editor::WrapOneLine(Surface *surface, int lineToWrap) {
+ AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap));
+ int linesWrapped = 1;
+ if (ll) {
+ LayoutLine(lineToWrap, surface, vs, ll, wrapWidth);
+ linesWrapped = ll->lines;
+ }
+ return cs.SetHeight(lineToWrap, linesWrapped);
+}
+
// Check if wrapping needed and perform any needed wrapping.
// fullwrap: if true, all lines which need wrapping will be done,
// in this single call.
@@ -1340,13 +1350,7 @@ bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
// Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap);
// Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd);
while (lineToWrap < lastLineToWrap) {
- AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap));
- int linesWrapped = 1;
- if (ll) {
- LayoutLine(lineToWrap, surface, vs, ll, wrapWidth);
- linesWrapped = ll->lines;
- }
- if (cs.SetHeight(lineToWrap, linesWrapped)) {
+ if (WrapOneLine(surface, lineToWrap)) {
wrapOccurred = true;
}
lineToWrap++;
@@ -3306,6 +3310,14 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
if (charReplaceAction) {
pdoc->EndUndoAction();
}
+ // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information
+ if (wrapState != eWrapNone) {
+ AutoSurface surface(this);
+ if (surface) {
+ WrapOneLine(surface, pdoc->LineFromPosition(currentPos));
+ }
+ SetScrollBars();
+ }
EnsureCaretVisible();
// Avoid blinking during rapid typing:
ShowCaretAtCurrentPosition();