diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2011-07-12 14:45:31 +0000 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2011-07-12 14:45:31 +0000 |
commit | 4ec5dfaa408ca6bc08615b7112f9c2ed00e7a271 (patch) | |
tree | 7379ce5df521391aa2415b2a99151e255766a94e /scintilla/src | |
parent | 61c639e3dbb9070523e09c58e4cd7b4b5bf974c1 (diff) | |
download | notepad2-mod-4ec5dfaa408ca6bc08615b7112f9c2ed00e7a271.zip notepad2-mod-4ec5dfaa408ca6bc08615b7112f9c2ed00e7a271.tar.gz notepad2-mod-4ec5dfaa408ca6bc08615b7112f9c2ed00e7a271.tar.bz2 |
update scintilla
git-svn-id: https://notepad2-mod.googlecode.com/svn/trunk@555 28bd50df-7adb-d945-0439-6e466c6a13cc
Diffstat (limited to 'scintilla/src')
-rw-r--r-- | scintilla/src/Document.cxx | 23 | ||||
-rw-r--r-- | scintilla/src/Document.h | 2 | ||||
-rw-r--r-- | scintilla/src/KeyMap.h | 1 | ||||
-rw-r--r-- | scintilla/src/PositionCache.cxx | 8 | ||||
-rw-r--r-- | scintilla/src/PositionCache.h | 2 | ||||
-rw-r--r-- | scintilla/src/ScintillaBase.cxx | 3 |
6 files changed, 23 insertions, 16 deletions
diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index c45b582..ee621bf 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -662,7 +662,8 @@ bool SCI_METHOD Document::IsDBCSLeadByte(char ch) const { case 932:
// Shift_jis
return ((uch >= 0x81) && (uch <= 0x9F)) ||
- ((uch >= 0xE0) && (uch <= 0xEF));
+ ((uch >= 0xE0) && (uch <= 0xFC));
+ // Lead bytes F0 to FC may be a Microsoft addition.
case 936:
// GBK
return (uch >= 0x81) && (uch <= 0xFE);
@@ -1112,17 +1113,17 @@ void Document::Indent(bool forwards, int lineBottom, int lineTop) { // Convert line endings for a piece of text to a particular mode.
// Stop at len or when a NUL is found.
// Caller must delete the returned pointer.
-char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode) {
+char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolModeWanted) {
char *dest = new char[2 * len + 1];
const char *sptr = s;
char *dptr = dest;
for (size_t i = 0; (i < len) && (*sptr != '\0'); i++) {
if (*sptr == '\n' || *sptr == '\r') {
- if (eolMode == SC_EOL_CR) {
+ if (eolModeWanted == SC_EOL_CR) {
*dptr++ = '\r';
- } else if (eolMode == SC_EOL_LF) {
+ } else if (eolModeWanted == SC_EOL_LF) {
*dptr++ = '\n';
- } else { // eolMode == SC_EOL_CRLF
+ } else { // eolModeWanted == SC_EOL_CRLF
*dptr++ = '\r';
*dptr++ = '\n';
}
@@ -1427,7 +1428,6 @@ long Document::FindText(int minPos, int maxPos, const char *search, // Compute actual search ranges needed
const int lengthFind = (*length == -1) ? static_cast<int>(strlen(search)) : *length;
- const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos;
//Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind);
const int limitPos = Platform::Maximum(startPos, endPos);
@@ -1437,6 +1437,7 @@ long Document::FindText(int minPos, int maxPos, const char *search, pos = NextPosition(pos, increment);
}
if (caseSensitive) {
+ const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos;
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
bool found = (pos + lengthFind) <= limitPos;
for (int indexSearch = 0; (indexSearch < lengthFind) && found; indexSearch++) {
@@ -1454,7 +1455,7 @@ long Document::FindText(int minPos, int maxPos, const char *search, std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
const int lenSearch = static_cast<int>(
pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind));
- while (forward ? (pos < endSearch) : (pos >= endSearch)) {
+ while (forward ? (pos < endPos) : (pos >= endPos)) {
int widthFirstCharacter = 0;
int indexDocument = 0;
int indexSearch = 0;
@@ -1467,6 +1468,8 @@ long Document::FindText(int minPos, int maxPos, const char *search, const int widthChar = static_cast<int>(ExtractChar(pos + indexDocument, bytes));
if (!widthFirstCharacter)
widthFirstCharacter = widthChar;
+ if ((pos + indexDocument + widthChar) > limitPos)
+ break;
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar));
folded[lenFlat] = 0;
@@ -1494,7 +1497,7 @@ long Document::FindText(int minPos, int maxPos, const char *search, std::vector<char> searchThing(lengthFind * maxBytesCharacter * maxFoldingExpansion + 1);
const int lenSearch = static_cast<int>(
pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind));
- while (forward ? (pos < endSearch) : (pos >= endSearch)) {
+ while (forward ? (pos < endPos) : (pos >= endPos)) {
int indexDocument = 0;
int indexSearch = 0;
bool characterMatches = true;
@@ -1506,6 +1509,8 @@ long Document::FindText(int minPos, int maxPos, const char *search, const int widthChar = IsDBCSLeadByte(bytes[0]) ? 2 : 1;
if (widthChar == 2)
bytes[1] = cb.CharAt(pos + indexDocument + 1);
+ if ((pos + indexDocument + widthChar) > limitPos)
+ break;
char folded[maxBytesCharacter * maxFoldingExpansion + 1];
const int lenFlat = static_cast<int>(pcf->Fold(folded, sizeof(folded), bytes, widthChar));
folded[lenFlat] = 0;
@@ -1524,7 +1529,7 @@ long Document::FindText(int minPos, int maxPos, const char *search, break;
}
} else {
- CaseFolderTable caseFolder;
+ const int endSearch = (startPos <= endPos) ? endPos - lengthFind + 1 : endPos;
std::vector<char> searchThing(lengthFind + 1);
pcf->Fold(&searchThing[0], searchThing.size(), search, lengthFind);
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h index 29adf33..1816bea 100644 --- a/scintilla/src/Document.h +++ b/scintilla/src/Document.h @@ -303,7 +303,7 @@ public: int GetColumn(int position);
int FindColumn(int line, int column);
void Indent(bool forwards, int lineBottom, int lineTop);
- static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode);
+ static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolModeWanted);
void ConvertLineEnds(int eolModeSet);
void SetReadOnly(bool set) { cb.SetReadOnly(set); }
bool IsReadOnly() { return cb.IsReadOnly(); }
diff --git a/scintilla/src/KeyMap.h b/scintilla/src/KeyMap.h index c1b1a10..6584b29 100644 --- a/scintilla/src/KeyMap.h +++ b/scintilla/src/KeyMap.h @@ -16,6 +16,7 @@ namespace Scintilla { #define SCI_SHIFT SCMOD_SHIFT
#define SCI_CTRL SCMOD_CTRL
#define SCI_ALT SCMOD_ALT
+#define SCI_META SCMOD_META
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)
diff --git a/scintilla/src/PositionCache.cxx b/scintilla/src/PositionCache.cxx index 50d964d..bc0d353 100644 --- a/scintilla/src/PositionCache.cxx +++ b/scintilla/src/PositionCache.cxx @@ -542,16 +542,16 @@ bool PositionCacheEntry::Retrieve(unsigned int styleNumber_, const char *s_, }
}
-int PositionCacheEntry::Hash(unsigned int styleNumber, const char *s, unsigned int len) {
+int PositionCacheEntry::Hash(unsigned int styleNumber_, const char *s, unsigned int len_) {
unsigned int ret = s[0] << 7;
- for (unsigned int i=0; i<len; i++) {
+ for (unsigned int i=0; i<len_; i++) {
ret *= 1000003;
ret ^= s[i];
}
ret *= 1000003;
- ret ^= len;
+ ret ^= len_;
ret *= 1000003;
- ret ^= styleNumber;
+ ret ^= styleNumber_;
return ret;
}
diff --git a/scintilla/src/PositionCache.h b/scintilla/src/PositionCache.h index 45c09ea..13436cb 100644 --- a/scintilla/src/PositionCache.h +++ b/scintilla/src/PositionCache.h @@ -110,7 +110,7 @@ public: void Set(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_, unsigned int clock);
void Clear();
bool Retrieve(unsigned int styleNumber_, const char *s_, unsigned int len_, int *positions_) const;
- static int Hash(unsigned int styleNumber, const char *s, unsigned int len);
+ static int Hash(unsigned int styleNumber_, const char *s, unsigned int len);
bool NewerThan(const PositionCacheEntry &other) const;
void ResetClock();
};
diff --git a/scintilla/src/ScintillaBase.cxx b/scintilla/src/ScintillaBase.cxx index 4cec34a..8afa6e7 100644 --- a/scintilla/src/ScintillaBase.cxx +++ b/scintilla/src/ScintillaBase.cxx @@ -205,7 +205,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) { if (ac.chooseSingle && (listType == 0)) {
if (list && !strchr(list, ac.GetSeparator())) {
const char *typeSep = strchr(list, ac.GetTypesep());
- int lenInsert = static_cast<int>((typeSep) ? (typeSep-list) : strlen(list));
+ int lenInsert = typeSep ?
+ static_cast<int>(typeSep-list) : static_cast<int>(strlen(list));
if (ac.ignoreCase) {
SetEmptySelection(sel.MainCaret() - lenEntered);
pdoc->DeleteChars(sel.MainCaret(), lenEntered);
|