summaryrefslogtreecommitdiff
path: root/noncore/apps/tinykate/libkate/document/katedocument.cpp
Unidiff
Diffstat (limited to 'noncore/apps/tinykate/libkate/document/katedocument.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/apps/tinykate/libkate/document/katedocument.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/apps/tinykate/libkate/document/katedocument.cpp b/noncore/apps/tinykate/libkate/document/katedocument.cpp
index 6dc4fd2..a70f3aa 100644
--- a/noncore/apps/tinykate/libkate/document/katedocument.cpp
+++ b/noncore/apps/tinykate/libkate/document/katedocument.cpp
@@ -2198,49 +2198,49 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) {
2198 TextLine::Ptr textLine; 2198 TextLine::Ptr textLine;
2199 int pos, newPos; 2199 int pos, newPos;
2200 2200
2201 if (searchFor.isEmpty()) return false; 2201 if (searchFor.isEmpty()) return false;
2202 2202
2203 bufLen = 0; 2203 bufLen = 0;
2204 t = 0L; 2204 t = 0L;
2205 2205
2206 line = sc.cursor.y; 2206 line = sc.cursor.y;
2207 col = sc.cursor.x; 2207 col = sc.cursor.x;
2208 if (!(sc.flags & KateView::sfBackward)) { 2208 if (!(sc.flags & KateView::sfBackward)) {
2209 //forward search 2209 //forward search
2210 if (sc.flags & KateView::sfSelected) { 2210 if (sc.flags & KateView::sfSelected) {
2211 if (line < selectStart) { 2211 if (line < selectStart) {
2212 line = selectStart; 2212 line = selectStart;
2213 col = 0; 2213 col = 0;
2214 } 2214 }
2215 searchEnd = selectEnd; 2215 searchEnd = selectEnd;
2216 } else searchEnd = lastLine(); 2216 } else searchEnd = lastLine();
2217 2217
2218 while (line <= searchEnd) { 2218 while (line <= searchEnd) {
2219 textLine = getTextLine(line); 2219 textLine = getTextLine(line);
2220 tlen = textLine->length(); 2220 tlen = textLine->length();
2221 if (tlen > bufLen) { 2221 if (tlen > bufLen) {
2222 delete t; 2222 delete [] t;
2223 bufLen = (tlen + 255) & (~255); 2223 bufLen = (tlen + 255) & (~255);
2224 t = new QChar[bufLen]; 2224 t = new QChar[bufLen];
2225 } 2225 }
2226 memcpy(t, textLine->getText(), tlen*sizeof(QChar)); 2226 memcpy(t, textLine->getText(), tlen*sizeof(QChar));
2227 if (sc.flags & KateView::sfSelected) { 2227 if (sc.flags & KateView::sfSelected) {
2228 pos = 0; 2228 pos = 0;
2229 do { 2229 do {
2230 pos = textLine->findSelected(pos); 2230 pos = textLine->findSelected(pos);
2231 newPos = textLine->findUnselected(pos); 2231 newPos = textLine->findUnselected(pos);
2232 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); 2232 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar));
2233 pos = newPos; 2233 pos = newPos;
2234 } while (pos < tlen); 2234 } while (pos < tlen);
2235 } 2235 }
2236 2236
2237 QString text(t, tlen); 2237 QString text(t, tlen);
2238 if (sc.flags & KateView::sfWholeWords) { 2238 if (sc.flags & KateView::sfWholeWords) {
2239 // Until the end of the line... 2239 // Until the end of the line...
2240 while (col < tlen) { 2240 while (col < tlen) {
2241 // ...find the next match. 2241 // ...find the next match.
2242 col = sc.search(text, col); 2242 col = sc.search(text, col);
2243 if (col != -1) { 2243 if (col != -1) {
2244 // Is the match delimited correctly? 2244 // Is the match delimited correctly?
2245 if (((col == 0) || (!m_highlight->isInWord(t[col]))) && 2245 if (((col == 0) || (!m_highlight->isInWord(t[col]))) &&
2246 ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) { 2246 ((col + sc.matchedLength == tlen) || (!m_highlight->isInWord(t[col + sc.matchedLength])))) {
@@ -2259,49 +2259,49 @@ bool KateDocument::doSearch(SConfig &sc, const QString &searchFor) {
2259 } 2259 }
2260 else { 2260 else {
2261 // Non-whole-word search. 2261 // Non-whole-word search.
2262 col = sc.search(text, col); 2262 col = sc.search(text, col);
2263 if (col != -1) 2263 if (col != -1)
2264 goto found; 2264 goto found;
2265 } 2265 }
2266 col = 0; 2266 col = 0;
2267 line++; 2267 line++;
2268 } 2268 }
2269 } else { 2269 } else {
2270 // backward search 2270 // backward search
2271 if (sc.flags & KateView::sfSelected) { 2271 if (sc.flags & KateView::sfSelected) {
2272 if (line > selectEnd) { 2272 if (line > selectEnd) {
2273 line = selectEnd; 2273 line = selectEnd;
2274 col = -1; 2274 col = -1;
2275 } 2275 }
2276 searchEnd = selectStart; 2276 searchEnd = selectStart;
2277 } else searchEnd = 0; 2277 } else searchEnd = 0;
2278 2278
2279 while (line >= searchEnd) { 2279 while (line >= searchEnd) {
2280 textLine = getTextLine(line); 2280 textLine = getTextLine(line);
2281 tlen = textLine->length(); 2281 tlen = textLine->length();
2282 if (tlen > bufLen) { 2282 if (tlen > bufLen) {
2283 delete t; 2283 delete [] t;
2284 bufLen = (tlen + 255) & (~255); 2284 bufLen = (tlen + 255) & (~255);
2285 t = new QChar[bufLen]; 2285 t = new QChar[bufLen];
2286 } 2286 }
2287 memcpy(t, textLine->getText(), tlen*sizeof(QChar)); 2287 memcpy(t, textLine->getText(), tlen*sizeof(QChar));
2288 if (sc.flags & KateView::sfSelected) { 2288 if (sc.flags & KateView::sfSelected) {
2289 pos = 0; 2289 pos = 0;
2290 do { 2290 do {
2291 pos = textLine->findSelected(pos); 2291 pos = textLine->findSelected(pos);
2292 newPos = textLine->findUnselected(pos); 2292 newPos = textLine->findUnselected(pos);
2293 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar)); 2293 memset(&t[pos], 0, (newPos - pos)*sizeof(QChar));
2294 pos = newPos; 2294 pos = newPos;
2295 } while (pos < tlen); 2295 } while (pos < tlen);
2296 } 2296 }
2297 2297
2298 if (col < 0 || col > tlen) col = tlen; 2298 if (col < 0 || col > tlen) col = tlen;
2299 2299
2300 QString text(t, tlen); 2300 QString text(t, tlen);
2301 if (sc.flags & KateView::sfWholeWords) { 2301 if (sc.flags & KateView::sfWholeWords) {
2302 // Until the beginning of the line... 2302 // Until the beginning of the line...
2303 while (col >= 0) { 2303 while (col >= 0) {
2304 // ...find the next match. 2304 // ...find the next match.
2305 col = sc.search(text, col); 2305 col = sc.search(text, col);
2306 if (col != -1) { 2306 if (col != -1) {
2307 // Is the match delimited correctly? 2307 // Is the match delimited correctly?