]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-top: exception when terminal size greater than PAD_WIDTH 61621/head
authorJos Collin <jcollin@redhat.com>
Mon, 27 Jan 2025 06:10:43 +0000 (11:40 +0530)
committerJos Collin <jcollin@redhat.com>
Wed, 12 Feb 2025 01:54:43 +0000 (07:24 +0530)
Fixes: https://tracker.ceph.com/issues/69669
Signed-off-by: Jos Collin <jcollin@redhat.com>
src/tools/cephfs/top/cephfs-top

index 45900f9a025b09769a4287b7bfc970bd96885120..a814174f3391f6e969a6ada8994313046d4208e8 100755 (executable)
@@ -360,12 +360,6 @@ class FSTop(FSTopBase):
             # requested it will raise an exception
             pass
 
-        # Check the window size before creating the pad. For large windows,
-        # PAD_WIDTH = window width.
-        h, w = self.stdscr.getmaxyx()
-        if (w > DEFAULT_PAD_WIDTH):
-            self.PAD_WIDTH = w
-        self.fstop_pad = curses.newpad(self.PAD_HEIGHT, self.PAD_WIDTH)
         self.run_all_display()
 
     def display_fs_menu(self, stdscr, selected_row_idx):
@@ -964,8 +958,13 @@ class FSTop(FSTopBase):
         top, left = 0, 0  # where to place pad
         vscrollOffset, hscrollOffset = 0, 0  # scroll offsets
 
-        # calculate the initial viewport height and width
+        # Check the window size before creating the pad. For large windows, PAD_WIDTH=window width.
         windowsize = self.stdscr.getmaxyx()
+        if (windowsize[1] > DEFAULT_PAD_WIDTH):
+            self.PAD_WIDTH = windowsize[1]
+        self.fstop_pad = curses.newpad(self.PAD_HEIGHT, self.PAD_WIDTH)
+
+        # calculate the initial viewport height and width
         self.viewportHeight, self.viewportWidth = windowsize[0] - 1, windowsize[1] - 1
 
         # create header subpad
@@ -1098,8 +1097,13 @@ class FSTop(FSTopBase):
         top, left = 0, 0  # where to place pad
         vscrollOffset, hscrollOffset = 0, 0  # scroll offsets
 
-        # calculate the initial viewport height and width
+        # Check the window size before creating the pad. For large windows, PAD_WIDTH=window width.
         windowsize = self.stdscr.getmaxyx()
+        if (windowsize[1] > DEFAULT_PAD_WIDTH):
+            self.PAD_WIDTH = windowsize[1]
+        self.fstop_pad = curses.newpad(self.PAD_HEIGHT, self.PAD_WIDTH)
+
+        # calculate the initial viewport height and width
         self.viewportHeight, self.viewportWidth = windowsize[0] - 1, windowsize[1] - 1
 
         # create header subpad