From 0580bf2c756853c189f2abbe9c500a8ae2d46e23 Mon Sep 17 00:00:00 2001 From: Kevin Lamonte Date: Sun, 10 Nov 2019 18:19:06 -0600 Subject: [PATCH] resync from TJIDE --- src/jexer/teditor/Document.java | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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(); + } + } -- 2.27.0