classification
Title: IDLE: remove \b from colorizer string prefix
Type: behavior Stage: resolved
Components: IDLE Versions: Python 3.8, Python 3.7, Python 3.6
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: miss-islington, serhiy.storchaka, taleinat, terry.reedy, tim.peters
Priority: normal Keywords: patch

Created on 2018-04-02 03:37 by terry.reedy, last changed 2018-07-30 09:09 by terry.reedy. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 6344 merged terry.reedy, 2018-04-02 04:34
PR 6345 merged miss-islington, 2018-04-02 05:48
PR 6346 merged miss-islington, 2018-04-02 05:48
PR 6347 merged terry.reedy, 2018-04-02 14:58
PR 6348 merged miss-islington, 2018-04-02 15:19
PR 6349 merged miss-islington, 2018-04-02 15:20
Messages (13)
msg314793 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-04-02 03:37
Lib\idlelib\colorizer.py, line 25, is:
  stringprefix = r"(?i:\br|u|f|fr|rf|b|br|rb)?"

The r prefix, but only the r prefix, must be preceded by a non-word character.

On pydev thread "IDLE colorizer", MRAB noted: "The \b will apply only to the first choice. Shouldn't it be more like:
  stringprefix = r"(?:\b(?i:r|u|f|fr|rf|b|br|rb))?"

I think the \b should be removed instead.  Currently uf'a' gets f'a' colored, while ur'a' only gets  'a' colored.  (Tim Peters pointed out the difference with a different example.) I prefer coloring the maximal legal string rather than the minimum.    I think the contrast between two chars legal by themselves, but differently colored when put together, makes the bug more obvious.
msg314794 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-04-02 03:45
The current test is part of the htest.  The section
# All valid prefixes for unicode and byte strings should be colored
contains "ur'is invalid'".  This should be moved to a new section with other invalid combinations.

# Invalid combinations of legal characters should be half colored.
ur'x', ru'x', uf'x', fu'x', UR'x'
(only one CAPS example is needed now).
msg314796 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2018-04-02 04:21
Sounds good (removing \b) to me, Terry!
msg314797 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-04-02 04:37
To see the visually verified test, run Lib/idlelib/colorizer as the main module, either from a command line or editor, and click the button.
msg314802 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-04-02 05:47
New changeset da58533ac67b01ce8f6466e6f03ff6b8b3bb04d5 by Terry Jan Reedy in branch 'master':
bpo-33204: IDLE: consistently color invalid string prefixes (#6344)
https://github.com/python/cpython/commit/da58533ac67b01ce8f6466e6f03ff6b8b3bb04d5
msg314803 - (view) Author: miss-islington (miss-islington) Date: 2018-04-02 06:09
New changeset 6130675efeb3c23cebc43ab07c49eb62cd03cacf by Miss Islington (bot) in branch '3.7':
bpo-33204: IDLE: consistently color invalid string prefixes (GH-6344)
https://github.com/python/cpython/commit/6130675efeb3c23cebc43ab07c49eb62cd03cacf
msg314804 - (view) Author: miss-islington (miss-islington) Date: 2018-04-02 06:33
New changeset 16cf84b4fbe78f9d876e0335f33459f1b92b7bf0 by Miss Islington (bot) in branch '3.6':
bpo-33204: IDLE: consistently color invalid string prefixes (GH-6344)
https://github.com/python/cpython/commit/16cf84b4fbe78f9d876e0335f33459f1b92b7bf0
msg314805 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-04-02 07:55
Is ''or'' correctly colorized?
msg314810 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-04-02 14:56
Yes, still correct, as a keyword.  Legal "x or''" is colored as "x" <normal> "or" <keyword> "''" <string>.  Legal "if'':" is colored as "if" <keyword> "''" <string> ":" <normal>".  New PR revises colorizer test and add the above.
msg314811 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-04-02 15:18
New changeset 55966f3a0d5f1bf823bd22ce1abbde267b06552f by Terry Jan Reedy in branch 'master':
bpo-33204: IDLE - revise and extend colorizer test. (GH-6347)
https://github.com/python/cpython/commit/55966f3a0d5f1bf823bd22ce1abbde267b06552f
msg314812 - (view) Author: miss-islington (miss-islington) Date: 2018-04-02 16:03
New changeset fa91aff07c16ad48a63580c2909934be92a5e9c8 by Miss Islington (bot) in branch '3.7':
bpo-33204: IDLE - revise and extend colorizer test. (GH-6347)
https://github.com/python/cpython/commit/fa91aff07c16ad48a63580c2909934be92a5e9c8
msg314813 - (view) Author: miss-islington (miss-islington) Date: 2018-04-02 16:12
New changeset 306559e6ca15b86eb230609f484f48132b7ca383 by Miss Islington (bot) in branch '3.6':
bpo-33204: IDLE - revise and extend colorizer test. (GH-6347)
https://github.com/python/cpython/commit/306559e6ca15b86eb230609f484f48132b7ca383
msg322659 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-07-30 08:40
Should this be closed as resolved?
History
Date User Action Args
2018-07-30 09:09:52terry.reedysetstatus: open -> closed
2018-07-30 09:08:03terry.reedysetresolution: fixed
stage: patch review -> resolved
2018-07-30 08:40:25taleinatsetnosy: + taleinat
messages: + msg322659
2018-04-02 16:12:59miss-islingtonsetmessages: + msg314813
2018-04-02 16:03:55miss-islingtonsetmessages: + msg314812
2018-04-02 15:20:16miss-islingtonsetpull_requests: + pull_request6059
2018-04-02 15:19:30miss-islingtonsetpull_requests: + pull_request6058
2018-04-02 15:18:06terry.reedysetmessages: + msg314811
2018-04-02 14:58:25terry.reedysetpull_requests: + pull_request6057
2018-04-02 14:56:55terry.reedysetmessages: + msg314810
2018-04-02 07:55:49serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg314805
2018-04-02 06:33:28miss-islingtonsetmessages: + msg314804
2018-04-02 06:09:20miss-islingtonsetnosy: + miss-islington
messages: + msg314803
2018-04-02 05:48:53miss-islingtonsetpull_requests: + pull_request6056
2018-04-02 05:48:09miss-islingtonsetpull_requests: + pull_request6055
2018-04-02 05:47:48terry.reedysetmessages: + msg314802
2018-04-02 04:37:11terry.reedysetstage: test needed -> patch review
2018-04-02 04:37:01terry.reedysetmessages: + msg314797
stage: patch review -> test needed
2018-04-02 04:34:21terry.reedysetkeywords: + patch
stage: test needed -> patch review
pull_requests: + pull_request6054
2018-04-02 04:21:22tim.peterssetnosy: + tim.peters
messages: + msg314796
2018-04-02 03:45:33terry.reedysetmessages: + msg314794
2018-04-02 03:37:29terry.reedycreate