浏览代码

Named items on DisplaySize method.

BDisp 4 年之前
父节点
当前提交
072de09dd5
共有 1 个文件被更改,包括 4 次插入4 次删除
  1. 4 4
      Terminal.Gui/Views/TextField.cs

+ 4 - 4
Terminal.Gui/Views/TextField.cs

@@ -148,7 +148,7 @@ namespace Terminal.Gui {
 				TextChanged?.Invoke (oldText);
 
 				if (point > text.Count) {
-					point = Math.Max (DisplaySize (text, 0).Item1 - 1, 0);
+					point = Math.Max (DisplaySize (text, 0).Size - 1, 0);
 				}
 
 				Adjust ();
@@ -242,7 +242,7 @@ namespace Terminal.Gui {
 		}
 
 		// Returns the size and length in a range of the string.
-		(int, int) DisplaySize (List<Rune> t, int start = -1, int end = -1, bool checkNextRune = true)
+		(int Size, int Length) DisplaySize (List<Rune> t, int start = -1, int end = -1, bool checkNextRune = true)
 		{
 			if (t == null || t.Count == 0) {
 				return (0, 0);
@@ -269,7 +269,7 @@ namespace Terminal.Gui {
 			if (point < first) {
 				first = point;
 			} else if (first + point - (Frame.Width + offB) == 0 ||
-				  DisplaySize (text, first, point).Item1 >= Frame.Width + offB) {
+				  DisplaySize (text, first, point).Size >= Frame.Width + offB) {
 				first = Math.Max (CalculateFirst (text, first, point, Frame.Width - 1 + offB), 0);
 			}
 			SetNeedsDisplay ();
@@ -303,7 +303,7 @@ namespace Terminal.Gui {
 				size += s;
 				if (size >= dSize - width) {
 					col = tcount - i + start;
-					if (col == start || (point == t.Count && (point - col > width))) {
+					if (start == 0 || col == start || (point == t.Count && (point - col > width))) {
 						col++;
 					}
 					break;