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.

classification
Title: in IDLE, assume new text files are python source by default
Type: Stage:
Components: IDLE Versions:
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: kbk Nosy List: jshute, kbk, mdehoon, tim.peters
Priority: normal Keywords: patch

Created on 2005-05-06 21:25 by jshute, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ispythonsource.patch jshute, 2005-05-06 21:26 patch
fixrmcolor.patch jshute, 2005-06-11 03:57 additional patch for bug turning off coloring
Messages (5)
msg48299 - (view) Author: Jeff Shute (jshute) Date: 2005-05-06 21:25
This changes IDLE so that when you use File->New
Window, it assumes that the file will be python source
by default, so syntax highlighting will be enabled. 
Currently, when you make a new window, it assumes that
it is not python source by default, so you do not get
syntax highlighting until you save the file with
extension .py.

I believe this was the original intent of the code,
based on the test for a missing filename, but it got
broken at some point when the code was modified to
accept a path instead of a missing filename.
msg48300 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-05-06 22:21
Logged In: YES 
user_id=31435

I haven't looked at the patch, but +1 on the idea.
msg48301 - (view) Author: Michiel de Hoon (mdehoon) * Date: 2005-06-10 16:02
Logged In: YES 
user_id=488897

I've tested this patch on Windows.
Without the patch, as soon as the file is saved as
something.py, syntax highlighting is turned on. Before
saving, no syntax highlighting is used.
With the patch, the file is assumed to contain Python code,
and syntax highlighting is turned on immediately.
Unfortunately, if the user is creating a generic text file
(so not containing Python code), syntax highlighting is
turned on even if  the user saves the file as something.txt.
For a correct patch, syntax highlighting should be turned
off again if the user decides to save the file as a *.txt.
msg48302 - (view) Author: Jeff Shute (jshute) Date: 2005-06-11 03:57
Logged In: YES 
user_id=39615

I noticed that behaviour before, but didn't fix it because I
considered it at the time to be an unrelated bug. (The same
thing happens when you have a file saved as .py, and then
save it as .txt - the coloring is turned off for new text,
but the old text is not uncolored.)  It is also trivial to
fix this problem.  Here is another patch that does so.
msg48303 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2005-06-12 04:38
Logged In: YES 
user_id=149084

ColorDelegator 1.15
EditorWindow.py 1.68
Closes Python Bugs 775012 and 800432,
partial fix IDLEfork 763524.

Thanks for the patches!
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41954
2005-05-06 21:25:58jshutecreate