X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fteditor%2FDocument.java;h=bd8e91f7a48fa575747fca4e7a0cfb8e22c4248a;hb=615a0d99fd0aa4437116dd083147f9150d5e6527;hp=e1a28a0d37f39504c482da627c880110e3d1a9d8;hpb=7d922e0dfd9a6da42b84e01d52adeec6fff10025;p=fanfix.git diff --git a/src/jexer/teditor/Document.java b/src/jexer/teditor/Document.java index e1a28a0..bd8e91f 100644 --- a/src/jexer/teditor/Document.java +++ b/src/jexer/teditor/Document.java @@ -41,6 +41,10 @@ import jexer.bits.CellAttributes; */ public class Document { + // ------------------------------------------------------------------------ + // Variables -------------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * The list of lines. */ @@ -72,6 +76,32 @@ public class Document { */ private Highlighter highlighter = new Highlighter(); + // ------------------------------------------------------------------------ + // Constructors ----------------------------------------------------------- + // ------------------------------------------------------------------------ + + /** + * Construct a new Document from an existing text string. + * + * @param str the text string + * @param defaultColor the color for unhighlighted text + */ + public Document(final String str, final CellAttributes defaultColor) { + this.defaultColor = defaultColor; + + // TODO: set different colors based on file extension + highlighter.setJavaColors(); + + String [] rawLines = str.split("\n"); + for (int i = 0; i < rawLines.length; i++) { + lines.add(new Line(rawLines[i], this.defaultColor, highlighter)); + } + } + + // ------------------------------------------------------------------------ + // Document --------------------------------------------------------------- + // ------------------------------------------------------------------------ + /** * Get the overwrite flag. * @@ -192,24 +222,6 @@ public class Document { } } - /** - * Construct a new Document from an existing text string. - * - * @param str the text string - * @param defaultColor the color for unhighlighted text - */ - public Document(final String str, final CellAttributes defaultColor) { - this.defaultColor = defaultColor; - - // TODO: set different colors based on file extension - highlighter.setJavaColors(); - - String [] rawLines = str.split("\n"); - for (int i = 0; i < rawLines.length; i++) { - lines.add(new Line(rawLines[i], this.defaultColor, highlighter)); - } - } - /** * Increment the line number by one. If at the last line, do nothing. *