浏览代码

Fixing bug in TextView, clicking line below text causes IndexOutOfRangeException

IKoshelev 6 年之前
父节点
当前提交
289424be81
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      Terminal.Gui/Views/TextView.cs

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

@@ -1091,8 +1091,10 @@ namespace Terminal.Gui {
 			if (!HasFocus)
 				SuperView.SetFocus (this);
 
-			if (ev.Y + topRow >= model.Count) {
-				currentRow = model.Count - topRow;
+
+			var maxCursorPositionableLine = (model.Count - 1) - topRow;
+			if (ev.Y > maxCursorPositionableLine) {
+				currentRow = maxCursorPositionableLine;
 			} else {
 				currentRow = ev.Y + topRow;
 			}