| Ticket UUID: | 18371b7ce70543cfbea4e132db7ac3ec3a1a4662 | |||
| Title: | Double-Button-1 selects more than a word (with elided text) | |||
| Type: | Bug | Version: | revised_text | |
| Submitter: | fvogel | Created on: | 2022-02-27 23:01:47 | |
| Subsystem: | 18. [text] | Assigned To: | fvogel | |
| Priority: | 5 Medium | Severity: | Minor | |
| Status: | Closed | Last Modified: | 2022-03-08 20:20:42 | |
| Resolution: | Fixed | Closed By: | fvogel | |
| Closed on: | 2022-03-08 20:20:42 | |||
| Description: |
With the revised text widget (but not with the legacy version), when double clicking on a word to select it, there are situations where more than this word gets selected. Such situations involve elided text. Example:
package require Tk
pack [text .t]
for {set n 1} {$n <= 10} {incr n} {
.t insert end "Line $n\n"
}
.t tag configure Elided -elide 1
.t tag add Elided 6.0 9.0
.t insert 6.0 "Hello world! "
# now double click on the word 'world'
With this script, the text gets selected from the beginning of the word 'world' up to the end of the line. What is expected is that only 'world!' gets selected. | |||
| User Comments: |
fvogel added on 2022-03-08 20:20:42:
Merged into revised_text. I have also backported the new test textDisp-32.4 to the test suite for the legacy text widget (in order to avoid unneeded differences between the two test suites). fvogel added on 2022-03-05 13:21:46: Fix: [5d4ac8f4f8] fvogel added on 2022-03-05 12:39:21: I have understood what's happening. The problem is in proc ::tk::TextButton1. This logic:
set pos [TextCursorPos $w $x $y]
set thisLineNo [$w lineno @last,$y]
if {[$w lineno $pos] ne $thisLineNo} {
# The button has been pressed at an x position after last character.
# In this case [$w index @$x,$y] is returning the start of next line,
# but we want the end of this line.
set pos "$thisLineNo.end"
}
does not take elided lines into account.
| |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki