X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fbits%2FCellAttributes.java;h=c14557679ee4ff28298021d492b502661ebd0e2a;hb=a0d734e68fc28e441d74075e4d8d0166bbcde180;hp=e889e89250c14dcb608bb7fa35132fc89d6b0c1f;hpb=e16dda65585466c8987bd1efd718431450a96605;p=fanfix.git diff --git a/src/jexer/bits/CellAttributes.java b/src/jexer/bits/CellAttributes.java index e889e89..c145576 100644 --- a/src/jexer/bits/CellAttributes.java +++ b/src/jexer/bits/CellAttributes.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2016 Kevin Lamonte + * Copyright (C) 2017 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -218,6 +218,16 @@ public class CellAttributes { reset(); } + /** + * Public constructor makes a copy from another instance. + * + * @param that another CellAttributes instance + * @see #reset() + */ + public CellAttributes(final CellAttributes that) { + setTo(that); + } + /** * Comparison check. All fields must match to return true. * @@ -231,13 +241,13 @@ public class CellAttributes { } CellAttributes that = (CellAttributes) rhs; - return ((bold == that.bold) - && (blink == that.blink) + return ((foreColor == that.foreColor) + && (backColor == that.backColor) + && (bold == that.bold) && (reverse == that.reverse) && (underline == that.underline) - && (protect == that.protect) - && (foreColor == that.foreColor) - && (backColor == that.backColor)); + && (blink == that.blink) + && (protect == that.protect)); } /** @@ -284,12 +294,8 @@ public class CellAttributes { */ @Override public String toString() { - if (bold) { - return String.format("bold %s on %s", - foreColor, backColor); - } else { - return String.format("%s on %s", foreColor, backColor); - } + return String.format("%s%s%s on %s", (bold == true ? "bold " : ""), + (blink == true ? "blink " : ""), foreColor, backColor); } }