felixangell / phi Goto Github PK
View Code? Open in Web Editor NEWphi: gpu accelerated code-editor; definitely not to be confused phonetically with vi.
Home Page: https://phi.felixangell.com/
License: MIT License
phi: gpu accelerated code-editor; definitely not to be confused phonetically with vi.
Home Page: https://phi.felixangell.com/
License: MIT License
this is a bit off. i havent looked into it so i dont know it should but i know it isn't "right". also there is a bug where if we delete a line that is longer and we go to the previous line the cursor isn't moved properly so an OOB can be triggered if we try and enter input outside of the current line
syntax is still specified using the "colouring" word, change this to background/foreground. make background take affect as only foreground is being used currently
some high priority languages I want to support in terms of highlighting:
need to add some backup/default configurations so that even if the config file fails to parse the editor will still load
im not sure what this is to do with, but on my macbook it can hang when you close the editor sometimes. i feel like this is to do with event handling but i can't pin point what exactly.
will have to investigate this further some point.
introduce variables into the toml configs in the theme files which can be referenced in the syntax highlighter files?
any alternatives?
This is really weird. After a few seconds macOS seems to think it's not responding and will just hang. Can't reproduce this on Linux whatsoever. Probably my shitty event handling code.
this isnt handled yet in the whacky input code... needs to be handled because for now we are inserting the keycode? for the shift as well as the combination-y keycode
the commands/configuration files should be documented so that people can know what they can configure. ideally this should be easily automated.
one idea: writing a parser for the toml configuration files so that we can spit out documentation from the comments?
right now the font size defaults to 14.
the font face is loaded from the res folder rather than from the OS system fonts folder.
Right now I'm hopping between mac and linux. The cross platform support for key input is mostly quick patches to get things to work.
In reality, I would prefer if the keyboard configurations were clearly configured per platform and "loaded" properly, rather than some hacky hashmap lookups on certain key combos.
this is likely due to how the lines are rendered. iirc the lines are rendered one character at a time which means we have to do a lot of work everytime we modify the buffer?
specifically i want to add support for spacing between lines, i.e. the padding above and below a line.
this needs to re-draw the editor. this might be a bit tricky considering we need to probably re-load the fonts in a different size too to avoid weird stretching?
the editor cannot handle loading large files whatsoever. even though we only render whats on screen
the ctrl+p shortcut is triggered from a buffer so if we have no buffers then the trigger wont be acted upon and the command palette wont show.
the command palette should be triggered from the main view instead.
Note that the behaviours aren't as simple; the bullet points provide simple summaries of the behaviour. There are a lot of edge cases, e.g. backspace has to join the lines to the last one if we backspace from the start of the line, etc.
This is not an exhaustive list.
These are the default key bindings for the behaviours, though the system should allow for an easy rebinding with the configuration file:
sdl and that is a bit of a pain!
these are the commands that need to be implemented (with links to their relevant issues):
ctrl+o
(depends on command palette)ctrl+w
ctrl+q
ctrl+c
(depends on shift selection)ctrl+v
ctrl+x
(depends on shift selection)ctrl+l
(depends on command palette)ctrl+z
ctrl+t
Any missing ones please comment!
the current implementation is a bit lackluster.
the editor will look for the fonts library dependent on the system and load the file from fontFolder + fontNameFromConfigFile + ".ttf"
. For now we will only support TTF.
i.e. when saving a file create a new file and save to that, then over-write the original file. this should be configured with a command "atomic_file_save": true
right now the way this is done is very naively implemented and is still rough around the edges. solidify this so it works properly and is more polished, then look into optimizing
when you swap a buffer if always_render is not enabled, the cursor wont render unless you modify the buffer.
for maintainability, move language definitions per file, for example:
/phi-editor/config.toml
/phi-editor/syntax/
/phi-editor/syntax/c-language.toml
/phi-editor/syntax/go-language.toml
/phi-editor/syntax/md-language.toml
The editor should load all toml files from this directory and process them at the start of the editor. In addition, regular expressions should be compiled and checked for validity on startup.
the code could probably be cut into modules a bit more cleanly. in addition to this a lot of the stuff that is in the buffer can be moved to the cursor module.
a simple syntax highlighting system proposal. languages are configured as such:
[file_associations]
c_language = [".c", ".h", ".cc"]
[syntax.c_language]
[syntax.c_language.type]
colouring = 0xff0000
match = [
"int", "char", "bool", "float", "double", "void",
"uint8_t", "uint16_t", "uint32_t", "uint64_t",
"int8_t", "int16_t", "int32_t", "int64_t",
]
[syntax.c_language.keyword]
colouring = 0xff00ff
match = [
"for", "break", "if", "else", "continue", "return",
"goto", "static", "extern", "const", "typedef",
]
the gist is. we register the file association i.e. c_language is associated with the given file extensions.
then we define the syntax highlighting for the language as syntax.language_name
. a syntax specifies types of values as well as their colouring, and what they can match.
obviously this is not very flexible but for basic syntax highlighting its quite good and easy to customize. in the future perhaps you can specify regex or something to match identifiers in different ways e.g. what regex pattern is a number f([0-9]+)
would match f323
or something like that
it will only render if we modify the buffer and it triggers a render, or if always_render
is set (for obvious reasons)
this is done with option+(left/right)
add some instructions to the readme for building on windows. preferably i want the build process to be as simple as possible for all platforms.
this means that if we run the editor from outside of the phi-editor directory it will probably fail. the icon needs to either be:
if the second option, there needs to be some install or something to move the icon to the correct folder.
there is currently some selection stuff. the rendering only works for "positive" selections at the moment. operations like delete, backspace, enter, ctrl+x, ctrl+c, etc. need to operate on selections.
When pressing the tab key, the editor should insert a tab. This can be in two modes:
\t
; orBy default the amount of spaces per tab is 4 spaces. Additionally, the editor mode will prefer spaces over tabs by default.
# github.com/felixangell/phi-editor/gui
gui/buffer.go:669:8: undefined: strife.MouseWheelEvent
gui/buffer.go:670:11: event.Y undefined (type strife.StrifeEvent has no field or method Y)
gui/buffer.go:673:11: event.Y undefined (type strife.StrifeEvent has no field or method Y)
the cursor blinking has been reimplemented, however it needs to not blink when we are moving the cursor around or entering text otherwise it's a bit distracting. for now it has been disabled due to this.
in my CN macbook
should also be configurable with a config option. one thing to watch out for is getting the width of the line bar thingy set correctly.
a command palette type thing is a feature I want to support. the feature can be seen in the prototype implementation found here
this would be wrapped over the gui.Buffer
. I still need to solidify some of the gui however i.e. layout and so on before I want to tackle this.
general notes:
right now i've only mapped the keys for my macbook with a uk layout... i.e. 2 is @, etc.
text should be select-able with shift arrow combo. this should create a marker on the text which creates a selection. actions can be performed on the selections.
as well as an option to atomically save files too?
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.