WORK IN PROGRESS / NOTHING TO SEE HERE (YET)
local codedit = require'codedit'
Codedit is a source code editor engine written in Lua. Codedit exposes the logic of source code editing with all its intricacies in a set of highly compartimentalized APIs, making it easy to explore, understand and extend.
Being made in pure Lua, it runs on all the platforms that Lua runs on. If, inside your Lua environment, you have the means to:
- display a character at certain coordinates
- display a filled rectangle at certain coordinates
- rectangle clipping
- process keyboard and mouse events
then you can hook up codedit and add code editing capabilities to your app.
Codedit comes with a minimalist code editor based on cplayer.
- utf8-ready, using a small string module over utf8.
- cross-platform: written in Lua and with no dependencies
- simple interface for integrating with rendering and input APIs
- highly modular, with separate buffer, cursor, selection, view and controller objects, allowing multiple cursors and multiple selections.
- File format autodetection (code)
- loading files with mixed line endings
- detecting the most common line ending used in the file and using that when saving the file
- Normalization (code)
- removing spaces past end-of-line before saving
- removing empty lines at end-of-file before saving, or ensuring that the file ends with at least one empty line before saving
- undo/redo stack (code)
- Selections (code)
- block (column) selection mode (code)
- indent/outdent (also for block selections)
- Cursors (code)
- insert and overwrite insert modes, with wide overwrite caret
- smart tabs: use tabs only when indenting, and use spaces inside the lines
- option to allow or restrict the cursor past end-of-line
- option to allow or restrict the cursor past end-of-file
- auto-indent: copy the indent of the line above when pressing enter
- moving through words
- Rendering (code)
- syntax highlighting using scintillua lexers
- simple rendering and measuring API for monospace fonts (code)
- user-defined margins (code)
- line numbers margin (code)
- Controller (code)
- configurable key bindings and commands (code)
- simple clipboard API (stubbed to an in-process clipboard)
- scrolling, one line/char at a time or smooth scrolling (code)
- selecting with the mouse
- fixed char width (monospace fonts only)
- fixed line height
- no incremental repaint
- mixed line terminators are not preserved
18 months ago
Edit on GitHub