3 * @author Shinichiro Nakamura
4 * @brief NT-Shell用テキストエディタモジュールの定義。
6 * 文字列の編集を論理的に扱うためのモジュール。
7 * このモジュールはビューに関して一切感知しない。
11 * ===============================================================
12 * Natural Tiny Shell (NT-Shell)
13 * ===============================================================
14 * Copyright (c) 2010-2012 Shinichiro Nakamura
16 * Permission is hereby granted, free of charge, to any person
17 * obtaining a copy of this software and associated documentation
18 * files (the "Software"), to deal in the Software without
19 * restriction, including without limitation the rights to use,
20 * copy, modify, merge, publish, distribute, sublicense, and/or
21 * sell copies of the Software, and to permit persons to whom the
22 * Software is furnished to do so, subject to the following
25 * The above copyright notice and this permission notice shall be
26 * included in all copies or substantial portions of the Software.
28 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
29 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
30 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
31 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
32 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
33 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
34 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35 * OTHER DEALINGS IN THE SOFTWARE.
36 * ===============================================================
47 #define TEXTEDITOR_MAXLEN (NTCONF_EDITOR_MAXLEN)
50 * @brief テキストエディタ構造体の実装。
53 char buffer[TEXTEDITOR_MAXLEN]; /**< バッファ。 */
54 int pos; /**< カーソル位置。 */
55 int len; /**< テキスト長さ。 */
62 void text_editor_init(text_editor_t *p);
63 int text_editor_insert(text_editor_t *p, char c);
64 int text_editor_backspace(text_editor_t *p);
65 int text_editor_delete(text_editor_t *p);
66 int text_editor_cursor_get_position(text_editor_t *p);
67 int text_editor_cursor_head(text_editor_t *p);
68 int text_editor_cursor_tail(text_editor_t *p);
69 int text_editor_cursor_left(text_editor_t *p);
70 int text_editor_cursor_right(text_editor_t *p);
71 int text_editor_set_text(text_editor_t *p, char *buf);
72 int text_editor_get_text(text_editor_t *p, char *buf, int siz);
73 void text_editor_clear(text_editor_t *p);