Explorar o código

Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop

Tig Kindel hai 1 ano
pai
achega
b0dc1e694c

+ 1 - 0
Terminal.Gui/Views/FileDialog.cs

@@ -209,6 +209,7 @@ namespace Terminal.Gui {
 			};
 			this.tableView.AddKeyBinding (Key.Space, Command.ToggleChecked);
 			this.tableView.MouseClick += OnTableViewMouseClick;
+			tableView.Style.InvertSelectedCellFirstCharacter = true;
 			Style.TableStyle = tableView.Style;
 
 			var nameStyle = Style.TableStyle.GetOrCreateColumnStyle (0);

+ 5 - 0
Terminal.Gui/Views/Menu.cs

@@ -1844,6 +1844,11 @@ namespace Terminal.Gui {
 			var c = ((uint)kb.Key & (uint)Key.CharMask);
 			for (int i = 0; i < children.Length; i++) {
 				var mi = children [i];
+
+				if(mi == null) {
+					continue;
+				}
+
 				int p = mi.Title.IndexOf (MenuBar.HotKeySpecifier.ToString ());
 				if (p != -1 && p + 1 < mi.Title.GetRuneCount ()) {
 					if (Char.ToUpperInvariant ((char)mi.Title [p + 1]) == c) {

+ 3 - 3
Terminal.Gui/Views/TableView/TableView.cs

@@ -572,7 +572,7 @@ namespace Terminal.Gui {
 			Attribute color;
 
 			if (FullRowSelect && IsSelected (0, rowToRender)) {
-				color = focused ? rowScheme.HotFocus : rowScheme.HotNormal;
+				color = focused ? rowScheme.Focus : rowScheme.HotNormal;
 			} else {
 				color = Enabled ? rowScheme.Normal : rowScheme.Disabled;
 			}
@@ -618,7 +618,7 @@ namespace Terminal.Gui {
 
 				Attribute cellColor;
 				if (isSelectedCell) {
-					cellColor = focused ? scheme.HotFocus : scheme.HotNormal;
+					cellColor = focused ? scheme.Focus : scheme.HotNormal;
 				} else {
 					cellColor = Enabled ? scheme.Normal : scheme.Disabled;
 				}
@@ -634,7 +634,7 @@ namespace Terminal.Gui {
 				if (scheme != rowScheme) {
 
 					if (isSelectedCell) {
-						color = focused ? rowScheme.HotFocus : rowScheme.HotNormal;
+						color = focused ? rowScheme.Focus : rowScheme.HotNormal;
 					} else {
 						color = Enabled ? rowScheme.Normal : rowScheme.Disabled;
 					}

+ 23 - 19
UnitTests/Views/TableViewTests.cs

@@ -840,7 +840,7 @@ namespace Terminal.Gui.ViewsTests {
 				// 0
 				tv.ColorScheme.Normal,				
 				// 1
-				focused ? tv.ColorScheme.HotFocus : tv.ColorScheme.HotNormal});
+				focused ? tv.ColorScheme.Focus : tv.ColorScheme.HotNormal});
 
 			Application.Shutdown ();
 		}
@@ -880,14 +880,14 @@ namespace Terminal.Gui.ViewsTests {
 01000
 ";
 
-			var invertHotFocus = new Attribute (tv.ColorScheme.HotFocus.Background, tv.ColorScheme.HotFocus.Foreground);
+			var invertFocus = new Attribute (tv.ColorScheme.Focus.Background, tv.ColorScheme.Focus.Foreground);
 			var invertHotNormal = new Attribute (tv.ColorScheme.HotNormal.Background, tv.ColorScheme.HotNormal.Foreground);
 
 			TestHelpers.AssertDriverColorsAre (expectedColors, new Attribute [] {
 				// 0
 				tv.ColorScheme.Normal,				
 				// 1
-				focused ?  invertHotFocus : invertHotNormal});
+				focused ?  invertFocus : invertHotNormal});
 
 			Application.Shutdown ();
 		}
@@ -906,11 +906,13 @@ namespace Terminal.Gui.ViewsTests {
 			var rowHighlight = new ColorScheme () {
 				Normal = new Attribute (Color.BrightCyan, Color.DarkGray),
 				HotNormal = new Attribute (Color.Green, Color.Blue),
-				HotFocus = new Attribute (Color.BrightYellow, Color.White),
-				Focus = new Attribute (Color.Cyan, Color.Magenta),
+				Focus = new Attribute (Color.BrightYellow, Color.White),
+				
+				// Not used by TableView
+				HotFocus = new Attribute (Color.Cyan, Color.Magenta),
 			};
 
-			// when B is 2 use the custom highlight colour for the row
+			// when B is 2 use the custom highlight color for the row
 			tv.Style.RowColorGetter += (e) => Convert.ToInt32 (e.Table [e.RowIndex, 1]) == 2 ? rowHighlight : null;
 
 			// private method for forcing the view to be focused/not focused
@@ -940,7 +942,7 @@ namespace Terminal.Gui.ViewsTests {
 				// 0
 				tv.ColorScheme.Normal,				
 				// 1
-				focused ? rowHighlight.HotFocus : rowHighlight.HotNormal,
+				focused ? rowHighlight.Focus : rowHighlight.HotNormal,
 				// 2
 				rowHighlight.Normal});
 
@@ -973,7 +975,7 @@ namespace Terminal.Gui.ViewsTests {
 				// 0
 				tv.ColorScheme.Normal,
 				// 1
-				focused ? tv.ColorScheme.HotFocus : tv.ColorScheme.HotNormal });
+				focused ? tv.ColorScheme.Focus : tv.ColorScheme.HotNormal });
 
 			// Shutdown must be called to safely clean up Application if Init has been called
 			Application.Shutdown ();
@@ -993,12 +995,14 @@ namespace Terminal.Gui.ViewsTests {
 			// Create a style for column B
 			var bStyle = tv.Style.GetOrCreateColumnStyle (1);
 
-			// when B is 2 use the custom highlight colour
+			// when B is 2 use the custom highlight color
 			var cellHighlight = new ColorScheme () {
 				Normal = new Attribute (Color.BrightCyan, Color.DarkGray),
 				HotNormal = new Attribute (Color.Green, Color.Blue),
-				HotFocus = new Attribute (Color.BrightYellow, Color.White),
 				Focus = new Attribute (Color.Cyan, Color.Magenta),
+				
+				// Not used by TableView
+				HotFocus = new Attribute (Color.BrightYellow, Color.White),
 			};
 
 			bStyle.ColorGetter = (a) => Convert.ToInt32 (a.CellValue) == 2 ? cellHighlight : null;
@@ -1030,7 +1034,7 @@ namespace Terminal.Gui.ViewsTests {
 				// 0
 				tv.ColorScheme.Normal,				
 				// 1
-				focused ? tv.ColorScheme.HotFocus : tv.ColorScheme.HotNormal,
+				focused ? tv.ColorScheme.Focus : tv.ColorScheme.HotNormal,
 				// 2
 				cellHighlight.Normal});
 
@@ -1063,7 +1067,7 @@ namespace Terminal.Gui.ViewsTests {
 				// 0
 				tv.ColorScheme.Normal,				
 				// 1
-				focused ? tv.ColorScheme.HotFocus : tv.ColorScheme.HotNormal });
+				focused ? tv.ColorScheme.Focus : tv.ColorScheme.HotNormal });
 
 			// Shutdown must be called to safely clean up Application if Init has been called
 			Application.Shutdown ();
@@ -2213,11 +2217,11 @@ namespace Terminal.Gui.ViewsTests {
 			TestHelpers.AssertDriverContentsAre (expected, output);
 
 			var normal = tv.ColorScheme.Normal;
-			var focus = tv.ColorScheme.HotFocus = new Attribute (Color.Magenta, Color.White);
+			var focus = tv.ColorScheme.Focus = new Attribute (Color.Magenta, Color.White);
 
 			tv.Draw ();
 
-			// HotFocus color (1) should be used for rendering the selected line
+			// Focus color (1) should be used for rendering the selected line
 			// But should not spill into the borders.  Normal color (0) should be
 			// used for the rest.
 			expected =
@@ -2271,11 +2275,11 @@ namespace Terminal.Gui.ViewsTests {
 			TestHelpers.AssertDriverContentsAre (expected, output);
 
 			var normal = tv.ColorScheme.Normal;
-			var focus = tv.ColorScheme.HotFocus = new Attribute (Color.Magenta, Color.White);
+			var focus = tv.ColorScheme.Focus = new Attribute (Color.Magenta, Color.White);
 
 			tv.Draw ();
 
-			// HotFocus color (1) should be used for cells only because
+			// Focus color (1) should be used for cells only because
 			// AlwaysUseNormalColorForVerticalCellLines is true
 			expected =
 				@"
@@ -2766,12 +2770,12 @@ A B C
 			TestHelpers.AssertDriverContentsAre (expected, output);
 
 			var normal = tv.ColorScheme.Normal;
-			var focus = tv.ColorScheme.HotFocus = new Attribute (Color.Magenta, Color.White);
+			var focus = tv.ColorScheme.Focus = new Attribute (Color.Magenta, Color.White);
 
 			tv.Draw ();
 
-			// HotFocus color (1) should be used for rendering the selected line
-			// Note that because there are no vertical cell lines we use the hot focus
+			// Focus color (1) should be used for rendering the selected line
+			// Note that because there are no vertical cell lines we use the focus
 			// color for the whole row
 			expected =
 				@"