2
0
Эх сурвалжийг харах

Fixes #3525. Allow to set Contents to dirty to just refresh the screen.

BDisp 1 жил өмнө
parent
commit
9297d05c13

+ 22 - 3
Terminal.Gui/ConsoleDrivers/ConsoleDriver.cs

@@ -315,12 +315,31 @@ public abstract class ConsoleDriver
                 {
                 {
                     Contents [row, c] = new Cell
                     Contents [row, c] = new Cell
                     {
                     {
-                        Rune = (Rune)' ', 
-                        Attribute = new Attribute (Color.White, Color.Black), 
+                        Rune = (Rune)' ',
+                        Attribute = new Attribute (Color.White, Color.Black),
                         IsDirty = true
                         IsDirty = true
                     };
                     };
-                    _dirtyLines [row] = true;
                 }
                 }
+                _dirtyLines [row] = true;
+            }
+        }
+    }
+
+    /// <summary>
+    /// Sets <see cref="Contents"/> as dirty for situations where views
+    /// don't need layout and redrawing, but just refresh the screen.
+    /// </summary>
+    public void SetContentsAsDirty ()
+    {
+        lock (Contents)
+        {
+            for (var row = 0; row < Rows; row++)
+            {
+                for (var c = 0; c < Cols; c++)
+                {
+                    Contents [row, c].IsDirty = true;
+                }
+                _dirtyLines [row] = true;
             }
             }
         }
         }
     }
     }