X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fteditor%2FDocument.java;h=9b0453860327b67ecfa5837ffa4966b5008854fe;hb=978a5d8f650488c8840d54ccc3032599ca50a084;hp=e1a28a0d37f39504c482da627c880110e3d1a9d8;hpb=4297b49b4f9f66a75d98c0d5e326a471e94cf404;p=fanfix.git diff --git a/src/jexer/teditor/Document.java b/src/jexer/teditor/Document.java index e1a28a0..9b04538 100644 --- a/src/jexer/teditor/Document.java +++ b/src/jexer/teditor/Document.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"), @@ -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. *