/[LeafOK_CVS]/lbbs/include/editor.h
ViewVC logotype

Contents of /lbbs/include/editor.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations)
Sun Oct 19 07:08:29 2025 UTC (4 months, 4 weeks ago) by sysadm
Branch: MAIN
Changes since 1.7: +1 -1 lines
Content type: text/x-chdr
Add feature to editor:
Ctrl-Y, delete current display line
Ctrl-K, delete current display line since the position of cursor

1 /***************************************************************************
2 editor.h - description
3 -------------------
4 copyright : (C) 2004-2025 by Leaflet
5 email : leaflet@leafok.com
6 ***************************************************************************/
7
8 /***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 3 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16
17 #ifndef _EDITOR_H_
18 #define _EDITOR_H_
19
20 #include "screen.h"
21
22 #define MAX_EDITOR_DATA_LINES 65536
23 #define MAX_EDITOR_DATA_LINE_LENGTH 1024
24
25 struct editor_data_t
26 {
27 char *p_display_lines[MAX_EDITOR_DATA_LINES];
28 long display_line_lengths[MAX_EDITOR_DATA_LINES]; // string length of display line
29 int display_line_widths[MAX_EDITOR_DATA_LINES]; // display width of display line
30 long display_line_total;
31 };
32 typedef struct editor_data_t EDITOR_DATA;
33
34 struct editor_ctx_t
35 {
36 int reach_begin;
37 int reach_end;
38 long line_cursor;
39 char msg[MSG_EXT_MAX_LEN];
40 };
41 typedef struct editor_ctx_t EDITOR_CTX;
42
43 extern int editor_memory_pool_init(void);
44 extern void editor_memory_pool_cleanup(void);
45
46 extern EDITOR_DATA *editor_data_load(const char *p_data);
47 extern long editor_data_save(const EDITOR_DATA *p_editor_data, char *p_data, size_t buf_len);
48 extern void editor_data_cleanup(EDITOR_DATA *p_editor_data);
49
50 extern int editor_display(EDITOR_DATA *p_editor_data);
51
52 extern int editor_data_insert(EDITOR_DATA *p_editor_data, long *p_display_line, long *p_offset,
53 const char *str, int str_len, long *p_last_updated_line);
54
55 extern int editor_data_delete(EDITOR_DATA *p_editor_data, long *p_display_line, long *p_offset,
56 long *p_last_updated_line, int del_line);
57
58 #endif //_EDITOR_H_

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1