Browse Source

Remove legacy default colour behaviour.

We now specify the default colour using display properties, not
by ascribing special value to the first colour code in a message.

Closes #741
pull/772/head
Chris Smith 7 years ago
parent
commit
ab84f1d094
1 changed files with 3 additions and 24 deletions
  1. 3
    24
      src/main/java/com/dmdirc/ui/messages/Styliser.java

+ 3
- 24
src/main/java/com/dmdirc/ui/messages/Styliser.java View File

@@ -146,8 +146,7 @@ public class Styliser implements ConfigChangeListener, StyleApplier {
146 146
                 position += next.length();
147 147
 
148 148
                 if (position < target.length()) {
149
-                    position += readControlChars(target.substring(position), state, maker,
150
-                            position == 0);
149
+                    position += readControlChars(target.substring(position), state, maker);
151 150
                 }
152 151
             }
153 152
         }
@@ -258,13 +257,10 @@ public class Styliser implements ConfigChangeListener, StyleApplier {
258 257
      * applies it to the specified attribute set.
259 258
      *
260 259
      * @return The number of characters read as control characters
261
-     *@param string  The string to read from
260
+     * @param string  The string to read from
262 261
      * @param maker The attribute set that new attributes will be applied to
263
-     * @param isStart Whether this is at the start of the string or not
264 262
      */
265
-    private int readControlChars(final String string,
266
-            final StyliserState state,
267
-            final StyledMessageMaker<?> maker, final boolean isStart) {
263
+    private int readControlChars(final String string, final StyliserState state, final StyledMessageMaker<?> maker) {
268 264
         final boolean isNegated = state.isNegated;
269 265
 
270 266
         // Bold
@@ -375,10 +371,6 @@ public class Styliser implements ConfigChangeListener, StyleApplier {
375 371
                 if (!isNegated) {
376 372
                     maker.setForeground(colourManager.getColourFromString(
377 373
                             String.valueOf(foreground), Colour.WHITE));
378
-                    if (isStart) {
379
-                        maker.setDefaultForeground(colourManager
380
-                                .getColourFromString(String.valueOf(foreground), Colour.WHITE));
381
-                    }
382 374
                 }
383 375
 
384 376
                 // Now background
@@ -396,10 +388,6 @@ public class Styliser implements ConfigChangeListener, StyleApplier {
396 388
                     if (!isNegated) {
397 389
                         maker.setBackground(colourManager
398 390
                                 .getColourFromString(String.valueOf(background), Colour.WHITE));
399
-                        if (isStart) {
400
-                            maker.setDefaultBackground(colourManager
401
-                                    .getColourFromString(String.valueOf(background), Colour.WHITE));
402
-                        }
403 391
                     }
404 392
                 }
405 393
             } else if (!isNegated) {
@@ -416,11 +404,6 @@ public class Styliser implements ConfigChangeListener, StyleApplier {
416 404
                     maker.setForeground(
417 405
                             colourManager.getColourFromString(string.substring(1, 7).toUpperCase(),
418 406
                                     Colour.WHITE));
419
-                    if (isStart) {
420
-                        maker.setDefaultForeground(
421
-                                colourManager.getColourFromString(
422
-                                        string.substring(1, 7).toUpperCase(), Colour.WHITE));
423
-                    }
424 407
                 }
425 408
 
426 409
                 count += 6;
@@ -435,10 +418,6 @@ public class Styliser implements ConfigChangeListener, StyleApplier {
435 418
                     if (!isNegated) {
436 419
                         maker.setBackground(colourManager.getColourFromString(
437 420
                                 string.substring(count, count + 6).toUpperCase(), Colour.WHITE));
438
-                        if (isStart) {
439
-                            maker.setDefaultBackground(colourManager.getColourFromString(
440
-                                    string.substring(count, count + 6).toUpperCase(), Colour.WHITE));
441
-                        }
442 421
                     }
443 422
 
444 423
                     count += 6;

Loading…
Cancel
Save