Coder Social home page Coder Social logo

brewcode's People

Contributors

adamnemecek avatar cbrewster avatar rofrol avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

brewcode's Issues

Add font-kit support

Continued from #1

Right now fonts are accessed via hard-coded paths. This is not portable, we should look into using fontkit.

Improve syntax highlighting

I put in text highlighting really quickly for fun, but it is done in a very slow and hackish way. It is hardcoded to only do Rust syntax highlighting instead of trying to match the file extensions and text highlighting is recomputed for the entire buffer any time a change is made to the buffer.

I am using syntect for syntax highlighting and it allows for incrementally recomputing syntax highlighting. For example, usually the text highlighting preceding an edit stays the same so that portion can be skipped. Syntect has a way to save snapshots of the highlighter state which can be used to do this incremental re-computation.

Support proper text selection and editing

Right now text insertion does not take into account text selection. I am not entirely sure what I want the text editing API to look like yet, but here is my idea for a first cut:

There should be a API which allows for a "span" of text to be replaced with a new span of text. Something like:

fn apply_edit(&mut self, span: Span, edit: &str) -> Location;

A span is two (row, col) pairs where the first pair precedes the second pair (in terms of location in the text buffer). The span can be empty, but represents a location. This is represented by the start and end pairs having the same value. The edit is a new string which replaces the text in the span. The function would return a the location of the start of the edit so that the cursor location can be updated.

One thing I want to do with this editor is experiment with different text editing approaches. I really like vim's modal approach but I think there is some room to create a more streamlined modal editor.

Support better text metrics

Right now some text metrics are hard-coded (especially those related to hit_testing), we should instead use actual text metrics from the font itself. To do this, we probably need to store the text layout somewhere. Right now, we regenerate the text layout whenever we render, but this is expensive and we don't have access to the result text layout outside of the render method.

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.