resync from TJIDE
authorKevin Lamonte <kevin.lamonte@gmail.com>
Mon, 11 Nov 2019 00:19:06 +0000 (18:19 -0600)
committerKevin Lamonte <kevin.lamonte@gmail.com>
Mon, 11 Nov 2019 00:19:06 +0000 (18:19 -0600)
src/jexer/teditor/Document.java

index a9979f5a17d4a375197dac4bb7b09e3bcd405060..e94950371af02507ad1abaad4f305983e8260274 100644 (file)
@@ -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();
+    }
+
 }