aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authornyamatongwe <unknown>2007-07-25 02:53:19 +0000
committernyamatongwe <unknown>2007-07-25 02:53:19 +0000
commit8b609f7f8901b3ae3b8171a21858f35ae9703d15 (patch)
tree3d764bf555181cb56f3a0a180b60a816a51cdc49 /src
parent5ae581a400e6c410f5e611672fc3bbcc1df9a198 (diff)
downloadscintilla-mirror-8b609f7f8901b3ae3b8171a21858f35ae9703d15.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')
-rw-r--r--src/Editor.cxx26
-rw-r--r--src/Editor.h1
2 files changed, 20 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();
diff --git a/src/Editor.h b/src/Editor.h
index 2115af7d9..049cc373f 100644
--- a/src/Editor.h
+++ b/src/Editor.h
@@ -299,6 +299,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void UpdateSystemCaret();
void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
+ bool WrapOneLine(Surface *surface, int lineToWrap);
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
void LinesJoin();
void LinesSplit(int pixelWidth);