-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix _cmd_proxy()
#23
Fix _cmd_proxy()
#23
Conversation
Tomorrow |
I figured out what's wrong. It's inserting the text first and then I'm trying to figure out where in the heck the inserted text is. |
I think I got it working. We should do some extensive tests to find any possible issue that could occur from this as its a pretty big change. If it works properly then this fixes #21. |
@Moosems Please find those "most outlandish issues". I haven't tested this with |
Delete breaks (started working on a fix) but I haven't yet dove into replace a bunch. |
@rdbende I don't know what in the world was changed but inserting is now broken. The insert part was actually pretty good so I would've stuck with that. Code that breaks it: from chlorophyll import CodeView
from tkinter import Tk
root = Tk()
cd = CodeView(root)
cd.pack()
cd.insert("end", "\"\"\"This is a test\n")
root.mainloop() from chlorophyll import CodeView
from tkinter import Tk
root = Tk()
cd = CodeView(root)
cd.pack()
cd.replace("1.0", "end", "print('Hello, World!')")
root.mainloop() |
@Moosems I simplified the code, because there was some unnecessary hacking-around with indexes, and the delete was completely broken. Now it mostly works. Feel free to add more changes, I won't be able to work on this today. |
Test (works): from chlorophyll import CodeView
from tkinter import Tk
root = Tk()
cd = CodeView(root)
cd.pack()
cd.insert("end", "\"\"\"\nThis is a test\n\n\n\n\"\"\"")
cd.insert("end", "\n\nprint()")
root.mainloop() |
Typing doesn't highlight until you go to a new line (press return) |
Traceback (most recent call last):
File "/Users/Moosems/Desktop/chlorophyll/test.py", line 283, in <module>
root.mainloop()
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/tkinter/__init__.py", line 1485, in mainloop
self.tk.mainloop(n)
File "/Users/Moosems/Desktop/chlorophyll/chlorophyll/codeview.py", line 109, in _cmd_proxy
str(self.tk.call(self._orig, "index", args[0])).split(".")[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_tkinter.TclError: text doesn't contain any characters tagged with "sel" |
Looks good to me. |
@rdbende This isn't quite working. Could you work on this while I eat dinner?