| Ticket UUID: | 6e16952a49fc50fa662ddbdf8fe6bb712aa42b1e | |||
| Title: | revised_text insertion cursor and -padx issues | |||
| Type: | Bug | Version: | revised_text | |
| Submitter: | kjnash | Created on: | 2018-01-24 13:14:58 | |
| Subsystem: | 18. [text] | Assigned To: | gcramer | |
| Priority: | 5 Medium | Severity: | Important | |
| Status: | Closed | Last Modified: | 2018-11-04 18:57:39 | |
| Resolution: | Fixed | Closed By: | fvogel | |
| Closed on: | 2018-11-04 18:57:39 | |||
| Description: |
Bugs in revised_text (seen at revision [74f86687]). (1) When -padx is > 0, the color set by the tag option -lmargincolor may appear in the rightmost pixel column of the left margin, even though the tag has -lmargin1 and -lmargin2 equal to 0. (2) When -padx is 0, the insertion cursor vanishes. Demo script is attached. | |||
| User Comments: |
fvogel added on 2018-11-04 18:57:39:
OK, sorry. I must have tested the wrong binary previously. I agree it works. Closing, thanks. gcramer added on 2018-11-04 17:47:29: > Just use the script provided in attachment... Works well under my Ubuntu 14.04, the cursor is 100 pixels wide. fvogel added on 2018-11-04 14:11:59: This still does not seem to work. Just use the script provided in attachment to the present ticket, and add ".t2 configure -insertwidth 100" (this is a huge value, but it illustrates well). Then look at the insert cursor in the bottom text widget: it's still very low width. Select text with the mouse or with the keyboard: selection is not at the same place as the insert cursor. gcramer added on 2018-11-04 13:46:27: You're right, -insertwidth should be honored. I did a change, please try [8317b198eb]. fvogel added on 2018-11-03 10:15:25: Thanks for this new fix, indeed the cursor now displays at the left of the display line as expected. I have seen another cursor oddity: -insertwidth does not seem to be honored correctly. It is not ignored, but the cursor does not have the required width when displayed. Perhaps that was the case before I didn't check. gcramer added on 2018-11-02 18:45:19: > About issue (2) and cursor disappearance when it's at the left of the very first character of the display line: wouldn't it be preferable, in this specific position, that the cursor be still displayed at the cost of overlapping the first character of the line? I think it's much better than not seeing the cursor at all. I agree, realized with [b5d2bf70cd]. fvogel added on 2018-10-30 21:34:45: Thanks for the fixes. Issue (2) was in fact fixed by [08ec7aed], and issue (1) by [6523c540]. About issue (2) and cursor disappearance when it's at the left of the very first character of the display line: wouldn't it be preferable, in this specific position, that the cursor be still displayed at the cost of overlapping the first character of the line? I think it's much better than not seeing the cursor at all. To that purpose I suggest the following additional patch:
Index: generic/tkTextDisp.c
==================================================================
--- generic/tkTextDisp.c
+++ generic/tkTextDisp.c
@@ -6281,12 +6281,12 @@
* TODO: is it possible to set the extents to zero when state=READONLY.
* We have to test whether the cursor artefacts (in padding area) are
* already eliminated, otherwise we cannot do this optimization.
*/
- *extent1 = MIN(textPtr->padX, textPtr->insertWidth/2);
- *extent2 = MIN(textPtr->padX, (textPtr->insertWidth + 1)/2);
+ *extent1 = MAX(1,MIN(textPtr->padX, textPtr->insertWidth/2));
+ *extent2 = MAX(1,MIN(textPtr->padX, (textPtr->insertWidth + 1)/2));
}
static void
DisplayDLine(
(+ tweak the associated comment above these lines in the code) gcramer added on 2018-10-30 13:53:56: Issue (1) has been fixed with [6e16952a49], now it has same behavior as legacy widget. gcramer added on 2018-10-30 12:52:15: Issue (2) is fixed with [6e16952a49], now cursor will be visible even if -padx is zero. But note that the very left cursor (left from first character in line) is not visible, this means that -padx > 0 is required if vertical line is used for cursor. But a block cursor can be used with -padx = 0. fvogel added on 2018-10-07 19:26:53: Assigning to gcramer on his request. fvogel added on 2018-10-01 12:23:39: Further relevant code is in tkTextMark.c. fvogel added on 2018-10-01 11:28:27: Issue 2 (the insert cursor disappearing when -padx is 0) appears to be due to these lines, where in addition the TODO comment overlooked the case of -padx 0 kjnash added on 2018-01-26 05:08:41: Yes, it's only a bug for revised_text. fvogel added on 2018-01-25 19:13:54: Confirmed, I see the bug at least on Windows. Not in the legacy version though, only in the revised_text branch. | |||
Attachments:
- Snapshot.png [download] added by fvogel on 2018-01-25 19:13:13. [details]
- revised_text_bug_6e16952a49.tcl [download] added by kjnash on 2018-01-24 13:18:37. [details]
