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 183807 Details for
Bug 99299
[StyledText] DefaultContent.getLine(DefaultContent.java:489) - java.lang.StringIndexOutOfBoundsException
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]
Proposed patch in DefaultContent.java
org.eclipse.swt.custom.DefaultContent.java.patch (text/plain), 3.25 KB, created by
Patrick Tasse
on 2010-11-24 16:58:04 EST
(
hide
)
Description:
Proposed patch in DefaultContent.java
Filename:
MIME Type:
Creator:
Patrick Tasse
Created:
2010-11-24 16:58:04 EST
Size:
3.25 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.swt >Index: Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java,v >retrieving revision 1.28 >diff -u -r1.28 DefaultContent.java >--- Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java 1 Jul 2009 14:49:33 -0000 1.28 >+++ Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/DefaultContent.java 24 Nov 2010 21:36:47 -0000 >@@ -7,6 +7,7 @@ > * > * Contributors: > * IBM Corporation - initial API and implementation >+ * Patrick Tasse - [99299] DefaultContent.getLine(DefaultContent.java:489) - java.lang.StringIndexOutOfBoundsException > *******************************************************************************/ > package org.eclipse.swt.custom; > >@@ -267,6 +268,30 @@ > boolean endInsert = position == getCharCount(); > adjustGap(position, change, startLine); > >+ // if the beginning of the inserted text is continuing a CR+LF delimiter >+ // then append LF to the previous line and adjust the start line and gap >+ // and then continue with the remaining text to insert, if any >+ if (text.charAt(0) == SWT.LF && startLine > 0 && lines[startLine][0] == position) { >+ if (textStore[position - 1] == SWT.CR) { >+ textStore[position++] = SWT.LF; >+ lines[startLine - 1][1]++; >+ lines[startLine][0]++; >+ lines[startLine][1]--; >+ gapStart++; >+ text = text.substring(1); >+ if (text.length() == 0) return; >+ } >+ } >+ >+ // if the end of the inserted text is creating a CR+LF delimiter from a LF >+ // then insert the CR at the end of the gap on the current line and adjust the gap >+ // and then continue with the remaining text to insert, if any >+ if (text.charAt(text.length() - 1) == SWT.CR && gapEnd < textStore.length && textStore[gapEnd] == SWT.LF) { >+ textStore[--gapEnd] = SWT.CR; >+ text = text.substring(0, text.length() - 1); >+ if (text.length() == 0) return; >+ } >+ > // during an insert the gap will be adjusted to start at > // position and it will be associated with startline, the > // inserted text will be placed in the gap >@@ -837,6 +862,28 @@ > } > > adjustGap(position + length, -length, startLine); >+ >+ // if the characters before and after the deleted text are creating a CR+LF >+ // then shift the text to delete by one, append a LF to the previous line, >+ // add a LF to the text to delete, adjust the previous line, start line and gap, >+ // and then continue with the augmented text to delete >+ if (position > 0 && textStore[position - 1] == SWT.CR && gapEnd < textStore.length && textStore[gapEnd] == SWT.LF) { >+ for (int i = position + length; i > position; i--) { >+ textStore[i] = textStore[i - 1]; >+ } >+ gapStart++; >+ textStore[gapEnd++] = 0; >+ textStore[position++] = SWT.LF; >+ textStore[gapStart++] = SWT.LF; >+ lines[startLine - 1][1]++; >+ lines[startLine][0]++; >+ lines[startLine][1]--; >+ length++; >+ numLines++; >+ startLineOffset++; >+ endLine++; >+ } >+ > int [][] oldLines = indexLines(position, length + (gapEnd - gapStart), numLines); > > // enlarge the gap - the gap can be enlarged either to the
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 99299
:
22778
| 183807