X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2Fteditor%2FDocument.java;h=e94950371af02507ad1abaad4f305983e8260274;hb=0580bf2c756853c189f2abbe9c500a8ae2d46e23;hp=a9979f5a17d4a375197dac4bb7b09e3bcd405060;hpb=5ca5f8e5310b189232ed337643f3b7b2ce6cd3b1;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(); + } + }