git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] gitk: fix error when resizing gitk
@ 2021-11-21  7:33 Shulhan
  0 siblings, 0 replies; 4+ messages in thread
From: Shulhan @ 2021-11-21  7:33 UTC (permalink / raw)
  To: git; +Cc: paulus, Shulhan

When using gitk run on Wayland (in this case using sway window manager)
and the window is vertical split, trying to resize the split will thrown
the following error,

	expected integer but got ""
	expected integer but got ""
	    while executing
	"$win sash place 0 $sash0 [lindex $s0 1]"
	    (procedure "resizeclistpanes" line 38)
	    invoked from within
	"resizeclistpanes .tf.histframe.pwclist 983"
	    (command bound to event)

The issue is confirmed by Anders Kaseorg on the list [1].

This commit fix this issue by checking if the $s0 or $s1 is empty
string, if its true set it to 0.

PS: I have send this patch to paulus@ozlabs.org, and it seems like there
is no reply since 7 Oct.

[1] https://public-inbox.org/git/1f6e179c-d9c3-e503-3218-0acf4ff27cca@mit.edu/

Signed-off-by: Shulhan <ms@kilabit.info>
---
 gitk-git/gitk | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 23d9dd1fe0..fc2add49b4 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2989,8 +2989,16 @@ proc resizeclistpanes {win w} {
             $win sashpos 0 $sash0
             $win sashpos 1 $sash1
         } else {
-            $win sash place 0 $sash0 [lindex $s0 1]
-            $win sash place 1 $sash1 [lindex $s1 1]
+            set p0 [lindex $s0 1]
+            set p1 [lindex $s1 1]
+            if {$p0 eq ""} {
+                set p0 0
+            }
+            if {$p1 eq ""} {
+                set p1 0
+            }
+            $win sash place 0 $sash0 $p0
+            $win sash place 1 $sash1 $p1
         }
 	set oldsash($win) [list $sash0 $sash1]
     }
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] gitk: fix error when resizing gitk
@ 2021-11-25 12:57 Shulhan
  2022-02-23 15:03 ` Halil SEN
  0 siblings, 1 reply; 4+ messages in thread
From: Shulhan @ 2021-11-25 12:57 UTC (permalink / raw)
  To: git; +Cc: paulus, Shulhan

When using gitk run on Wayland (in this case using sway window manager)
and the window is vertical split, trying to resize the split will thrown
the following error,

	expected integer but got ""
	expected integer but got ""
	    while executing
	"$win sash place 0 $sash0 [lindex $s0 1]"
	    (procedure "resizeclistpanes" line 38)
	    invoked from within
	"resizeclistpanes .tf.histframe.pwclist 983"
	    (command bound to event)

The issue is confirmed by Anders Kaseorg on the list [1].

This commit fix this issue by checking if the $s0 or $s1 is empty
string, if its true set it to 0.

PS: I have send this patch to paulus@ozlabs.org, and it seems like there
is no reply since 7 Oct. Either the email is not received or somethings
in between.

[1] https://public-inbox.org/git/1f6e179c-d9c3-e503-3218-0acf4ff27cca@mit.edu/

Signed-off-by: Shulhan <ms@kilabit.info>
---
 gitk-git/gitk | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/gitk-git/gitk b/gitk-git/gitk
index 23d9dd1fe0..fc2add49b4 100755
--- a/gitk-git/gitk
+++ b/gitk-git/gitk
@@ -2989,8 +2989,16 @@ proc resizeclistpanes {win w} {
             $win sashpos 0 $sash0
             $win sashpos 1 $sash1
         } else {
-            $win sash place 0 $sash0 [lindex $s0 1]
-            $win sash place 1 $sash1 [lindex $s1 1]
+            set p0 [lindex $s0 1]
+            set p1 [lindex $s1 1]
+            if {$p0 eq ""} {
+                set p0 0
+            }
+            if {$p1 eq ""} {
+                set p1 0
+            }
+            $win sash place 0 $sash0 $p0
+            $win sash place 1 $sash1 $p1
         }
 	set oldsash($win) [list $sash0 $sash1]
     }
-- 
2.34.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitk: fix error when resizing gitk
  2021-11-25 12:57 Shulhan
@ 2022-02-23 15:03 ` Halil SEN
  2022-02-23 17:16   ` Shulhan
  0 siblings, 1 reply; 4+ messages in thread
From: Halil SEN @ 2022-02-23 15:03 UTC (permalink / raw)
  To: Shulhan; +Cc: git, paulus

Hello Shulhan,

I just stumbled upon your patch while looking for the patch
that I sent at the beginning of this week for the exact same
issue.  It turns out you sent your patch two months ago.  I
should have checked before debugging :face_palm:

If you would like to check it out, here is my patch in [1].

I see that you have fixed resizeclistpanes but exact same issue
is present on resizecdetpanes as well.

I am not sure if the conditional logic is necessary because we
are sure that `sash#` includes x, y positions in ttk mode but it
includes only the x position if not ttk. Also setting the y coord
to 0 might have unintended consequences.


[1] https://lore.kernel.org/git/0b5b8fb591e434a2a24b1f58d1ce3fc7da48a28e.1645386457.git.gitgitgadget@gmail.com/

Signed-off-by: Halil Sen <halil.sen@gmail.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gitk: fix error when resizing gitk
  2022-02-23 15:03 ` Halil SEN
@ 2022-02-23 17:16   ` Shulhan
  0 siblings, 0 replies; 4+ messages in thread
From: Shulhan @ 2022-02-23 17:16 UTC (permalink / raw)
  To: Halil SEN; +Cc: git, paulus

[-- Attachment #1: Type: text/plain, Size: 1239 bytes --]

On Wed, 23 Feb 2022 16:03:55 +0100
Halil SEN <halilsen@gmail.com> wrote:

> Hello Shulhan,

Hi Halil,

> 
> I just stumbled upon your patch while looking for the patch
> that I sent at the beginning of this week for the exact same
> issue.  It turns out you sent your patch two months ago.  I
> should have checked before debugging :face_palm:
> 
> If you would like to check it out, here is my patch in [1].
> 
> I see that you have fixed resizeclistpanes but exact same issue
> is present on resizecdetpanes as well.

I have never encounter this issue.

> 
> I am not sure if the conditional logic is necessary because we
> are sure that `sash#` includes x, y positions in ttk mode but it
> includes only the x position if not ttk. Also setting the y coord
> to 0 might have unintended consequences.
> 

I am new to Tcl/Tk at the time fixing this issue, so it kinda
try-and-error-patch with printf here and there.  Your patch is more
simple and fix the issue too.

> 
> [1]
> https://lore.kernel.org/git/0b5b8fb591e434a2a24b1f58d1ce3fc7da48a28e.1645386457.git.gitgitgadget@gmail.com/
> 
> Signed-off-by: Halil Sen <halil.sen@gmail.com>

-- 
{ "github":"github.com/shuLhan", "site":"kilabit.info" }

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-02-23 17:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-21  7:33 [PATCH] gitk: fix error when resizing gitk Shulhan
  -- strict thread matches above, loose matches on Subject: below --
2021-11-25 12:57 Shulhan
2022-02-23 15:03 ` Halil SEN
2022-02-23 17:16   ` Shulhan

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).