summaryrefslogtreecommitdiffstats
path: root/kate/part/katehighlight.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-05 14:50:18 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2013-05-05 14:50:18 -0500
commit86cf9b58635149405cb5600b65c16fdf2ddc732d (patch)
tree0803f7f5b039190f68e1d159bd1bbc618cb3a71d /kate/part/katehighlight.cpp
parentb53f4dcb2ad447c5ee521c42a0abc15a8cd48e31 (diff)
downloadtdelibs-86cf9b58635149405cb5600b65c16fdf2ddc732d.tar.gz
tdelibs-86cf9b58635149405cb5600b65c16fdf2ddc732d.zip
Fix Kate syntax highlighting stall
This resolves Bug 1279
Diffstat (limited to 'kate/part/katehighlight.cpp')
-rw-r--r--kate/part/katehighlight.cpp39
1 files changed, 19 insertions, 20 deletions
diff --git a/kate/part/katehighlight.cpp b/kate/part/katehighlight.cpp
index 119b718fb..8c6ce36e5 100644
--- a/kate/part/katehighlight.cpp
+++ b/kate/part/katehighlight.cpp
@@ -439,24 +439,23 @@ KateHlItem::~KateHlItem()
void KateHlItem::dynamicSubstitute(TQString &str, const TQStringList *args)
{
- for (uint i = 0; i < str.length() - 1; ++i)
- {
- if (str[i] == '%')
- {
- char c = str[i + 1].latin1();
- if (c == '%')
- str.replace(i, 1, "");
- else if (c >= '0' && c <= '9')
- {
- if ((uint)(c - '0') < args->size())
- {
- str.replace(i, 2, (*args)[c - '0']);
- i += ((*args)[c - '0']).length() - 1;
+ uint strLength = str.length();
+ if (strLength > 0) {
+ for (uint i = 0; i < strLength - 1; ++i) {
+ if (str[i] == '%') {
+ char c = str[i + 1].latin1();
+ if (c == '%') {
+ str.replace(i, 1, "");
}
- else
- {
- str.replace(i, 2, "");
- --i;
+ else if (c >= '0' && c <= '9') {
+ if ((uint)(c - '0') < args->size()) {
+ str.replace(i, 2, (*args)[c - '0']);
+ i += ((*args)[c - '0']).length() - 1;
+ }
+ else {
+ str.replace(i, 2, "");
+ --i;
+ }
}
}
}
@@ -1038,7 +1037,7 @@ static int checkEscapedChar(const TQString& text, int offset, int& len)
// replaced with something else but
// for right now they work
// check for hexdigits
- for (i = 0; (len > 0) && (i < 2) && (static_cast<const char>(text.at(offset)) >= '0' && static_cast<const char>(text.at(offset)) <= '9' || (text[offset] & 0xdf) >= 'A' && (text[offset] & 0xdf) <= 'F'); i++)
+ for (i = 0; (len > 0) && (i < 2) && (((static_cast<const char>(text.at(offset)) >= '0') && (static_cast<const char>(text.at(offset)) <= '9')) || ((text[offset] & 0xdf) >= 'A' && (text[offset] & 0xdf) <= 'F')); i++)
{
offset++;
len--;
@@ -1460,7 +1459,7 @@ void KateHighlighting::doHighlight ( KateTextLine *prevLine,
if (item->region2)
{
// kdDebug(13010)<<TQString("Region mark 2 detected: %1").arg(item->region2)<<endl;
- if ( !foldingList->isEmpty() && ((item->region2 < 0) && (*foldingList)[foldingList->size()-2] == -item->region2 ) )
+ if ( !foldingList->isEmpty() && ((item->region2 < 0) && ((int)((*foldingList)[foldingList->size()-2]) == -item->region2) ) )
{
foldingList->resize (foldingList->size()-2, TQGArray::SpeedOptim);
}
@@ -2826,7 +2825,7 @@ int KateHighlighting::addToContextList(const TQString &ident, int ctx0)
// to be matched to at once)
datasub=KateHlManager::self()->syntax->getSubItems(data);
bool tmpbool;
- if (tmpbool=KateHlManager::self()->syntax->nextItem(datasub))
+ if ((tmpbool = KateHlManager::self()->syntax->nextItem(datasub)))
{
for (;tmpbool;tmpbool=KateHlManager::self()->syntax->nextItem(datasub))
{