]> git.decadent.org.uk Git - ion3.git/blob - mod_query/wedln-wrappers.c
82ef6def3292f4ef12ea8743d33097aa7b238187
[ion3.git] / mod_query / wedln-wrappers.c
1 /*
2  * ion/mod_query/wedln-wrappers.c
3  *
4  * Copyright (c) Tuomo Valkonen 1999-2008. 
5  *
6  * See the included file LICENSE for details.
7  */
8
9 #include "wedln.h"
10 #include "edln.h"
11 #include "complete.h"
12
13 /*EXTL_DOC
14  * Move backward one character.
15  */
16 EXTL_EXPORT_MEMBER
17 void wedln_back(WEdln *wedln)
18 {
19     edln_back(&(wedln->edln));
20 }
21
22 /*EXTL_DOC
23  * Move forward one character.
24  */
25 EXTL_EXPORT_MEMBER
26 void wedln_forward(WEdln *wedln)
27 {
28     edln_forward(&(wedln->edln));
29 }
30
31 /*EXTL_DOC
32  * Transpose characters.
33  */
34 EXTL_EXPORT_MEMBER
35 void wedln_transpose_chars(WEdln *wedln)
36 {
37     edln_transpose_chars(&(wedln->edln));
38 }
39
40 /*EXTL_DOC
41  * Transpose words.
42  */
43 EXTL_EXPORT_MEMBER
44 void wedln_transpose_words(WEdln *wedln)
45 {
46     edln_transpose_words(&(wedln->edln));
47 }
48
49 /*EXTL_DOC
50  * Go to the beginning of line.
51  */
52 EXTL_EXPORT_MEMBER
53 void wedln_bol(WEdln *wedln)
54 {
55     edln_bol(&(wedln->edln));
56 }
57
58 /*EXTL_DOC
59  * Go to the end of line.
60  */
61 EXTL_EXPORT_MEMBER
62 void wedln_eol(WEdln *wedln)
63 {
64     edln_eol(&(wedln->edln));
65 }
66
67 /*EXTL_DOC
68  * Go to to end of current sequence of whitespace followed by alphanumeric
69  * characters..
70  */
71 EXTL_EXPORT_MEMBER
72 void wedln_skip_word(WEdln *wedln)
73 {
74     edln_skip_word(&(wedln->edln));
75 }
76
77 /*EXTL_DOC
78  * Go to to beginning of current sequence of alphanumeric characters
79  * followed by whitespace.
80  */
81 EXTL_EXPORT_MEMBER
82 void wedln_bskip_word(WEdln *wedln)
83 {
84     edln_bskip_word(&(wedln->edln));
85 }
86
87 /*EXTL_DOC
88  * Delete current character.
89  */
90 EXTL_EXPORT_MEMBER
91 void wedln_delete(WEdln *wedln)
92 {
93     edln_delete(&(wedln->edln));
94 }
95
96 /*EXTL_DOC
97  * Delete previous character.
98  */
99 EXTL_EXPORT_MEMBER
100 void wedln_backspace(WEdln *wedln)
101 {
102     edln_backspace(&(wedln->edln));
103 }
104
105 /*EXTL_DOC
106  * Delete all characters from current to end of line.
107  */
108 EXTL_EXPORT_MEMBER
109 void wedln_kill_to_eol(WEdln *wedln)
110 {
111     edln_kill_to_eol(&(wedln->edln));
112 }
113
114 /*EXTL_DOC
115  * Delete all characters from previous to beginning of line.
116  */
117 EXTL_EXPORT_MEMBER
118 void wedln_kill_to_bol(WEdln *wedln)
119 {
120     edln_kill_to_bol(&(wedln->edln));
121 }
122
123 /*EXTL_DOC
124  * Delete the whole line.
125  */
126 EXTL_EXPORT_MEMBER
127 void wedln_kill_line(WEdln *wedln)
128 {
129     edln_kill_line(&(wedln->edln));
130 }
131
132 /*EXTL_DOC
133  * Starting from the current point, delete possible whitespace and
134  * following alphanumeric characters until next non-alphanumeric character.
135  */
136 EXTL_EXPORT_MEMBER
137 void wedln_kill_word(WEdln *wedln)
138 {
139     edln_kill_word(&(wedln->edln));
140 }
141
142 /*EXTL_DOC
143  * Starting from the previous characters, delete possible whitespace and
144  * preceding alphanumeric characters until previous non-alphanumeric character.
145  */
146 EXTL_EXPORT_MEMBER
147 void wedln_bkill_word(WEdln *wedln)
148 {
149     edln_bkill_word(&(wedln->edln));
150 }
151
152 /*EXTL_DOC
153  * Set \emph{mark} to current cursor position.
154  */
155 EXTL_EXPORT_MEMBER
156 void wedln_set_mark(WEdln *wedln)
157 {
158     edln_set_mark(&(wedln->edln));
159 }
160
161 /*EXTL_DOC
162  * Clear \emph{mark}.
163  */
164 EXTL_EXPORT_MEMBER
165 void wedln_clear_mark(WEdln *wedln)
166 {
167     edln_clear_mark(&(wedln->edln));
168 }
169
170 /*EXTL_DOC
171  * Copy text between \emph{mark} and current cursor position to clipboard
172  * and then delete that sequence.
173  */
174 EXTL_EXPORT_MEMBER
175 void wedln_cut(WEdln *wedln)
176 {
177     edln_cut(&(wedln->edln));
178 }
179
180 /*EXTL_DOC
181  * Copy text between \emph{mark} and current cursor position to clipboard.
182  */
183 EXTL_EXPORT_MEMBER
184 void wedln_copy(WEdln *wedln)
185 {
186     edln_copy(&(wedln->edln));
187 }
188
189 /*EXTL_DOC
190  * Replace line editor contents with next entry in history if one exists.
191  * If \var{match} is \code{true}, the initial part of the history entry
192  * must match the current line from beginning to point.
193  */
194 EXTL_EXPORT_MEMBER
195 void wedln_history_next(WEdln *wedln, bool match)
196 {
197     edln_history_next(&(wedln->edln), match);
198 }
199
200 /*EXTL_DOC
201  * Replace line editor contents with previous in history if one exists.
202  * If \var{match} is \code{true}, the initial part of the history entry
203  * must match the current line from beginning to point.
204  */
205 EXTL_EXPORT_MEMBER
206 void wedln_history_prev(WEdln *wedln, bool match)
207 {
208     edln_history_prev(&(wedln->edln), match);
209 }
210
211
212 /*EXTL_DOC
213  * Input \var{str} in wedln at current editing point.
214  */
215 EXTL_EXPORT_AS(WEdln, insstr)
216 void wedln_insstr_exported(WEdln *wedln, const char *str)
217 {
218     edln_insstr(&(wedln->edln), str);
219 }
220
221
222 /*EXTL_DOC
223  * Get line editor contents.
224  */
225 EXTL_SAFE
226 EXTL_EXPORT_MEMBER
227 const char *wedln_contents(WEdln *wedln)
228 {
229     return wedln->edln.p;
230 }
231
232 /*EXTL_DOC
233  * Get current editing point. 
234  * Beginning of the edited line is point 0.
235  */
236 EXTL_SAFE
237 EXTL_EXPORT_MEMBER
238 int wedln_point(WEdln *wedln)
239 {
240     return wedln->edln.point;
241 }
242
243 /*EXTL_DOC
244  * Get current mark (start of selection) for \var{wedln}.
245  * Return value of -1 indicates that there is no mark, and
246  * 0 is the beginning of the line.
247  */
248 EXTL_SAFE
249 EXTL_EXPORT_MEMBER
250 int wedln_mark(WEdln *wedln)
251 {
252     return wedln->edln.mark;
253 }
254
255
256 /*EXTL_DOC
257  * Set history context for \var{wedln}.
258  */
259 EXTL_EXPORT_MEMBER
260 void wedln_set_context(WEdln *wedln, const char *context)
261 {
262     edln_set_context(&(wedln->edln), context);
263 }
264
265
266 /*EXTL_DOC
267  * Get history context for \var{wedln}.
268  */
269 EXTL_SAFE
270 EXTL_EXPORT_MEMBER
271 const char *wedln_context(WEdln *wedln)
272 {
273     return wedln->edln.context;
274 }
275