mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 08:50:25 +01:00
TextView MoveHome and MoveEnd methods.
This commit is contained in:
@@ -234,6 +234,18 @@ namespace Terminal.Gui {
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>Control-Home</term>
|
||||
/// <description>
|
||||
/// Scrolls to the first line and moves the cursor there.
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>Control-End</term>
|
||||
/// <description>
|
||||
/// Scrolls to the last line and moves the cursor there.
|
||||
/// </description>
|
||||
/// </item>
|
||||
/// <item>
|
||||
/// <term>Delete, Control-d</term>
|
||||
/// <description>
|
||||
/// Deletes the character in front of the cursor.
|
||||
@@ -1004,15 +1016,11 @@ namespace Terminal.Gui {
|
||||
break;
|
||||
|
||||
case Key.CtrlMask | Key.End:
|
||||
currentRow = model.Count;
|
||||
TrackColumn ();
|
||||
PositionCursor ();
|
||||
MoveEnd ();
|
||||
break;
|
||||
|
||||
case Key.CtrlMask | Key.Home:
|
||||
currentRow = 0;
|
||||
TrackColumn ();
|
||||
PositionCursor ();
|
||||
MoveHome ();
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1086,6 +1094,26 @@ namespace Terminal.Gui {
|
||||
|
||||
Rune RuneAt (int col, int row) => model.GetLine (row) [col];
|
||||
|
||||
/// <summary>
|
||||
/// Will scroll the <see cref="TextView"/> to the last line and position the cursor there.
|
||||
/// </summary>
|
||||
public void MoveEnd ()
|
||||
{
|
||||
currentRow = model.Count - 1;
|
||||
TrackColumn ();
|
||||
PositionCursor ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Will scroll the <see cref="TextView"/> to the first line and position the cursor there.
|
||||
/// </summary>
|
||||
public void MoveHome ()
|
||||
{
|
||||
currentRow = 0;
|
||||
TrackColumn ();
|
||||
PositionCursor ();
|
||||
}
|
||||
|
||||
bool MoveNext (ref int col, ref int row, out Rune rune)
|
||||
{
|
||||
var line = model.GetLine (row);
|
||||
|
||||
Reference in New Issue
Block a user