Coder Social home page Coder Social logo

felixangell / phi Goto Github PK

View Code? Open in Web Editor NEW
310.0 7.0 19.0 13.44 MB

phi: gpu accelerated code-editor; definitely not to be confused phonetically with vi.

Home Page: https://phi.felixangell.com/

License: MIT License

Go 99.88% Makefile 0.12%
text-editor go phi-editor code-editor strife gpu

phi's People

Contributors

chyroc avatar clee avatar erinok avatar felixangell avatar matsuu avatar mattn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

phi's Issues

delete line behaviour

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

language support tracking issue

some high priority languages I want to support in terms of highlighting:

  • golang - issue #xyz
  • c - issue #xyz
  • c++ - issue #xyz
  • markdown - issue #xyz
  • html - issue #xyz
  • css - issue #xyz

mac event handling is off

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.

syntax highlighting themes

introduce variables into the toml configs in the theme files which can be referenced in the syntax highlighter files?

any alternatives?

Hang on macOS

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.

handle super/shift/... combos

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

documentation for the commands

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?

solidify keyboard support on main platforms

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.

handle input/rendering latency thing

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?

line padding support

specifically i want to add support for spacing between lines, i.e. the padding above and below a line.

editor resizing

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?

loading large files

the editor cannot handle loading large files whatsoever. even though we only render whats on screen

Text input event behaviours (tracking issue)

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:

  • left - move cursor left a letter
  • right - move cursor right a letter
  • delete - delete the letter in front
  • end - move to the end of the line
  • home - move to the start of the line
  • backspace - delete the last letter

  • alt+left - move left one word
  • alt+right - move right one word
  • alt+up - swap line up
  • alt+down - swap line down
  • alt+home - go the start of the file
  • alt+end - go to the end of the file
  • alt+backspace - delete the last word

  • ctrl+l - show/hide the command palette
  • ctrl+s - save
  • ctrl+o - open command palette with the "open" command already entered
  • ctrl+w - close the current buffer

  • ctrl+left - shift focus on the buffer to the left in the view
  • ctrl+right - shift focus on the buffer to the right in the view

commands tracking issue

these are the commands that need to be implemented (with links to their relevant issues):

  • open file ctrl+o (depends on command palette)
  • close file ctrl+w
  • exit editor ctrl+q
  • copy to clipboard ctrl+c (depends on shift selection)
  • paste to current buffer ctrl+v
  • cut ctrl+x (depends on shift selection)
  • goto line ctrl+l (depends on command palette)
  • undo ctrl+z
  • redo
  • new buffer ctrl+t
  • [ ]

Any missing ones please comment!

font_face configuration option improvements

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.

  • improve the font loading system so that it loads fonts from the right place on any platform
  • better error message for failure to find a font
  • include a fail safe font for each platform

atomic file saving

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

improve syntax highlighting

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

move language highlighter definitions into a sep. folder

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.

code structure cleanups

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.

syntax highlighting system

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

add build instructions for windows

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.

editor icon is loaded from a relative path

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:

  • packed into the binary somehow
  • put into the phi-editor config folder
  • something else?

if the second option, there needs to be some install or something to move the icon to the correct folder.

operations on selections

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.

Indentation

When pressing the tab key, the editor should insert a tab. This can be in two modes:

  • a tab character, i.e. \t; or
  • n amount of spaces

By default the amount of spaces per tab is 4 spaces. Additionally, the editor mode will prefer spaces over tabs by default.

go build does not work

# 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)

do not blink cursor when moving

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.

rendering line numbers

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.

command palette

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:

  • the command palette would be triggered with ctrl+p or cmd+p by default
  • the command palette will be positioned top/center of the screen

text selection

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.

saving files!

as well as an option to atomically save files too?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.