X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjexer%2Fteditor%2FDocument.java;h=e94950371af02507ad1abaad4f305983e8260274;hb=6cd9e129296133418d01b82cd5082e863f5ee490;hp=a9979f5a17d4a375197dac4bb7b09e3bcd405060;hpb=edbcdccc16e7ba5fd4ca92042a12165db28dd9d6;p=nikiroo-utils.git 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(); + } + }