X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fteditor%2FLine.java;h=965c38f84a421986cd753c8b42f74cdfcd7228bf;hb=6582df7ecd410f7aebf9c32ddba885b806ad393e;hp=d6016c22ee701c478bf86bd18597f87117b7260a;hpb=71a389c9810382e014682dde52e94d3f34e385fa;p=fanfix.git diff --git a/src/jexer/teditor/Line.java b/src/jexer/teditor/Line.java index d6016c2..965c38f 100644 --- a/src/jexer/teditor/Line.java +++ b/src/jexer/teditor/Line.java @@ -3,7 +3,7 @@ * * The MIT License (MIT) * - * Copyright (C) 2017 Kevin Lamonte + * Copyright (C) 2019 Kevin Lamonte * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -39,6 +39,10 @@ import jexer.bits.CellAttributes; */ public class Line { + // ------------------------------------------------------------------------ + // Variables -------------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * The list of words. */ @@ -65,6 +69,42 @@ public class Line { */ private StringBuilder rawText; + // ------------------------------------------------------------------------ + // Constructors ----------------------------------------------------------- + // ------------------------------------------------------------------------ + + /** + * Construct a new Line from an existing text string, and highlight + * certain strings. + * + * @param str the text string + * @param defaultColor the color for unhighlighted text + * @param highlighter the highlighter to use + */ + public Line(final String str, final CellAttributes defaultColor, + final Highlighter highlighter) { + + this.defaultColor = defaultColor; + this.highlighter = highlighter; + this.rawText = new StringBuilder(str); + + scanLine(); + } + + /** + * Construct a new Line from an existing text string. + * + * @param str the text string + * @param defaultColor the color for unhighlighted text + */ + public Line(final String str, final CellAttributes defaultColor) { + this(str, defaultColor, null); + } + + // ------------------------------------------------------------------------ + // Line ------------------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * Get a (shallow) copy of the words in this line. * @@ -145,34 +185,6 @@ public class Line { } } - /** - * Construct a new Line from an existing text string, and highlight - * certain strings. - * - * @param str the text string - * @param defaultColor the color for unhighlighted text - * @param highlighter the highlighter to use - */ - public Line(final String str, final CellAttributes defaultColor, - final Highlighter highlighter) { - - this.defaultColor = defaultColor; - this.highlighter = highlighter; - this.rawText = new StringBuilder(str); - - scanLine(); - } - - /** - * Construct a new Line from an existing text string. - * - * @param str the text string - * @param defaultColor the color for unhighlighted text - */ - public Line(final String str, final CellAttributes defaultColor) { - this(str, defaultColor, null); - } - /** * Decrement the cursor by one. If at the first column, do nothing. *