-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodedit.html
175 lines (168 loc) · 7.67 KB
/
codedit.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> codedit - code editor engine in Lua </title>
<script src="jquery.js"></script>
<script src="jquery-cookie.js"></script>
<script src="jquery-tablesorter.js"></script>
<script src="strftime.js"></script>
<script src="mustache.js"></script>
<script src="config.js"></script>
<script src="main.js"></script>
<link rel="stylesheet" type="text/css" href="templates/reset.css" />
<link rel="stylesheet" type="text/css" href="templates/hack.css" />
<link rel="stylesheet" type="text/css" id="lights_css" />
<script>
var DOCNAME = 'codedit'
var PROJECT = 'codedit'
//set the lights before rendering starts
set_lights()
</script>
</head>
<body>
<header>
<div class="container">
<div class="btn-container btn-lights-container">
<a href="#" class="btn btn-lights" id="lights">lights</a>
</div>
<div class="btn-container btn-home-container">
<a href="/" class="btn btn-home">luapower</a>
</div>
<table id="header_table">
<tr>
<td style="vertical-align: middle;" width="100%">
<h1> codedit </h1>
<h2> code editor engine in Lua </h2>
</td>
<td style="vertical-align: middle;" align="right" style="height: 150px">
<table><tr><td>
<div class="doc" id="package_info_container">
<div id="package_info"> </div>
<div id="commit_log"> </div>
</div>
<a href="https://github.com/luapower/codedit" class="btn btn-rightside btn-github"><span class="icon"></span>View on GitHub</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/codedit/tarball/master" class="btn btn-rightside">Download as .tar.gz</a>
</td></tr><tr><td>
<a href="https://github.com/luapower/codedit/zipball/master" class="btn btn-rightside">Download as .zip</a>
</td></tr></table>
</td>
</tr>
</table>
<div class="btn-container btn-discuss-container">
<a href="https://github.com/luapower/codedit/issues/new" target="_blank"
class="btn btn-rightside btn-discuss"><span class="icon"></span>Discuss</a>
</div>
</div>
</header>
<div class="bg-container">
<div class="bg-center-container">
<div class="bg bg-codedit" style="background-image: url('bg/codedit.png');"></div>
</div>
</div>
<div class="under-header">
<div class="container">
<div id="toc_container" class="toc_container doc"></div>
<button id=tab1_button class="tab_button hidden">Documentation</button>
<button id=tab2_button class="tab_button hidden">Package Info</button>
<div id="tabs_cointainer">
<div id="tab1_container">
<section class="doc">
<span id="module_info"></span>
<h2 id="this-is-work-in-progress-nothing-to-see-here-yet">THIS IS WORK IN PROGRESS / NOTHING TO SEE HERE (YET)</h2>
<h2 id="local-codedit-requirecodedit"><code>local codedit = require'codedit'</code></h2>
<p>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.</p>
<p>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:</p>
<ul>
<li>display a character at certain coordinates</li>
<li>display a filled rectangle at certain coordinates</li>
<li>rectangle clipping</li>
<li>process keyboard and mouse events</li>
</ul>
<p>then you can hook up codedit and add code editing capabilities to your app.</p>
<p>Codedit comes with a minimalist code editor based on <a href="cplayer.html">cplayer</a>.</p>
<h2 id="highlights">Highlights</h2>
<ul>
<li>utf8-ready, using a small <a href="https://github.com/luapower/codedit/blob/master/codedit_str.lua">string module</a> over <a href="utf8.html">utf8</a>.</li>
<li>cross-platform: written in Lua and with no dependencies</li>
<li><a href="https://github.com/luapower/cplayer/blob/master/cplayer/code_editor.lua">simple interface</a> for integrating with rendering and input APIs</li>
<li>highly modular, with separate buffer, cursor, selection, view and controller objects, allowing multiple cursors and multiple selections.</li>
</ul>
<h2 id="features">Features</h2>
<ul>
<li><a href="codedit_buffer.html">Buffers</a>
<ul>
<li><em>File format autodetection</em> (<a href="https://github.com/luapower/codedit/blob/master/codedit_detect.lua">code</a>)
<ul>
<li>loading files with mixed line endings</li>
<li>detecting the most common line ending used in the file and using that when saving the file</li>
</ul></li>
<li><em>Normalization</em> (<a href="https://github.com/luapower/codedit/blob/master/codedit_normal.lua">code</a>)
<ul>
<li>removing spaces past end-of-line before saving</li>
<li>removing empty lines at end-of-file before saving, or ensuring that the file ends with at least one empty line before saving</li>
</ul></li>
<li>undo/redo stack (<a href="https://github.com/luapower/codedit/blob/master/codedit_undo.lua">code</a>)</li>
</ul></li>
<li><em>Selections</em> (<a href="https://github.com/luapower/codedit/blob/master/codedit_selction.lua">code</a>)
<ul>
<li>block (column) selection mode (<a href="https://github.com/luapower/codedit/blob/master/codedit_blocksel.lua">code</a>)</li>
<li>indent/outdent (also for block selections)</li>
</ul></li>
<li><em>Cursors</em> (<a href="https://github.com/luapower/codedit/blob/master/codedit_cursor.lua">code</a>)
<ul>
<li>insert and overwrite insert modes, with wide overwrite caret</li>
<li>smart tabs: use tabs only when indenting, and use spaces inside the lines</li>
<li>option to allow or restrict the cursor past end-of-line</li>
<li>option to allow or restrict the cursor past end-of-file</li>
<li>auto-indent: copy the indent of the line above when pressing enter</li>
<li>moving through words</li>
</ul></li>
<li><em>Rendering</em> (<a href="https://github.com/luapower/codedit/blob/master/codedit_render.lua">code</a>)
<ul>
<li>syntax highlighting using <a href="http://foicica.com/scintillua/">scintillua</a> lexers</li>
<li>simple rendering and measuring API for monospace fonts (<a href="https://github.com/luapower/codedit/blob/master/codedit_metrics.lua">code</a>)</li>
<li>user-defined margins (<a href="https://github.com/luapower/codedit/blob/master/codedit_margin.lua">code</a>)
<ul>
<li>line numbers margin (<a href="https://github.com/luapower/codedit/blob/master/codedit_line_numbers.lua">code</a>)</li>
</ul></li>
</ul></li>
<li><em>Controller</em> (<a href="https://github.com/luapower/codedit/blob/master/codedit_editor.lua">code</a>)
<ul>
<li>configurable key bindings and commands (<a href="https://github.com/luapower/codedit/blob/master/codedit_keys.lua">code</a>)</li>
<li>simple clipboard API (stubbed to an in-process clipboard)</li>
<li>scrolling, one line/char at a time or smooth scrolling (<a href="https://github.com/luapower/codedit/blob/master/codedit_scroll.lua">code</a>)</li>
<li>selecting with the mouse</li>
</ul></li>
</ul>
<h2 id="limitations">Limitations</h2>
<ul>
<li>fixed char width (monospace fonts only)</li>
<li>fixed line height</li>
<li>no incremental repaint</li>
<li>mixed line terminators are not preserved</li>
</ul>
<h2 id="usage">Usage</h2>
</section>
</div>
<div id="tab2_container" class="doc"></div>
</div>
</div>
<div class="container">
<footer>
<div id="disqus_thread"></div>
<div class="faint">cosmin.apreutesei@gmail.com | <a href="http://unlicense.org/">public domain</a></div>
</footer>
</div>
</div>
<script type="text/x-mustache" id=info_tab_template>
<h3>Modules</h3>
<ul>
{{#module_array}}
<li>{{name}}</li>
{{/module_array}}
</ul>
</script>
</body>
</html>