Tk Source Code

View Ticket
Login
Ticket UUID: 47fbfc11391f25497d20149ce968b55fa437bd7c
Title: text's cursor width on 0th column
Type: Bug Version: 8.6+
Submitter: anonymous Created on: 2024-05-27 12:02:54
Subsystem: 18. [text] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2024-06-01 09:42:29
Resolution: None Closed By: nobody
    Closed on:
Description:

When the cursor is on 0th column of Tk text row, we see the cursor width = 1, instead of 2 as set with -insertwidth option.

Seemingly 1 pixel of the cursor width is lost at 0th position. Though, it's for 0th column the cursor is especially wanted to be wider than 1.

Checked on Linux and Windows.

However minor, this issue looks strange. It's specific for Tk text. No problems with other Tk widgets and with text widget of other libraries.

I solved this problem in alited editor (binding to cursor position change) - alas, it's my "workaround" only. Hopefully, there is a better way.

#_______________________

puts "Tk v[package require Tk]"

pack [text .txt -height 4 -width 50 -undo 1 -insertwidth 2] -pady 4 -padx 4
pack [entry .ent -width 50 -insertwidth 2 -textvar ::ent] -pady 4 -padx 4
set ::ent {  1. 123 5 789012  LINE-1}
.txt insert 1.0 $::ent\n\n
focus .txt
User Comments: fvogel added on 2024-05-30 10:12:29:

The revised text widget is currently hosted in the revised_text branch of the Tk repository.


anonymous added on 2024-05-30 09:55:17:

Hi François,

No, not at all a big issue. Just interesting.

Would you share a link to the revised text widget, or an info how it's available/used in the current Tk versions?

Please share it and then close the ticket.

Thanks in advance.


fvogel added on 2024-05-29 04:26:35:

This issue has been addressed in the revised implementation of the text widget, see here and TIP #466.

If this really is a big issue I can investigate fixing this in the legacy widget too.