From: Kevin Lamonte Date: Mon, 11 Nov 2019 00:19:06 +0000 (-0600) Subject: resync from TJIDE X-Git-Url: http://git.nikiroo.be/?a=commitdiff_plain;h=0580bf2c756853c189f2abbe9c500a8ae2d46e23;p=fanfix-jexer.git resync from TJIDE --- diff --git a/src/jexer/teditor/Document.java b/src/jexer/teditor/Document.java index a9979f5..e949503 100644 --- a/src/jexer/teditor/Document.java +++ b/src/jexer/teditor/Document.java @@ -121,6 +121,13 @@ public class Document { return dirty; } + /** + * Unset the dirty flag. + */ + public void setNotDirty() { + dirty = false; + } + /** * Save contents to file. * @@ -638,4 +645,18 @@ public class Document { return lines.get(lineNumber).getDisplayLength(); } + /** + * Get the entire contents of the document as one string. + * + * @return the document contents + */ + public String getText() { + StringBuilder sb = new StringBuilder(); + for (Line line: getLines()) { + sb.append(line.getRawString()); + sb.append("\n"); + } + return sb.toString(); + } + }