Message394232
This is at least partly a tcl/tk issue.
Using Terry's last example, the Text widget reports that the length of the line is 14 (t.index('1.end') -> '1.14'), despite it only including 11 characters. It appears that each emoji character adds an extra character.
Minimal reproducer:
>>> t.delete('1.0', 'end')
>>> t.insert('1.0', 'a')
>>> t.index('1.end')
'1.1'
>>> t.delete('1.0', 'end')
>>> t.insert('1.0', '😀')
>>> t.index('1.end')
'1.2'
The same happens when using tcl/tk directly, so it's not a tkinter issue:
$ wish
% tk::text .t -width 40 -height 5 -wrap none -yscrollcommand ".ys set" -xscrollcommand ".xs set"
.t
% ttk::scrollbar .ys -orient vertical -command ".t yview"
.ys
% ttk::scrollbar .xs -orient horizontal -command ".t xview".t
extra characters after close-quote
% ttk::scrollbar .xs -orient horizontal -command ".t xview"
.xs
% .t insert end "a"
% grid .t -column 0 -row 0 -sticky nwes
% grid .t -column 0 -row 0 -sticky nwes
% grid .ys -column 1 -row 0 -sticky ns
% grid columnconfigure . 0 -weight 1
% grid rowconfigure . 0 -weight 1
% .t delete 1.0 end
% .t insert end "😀"
% .t index 1.end
1.2
% .t get 1.0
😀 |
|
Date |
User |
Action |
Args |
2021-05-24 04:51:27 | taleinat | set | recipients:
+ taleinat, terry.reedy, steven.daprano, erlendaasland, shreyanavigyan |
2021-05-24 04:51:27 | taleinat | set | messageid: <1621831887.45.0.571806655012.issue44217@roundup.psfhosted.org> |
2021-05-24 04:51:27 | taleinat | link | issue44217 messages |
2021-05-24 04:51:27 | taleinat | create | |
|