Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 45037 Details for
Bug 137694
[console] scrollbar in empty console
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
revised patch
documentAdapter.txt (text/plain), 3.72 KB, created by
Kevin Barnes
on 2006-06-21 16:02:22 EDT
(
hide
)
Description:
revised patch
Filename:
MIME Type:
Creator:
Kevin Barnes
Created:
2006-06-21 16:02:22 EDT
Size:
3.72 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.console >Index: src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java,v >retrieving revision 1.21 >diff -u -r1.21 ConsoleDocumentAdapter.java >--- src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java 8 May 2006 20:41:09 -0000 1.21 >+++ src/org/eclipse/ui/internal/console/ConsoleDocumentAdapter.java 21 Jun 2006 20:05:10 -0000 >@@ -13,6 +13,8 @@ > import java.util.ArrayList; > import java.util.Iterator; > import java.util.List; >+import java.util.regex.Matcher; >+import java.util.regex.Pattern; > > import org.eclipse.jface.text.Assert; > import org.eclipse.jface.text.BadLocationException; >@@ -41,7 +43,8 @@ > > int[] offsets = new int[5000]; > int[] lengths = new int[5000]; >- private int regionCount = 0; >+ private int regionCount = 1; >+ private Pattern pattern = Pattern.compile("$", Pattern.MULTILINE); //$NON-NLS-1$ > > > public ConsoleDocumentAdapter(int width) { >@@ -278,11 +281,13 @@ > changeEvent.newCharCount = (event.fText == null ? 0 : event.fText.length()); > > int first = getLineAtOffset(event.fOffset); >- int last = getLineAtOffset(event.fOffset + event.fLength); >- changeEvent.replaceLineCount= last - first; >- >- changeEvent.newLineCount = countLines(event.fText); >- >+ int lOffset = Math.max(event.fOffset + event.fLength - 1, 0); >+ int last = getLineAtOffset(lOffset); >+ changeEvent.replaceLineCount = Math.max(last - first, 0); >+ >+ int newLineCount = countNewLines(event.fText); >+ changeEvent.newLineCount = newLineCount >= 0 ? newLineCount : 0; >+ > if (changeEvent.newLineCount > offsets.length-regionCount) { > growRegionArray(changeEvent.newLineCount); > } >@@ -303,47 +308,44 @@ > lengths = newLengths; > } > >- /** >- * Counts the number of lines the viewer's text widget will need to use to >- * display the String >- * @return The number of lines necessary to display the string in the viewer. >- */ >- private int countLines(String line) { >+ private int countNewLines(String string) { > int count = 0; > >- int lastDelimiter = 0; >- for (int i = 0; i < line.length(); i++) { >- char c = line.charAt(i); >- if (c == '\n') { >- count++; >- if (consoleWidth > 0) { >- count += (i-lastDelimiter)/consoleWidth; >- } >- lastDelimiter = i; >- } else if (c == '\r') { >- count++; >- if (consoleWidth > 0) { >- count += (i-lastDelimiter)/consoleWidth; >- } >- if (i+1 < line.length()) { >- char next = line.charAt(i+1); >- if (next == '\n') { >- i++; >- } >- } >- lastDelimiter = i; >- } >+ if (string.length() == 0) return 0; >+ >+ // work around to >+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4994840 >+ // see bug 84641 >+ if (string.endsWith("\r")) { //$NON-NLS-1$ >+ int len = string.length(); >+ int index = len >= 2 ? len - 2 : 0; >+ string = string.substring(0, index); >+ count++; > } > >- if (lastDelimiter < line.length()) { >- count++; >+ int lastIndex = 0; >+ int index = 0; >+ >+ Matcher matcher = pattern.matcher(string); >+ >+ while (matcher.find()) { >+ index = matcher.start(); >+ >+ if (index == 0) >+ count++; >+ else if (index!=string.length()) >+ count++; >+ > if (consoleWidth > 0) { >- count += (line.length()-lastDelimiter)/consoleWidth; >+ int lineLen = index - lastIndex + 1; >+ if (index == 0) lineLen += lengths[regionCount-1]; >+ count += lineLen/consoleWidth; > } >+ >+ lastIndex = index; > } >- > return count; >- } >+ } > > > /* (non-Javadoc)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 137694
:
39022
|
44547
| 45037 |
48950