{"thread":{"id":"56980","subject":"[PATCH] gitk: fix error when resizing gitk","startedAt":"2021-11-25T14:23:18Z","lastAt":"2021-11-25T14:23:18Z","messageCount":1,"participants":["Shulhan"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"442310","messageId":"20211121073337.1953186-1-ms@kilabit.info","threadId":"56980","inReplyTo":null,"subject":"[PATCH] gitk: fix error when resizing gitk","fromName":"Shulhan","fromEmail":"ms@kilabit.info","sentAt":"2021-11-21T07:33:37Z","receivedAt":"2021-11-25T14:23:18Z","isPatch":true,"sender":{"key":"ms@kilabit.info","avatar":"https://gravatar.com/avatar/7c1ee6694e3700fd875823c62aec25e00a70f36f47a217ccd9240a0f5f8cb25e?d=mp&s=160"},"body":"When using gitk run on Wayland (in this case using sway window manager)\nand the window is vertical split, trying to resize the split will thrown\nthe following error,\n\n\texpected integer but got \"\"\n\texpected integer but got \"\"\n\t    while executing\n\t\"$win sash place 0 $sash0 [lindex $s0 1]\"\n\t    (procedure \"resizeclistpanes\" line 38)\n\t    invoked from within\n\t\"resizeclistpanes .tf.histframe.pwclist 983\"\n\t    (command bound to event)\n\nThe issue is confirmed by Anders Kaseorg on the list [1].\n\nThis commit fix this issue by checking if the $s0 or $s1 is empty\nstring, if its true set it to 0.\n\nPS: I have send this patch to paulus@ozlabs.org, and it seems like there\nis no reply since 7 Oct.\n\n[1] https://public-inbox.org/git/1f6e179c-d9c3-e503-3218-0acf4ff27cca@mit.edu/\n\nSigned-off-by: Shulhan <ms@kilabit.info>\n---\n gitk-git/gitk | 12 ++++++++++--\n 1 file changed, 10 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk-git/gitk b/gitk-git/gitk\nindex 23d9dd1fe0..fc2add49b4 100755\n--- a/gitk-git/gitk\n+++ b/gitk-git/gitk\n@@ -2989,8 +2989,16 @@ proc resizeclistpanes {win w} {\n             $win sashpos 0 $sash0\n             $win sashpos 1 $sash1\n         } else {\n-            $win sash place 0 $sash0 [lindex $s0 1]\n-            $win sash place 1 $sash1 [lindex $s1 1]\n+            set p0 [lindex $s0 1]\n+            set p1 [lindex $s1 1]\n+            if {$p0 eq \"\"} {\n+                set p0 0\n+            }\n+            if {$p1 eq \"\"} {\n+                set p1 0\n+            }\n+            $win sash place 0 $sash0 $p0\n+            $win sash place 1 $sash1 $p1\n         }\n \tset oldsash($win) [list $sash0 $sash1]\n     }\n-- \n2.34.0\n\n"}]}