diff options
author | nyamatongwe <unknown> | 2002-10-08 09:53:35 +0000 |
---|---|---|
committer | nyamatongwe <unknown> | 2002-10-08 09:53:35 +0000 |
commit | 4ef103f0943b6dde707c037cbf7dc5136fbbef84 (patch) | |
tree | be2f0ee42add594d2d3f4aea6aed1f84c9ca3721 /src | |
parent | e38e26d27d76b6b6eb997b08c9deb823cef8b8cd (diff) | |
download | scintilla-mirror-4ef103f0943b6dde707c037cbf7dc5136fbbef84.tar.gz |
Extra safety by anding mask into styles being set.
Diffstat (limited to 'src')
-rw-r--r-- | src/CellBuffer.cxx | 1 | ||||
-rw-r--r-- | src/Document.cxx | 13 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/CellBuffer.cxx b/src/CellBuffer.cxx index 420dee6ff..8f292869d 100644 --- a/src/CellBuffer.cxx +++ b/src/CellBuffer.cxx @@ -739,6 +739,7 @@ void CellBuffer::InsertCharStyle(int position, char ch, char style) { } bool CellBuffer::SetStyleAt(int position, char style, char mask) { + style &= mask; char curVal = ByteAt(position * 2 + 1); if ((curVal & mask) != style) { SetByteAt(position*2 + 1, static_cast<char>((curVal & ~mask) | style)); diff --git a/src/Document.cxx b/src/Document.cxx index 747ccd8f2..5afd34625 100644 --- a/src/Document.cxx +++ b/src/Document.cxx @@ -524,7 +524,7 @@ bool Document::InsertString(int position, const char *s, size_t insertLength) { sWithStyle[i*2] = s[i]; sWithStyle[i*2 + 1] = 0; } - changed = InsertStyledString(position*2, sWithStyle, + changed = InsertStyledString(position*2, sWithStyle, static_cast<int>(insertLength*2)); delete []sWithStyle; } @@ -745,7 +745,7 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { } /** - * Find the start of the next word in either a forward (delta >= 0) or backwards direction + * Find the start of the next word in either a forward (delta >= 0) or backwards direction * (delta < 0). * This is looking for a transition between character classes although there is also some * additional movement to transit white space. @@ -798,7 +798,7 @@ bool Document::IsWordEndAt(int pos) { } /** - * Check that the given range is has transitions between character classes at both + * Check that the given range is has transitions between character classes at both * ends and where the characters on the inside are word or punctuation characters. */ bool Document::IsWordAt(int start, int end) { @@ -872,8 +872,8 @@ long Document::FindText(int minPos, int maxPos, const char *s, // Replace: $(\1-\2) int lineRangeStart = LineFromPosition(startPos); int lineRangeEnd = LineFromPosition(endPos); - if ((increment == 1) && - (startPos >= LineEnd(lineRangeStart)) && + if ((increment == 1) && + (startPos >= LineEnd(lineRangeStart)) && (lineRangeStart < lineRangeEnd)) { // the start position is at end of line or between line end characters. lineRangeStart++; @@ -1078,7 +1078,7 @@ void Document::SetWordChars(unsigned char *chars) { } } else { for (ch = 0; ch < 256; ch++) { - if (ch >= 0x80 || isalnum(ch) || ch == '_') + if (ch >= 0x80 || isalnum(ch) || ch == '_') charClass[ch] = ccWord; } } @@ -1103,6 +1103,7 @@ bool Document::SetStyleFor(int length, char style) { return false; } else { enteredCount++; + style &= stylingMask; int prevEndStyled = endStyled; if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, |