mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Save
This commit is contained in:
@@ -15,6 +15,7 @@
|
|||||||
// keybindings to go to top/bottom
|
// keybindings to go to top/bottom
|
||||||
// public API to insert, remove ranges
|
// public API to insert, remove ranges
|
||||||
// Add word forward/word backwards commands
|
// Add word forward/word backwards commands
|
||||||
|
// Save buffer API
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -286,6 +287,36 @@ namespace Terminal.Gui {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads the contents of the file into the TextView.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c>, if file was loaded, <c>false</c> otherwise.</returns>
|
||||||
|
/// <param name="path">Path to the file to load.</param>
|
||||||
|
public bool LoadFile (string path)
|
||||||
|
{
|
||||||
|
if (path == null)
|
||||||
|
throw new ArgumentNullException (nameof (path));
|
||||||
|
ResetPosition ();
|
||||||
|
var res = model.LoadFile (path);
|
||||||
|
SetNeedsDisplay ();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Loads the contents of the stream into the TextView.
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><c>true</c>, if stream was loaded, <c>false</c> otherwise.</returns>
|
||||||
|
/// <param name="stream">Stream.</param>
|
||||||
|
public bool LoadStream (Stream stream)
|
||||||
|
{
|
||||||
|
if (stream == null)
|
||||||
|
throw new ArgumentNullException (nameof (stream));
|
||||||
|
ResetPosition ();
|
||||||
|
var res = model.LoadFile (path);
|
||||||
|
SetNeedsDisplay ();
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The current cursor row.
|
/// The current cursor row.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user