Browse Source

Fix keyboard splitter adjustment to avoid float boundary issues (resulted in splitter getting stuck at some points).

tznind 2 years ago
parent
commit
d576799ef9
1 changed files with 4 additions and 2 deletions
  1. 4 2
      Terminal.Gui/Views/SplitContainer.cs

+ 4 - 2
Terminal.Gui/Views/SplitContainer.cs

@@ -477,8 +477,10 @@ namespace Terminal.Gui {
 			/// <returns></returns>
 			private Pos ConvertToPosFactor (Pos p, int parentLength)
 			{
-				int position = p.Anchor (parentLength);
-				return new Pos.PosFactor (position / (float)parentLength);
+				// calculate position in the 'middle' of the cell at p distance along parentLength
+				float position = p.Anchor (parentLength) + 0.5f;
+
+				return new Pos.PosFactor (position / parentLength);
 			}
 		}
 	}