mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-31 02:08:03 +01:00
Merge branch 'develop' into splitcontainer
This commit is contained in:
@@ -829,22 +829,28 @@ namespace Terminal.Gui {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Moves or extends the selection to the first cell in the table (0,0)
|
/// Moves or extends the selection to the first cell in the table (0,0).
|
||||||
|
/// If <see cref="FullRowSelect"/> is enabled then selection instead moves
|
||||||
|
/// to (<see cref="SelectedColumn"/>,0) i.e. no horizontal scrolling.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="extend">true to extend the current selection (if any) instead of replacing</param>
|
/// <param name="extend">true to extend the current selection (if any) instead of replacing</param>
|
||||||
public void ChangeSelectionToStartOfTable (bool extend)
|
public void ChangeSelectionToStartOfTable (bool extend)
|
||||||
{
|
{
|
||||||
SetSelection (0, 0, extend);
|
SetSelection (FullRowSelect ? SelectedColumn : 0, 0, extend);
|
||||||
Update ();
|
Update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Moves or extends the selection to the final cell in the table
|
/// Moves or extends the selection to the final cell in the table (nX,nY).
|
||||||
|
/// If <see cref="FullRowSelect"/> is enabled then selection instead moves
|
||||||
|
/// to (<see cref="SelectedColumn"/>,nY) i.e. no horizontal scrolling.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="extend">true to extend the current selection (if any) instead of replacing</param>
|
/// <param name="extend">true to extend the current selection (if any) instead of replacing</param>
|
||||||
public void ChangeSelectionToEndOfTable(bool extend)
|
public void ChangeSelectionToEndOfTable(bool extend)
|
||||||
{
|
{
|
||||||
SetSelection (Table.Columns.Count - 1, Table.Rows.Count - 1, extend);
|
var finalColumn = Table.Columns.Count - 1;
|
||||||
|
|
||||||
|
SetSelection (FullRowSelect ? SelectedColumn : finalColumn, Table.Rows.Count - 1, extend);
|
||||||
Update ();
|
Update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1381,6 +1381,54 @@ namespace Terminal.Gui.Views {
|
|||||||
Assert.Equal (1, tableView.SelectedColumn);
|
Assert.Equal (1, tableView.SelectedColumn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
[InlineData(true)]
|
||||||
|
[InlineData (false)]
|
||||||
|
[Theory, AutoInitShutdown]
|
||||||
|
public void TestMoveStartEnd_WithFullRowSelect(bool withFullRowSelect)
|
||||||
|
{
|
||||||
|
var tableView = GetTwoRowSixColumnTable ();
|
||||||
|
tableView.FullRowSelect = withFullRowSelect;
|
||||||
|
|
||||||
|
tableView.SelectedRow = 1;
|
||||||
|
tableView.SelectedColumn = 1;
|
||||||
|
|
||||||
|
tableView.ProcessKey (new KeyEvent
|
||||||
|
{
|
||||||
|
Key = Key.Home | Key.CtrlMask
|
||||||
|
});
|
||||||
|
|
||||||
|
if(withFullRowSelect)
|
||||||
|
{
|
||||||
|
// Should not be any horizontal movement when
|
||||||
|
// using navigate to Start/End and FullRowSelect
|
||||||
|
Assert.Equal (1, tableView.SelectedColumn);
|
||||||
|
Assert.Equal (0, tableView.SelectedRow);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.Equal (0, tableView.SelectedColumn);
|
||||||
|
Assert.Equal (0, tableView.SelectedRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
tableView.ProcessKey (new KeyEvent
|
||||||
|
{
|
||||||
|
Key = Key.End | Key.CtrlMask
|
||||||
|
});
|
||||||
|
|
||||||
|
if(withFullRowSelect)
|
||||||
|
{
|
||||||
|
Assert.Equal (1, tableView.SelectedColumn);
|
||||||
|
Assert.Equal (1, tableView.SelectedRow);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Assert.Equal (5, tableView.SelectedColumn);
|
||||||
|
Assert.Equal (1, tableView.SelectedRow);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
[InlineData (true)]
|
[InlineData (true)]
|
||||||
[InlineData (false)]
|
[InlineData (false)]
|
||||||
[Theory, AutoInitShutdown]
|
[Theory, AutoInitShutdown]
|
||||||
|
|||||||
Reference in New Issue
Block a user