Revision 6a822179
Added by Patrick Plitzner over 9 years ago
- fixed removing of control characters (fixes #4373, affects #2248)
- added condition to only replace if the string contains control characters
- cursor will still jump back but only when control characters were removed
- removed unused method
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/TextWithLabelElement.java | ||
---|---|---|
160 | 160 |
public void modifyText(ModifyEvent e) { |
161 | 161 |
if(e.widget == text){ |
162 | 162 |
Text text = (Text) e.widget; |
163 |
//remove control character such as line breaks etc. |
|
164 |
setText(text.getText().replaceAll("\\p{C}", "?")); |
|
163 |
boolean hasControlCharacters = false; |
|
164 |
String textString = text.getText(); |
|
165 |
int stringLength = textString.length(); |
|
166 |
for (int i = 0; i < stringLength; i++) { |
|
167 |
if (Character.isISOControl(textString.charAt(i))) { |
|
168 |
hasControlCharacters = true; |
|
169 |
break; |
|
170 |
} |
|
171 |
} |
|
172 |
if(hasControlCharacters){ |
|
173 |
//remove control character such as line breaks etc. |
|
174 |
setText(text.getText().replaceAll("\\p{C}", "")); |
|
175 |
} |
|
165 | 176 |
} |
166 | 177 |
firePropertyChangeEvent(new CdmPropertyChangeEvent(this, e)); |
167 | 178 |
} |
Also available in: Unified diff