-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodedit_cursor.html
225 lines (218 loc) · 9.9 KB
/
codedit_cursor.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title> codedit_cursor - text navigation </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_cursor'
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_cursor </h1>
<h2> text navigation </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="local-cursor-requirecodedit_cursor"><code>local cursor = require'codedit_cursor'</code></h2>
<p>Cursor object, providing caret-based navigation and editing.</p>
<h2 id="properties">Properties</h2>
<pre class="sourceCode lua"><code class="sourceCode lua"><span class="co">--navigation options</span>
<span class="kw">restrict_eol</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--don't allow caret past end-of-line</span>
<span class="kw">restrict_eof</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--don't allow caret past end-of-file</span>
<span class="kw">land_bof</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--go at bof if cursor goes up past it</span>
<span class="kw">land_eof</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--go at eof if cursor goes down past it</span>
<span class="kw">word_chars</span> <span class="ot">=</span> <span class="st">'^[a-zA-Z]'</span> <span class="co">--for jumping between words</span>
<span class="kw">move_tabfuls</span> <span class="ot">=</span> <span class="st">'indent'</span> <span class="co">--'indent', 'never'; where to move the cursor between tabfuls instead of individual spaces.</span>
<span class="co">--editing state</span>
<span class="kw">insert_mode</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--insert or overwrite when typing characters</span>
<span class="co">--editing options</span>
<span class="kw">auto_indent</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--pressing enter copies the indentation of the current line over to the following line</span>
<span class="kw">insert_tabs</span> <span class="ot">=</span> <span class="st">'indent'</span> <span class="co">--never, indent, always: where to insert a tab instead of enough spaces that make up a tab.</span>
<span class="kw">insert_align_list</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--insert whitespace up to the next word on the above line</span>
<span class="kw">insert_align_args</span> <span class="ot">=</span> <span class="kw">true</span> <span class="co">--insert whitespace up to after '(' on the above line</span>
<span class="co">--view overrides</span>
<span class="kw">thickness</span> <span class="ot">=</span> <span class="kw">nil</span>
<span class="kw">color</span> <span class="ot">=</span> <span class="kw">nil</span>
<span class="kw">line_highlight_color</span> <span class="ot">=</span> <span class="kw">nil</span></code></pre>
<h3 id="methods">Methods</h3>
<table>
<col width="50%" />
<col width="50%" />
<tbody>
<tr class="odd">
<td align="left"><code>cursor:new(buffer, [view], visible) -> cur</code></td>
<td align="left">create a cursor object</td>
</tr>
<tr class="even">
<td align="left"><strong>navigation</strong></td>
<td align="left"></td>
</tr>
<tr class="odd">
<td align="left"><code>cur:move(line, col, [keep_vcol])</code></td>
<td align="left">move to a wanted position, restricting the final position according to navigation policies. also store the visual col of the cursor to be used as the wanted landing col by <code>move_vert()</code>, unless <code>keep_vcol</code> is true</td>
</tr>
<tr class="even">
<td align="left"><code>cur:move_vert(lines)</code></td>
<td align="left">navigate vertically, using the visual column that resulted from horizontal navigation, as target column</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:prev_pos() -> line, col</code><br /><code>cur:next_pos([restrict_eol]) -> line, col</code></td>
<td align="left">position before or after the cursor</td>
</tr>
<tr class="even">
<td align="left"><code>cur:move_prev_pos()</code><br /><code>cur:move_next_pos()</code></td>
<td align="left">horizontal navigation</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:move_up()</code><br /><code>cur:move_down()</code></td>
<td align="left">vertical navigation</td>
</tr>
<tr class="even">
<td align="left"><code>cur:move_home()</code><br /><code>cur:move_end()</code></td>
<td align="left">navigation to document boundaries</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:move_bol()</code><br /><code>cur:move_eol()</code></td>
<td align="left">navigation to line boundaries</td>
</tr>
<tr class="even">
<td align="left"><code>cur:move_up_page()</code><br /><code>cur:move_down_page()</code></td>
<td align="left">navigation to view boundaries</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:move_prev_word_break()</code><br /><code>cur:move_next_word_break()</code></td>
<td align="left">navigation to word boundaries</td>
</tr>
<tr class="even">
<td align="left"><code>cur:move_to_selection(sel)</code></td>
<td align="left">navigation to selection boundaries</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:move_to_coords(x, y)</code></td>
<td align="left">navigation to view coordinates</td>
</tr>
<tr class="even">
<td align="left"><strong>editing</strong></td>
<td align="left"></td>
</tr>
<tr class="odd">
<td align="left"><code>cur:insert_string(s)</code></td>
<td align="left">insert a string at cursor and move the cursor to after the string</td>
</tr>
<tr class="even">
<td align="left"><code>cur:insert_block(s) -> line2, col2</code></td>
<td align="left">insert a string block at cursor. does not move the cursor, but returns the position after the text.</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:insert_char(c)</code></td>
<td align="left">insert or overwrite a char at cursor, depending on the insert mode</td>
</tr>
<tr class="even">
<td align="left"><code>cur:delete_pos(restrict_eol)</code></td>
<td align="left">delete the text up to the next cursor position</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:insert_newline()</code></td>
<td align="left">add a new line, optionally copying the indent of the current line, and carry the cursor over</td>
</tr>
<tr class="even">
<td align="left"><code>cur:insert_tab()</code></td>
<td align="left">insert a tab character, expanding it according to tab expansion policies</td>
</tr>
<tr class="odd">
<td align="left"><code>cur:outdent_line()</code></td>
<td align="left">outdent current line</td>
</tr>
<tr class="even">
<td align="left"><code>cur:move_line_up()</code><br /><code>cur:move_line_down()</code></td>
<td align="left">move the contents of the current line up and down in the text</td>
</tr>
<tr class="odd">
<td align="left"><strong>scrolling</strong></td>
<td align="left"></td>
</tr>
<tr class="even">
<td align="left"><code>cur:make_visible()</code></td>
<td align="left">scroll the text into view to make the cursor visible</td>
</tr>
</tbody>
</table>
</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>