Skip to content

Inserting can cause weird highlighting

If you insert instead of copy paste a large snippet of code it is likely to highlight weirdly. Reproducible code:

from tkinter import Tk
from chlorophyll import CodeView

root = Tk()
text = CodeView(root, wrap="none")
text.pack()

text.insert("1.0", """
from tkinter import Tk
from chlorophyll import CodeView

root = Tk()
text = CodeView(root, wrap="none")
text.pack()

text.insert("1.0", "Hello world")

root.mainloop()
""")

root.mainloop()