Skip to content

Commit d7080f4

Browse files
author
tznind
committed
Fix for new API, apparently the Value of the TreeView is its selection
1 parent 4faecc2 commit d7080f4

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/Design.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,9 @@ public IEnumerable<IOperation> GetExtraOperations(Mouse? mouse = null)
314314
}
315315

316316
// if no column was right clicked then provide commands for the selected column
317-
if (col == null && tv.Cursor.Position.Value.X >= 0)
317+
if (col == null && tv.Value != null && tv.Value.Cursor.X >= 0)
318318
{
319-
col = dt.Columns[tv.Cursor.Position.Value.X];
319+
col = dt.Columns[tv.Value.Cursor.X];
320320
}
321321

322322
yield return new AddColumnOperation(App, this, null);

src/UI/Windows/KeyBindingsUI.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
namespace TerminalGuiDesigner.UI.Windows {
1919
using Terminal.Gui;
20-
20+
using Terminal.Gui.Input;
2121

2222
public partial class KeyBindingsUI {
2323
private readonly IApplication app;
@@ -60,12 +60,15 @@ public KeyBindingsUI(IApplication app, KeyMap keyMap) {
6060
return null;
6161
};
6262

63-
tableView.Activated += (s, e) =>
63+
tableView.KeyBindings.Clear(Command.Accept);
64+
tableView.KeyBindings.Add(Key.Enter, new KeyBinding([Command.Activate]));
65+
tableView.Activating += (s, e) =>
6466
{
65-
var prop = _props[tableView.Cursor.Position.Value.Y];
67+
var prop = _props[tableView.Value.Cursor.Y];
6668
var k = Modals.GetShortcut(app);
6769
prop.SetValue(this.keyMap,k.ToString());
6870
this.SetNeedsDraw();
71+
e.Handled = true;
6972
};
7073
btnReset.Accepting += (s, e) =>
7174
{

0 commit comments

Comments
 (0)