Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 207743
Collapse All | Expand All

(-)src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java (-22 / +25 lines)
Lines 320-353 Link Here
320
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4994840
320
		// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4994840
321
		// see bug 84641
321
		// see bug 84641
322
		int offset = string.length() - 1;
322
		int offset = string.length() - 1;
323
		while (string.charAt(offset) == '\r') {
323
		while (offset >= 0 && string.charAt(offset) == '\r') {
324
			offset--;
324
			offset--;
325
			count++;
325
			count++;
326
		}
326
		}
327
		if (offset < (string.length() - 1)) {
327
		// if offset == 0, the line was all '\r' and there is no string to search for matches (bug 207743)
328
			string = string.substring(0, offset);
328
		if (offset > 0) {
329
		}
329
			if (offset < (string.length() - 1)) {
330
		
330
				string = string.substring(0, offset);
331
		int lastIndex = 0;
331
			}
332
		int index = 0;
333
		
334
		Matcher matcher = pattern.matcher(string);
335
		
336
		while (matcher.find()) {
337
			index = matcher.start();
338
			
332
			
339
			if (index == 0)
333
			int lastIndex = 0;
340
				count++;
334
			int index = 0;
341
			else if (index!=string.length())
342
				count++;
343
			
335
			
344
			if (consoleWidth > 0) {
336
			Matcher matcher = pattern.matcher(string);
345
				int lineLen = index - lastIndex + 1;
346
				if (index == 0) lineLen += lengths[regionCount-1];
347
				count += lineLen/consoleWidth;
348
			}
349
			
337
			
350
			lastIndex = index;
338
			while (matcher.find()) {
339
				index = matcher.start();
340
				
341
				if (index == 0)
342
					count++;
343
				else if (index!=string.length())
344
					count++;
345
				
346
				if (consoleWidth > 0) {
347
					int lineLen = index - lastIndex + 1;
348
					if (index == 0) lineLen += lengths[regionCount-1];
349
					count += lineLen/consoleWidth;
350
				}
351
				
352
				lastIndex = index;
353
			}
351
		}
354
		}
352
		return count;
355
		return count;
353
	}
356
	}

Return to bug 207743