)]}'
{
  "commit": "e19565b86516c19d909d0a62b5787b6bba02cbcc",
  "tree": "9ad59e48294af11e42fce04c29f1fe1a08faebac",
  "parents": [
    "b0fcf3e344438a4d115afdfaa7468bf90cc8c880"
  ],
  "author": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Tue Feb 01 12:29:57 2022 +0000"
  },
  "committer": {
    "name": "Andrew Burgess",
    "email": "aburgess@redhat.com",
    "time": "Sun Apr 03 15:31:47 2022 +0100"
  },
  "message": "gdb/tui: allow cmd window to change size in tui_layout_split::apply\n\nWhen we switch layouts we call the tui_layout_split::apply member\nfunction to reapply the layout, and recalculate all the window sizes.\n\nOne special case is the cmd window, which we try to keep at its\nexisting size.\n\nHowever, in some cases it is not appropriate to keep the cmd window at\nits existing size.  I will describe two such cases here, in one, we\nwant the cmd window to reduce in size, and in the other, we want the\ncmd window to grow in size.\n\nTry these steps in a 80 columns, by 24 lines terminal:\n\n  (gdb) tui enable\n  (gdb) layout src\n  (gdb) winheight cmd 20\n  (gdb) layout split\n\nYou should see that the status window is missing from the new layout,\nand that the cmd window has been placed over the border of the asm\nwindow.  The \u0027info win\u0027 output is:\n\n  (gdb) info win\n  Name       Lines Columns Focus\n  src            3      80 (has focus)\n  asm            3      80\n  status         1      80\n  cmd           20      80\n\nNotice that gdb has assigned 27 lines of screen space, even with the\nborder overlap between the src and asm windows, this is still 2 lines\ntoo many.\n\nThe problem here is that after switching layouts, gdb has forced the\ncmd window to retain its 20 line height.  Really, we want the cmd\nwindow to reduce in height so that the src and asm windows can occupy\ntheir minimum required space.\n\nThis commit allows this (details on how are below).  After this\ncommit, in the above situation, we now see the status window displayed\ncorrectly, and the \u0027info win\u0027 output is:\n\n  (gdb) info win\n  Name       Lines Columns Focus\n  src            3      80 (has focus)\n  asm            3      80\n  status         1      80\n  cmd           18      80\n\nThe cmd window has been reduced in size by 2 lines so that everything\ncan fit on the screen.\n\nThe second example is one which was discussed in a recent commit,\nconsider this case (still in the 80 column, 24 line terminal):\n\n  (gdb) tui enable\n  (gdb) tui new-layout conly cmd 1\n  (gdb) layout conly\n  (gdb) info win\n  Name       Lines Columns Focus\n  cmd            8      80 (has focus)\n  (gdb)\n\nThis layout only contains a cmd window, which we would expect to\noccupy the entire terminal.  But instead, the cmd window only occupies\nthe first 8 lines, and the rest of the terminal is unused!\n\nThe reason is, again, that the cmd window is keeping its previous\nsize (8 lines).\n\nAfter this commit things are slightly different, the \u0027info win\u0027 output\nis now:\n\n  (gdb) info win\n  Name       Lines Columns Focus\n  cmd           20      80 (has focus)\n\nWhich is a little better, but why only 20 lines?  Turns out there\u0027s\nyet another bug hitting this case.  That bug will be addressed in a\nlater commit, so, for now, we\u0027re accepting the 20 lines.\n\nWhat this commit does is modify the phase of tui_layout_split::apply\nthat handles any left over space.  Usually, in \"Step 2\", each\nsub-layout has a size calculated.  As the size is an integer, then,\nwhen all sizes are calculated we may have some space left over.\n\nThis extra space is then distributed between all the windows fairly\nuntil all the space is used up.\n\nWhen we consider windows minimum size, or fixed size windows, then it\nis possible that we might try to use more space than is available,\nthis was our first example above.  The same code that added extra\nspace to the windows, can also be used to reclaim space (in the over\nallocation case) to allow all windows to fit.\n\nThe problem then is the cmd window, which we often force to a fixed\nsize.  Inside the loop that handles the allocation of excess space, if\nwe find that we have tried every window, and still have space either\nleft to give, or we need to claim back more space, then, if the cmd\nwindow was changed to a fixed size, we can change the cmd window back\nto a non-fixed-size window, and proceed to either give, or take space\nfrom the cmd window as needed.\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "66048e6523895269a1eed1d013c3254f2d2f61fb",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.tui/new-layout.exp",
      "new_id": "0d49d033be502d287809501e9eee830358597948",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.tui/new-layout.exp"
    },
    {
      "type": "modify",
      "old_id": "0d0c886304d85e462ea660dffb552c347eda4386",
      "old_mode": 33188,
      "old_path": "gdb/testsuite/gdb.tui/winheight.exp",
      "new_id": "b541c21b8250290e2e140ada73e98c4ea556578a",
      "new_mode": 33188,
      "new_path": "gdb/testsuite/gdb.tui/winheight.exp"
    },
    {
      "type": "modify",
      "old_id": "30beefddfdb9f9e6aadc95cf7f852f66bda08817",
      "old_mode": 33188,
      "old_path": "gdb/tui/tui-layout.c",
      "new_id": "874760d526f3e988625bb15257715cfa8a56b7e7",
      "new_mode": 33188,
      "new_path": "gdb/tui/tui-layout.c"
    }
  ]
}
