tomlin7 / cupcake Goto Github PK
View Code? Open in Web Editor NEWembeddable text editor with autocompletions
Home Page: https://billyeatcookies.github.io/cupcake/
License: MIT License
embeddable text editor with autocompletions
Home Page: https://billyeatcookies.github.io/cupcake/
License: MIT License
Describe the bug
Right now straight typing through delimiters provides annoying behavior that slows down the ability to fluidly continue writing code, and duplicates the delimiters unnecessarily like seen here:
Typically when writing these, the cursor by default should move through the second quotation like the following:
There are however a couple of situations you'd want this behavior (as pointed out by @oliverbooth):
As for how autocomplete list is currently implemented, it have a lot of optimization problems. When big files are opened, autocomplete seems to be less responsive, leaving the editor not responsive. This can be more optimized by using the tree view widget with some styling
First, autocomplete will insert the word, not really complete the word that user input.
Second, when I input "{" it will complete a "]" for some reason.
Editor currently have no scrollbar, this shall be implemented
Hi
Anyone else getting an issue with autocompletion, this is what I am getting.
I have hacked together a fix and I am now getting this
However maybe it is just an issue on my machine, so just checking if others are experiencing this.
To be updated from biscuit code base
Bracket filling is an essential feature for code editors, this shall be implemented
Autocompletion is not done correctly, wrong words are completed. selection of the autocomplete list seems to be not updating correctly.
I want more language support but only C++ and Plain text is supported. I also want Python support.
Language detection shall be left to the editor too. There should be pre-built configurations for popular languages. Custom language support and API for that shall be created
I haven't been able to actually use cupcake yet but I would like to be able to ask questions about it and give feedback through discussions :).
Using a peer widget matches the tags and you can just reduce the font size :D.
Make a full fledged API for cupcake to be used with other tkinter applications, mainly Biscuit.
class LineNumbers(Canvas):
def __init__(self, master, text=None, *args, **kwargs):
super().__init__(master, *args, **kwargs)
self.config(width=65, bd=0, highlightthickness=0)
self.text = text
self.text.bind("<Configure>", self.redraw)
def get_indentation_level(self, line):
"""Get the indentation level of a given line."""
return len(line) - len(line.lstrip())
def redraw(self, *_):
self.delete(tk.ALL)
prev_indent = 0
i = self.text.index("@0,0")
while True:
dline = self.text.dlineinfo(i)
if dline is None:
break
y = dline[1]
linenum = str(i).split(".")[0]
# Get the text content of the current line
line_content = self.text.get(f"{linenum}.0", f"{linenum}.end")
current_indent = self.get_indentation_level(line_content)
# Determine if the current line has more indentation than the previous line
if current_indent > prev_indent:
line_num_with_indent = f"{linenum} +"
else:
line_num_with_indent = linenum
# to highlight the current line
curline = self.text.dlineinfo(tk.INSERT)
cur_y = curline[1] if curline else None
if not cur_y:
i = self.text.index(f"{i}+1line")
continue
self.create_text(40, y, anchor=tk.NE, text=line_num_with_indent, font=("Consolas", 14), tag=i)
# Update the previous indentation level
prev_indent = current_indent
i = self.text.index(f"{i}+1line")
Hi, its me again.
** 3 Issues in one repo! **
Anyway, I want custom language support for editor
Like
class MyLexer:
keywords = ["echo", "rmdir", "if"]
e = Editor(root, lexer=MyLexer)
e.pack()
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.