Prechádzať zdrojové kódy

Fix horizontal scrolling in the ListView.

BDisp 1 rok pred
rodič
commit
36469b7298
1 zmenil súbory, kde vykonal 3 pridanie a 2 odobranie
  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 ();