Skip to content

Commit ac1e1ac

Browse files
EcljpseB0Tjukzi
authored andcommitted
fix "The parameter text should not be assigned"
1 parent d848e69 commit ac1e1ac

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

debug/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ansi/participants/AnsiConsoleStyleListener.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,20 +222,18 @@ private static List<AnsiPosition> findPositions(int offset, String currentText)
222222
* @param text For insert / append, this is the new text. For delete, empty string.
223223
*/
224224
private void calculateDocumentAnsiPositions(IDocument eventDocument, int offset, int length, String text) {
225-
if (text == null) {
226-
text = eventDocument.get();
227-
}
225+
String txt = (text != null) ? text : eventDocument.get();
228226

229227
if (length != 0) { // This is the length of the text replaced. If not zero then this is not append, is replace.
230228
return;
231229
}
232230
// First time or the appended text is at the end (so it is not inserted text).
233-
if (documentEverScanned && offset + text.length() != eventDocument.getLength()) {
231+
if (documentEverScanned && offset + txt.length() != eventDocument.getLength()) {
234232
return;
235233
}
236234
documentEverScanned = true;
237235
try {
238-
List<AnsiPosition> newPos = findPositions(offset, text);
236+
List<AnsiPosition> newPos = findPositions(offset, txt);
239237
for (AnsiPosition apos : newPos) {
240238
eventDocument.addPosition(AnsiPosition.POSITION_NAME, apos);
241239
}

0 commit comments

Comments
 (0)