| 1 |
/*************************************************************************** |
/* SPDX-License-Identifier: GPL-3.0-or-later */ |
| 2 |
editor.h - description |
/* |
| 3 |
------------------- |
* editor |
| 4 |
copyright : (C) 2004-2025 by Leaflet |
* - user interactive full-screen text editor |
| 5 |
email : leaflet@leafok.com |
* |
| 6 |
***************************************************************************/ |
* Copyright (C) 2004-2025 Leaflet <leaflet@leafok.com> |
| 7 |
|
*/ |
|
/*************************************************************************** |
|
|
* * |
|
|
* This program is free software; you can redistribute it and/or modify * |
|
|
* it under the terms of the GNU General Public License as published by * |
|
|
* the Free Software Foundation; either version 3 of the License, or * |
|
|
* (at your option) any later version. * |
|
|
* * |
|
|
***************************************************************************/ |
|
| 8 |
|
|
| 9 |
#include "bbs.h" |
#include "bbs.h" |
| 10 |
#include "common.h" |
#include "common.h" |
| 18 |
#include <string.h> |
#include <string.h> |
| 19 |
#include <sys/param.h> |
#include <sys/param.h> |
| 20 |
|
|
| 21 |
#define EDITOR_ESC_DISPLAY_STR "\033[32m*\033[m" |
enum _editor_constant_t |
| 22 |
#define EDITOR_MEM_POOL_LINE_PER_CHUNK 1000 |
{ |
| 23 |
#define EDITOR_MEM_POOL_CHUNK_LIMIT (MAX_EDITOR_DATA_LINES / EDITOR_MEM_POOL_LINE_PER_CHUNK + 1) |
EDITOR_MEM_POOL_LINE_PER_CHUNK = 1000, |
| 24 |
|
EDITOR_MEM_POOL_CHUNK_LIMIT = (MAX_EDITOR_DATA_LINES / EDITOR_MEM_POOL_LINE_PER_CHUNK + 1), |
| 25 |
|
}; |
| 26 |
|
|
| 27 |
|
static const char EDITOR_ESC_DISPLAY_STR[] = "\033[32m*\033[m"; |
| 28 |
|
|
| 29 |
static MEMORY_POOL *p_mp_data_line; |
static MEMORY_POOL *p_mp_data_line; |
| 30 |
static MEMORY_POOL *p_mp_editor_data; |
static MEMORY_POOL *p_mp_editor_data; |
| 704 |
iflush(); |
iflush(); |
| 705 |
|
|
| 706 |
str_len = 0; |
str_len = 0; |
| 707 |
ch = igetch_t(MAX_DELAY_TIME); |
ch = igetch_t(BBS_max_user_idle_time); |
| 708 |
while (!SYS_server_exit) |
while (!SYS_server_exit) |
| 709 |
{ |
{ |
| 710 |
if (ch != KEY_NULL && ch != KEY_TIMEOUT) |
if (ch != KEY_NULL && ch != KEY_TIMEOUT) |
| 1056 |
output_end_row = SCREEN_ROWS - 1; // Legacy Fterm only works with this line |
output_end_row = SCREEN_ROWS - 1; // Legacy Fterm only works with this line |
| 1057 |
col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_widths[line_current - output_current_row + row_pos])); |
col_pos = MIN(col_pos, MAX(1, p_editor_data->display_line_widths[line_current - output_current_row + row_pos])); |
| 1058 |
break; |
break; |
|
case KEY_SPACE: |
|
|
break; |
|
| 1059 |
case KEY_RIGHT: |
case KEY_RIGHT: |
| 1060 |
offset_in = split_line(p_editor_data->p_display_lines[line_current - output_current_row + row_pos], |
offset_in = split_line(p_editor_data->p_display_lines[line_current - output_current_row + row_pos], |
| 1061 |
(int)col_pos - 1, &eol, &display_len, 0); |
(int)col_pos - 1, &eol, &display_len, 0); |
| 1127 |
break; |
break; |
| 1128 |
case Ctrl('Q'): |
case Ctrl('Q'): |
| 1129 |
case KEY_F1: |
case KEY_F1: |
| 1130 |
if (!show_help) // Not reentrant |
if (!show_help) // Not re-entrant |
| 1131 |
{ |
{ |
| 1132 |
break; |
break; |
| 1133 |
} |
} |
| 1134 |
// Display help information |
// Display help information |
| 1135 |
show_help = 0; |
show_help = 0; |
| 1136 |
display_file(DATA_READ_HELP, 1); |
display_file(DATA_EDITOR_HELP, 1); |
| 1137 |
show_help = 1; |
show_help = 1; |
| 1138 |
case KEY_F5: |
case KEY_F5: |
| 1139 |
// Refresh after display help information |
// Refresh after display help information |
| 1160 |
break; |
break; |
| 1161 |
} |
} |
| 1162 |
|
|
| 1163 |
ch = igetch_t(MAX_DELAY_TIME); |
ch = igetch_t(BBS_max_user_idle_time); |
| 1164 |
} |
} |
| 1165 |
|
|
| 1166 |
continue; |
continue; |