diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/Editor.cxx | 26 | ||||
| -rw-r--r-- | src/Editor.h | 1 | 
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); | 
