diff --git a/Terminal.Gui/Views/TextView.cs b/Terminal.Gui/Views/TextView.cs
index 3adedaedf..b5ca54651 100644
--- a/Terminal.Gui/Views/TextView.cs
+++ b/Terminal.Gui/Views/TextView.cs
@@ -15,6 +15,7 @@
// keybindings to go to top/bottom
// public API to insert, remove ranges
// Add word forward/word backwards commands
+// Save buffer API
using System;
using System.Collections.Generic;
@@ -286,6 +287,36 @@ namespace Terminal.Gui {
}
}
+ ///
+ /// Loads the contents of the file into the TextView.
+ ///
+ /// true, if file was loaded, false otherwise.
+ /// Path to the file to load.
+ public bool LoadFile (string path)
+ {
+ if (path == null)
+ throw new ArgumentNullException (nameof (path));
+ ResetPosition ();
+ var res = model.LoadFile (path);
+ SetNeedsDisplay ();
+ return res;
+ }
+
+ ///
+ /// Loads the contents of the stream into the TextView.
+ ///
+ /// true, if stream was loaded, false otherwise.
+ /// Stream.
+ public bool LoadStream (Stream stream)
+ {
+ if (stream == null)
+ throw new ArgumentNullException (nameof (stream));
+ ResetPosition ();
+ var res = model.LoadFile (path);
+ SetNeedsDisplay ();
+ return res;
+ }
+
///
/// The current cursor row.
///