This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: IDLE file completion has 2 bugs depending on open quote used
Type: behavior Stage: test needed
Components: IDLE Versions: Python 3.6
Status: open Resolution:
Dependencies: 30348 30666 Superseder:
Assigned To: terry.reedy Nosy List: cheryl.sabella, egerosa, terry.reedy
Priority: normal Keywords:

Created on 2016-08-03 15:11 by egerosa, last changed 2022-04-11 14:58 by admin.

File name Uploaded Description Edit
bug_pic.png egerosa, 2016-08-03 15:11 png file to show the bug in action in IDLE
Messages (6)
msg271910 - (view) Author: Edoardo Gerosa (egerosa) * Date: 2016-08-03 15:11
A cosmetic bug was noticed when executing os.chdir() in IDLE. When inputting a raw string path in os.chdir() using autocompletion the last directory in the path will remain black if the user presses enter while the autocompletion drop down list is still open. The bug seems to affect only single quoted strings. To reproduce the bug input a raw single quoted string into os.chdir(); select directories through the drop down autocomplete list using Tab; once the destination directory is reached do not make the drop down list disappear, instead after selecting the destination directory type in the closing single quote and brace and hit enter: the final directory in the path will remain black and not turn green. (image file has been added to showcase bug).
msg271924 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-08-03 19:40
When encountering a bug, it helps to determine the minimum needed to invoke the bug.  os.chdir is irrelevant and distracting noise as far as investigating these bugs.  There turns out to be two.  Raw versus cooked mode is also irrelevant, so an 'r' prefix is not needed.  The path separator also seems to not matter.  So we can use '/'.

I did several tests with 3.6 on Windows 10, first in Shell, then a quick confirmation in a fresh editor.  What does matter is the open quote: ', ", ''', or """. When one types a string without completions, the opening quote along with any prefix is colored, as is the subsequent content and closing quote as they are entered.  This should remain true when completions are involved.  It is true for opening """ or ".  For ''' and ', the first action after typing '/' is colored, subsequent actions are not. The action can be either typing a letter or moving the selection in the completion box with up or down arrow.  (Things are different when moving around in a string and forcing completions open with cntl-space.)

When one types a closing quote, the final directory should be completed if it is not already and the completion box closed.  This is true for """ and ", but ''' and ' neither complete nor close.  After a ''', additional characters are also colored.  For "'''/Ga'''me", the "me" are also, improperly, colored and the box remains.

We thus have two bugs: a color but that depends on the number of open quotes and a complete and close bug that depends of the type of open quote.  A single single quote has both.  Thank you for the report.

Colorizer has a pair of symmetrical regexes for single quote strings (possible not complete) and another pair for triple quote strings.  (Symmetrical means identical except for reversing roles of ' and ".)  So it is plausible that these might be the cause of a number-dependent bug.  It has a debug most that could be turned on doing file completion in an editor.
msg271926 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2016-08-03 20:34
Experiments with colorizer debugger on: with auto popup disabled with a 
long wait, output for each character entered is (except for time variations) the following, regardless of quotation.
  schedule colorizing
  0.002 seconds

If I type "'/" <tab> for box 'G', I see
  schedule colorizing
  colorizing ...
but no completion time.  An immediate 'a' is not colored and produces 
  stop colorizing
  schedule colorizing
  already colorizing

However, if after entering G, I shift focus off the window, but clicking another window or opening and closing About IDLE, the colorizing completes and I see a time, such as
  41.480 seconds
and following chars are colorized.  If instead, I enter 'a' quickly and then do the shift, I see something like
  colorizing stopped
  58.904 seconds
and 'a' turns to green, as it should have without the delay.

Neither of the autocomplete files import colorizer (at least not directly), but the completion box somehow affects colorizing, perhaps through affecting the tk loop.

If I start with ''' instead of ', the debug output for post-box 'ga' is the same, but 'a' and subsequent chars are colored anyway.

autocomplete imports hyperparser. but I do not immediately see any asymmetry there or in the autocomplete files to explain why '('') and "("") are treated differently.
msg316299 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-05-08 23:56
I can't seem to recreate this. I tried on Ubuntu with master and Windows with 3.6.3.  I'm not sure if it's been fixed by another change or if I'm not doing the steps correctly to recreate it.
msg316312 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-05-09 06:29
I believe the report in August 2016 was about the time of the preliminary.0a4 release, months before the final 3.6.0 release.  Something could have easily changed after.

I should have been more detailed and accurate is what I wrote.  In paragraph 2, I said I observed the color bug with ' or '''.  In paragraph 4, I said that the color bug depended on the number rather than type of quote.  The later was accurate.

My C: directory contains a Logs directory.  If in 3.5.4, I type '/, the / is green and the selction box appears.  When I type L, the L is green and the selection moves to Logs.  When I type o, the o is white (I am using IDLEDark).  Or if I backspace and type L, the L is white.  Or if I move with the cursor, the inserted word is white.

This is not true in 3.6.5.  The color bug seems fixed.  The autocompletion window, which handles interaction when the window is open, was patched in #24570 for a Mac-specific bug.

The completion bug remains in 3.6.5 and newer.  If I type '/L' or '''/L''', L is not completed to Logs and the box does not disappear. The opposite is true for " and """.  "/L" completes to "/Logs" and the box goes away.  Also, "/L/ completes to "/Logs/, leaving the box open for selection of a subdirectory.  "// does not complete to the first item in the box -- at least one action is needed.

The effect of // is analogous to .. in attribute completion.  []. brings up the box.  A second . completes the selected name and brings up a new box with subattributes.  This does not require an inbetween action.

Cheryl, is this clear enough to reproduce?  It is possible that Linux does not have the bug.  It should be in and we already know that this has system-specific behavior.

I would be reluctant do anything beyond trivial without improving the autocomplete tests.  I added #30348 and #30666 as dependencies, at least for the present. This issue is a dependency master autocompletion issue #27609.
msg316342 - (view) Author: Cheryl Sabella (cheryl.sabella) * (Python committer) Date: 2018-05-09 23:20
Thanks, Terry!

I'm able to recreate the autocomplete issue on Windows 7 using 3.6.3, but not on Ubuntu.  As you said, the color issue seems fine now for both platforms.

I'll take a look at those other issues for the test cases.
Date User Action Args
2022-04-11 14:58:34adminsetgithub: 71862
2018-05-09 23:20:59cheryl.sabellasetmessages: + msg316342
2018-05-09 06:29:06terry.reedysetdependencies: + IDLE: Add test_autocomplete unittests, IDLE: add tests for autocomplete window.
messages: + msg316312
2018-05-08 23:56:53cheryl.sabellasetnosy: + cheryl.sabella
messages: + msg316299
2016-08-03 20:34:39terry.reedysetmessages: + msg271926
2016-08-03 19:40:02terry.reedysettitle: IDLE does not fully color raw string directory paths to green when invoking os.chdir() if statement is executed with autocompletion drop down list still open -> IDLE file completion has 2 bugs depending on open quote used
stage: test needed
messages: + msg271924
versions: + Python 3.6, - Python 3.5
2016-08-03 19:34:05terry.reedylinkissue27609 dependencies
2016-08-03 15:11:43egerosacreate