# gitk: regression when opening preferences with `want_ttk=0`

3 messages from 2025-05-22 to 2025-05-22. Participants: punk.lion0906@fastmail.com, Johannes Sixt.
Thread: https://gitlist.dev/t/63499

## punk.lion0906@fastmail.com, 2025-05-22 02:55

Subject: gitk: regression when opening preferences with `want_ttk=0`
Message-ID: <087f6a4d-d276-4f1e-94a4-7423b3387b79@app.fastmail.com>
URL: https://gitlist.dev/e/087f6a4d-d276-4f1e-94a4-7423b3387b79%40app.fastmail.com

```
This duplicates https://github.com/j6t/gitk/issues/18.

I found a regression in `gitk`'s commit 904b36b. When `gitk` is run with `want_ttk=0`
(AKA "use themed widgets" set to off), I cannot open the settings dialog since that
commit.  It gives the following error in a modal dialog, and then opens a completely empty non-modal dialog where the settings dialog should be:

ˋˋˋ
`invalid command name "::combobox"
invalid command name "::combobox"
    while executing
"${NS}::combobox $page.wrapcomment -values {none char word} -state readonly  -textvariable wrapcomment"
    (procedure "prefspage_general" line 43)
    invoked from within
"prefspage_general $notebook"
    (procedure "doprefs" line 27)
    invoked from within
"doprefs"
    (procedure "::tk::mac::ShowPreferences" line 1)
    invoked from within
"::tk::mac::ShowPreferences"`
ˋˋˋ

Indeed, 904b36b adds some `::combobox`es.

I tested this on MacOS with Tcl/Tk 8.6, both with Homebrew-installed `gitk` from the `git-gui` 2.49.0 package, and with the master branch of https://github.com/j6t/gitk (commit 9f27318), and with that repo's 904b36b. The parent of 904b36b works fine.

The workaround is to close gitk, and set `want_ttk` to 1 in ~/.config/git/gitk, ~/.gitk, or equivalent. Completely deleting the config file at ~/.config/git/gitk also fixed the problem for me.

       Ilya.

```

## punk.lion0906@fastmail.com, 2025-05-22 03:03

Subject: Re: gitk: regression when opening preferences with `want_ttk=0`
Message-ID: <55a7668d-5227-4b7e-93f9-40d049f2e1be@app.fastmail.com>
URL: https://gitlist.dev/e/55a7668d-5227-4b7e-93f9-40d049f2e1be%40app.fastmail.com
In-Reply-To: <087f6a4d-d276-4f1e-94a4-7423b3387b79@app.fastmail.com>

```
Since the commit probably has a different id in Git's main repo,
here is the description of the problematic commit 904b36b:

ˋˋˋ
gitk: add text wrapping preferences
Add a new preference "wrapdefault" which allows enabling char/word wrap.
Impacts all text in the ctext widget for which no other preference exists.

Also make the (existing) preference "wrapcomment" configurable graphically.
Its setting impacts only the "comment" part of the ctext widget.

Signed-off-by: Christoph Sommer <sommer@cms-labs.org>
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
ˋˋˋ

And the likely problematic section of the diff is:

ˋˋˋ
@@ -11607,6 +11607,17 @@ proc prefspage_general {notebook} {
     ${NS}::label $page.tabstopl -text [mc "Tab spacing"]
     spinbox $page.tabstop -from 1 -to 20 -width 4 -textvariable tabstop
     grid x $page.tabstopl $page.tabstop -sticky w
+
+    ${NS}::label $page.wrapcommentl -text [mc "Wrap comment text"]
+    ${NS}::combobox $page.wrapcomment -values {none char word} -state readonly \
+        -textvariable wrapcomment
+    grid x $page.wrapcommentl $page.wrapcomment -sticky w
+
+    ${NS}::label $page.wrapdefaultl -text [mc "Wrap other text"]
+    ${NS}::combobox $page.wrapdefault -values {none char word} -state readonly \
+        -textvariable wrapdefault
+    grid x $page.wrapdefaultl $page.wrapdefault -sticky w
+
     ${NS}::checkbutton $page.ntag -text [mc "Display nearby tags/heads"] \
         -variable showneartags
     grid x $page.ntag -sticky w
ˋˋˋ

Hopefully, this will make it easier to find for people.

        Ilya.

On Wed, May 21, 2025, at 7:55 PM, punk.lion0906@fastmail.com wrote:
> This duplicates https://github.com/j6t/gitk/issues/18.
>
> I found a regression in `gitk`'s commit 904b36b. When `gitk` is run 
> with `want_ttk=0`
> (AKA "use themed widgets" set to off), I cannot open the settings 
> dialog since that
> commit.  It gives the following error in a modal dialog, and then opens 
> a completely empty non-modal dialog where the settings dialog should be:
>
> ˋˋˋ
> `invalid command name "::combobox"
> invalid command name "::combobox"
>     while executing
> "${NS}::combobox $page.wrapcomment -values {none char word} -state 
> readonly  -textvariable wrapcomment"
>     (procedure "prefspage_general" line 43)
>     invoked from within
> "prefspage_general $notebook"
>     (procedure "doprefs" line 27)
>     invoked from within
> "doprefs"
>     (procedure "::tk::mac::ShowPreferences" line 1)
>     invoked from within
> "::tk::mac::ShowPreferences"`
> ˋˋˋ
>
> Indeed, 904b36b adds some `::combobox`es.
>
> I tested this on MacOS with Tcl/Tk 8.6, both with Homebrew-installed 
> `gitk` from the `git-gui` 2.49.0 package, and with the master branch of 
> https://github.com/j6t/gitk (commit 9f27318), and with that repo's 
> 904b36b. The parent of 904b36b works fine.
>
> The workaround is to close gitk, and set `want_ttk` to 1 in 
> ~/.config/git/gitk, ~/.gitk, or equivalent. Completely deleting the 
> config file at ~/.config/git/gitk also fixed the problem for me.
>
>        Ilya.

```

## Johannes Sixt, 2025-05-22 17:10

Subject: Re: gitk: regression when opening preferences with `want_ttk=0`
Message-ID: <086214b2-a747-4913-b279-aaf655e4869e@kdbg.org>
URL: https://gitlist.dev/e/086214b2-a747-4913-b279-aaf655e4869e%40kdbg.org
In-Reply-To: <087f6a4d-d276-4f1e-94a4-7423b3387b79@app.fastmail.com>

```
Am 22.05.25 um 04:55 schrieb punk.lion0906@fastmail.com:
> This duplicates https://github.com/j6t/gitk/issues/18.
> 
> I found a regression in `gitk`'s commit 904b36b. When `gitk` is run with `want_ttk=0`
> (AKA "use themed widgets" set to off), I cannot open the settings dialog since that
> commit.

There's a fix in this branch:
https://github.com/j6t/gitk/tree/yh/fix-non-themed-combobox

-- Hannes


```
