Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

19 May, 2024: Line wrapping has been changed to be more consistent with Usenet standards.
 If you find that it is broken please let me know here rocksolid.nodes.help


devel / comp.lang.tcl / Re: Tk text widget cursor jumps to next line when clicking on the right (??)

SubjectAuthor
* Tk text widget cursor jumps to next line when clicking on the right (??)xol odho
`* Re: Tk text widget cursor jumps to next line when clicking on theFrancois Vogel
 `* Re: Tk text widget cursor jumps to next line when clicking on theLuc
  `- Re: Tk text widget cursor jumps to next line when clicking on thexol odho

1
Tk text widget cursor jumps to next line when clicking on the right (??)

<e45c26d2-fd58-4ef6-96cf-436643bb886cn@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ac8:5d49:0:b0:35b:b603:504a with SMTP id g9-20020ac85d49000000b0035bb603504amr17524358qtx.511.1664838569099;
Mon, 03 Oct 2022 16:09:29 -0700 (PDT)
X-Received: by 2002:ae9:f810:0:b0:6ce:3cf5:42cc with SMTP id
x16-20020ae9f810000000b006ce3cf542ccmr14568219qkh.216.1664838568902; Mon, 03
Oct 2022 16:09:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Mon, 3 Oct 2022 16:09:28 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=201.231.246.253; posting-account=DnakAAoAAAA9ZZlBDSXHBE9MWv_A1hHG
NNTP-Posting-Host: 201.231.246.253
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e45c26d2-fd58-4ef6-96cf-436643bb886cn@googlegroups.com>
Subject: Tk text widget cursor jumps to next line when clicking on the right (??)
From: xolodho@gmail.com (xol odho)
Injection-Date: Mon, 03 Oct 2022 23:09:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3661
 by: xol odho - Mon, 3 Oct 2022 23:09 UTC

Hello all ... learning some Tk here ...

After playing around with Tk's lovely text megawidget, I've been
annoyed by the "line jumping" behavior when you click on the empty
area to the right of the text. Am I the only one that expects the
cursor to stay on the last char of the line, instead of jumping to the
first char of the next one? All editors I've used stay on the line
when you click on the empty area on the right.

For instance, try this in wish:

pack [text .t] -expand yes -fill both
.t insert end "hello\nthis is another line"

Make sure there is plenty of empty area to the right of the first
line. Now put the mouse pointer on the first line a little bit to the
right of the "hello", and start clicking and moving the cursor to the
right (click, move, click, etc). After the mouse pointer crosses the
middle of the empty area, on click the insertion cursor jumps to the
first char of the next line (before "this") instead of staying at the
end of the line (i.e. to the right of the "o"). I didn't expect this
behavior.

I don't know whether this is the intended behavior, but anyway I found
a little temporary fix for it, as follows.

In Tk 8.6.12, look for the `tk::TextClosestGap` procedure in
`text.tcl`, here it is (with minor reformatting):

proc ::tk::TextClosestGap {w x y} {
set pos [$w index @$x,$y]
set bbox [$w bbox $pos]
if {$bbox eq ""} {
return $pos
}
if {($x - [lindex $bbox 0]) < ([lindex $bbox 2]/2)} {
return $pos
}
$w index "$pos + 1 char"
}

That routine is directly invoked by tk::TextButton1 (on click) to set
the insertion cursor. It seems the second `if` is trying to determine
whether the click position ($x,$y) is horizontally on the left half of
the bounding box for the char at position $pos (which is under the
mouse pointer ($x,$y) according to `index`), and if so, $pos remains
where it was, otherwise it jumps to the next char. But when the char
at $pos is the last one on the line (newline), the bounding box
returned by `bbox` has the full width of the empty area, so if you
click in the right half of that area the insertion cursor will jump to
the next char, which is on the following line (unless you are on the
last line).

For now I'm fixing it with this in place of the first `if`:

if {$bbox eq "" || [$w compare $pos == "$pos lineend"]} {
return $pos
}

So if the mouse click is on the empty area to the right, $pos is the
index of the last char of that text line, and it will stay there. I'm
not sure this is the right way to do it but it is working so far...

Re: Tk text widget cursor jumps to next line when clicking on the right (??)

<633bcacf$0$2993$426a74cc@news.free.fr>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.mixmin.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-b.proxad.net!nnrp1-2.free.fr!not-for-mail
Date: Tue, 4 Oct 2022 07:55:27 +0200
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101
Thunderbird/102.3.1
Subject: Re: Tk text widget cursor jumps to next line when clicking on the
right (??)
Newsgroups: comp.lang.tcl
References: <e45c26d2-fd58-4ef6-96cf-436643bb886cn@googlegroups.com>
Content-Language: en-US
From: francois.vogel.fv.NOSPAM@gmail.com (Francois Vogel)
In-Reply-To: <e45c26d2-fd58-4ef6-96cf-436643bb886cn@googlegroups.com>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Antivirus: Avast (VPS 221003-12, 3/10/2022), Outbound message
X-Antivirus-Status: Clean
Lines: 22
Message-ID: <633bcacf$0$2993$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 04 Oct 2022 07:55:27 CEST
NNTP-Posting-Host: 82.65.57.56
X-Trace: 1664862927 news-1.free.fr 2993 82.65.57.56:50631
X-Complaints-To: abuse@proxad.net
 by: Francois Vogel - Tue, 4 Oct 2022 05:55 UTC

Le 04/10/2022 à 01:09, xol odho a écrit :
> After playing around with Tk's lovely text megawidget, I've been
> annoyed by the "line jumping" behavior when you click on the empty
> area to the right of the text.

See:

https://core.tcl-lang.org/tk/tktview?name=b461c70399

This was a lengthy discussion and I never actually made my mind on
changing the behavior or not, and if so, in what version of Tk (and what
version of the text widget - legacy or revised).

Opinions, final arguments and decisive remarks welcome.

Regards,
Francois

Re: Tk text widget cursor jumps to next line when clicking on the right (??)

<20221004175504.66c63144@lud1.home>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
Path: i2pn2.org!i2pn.org!aioe.org!jIHeyQZ0TSfMjc7nxbxWiw.user.46.165.242.75.POSTED!not-for-mail
From: no@no.no (Luc)
Newsgroups: comp.lang.tcl
Subject: Re: Tk text widget cursor jumps to next line when clicking on the
right (??)
Date: Tue, 4 Oct 2022 17:55:04 -0300
Organization: Aioe.org NNTP Server
Message-ID: <20221004175504.66c63144@lud1.home>
References: <e45c26d2-fd58-4ef6-96cf-436643bb886cn@googlegroups.com>
<633bcacf$0$2993$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Injection-Info: gioia.aioe.org; logging-data="48620"; posting-host="jIHeyQZ0TSfMjc7nxbxWiw.user.gioia.aioe.org"; mail-complaints-to="abuse@aioe.org";
X-Newsreader: Claws Mail 3.14.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu)
X-Notice: Filtered by postfilter v. 0.9.2
 by: Luc - Tue, 4 Oct 2022 20:55 UTC

That's not a big deal, but I think the current behavior is wrong.
There is no reason why a widget should take decisions for the user.
If I click one line, whatever it is, the insertion point must be
in that line, period. No surprises. Do you want the next line?
Click the next line then.

FWIW.

--
Luc
>>
**************************
On Tue, 4 Oct 2022 07:55:27 +0200, Francois Vogel wrote:

> Le 04/10/2022 à 01:09, xol odho a écrit :
> > After playing around with Tk's lovely text megawidget, I've been
> > annoyed by the "line jumping" behavior when you click on the empty
> > area to the right of the text.
>
> See:
>
> https://core.tcl-lang.org/tk/tktview?name=b461c70399
>
> This was a lengthy discussion and I never actually made my mind on
> changing the behavior or not, and if so, in what version of Tk (and
> what version of the text widget - legacy or revised).
>
> Opinions, final arguments and decisive remarks welcome.
>
> Regards,
> Francois
>

Re: Tk text widget cursor jumps to next line when clicking on the right (??)

<4949e4b1-3a24-4bef-bc86-9f08a42a4863n@googlegroups.com>

  copy mid

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

  copy link   Newsgroups: comp.lang.tcl
X-Received: by 2002:ac8:5985:0:b0:35b:ba8c:d522 with SMTP id e5-20020ac85985000000b0035bba8cd522mr21643269qte.213.1664926379430;
Tue, 04 Oct 2022 16:32:59 -0700 (PDT)
X-Received: by 2002:a05:620a:260e:b0:6df:a30d:dc87 with SMTP id
z14-20020a05620a260e00b006dfa30ddc87mr3425799qko.643.1664926379256; Tue, 04
Oct 2022 16:32:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.tcl
Date: Tue, 4 Oct 2022 16:32:58 -0700 (PDT)
In-Reply-To: <20221004175504.66c63144@lud1.home>
Injection-Info: google-groups.googlegroups.com; posting-host=201.231.246.253; posting-account=DnakAAoAAAA9ZZlBDSXHBE9MWv_A1hHG
NNTP-Posting-Host: 201.231.246.253
References: <e45c26d2-fd58-4ef6-96cf-436643bb886cn@googlegroups.com>
<633bcacf$0$2993$426a74cc@news.free.fr> <20221004175504.66c63144@lud1.home>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4949e4b1-3a24-4bef-bc86-9f08a42a4863n@googlegroups.com>
Subject: Re: Tk text widget cursor jumps to next line when clicking on the
right (??)
From: xolodho@gmail.com (xol odho)
Injection-Date: Tue, 04 Oct 2022 23:32:59 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 2096
 by: xol odho - Tue, 4 Oct 2022 23:32 UTC

Ok, I just read that Tk ticket page, I really had no idea this had
been reported already. I feel the current behavior is quite
unintuitive, it's one of the first quirks I noticed with the Tk text
widget (which apart from some annoyances like this one, is quite
impressive).

Can't this be fixed in the Tk 8.6 series? Do any apps/users depend on
this behavior? It seems to me like an unexpected secondary effect of
the implementation, not an intended feature and so shouldn't be
depended upon. But I'm a newcomer to Tk, so I really don't know.

There are other things in Tk that cause me more concern though, like
the "<KeyRelease>" semantics clearly broken on X11 (I reported a
ticket already), or the Tk button getting stuck after spacebar pressed
for a few seconds (I didn't file a ticket that one but I inquired
about that on this list a few weeks ago).


devel / comp.lang.tcl / Re: Tk text widget cursor jumps to next line when clicking on the right (??)

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor