浏览代码

Fix horizontal scrolling in the ListView.

BDisp 1 年之前
父节点
当前提交
36469b7298
共有 1 个文件被更改,包括 3 次插入2 次删除
  1. 3 2
      Terminal.Gui/Views/ListView.cs

+ 3 - 2
Terminal.Gui/Views/ListView.cs

@@ -912,7 +912,7 @@ public class ListWrapper : IListDataSource
         int start = 0
     )
     {
-        container.Move (col, line);
+        container.Move (Math.Max (col - start, 0), line);
         object t = _source? [item];
 
         if (t is null)
@@ -1028,7 +1028,8 @@ public class ListWrapper : IListDataSource
 
     private void RenderUstr (ConsoleDriver driver, string ustr, int col, int line, int width, int start = 0)
     {
-        string u = TextFormatter.ClipAndJustify (ustr, width, TextAlignment.Left);
+        string str = start > ustr.GetColumns () ? string.Empty : ustr.Substring (Math.Min (start, ustr.ToRunes ().Length - 1));
+        string u = TextFormatter.ClipAndJustify (str, width, TextAlignment.Left);
         driver.AddStr (u);
         width -= u.GetColumns ();