diff options
Diffstat (limited to 'src/Editor.cxx')
| -rw-r--r-- | src/Editor.cxx | 20 | 
1 files changed, 14 insertions, 6 deletions
| diff --git a/src/Editor.cxx b/src/Editor.cxx index f0a4f44f2..e4ae6060e 100644 --- a/src/Editor.cxx +++ b/src/Editor.cxx @@ -1606,7 +1606,7 @@ void Editor::LinesJoin() {  		UndoGroup ug(pdoc);  		bool prevNonWS = true;  		for (int pos = targetStart; pos < targetEnd; pos++) { -			if (IsEOLChar(pdoc->CharAt(pos))) { +			if (pdoc->IsPositionInLineEnd(pos)) {  				targetEnd -= pdoc->LenChar(pos);  				pdoc->DelChar(pos);  				if (prevNonWS) { @@ -2193,7 +2193,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  			bool isBadUTF = isBadUTFNext;  			isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars + charInLine + 1, numCharsInLine - charInLine - 1, trailBytes);  			if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) || -			        isControl || isControlNext || isBadUTF || isBadUTFNext) { +			        isControl || isControlNext || isBadUTF || isBadUTFNext || ((charInLine+1) >= numCharsBeforeEOL)) {  				ll->positions[startseg] = 0;  				if (vstyle.styles[ll->styles[charInLine]].visible) {  					if (isControl) { @@ -2213,7 +2213,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou  							        ll->positions + startseg + 1);  						}  						lastSegItalics = false; -					} else if (isBadUTF) { +					} else if ((isBadUTF) || (charInLine >= numCharsBeforeEOL)) {  						char hexits[4];  						sprintf(hexits, "x%2X", ll->chars[charInLine] & 0xff);  						ll->positions[charInLine + 1] = @@ -2504,7 +2504,15 @@ void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, Lin  			rcSegment.left = xStart + ll->positions[eolPos] - subLineStart + virtualSpace;  			rcSegment.right = xStart + ll->positions[eolPos+1] - subLineStart + virtualSpace;  			blobsWidth += rcSegment.Width(); -			const char *ctrlChar = ControlCharacterString(ll->chars[eolPos]); +			char hexits[4]; +			const char *ctrlChar; +			unsigned char chEOL = ll->chars[eolPos]; +			if (UTF8IsAscii(chEOL)) { +				ctrlChar = ControlCharacterString(chEOL); +			} else { +				sprintf(hexits, "x%2X", chEOL); +				ctrlChar = hexits; +			}  			int styleMain = ll->styles[eolPos];  			ColourDesired textBack = TextBackground(vsDraw, overrideBackground, background, eolInSelection, false, styleMain, eolPos, ll);  			ColourDesired textFore = vsDraw.styles[styleMain].fore; @@ -3995,7 +4003,7 @@ void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {  					}  				} else if (inOverstrike) {  					if (positionInsert < pdoc->Length()) { -						if (!IsEOLChar(pdoc->CharAt(positionInsert))) { +						if (!pdoc->IsPositionInLineEnd(positionInsert)) {  							pdoc->DelChar(positionInsert);  							currentSel->ClearVirtualSpace();  						} @@ -4240,7 +4248,7 @@ void Editor::Clear() {  					else  						sel.Range(r) = SelectionPosition(InsertSpace(sel.Range(r).caret.Position(), sel.Range(r).caret.VirtualSpace()));  				} -				if ((sel.Count() == 1) || !IsEOLChar(pdoc->CharAt(sel.Range(r).caret.Position()))) { +				if ((sel.Count() == 1) || !pdoc->IsPositionInLineEnd(sel.Range(r).caret.Position())) {  					pdoc->DelChar(sel.Range(r).caret.Position());  					sel.Range(r).ClearVirtualSpace();  				}  // else multiple selection so don't eat line ends | 
