Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

LOAD "LINUX",8,1 -- Topic on #LinuxGER


devel / comp.lang.tcl / Re: small inconsistencies in the 3 texting widgets

SubjectAuthor
* small inconsistencies in the 3 texting widgetset99
`- Re: small inconsistencies in the 3 texting widgetsHarald Oehlmann

1
small inconsistencies in the 3 texting widgets

<ud5k0r$1kvvs$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22672&group=comp.lang.tcl#22672

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: et99@rocketship1.me (et99)
Newsgroups: comp.lang.tcl
Subject: small inconsistencies in the 3 texting widgets
Date: Mon, 4 Sep 2023 14:59:55 -0700
Organization: A noiseless patient Spider
Lines: 62
Message-ID: <ud5k0r$1kvvs$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 4 Sep 2023 21:59:55 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="9143d5f116f24eef96c05d73da5ba878";
logging-data="1736700"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/7Tu6n3Lj0vEuu/EoFMp1t"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.6.1
Cancel-Lock: sha1:3Z8RCeaLgFZ1qpgE6q0g7XqlTz0=
Content-Language: en-US
 by: et99 - Mon, 4 Sep 2023 21:59 UTC

In the below examples, I am wondering if this is a Tk bug, or a user bug. One could argue that a programmer should not (by program) create a selection where the cursor is not also placed in or adjacent to the selection. So, I'm wondering if a ticket should be created for this.

Each of the 3 texting widgets,

entry
ttk::entry
text

say in the manual:

"If any normal printing characters are typed (in an entry), they are inserted at the point of the insertion cursor."

However, this is not always the case. The below 5 example programs demonstrate that when the program creates a selection, moves the insertion cursor outside the selection (or just leaves it where it was), and gives focus to the widget, typed characters (e.g. 123) will sometimes replace the selection, and sometimes not. If it replaces the selection, the inserted characters are not where the cursor was.

Note that interactive selections (user does the selection, not the program) don't apply since the cursor will always end up adjacent to the selection. I believe this is why this behavior may not have been noticed before.

The reason for these behaviors can be seen in the binding for <Key> which results in calls to several different procs.

Note that more specific bindings, such as <Key-BackSpace> take precedence and also have inconsistent results. The 2 entry's will delete the selection, but in ttk::entry the cursor is also moved. In text, it will delete 1 char at a time until it gets to the selection. Then it deletes the entire selection. However, the manual for text says:

"Backspace and Control-h delete the selection, if there is one in the widget. If there is no selection, they delete the character to the left of the insertion cursor."

And in addition, Control-h never deletes the full selection only 1 character at a time.

Examples (run each separately - I paste them into a windows console or rlwrap of wish):

ttk::entry .te -textvariable tevar ;# will delete selection
pack .te
set tevar "abc def ghi"
..te selection range 0 3
..te icursor end
focus -force .te

entry .te -textvariable tevar ;# will not delete selection
pack .te
set tevar "abc def ghi"
..te selection range 0 3
..te icursor end
focus -force .te

entry .te -textvariable tevar ;# will delete selection
pack .te
set tevar "abc def ghi"
..te selection range 0 3
..te icursor 0
focus -force .te

text .t ;# will not delete selection
pack .t
..t insert 0.0 "abc def ghi"
..t tag add sel 1.0 1.3
..t mark set insert end
focus -force .t

text .t ;# will delete selection
pack .t
..t insert 0.0 "abc def ghi"
..t tag add sel 1.0 1.3
..t mark set insert 1.3
focus -force .t

Re: small inconsistencies in the 3 texting widgets

<udbpci$2ssur$1@dont-email.me>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=22680&group=comp.lang.tcl#22680

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wortkarg3@yahoo.com (Harald Oehlmann)
Newsgroups: comp.lang.tcl
Subject: Re: small inconsistencies in the 3 texting widgets
Date: Wed, 6 Sep 2023 19:52:05 +0200
Organization: A noiseless patient Spider
Lines: 97
Message-ID: <udbpci$2ssur$1@dont-email.me>
References: <ud5k0r$1kvvs$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 7 Sep 2023 06:08:21 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="c49c51b253ffa81f953cdb22e86adf72";
logging-data="3044315"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LXjD6/k5W33OpR7CXBj09"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.15.0
Cancel-Lock: sha1:/l8D+ojr/Ev5/9UBA/0W+jX2HwE=
Content-Language: en-GB
In-Reply-To: <ud5k0r$1kvvs$1@dont-email.me>
 by: Harald Oehlmann - Wed, 6 Sep 2023 17:52 UTC

Am 04.09.2023 um 23:59 schrieb et99:
> In the below examples, I am wondering if this is a Tk bug, or a user
> bug. One could argue that a programmer should not (by program) create a
> selection where the cursor is not also placed in or adjacent to the
> selection. So, I'm wondering if a ticket should be created for this.
>
> Each of the 3 texting widgets,
>
> entry
> ttk::entry
> text
>
> say in the manual:
>
> "If any normal printing characters are typed (in an entry), they are
> inserted at the point of the insertion cursor."
>
>
> However, this is not always the case. The below 5 example programs
> demonstrate that when the program creates a selection, moves the
> insertion cursor outside the selection (or just leaves it where it was),
> and gives focus to the widget, typed characters (e.g. 123) will
> sometimes replace the selection, and sometimes not. If it replaces the
> selection, the inserted characters are not where the cursor was.
>
> Note that interactive selections (user does the selection, not the
> program) don't apply since the cursor will always end up adjacent to the
> selection.  I believe this is why this behavior may not have been
> noticed before.
>
> The reason for these behaviors can be seen in the binding for <Key>
> which results in calls to several different procs.
>
> Note that more specific bindings, such as <Key-BackSpace> take
> precedence and also have inconsistent results. The 2 entry's will delete
> the selection, but in ttk::entry the cursor is also moved. In text, it
> will delete 1 char at a time until it gets to the selection. Then it
> deletes the entire selection. However, the manual for text says:
>
> "Backspace and Control-h delete the selection, if there is one in the
> widget. If there is no selection, they delete the character to the left
> of the insertion cursor."
>
> And in addition, Control-h never deletes the full selection only 1
> character at a time.
>
> Examples (run each separately - I paste them into a windows console or
> rlwrap of wish):
>
> ttk::entry .te -textvariable tevar ;# will delete selection
> pack .te
> set tevar "abc def ghi"
> .te selection range 0 3
> .te icursor end
> focus -force .te
>
> entry .te -textvariable tevar ;# will not delete selection
> pack .te
> set tevar "abc def ghi"
> .te selection range 0 3
> .te icursor end
> focus -force .te
>
> entry .te -textvariable tevar ;# will delete selection
> pack .te
> set tevar "abc def ghi"
> .te selection range 0 3
> .te icursor 0
> focus -force .te
>
> text .t ;# will not delete selection
> pack .t
> .t insert 0.0 "abc def ghi"
> .t tag add sel 1.0 1.3
> .t mark set insert end
> focus -force .t
>
> text .t ;# will delete selection
> pack .t
> .t insert 0.0 "abc def ghi"
> .t tag add sel 1.0 1.3
> .t mark set insert 1.3
> focus -force .t
>

Thank you, Eric, for the great analysis.
Test hint: past the test scripts for setup and then press:
- a key
or backspace
or ctrl-backspace

Could you open a bug report for this?
At least, the documentation may be changed.
And a unified approach for all entry widgets would be great.

Take care,
Harald


devel / comp.lang.tcl / Re: small inconsistencies in the 3 texting widgets

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor