Tk Source Code

View Ticket
Login
Ticket UUID: 5f61f1a6d0993a933c3ef83f6c0363e2cfd679e4
Title: line wrap with space at the end should not display the space at the beginning of the next line
Type: Bug Version: revised_text
Submitter: bll Created on: 2017-07-03 18:05:48
Subsystem: 18. [text] Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2017-07-03 18:56:00
Resolution: Invalid Closed By: bll
    Closed on: 2017-07-03 18:56:00
Description:
Regression from the original text widget.

text configure -wrap char (probably -wrap word also)

tests: textDisp-24.8, textDisp-24.9, et.al.

revised_text:
  When there is not enough room, a wrapped line with a space at the end always
  displays the space on the next line.
  "a b c" (wrap)
  " d e f"

8.6.6:
  When there is not enough room, a wrapped line with a space at the end does
  not display the space.
  "a b c " (wrap, the space is hidden)
  "d e f"

An improvement could be made:

When there are zero pixels available, both versions move the space to the next
line.  In this case, the space does not need to be displayed.
Have:
  "a b c"  (zero pixels available for next character)
  " d e f" (current display)
Want:
  "a b c " (space is hidden)
  "d e f"
User Comments: bll added on 2017-07-03 18:56:00:
I will duplicate and adjust the tests to use the 'spacemode' option.
I knew there was a ticket you worked on for this, could not find it.

Hmmm....if the 'text' widget is set readonly (e.g. for displaying text), I would want spacemode to automatically turn on.

fvogel added on 2017-07-03 18:38:08:
This is intentional, the author of the revised implementation disagreed with what I did in the legacy code:

http://scidb.sourceforge.net/tk/trim-spaces.html

Personally I have no strong opinion on which approach is The Right Thing.