Browse Source

Use round to nearest whole number when calculating sixel resolution from window size/chars

tznind 11 tháng trước cách đây
mục cha
commit
4073ef305c
1 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 2 2
      Terminal.Gui/Drawing/SixelSupportDetector.cs

+ 2 - 2
Terminal.Gui/Drawing/SixelSupportDetector.cs

@@ -71,8 +71,8 @@ public class SixelSupportDetector
                             charWidth != 0 && charHeight != 0) // Avoid divide by zero
                         {
                             // Calculate the character cell size in pixels
-                            var cellWidth = pixelWidth / charWidth;
-                            var cellHeight = pixelHeight / charHeight;
+                            var cellWidth = (int)Math.Round ((double)pixelWidth / charWidth);
+                            var cellHeight = (int)Math.Round ((double)pixelHeight / charHeight);
 
                             // Set the resolution based on the character cell size
                             result.Resolution = new Size (cellWidth, cellHeight);