Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 1 | /************************************************************************** |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 2 | * proto.h -- This file is part of GNU nano. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 3 | * * |
Chris Allegretta | 8a07a96 | 2009-12-02 03:36:22 +0000 | [diff] [blame] | 4 | * Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, * |
Benno Schulenberg | 7a9f4a4 | 2014-04-30 20:18:26 +0000 | [diff] [blame] | 5 | * 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 6 | * * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 7 | * GNU nano is free software: you can redistribute it and/or modify * |
| 8 | * it under the terms of the GNU General Public License as published * |
| 9 | * by the Free Software Foundation, either version 3 of the License, * |
| 10 | * or (at your option) any later version. * |
| 11 | * * |
| 12 | * GNU nano is distributed in the hope that it will be useful, * |
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty * |
| 14 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
| 15 | * See the GNU General Public License for more details. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 16 | * * |
| 17 | * You should have received a copy of the GNU General Public License * |
Benno Schulenberg | 514cd9a | 2016-08-29 17:10:49 +0200 | [diff] [blame] | 18 | * along with this program. If not, see http://www.gnu.org/licenses/. * |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 19 | * * |
| 20 | **************************************************************************/ |
| 21 | |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 22 | #ifndef PROTO_H |
| 23 | #define PROTO_H 1 |
| 24 | |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 25 | #include "nano.h" |
| 26 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 27 | /* All external variables. See global.c for their descriptions. */ |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 28 | #ifndef NANO_TINY |
Benno Schulenberg | b77e6bd | 2016-12-14 20:37:03 +0100 | [diff] [blame] | 29 | extern volatile sig_atomic_t the_window_resized; |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 30 | #endif |
| 31 | |
Benno Schulenberg | 08cd197 | 2016-09-08 21:00:51 +0200 | [diff] [blame] | 32 | #ifdef __linux__ |
Benno Schulenberg | 290d278 | 2016-07-29 09:15:07 +0200 | [diff] [blame] | 33 | extern bool console; |
Benno Schulenberg | 928a24c | 2016-08-11 12:37:11 +0200 | [diff] [blame] | 34 | #endif |
| 35 | |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 36 | extern bool meta_key; |
Benno Schulenberg | 382c9d7 | 2016-04-24 11:28:28 +0200 | [diff] [blame] | 37 | extern bool shift_held; |
| 38 | |
Benno Schulenberg | 07e199f | 2015-03-28 17:01:46 +0000 | [diff] [blame] | 39 | extern bool focusing; |
Benno Schulenberg | c8f530a | 2016-05-19 20:43:08 +0200 | [diff] [blame] | 40 | |
Benno Schulenberg | eef7d10 | 2016-12-20 19:27:41 +0100 | [diff] [blame] | 41 | extern bool as_an_at; |
| 42 | |
Faissal Bensefia | de95ca6 | 2016-10-20 09:44:29 +0100 | [diff] [blame] | 43 | extern int margin; |
| 44 | extern int editwincols; |
Faissal Bensefia | de95ca6 | 2016-10-20 09:44:29 +0100 | [diff] [blame] | 45 | |
Benno Schulenberg | c8f530a | 2016-05-19 20:43:08 +0200 | [diff] [blame] | 46 | extern message_type lastmessage; |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 47 | |
Sumedh Pendurkar | dca4ab5 | 2016-12-07 09:43:47 +0530 | [diff] [blame] | 48 | extern filestruct *pletion_line; |
Sumedh Pendurkar | dca4ab5 | 2016-12-07 09:43:47 +0530 | [diff] [blame] | 49 | |
Benno Schulenberg | f08d79d | 2015-11-23 08:52:23 +0000 | [diff] [blame] | 50 | extern int controlleft; |
| 51 | extern int controlright; |
Benno Schulenberg | c6dbcf9 | 2016-06-25 15:16:52 +0200 | [diff] [blame] | 52 | extern int controlup; |
| 53 | extern int controldown; |
Benno Schulenberg | 08cd197 | 2016-09-08 21:00:51 +0200 | [diff] [blame] | 54 | #ifndef NANO_TINY |
Benno Schulenberg | 382c9d7 | 2016-04-24 11:28:28 +0200 | [diff] [blame] | 55 | extern int shiftcontrolleft; |
| 56 | extern int shiftcontrolright; |
| 57 | extern int shiftcontrolup; |
| 58 | extern int shiftcontroldown; |
| 59 | extern int shiftaltleft; |
| 60 | extern int shiftaltright; |
| 61 | extern int shiftaltup; |
| 62 | extern int shiftaltdown; |
Benno Schulenberg | f08d79d | 2015-11-23 08:52:23 +0000 | [diff] [blame] | 63 | #endif |
| 64 | |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 65 | #ifndef DISABLE_WRAPJUSTIFY |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 66 | extern ssize_t fill; |
David Lawrence Ramsey | 49c3f24 | 2004-07-12 16:07:14 +0000 | [diff] [blame] | 67 | extern ssize_t wrap_at; |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 68 | #endif |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 69 | |
| 70 | extern char *last_search; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 71 | |
Benno Schulenberg | e255627 | 2016-04-30 21:22:16 +0200 | [diff] [blame] | 72 | extern char *present_path; |
| 73 | |
Chris Allegretta | a48507d | 2009-08-14 03:18:29 +0000 | [diff] [blame] | 74 | extern unsigned flags[4]; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 75 | extern WINDOW *topwin; |
| 76 | extern WINDOW *edit; |
| 77 | extern WINDOW *bottomwin; |
| 78 | extern int editwinrows; |
Benno Schulenberg | 0208ae7 | 2017-01-12 17:33:46 +0100 | [diff] [blame] | 79 | extern int maxlines; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 80 | |
| 81 | extern filestruct *cutbuffer; |
Chris Allegretta | 12dc8ca | 2008-07-31 04:24:04 +0000 | [diff] [blame] | 82 | extern filestruct *cutbottom; |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 83 | extern partition *filepart; |
| 84 | extern openfilestruct *openfile; |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 85 | |
David Lawrence Ramsey | d89617f | 2006-01-06 21:51:10 +0000 | [diff] [blame] | 86 | #ifndef NANO_TINY |
| 87 | extern char *matchbrackets; |
| 88 | #endif |
| 89 | |
Benno Schulenberg | 90798fb | 2015-08-09 16:05:50 +0000 | [diff] [blame] | 90 | #ifndef NANO_TINY |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 91 | extern char *whitespace; |
David Lawrence Ramsey | 6e60db6 | 2005-03-10 22:52:21 +0000 | [diff] [blame] | 92 | extern int whitespace_len[2]; |
David Lawrence Ramsey | 89bb937 | 2004-05-29 16:47:52 +0000 | [diff] [blame] | 93 | #endif |
| 94 | |
Benno Schulenberg | 11d7644 | 2014-04-26 19:01:18 +0000 | [diff] [blame] | 95 | extern const char *exit_tag; |
| 96 | extern const char *close_tag; |
Benno Schulenberg | bc6e9aa | 2014-04-07 09:02:22 +0000 | [diff] [blame] | 97 | extern const char *uncut_tag; |
Chris Allegretta | e4f940d | 2002-03-03 22:36:36 +0000 | [diff] [blame] | 98 | #ifndef DISABLE_JUSTIFY |
Benno Schulenberg | bc6e9aa | 2014-04-07 09:02:22 +0000 | [diff] [blame] | 99 | extern const char *unjust_tag; |
David Lawrence Ramsey | 2c62b07 | 2004-05-29 16:38:57 +0000 | [diff] [blame] | 100 | extern char *punct; |
| 101 | extern char *brackets; |
Chris Allegretta | 45329a1 | 2002-03-10 01:22:21 +0000 | [diff] [blame] | 102 | extern char *quotestr; |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 103 | #ifdef HAVE_REGEX_H |
| 104 | extern regex_t quotereg; |
| 105 | extern int quoterc; |
| 106 | extern char *quoteerr; |
| 107 | #else |
| 108 | extern size_t quotelen; |
| 109 | #endif |
Benno Schulenberg | 492e9f6 | 2014-06-20 10:48:26 +0000 | [diff] [blame] | 110 | #endif /* !DISABLE_JUSTIFY */ |
| 111 | |
Benno Schulenberg | 6f12992 | 2016-06-30 18:02:45 +0200 | [diff] [blame] | 112 | extern char *word_chars; |
| 113 | |
Chris Allegretta | f86fa86 | 2009-02-25 04:32:15 +0000 | [diff] [blame] | 114 | extern bool nodelay_mode; |
Benno Schulenberg | 6f12992 | 2016-06-30 18:02:45 +0200 | [diff] [blame] | 115 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 116 | extern char *answer; |
| 117 | |
| 118 | extern ssize_t tabsize; |
| 119 | |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 120 | #ifndef NANO_TINY |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 121 | extern char *backup_dir; |
Chris Allegretta | 3116d2f | 2013-01-03 04:36:39 +0000 | [diff] [blame] | 122 | extern const char *locking_prefix; |
| 123 | extern const char *locking_suffix; |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 124 | #endif |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 125 | #ifndef DISABLE_OPERATINGDIR |
| 126 | extern char *operating_dir; |
Chris Allegretta | f5de33a | 2002-02-27 04:14:16 +0000 | [diff] [blame] | 127 | extern char *full_operating_dir; |
Chris Allegretta | e1f1452 | 2001-09-19 03:19:43 +0000 | [diff] [blame] | 128 | #endif |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 129 | |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 130 | #ifndef DISABLE_SPELLER |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 131 | extern char *alt_speller; |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 132 | #endif |
| 133 | |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 134 | #ifndef DISABLE_COLOR |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 135 | extern syntaxtype *syntaxes; |
| 136 | extern char *syntaxstr; |
Chris Allegretta | f4b9601 | 2001-01-03 07:11:47 +0000 | [diff] [blame] | 137 | #endif |
Chris Allegretta | 201f1d9 | 2003-02-05 02:51:19 +0000 | [diff] [blame] | 138 | |
Benno Schulenberg | 53f4a9f | 2016-04-25 21:14:18 +0200 | [diff] [blame] | 139 | extern bool refresh_needed; |
Benno Schulenberg | 4147c5e | 2014-06-20 07:55:24 +0000 | [diff] [blame] | 140 | |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 141 | extern int currmenu; |
Benno Schulenberg | 4147c5e | 2014-06-20 07:55:24 +0000 | [diff] [blame] | 142 | extern sc *sclist; |
| 143 | extern subnfunc *allfuncs; |
| 144 | extern subnfunc *exitfunc; |
| 145 | extern subnfunc *uncutfunc; |
Chris Allegretta | 805c26d | 2000-09-06 13:39:17 +0000 | [diff] [blame] | 146 | |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 147 | #ifndef DISABLE_HISTORIES |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 148 | extern filestruct *search_history; |
| 149 | extern filestruct *searchage; |
| 150 | extern filestruct *searchbot; |
| 151 | extern filestruct *replace_history; |
| 152 | extern filestruct *replaceage; |
| 153 | extern filestruct *replacebot; |
Benno Schulenberg | deb271d | 2016-01-12 19:20:40 +0000 | [diff] [blame] | 154 | extern poshiststruct *position_history; |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 155 | #endif |
| 156 | |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 157 | #ifdef HAVE_REGEX_H |
| 158 | extern regex_t search_regexp; |
| 159 | extern regmatch_t regmatches[10]; |
| 160 | #endif |
| 161 | |
Benno Schulenberg | c970035 | 2014-05-04 08:53:06 +0000 | [diff] [blame] | 162 | extern int hilite_attribute; |
Benno Schulenberg | 1663994 | 2014-05-03 18:24:45 +0000 | [diff] [blame] | 163 | #ifndef DISABLE_COLOR |
| 164 | extern char* specified_color_combo[NUMBER_OF_ELEMENTS]; |
| 165 | #endif |
Benno Schulenberg | 960e848 | 2016-07-12 09:35:48 +0200 | [diff] [blame] | 166 | extern int interface_color_pair[NUMBER_OF_ELEMENTS]; |
Chris Allegretta | a0d8997 | 2003-02-03 03:32:08 +0000 | [diff] [blame] | 167 | |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 168 | extern char *homedir; |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 169 | |
Benno Schulenberg | 3933a30 | 2014-07-02 08:47:09 +0000 | [diff] [blame] | 170 | typedef void (*functionptrtype)(void); |
| 171 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 172 | /* All functions in browser.c. */ |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 173 | #ifndef DISABLE_BROWSER |
Rishabh Dave | bd3f156 | 2016-05-25 11:16:58 +0200 | [diff] [blame] | 174 | char *do_browser(char *path); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 175 | char *do_browse_from(const char *inpath); |
Benno Schulenberg | d3bd855 | 2016-05-25 12:09:22 +0200 | [diff] [blame] | 176 | void read_the_list(const char *path, DIR *dir); |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 177 | functionptrtype parse_browser_input(int *kbinput); |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 178 | void browser_refresh(void); |
Benno Schulenberg | 2dc9cbe | 2015-04-08 18:40:40 +0000 | [diff] [blame] | 179 | void browser_select_dirname(const char *needle); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 180 | int filesearch_init(void); |
Benno Schulenberg | d517705 | 2015-04-07 13:34:12 +0000 | [diff] [blame] | 181 | void findnextfile(const char *needle); |
David Lawrence Ramsey | e38b808 | 2006-03-30 07:03:04 +0000 | [diff] [blame] | 182 | void filesearch_abort(void); |
| 183 | void do_filesearch(void); |
| 184 | void do_fileresearch(void); |
| 185 | void do_first_file(void); |
| 186 | void do_last_file(void); |
David Lawrence Ramsey | a4e92c8 | 2006-06-30 14:14:40 +0000 | [diff] [blame] | 187 | char *striponedir(const char *path); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 188 | #endif |
| 189 | |
Benno Schulenberg | 2163d96 | 2016-02-16 10:09:26 +0000 | [diff] [blame] | 190 | /* Most functions in chars.c. */ |
David Lawrence Ramsey | 4d72de7 | 2006-04-12 15:27:40 +0000 | [diff] [blame] | 191 | #ifdef ENABLE_UTF8 |
| 192 | void utf8_init(void); |
| 193 | bool using_utf8(void); |
| 194 | #endif |
Benno Schulenberg | f5ac8c1 | 2014-05-25 19:41:49 +0000 | [diff] [blame] | 195 | char *addstrings(char* str1, size_t len1, char* str2, size_t len2); |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 196 | #ifndef HAVE_ISBLANK |
David Lawrence Ramsey | 1aee5cc | 2005-06-29 18:17:54 +0000 | [diff] [blame] | 197 | bool nisblank(int c); |
David Lawrence Ramsey | 77abec7 | 2005-03-16 17:00:27 +0000 | [diff] [blame] | 198 | #endif |
David Lawrence Ramsey | 7eb30a8 | 2005-07-17 02:40:07 +0000 | [diff] [blame] | 199 | #if !defined(HAVE_ISWBLANK) && defined(ENABLE_UTF8) |
David Lawrence Ramsey | 1aee5cc | 2005-06-29 18:17:54 +0000 | [diff] [blame] | 200 | bool niswblank(wchar_t wc); |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 201 | #endif |
David Lawrence Ramsey | 356d248 | 2005-06-13 19:51:56 +0000 | [diff] [blame] | 202 | bool is_byte(int c); |
Benno Schulenberg | 20058a1 | 2016-08-02 22:09:22 +0200 | [diff] [blame] | 203 | bool is_alpha_mbchar(const char *c); |
David Lawrence Ramsey | 2515ccc | 2005-06-15 06:04:08 +0000 | [diff] [blame] | 204 | bool is_alnum_mbchar(const char *c); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 205 | bool is_blank_mbchar(const char *c); |
David Lawrence Ramsey | 8e341e1 | 2006-05-24 17:36:00 +0000 | [diff] [blame] | 206 | bool is_ascii_cntrl_char(int c); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 207 | bool is_cntrl_char(int c); |
David Lawrence Ramsey | d864048 | 2005-06-12 17:48:46 +0000 | [diff] [blame] | 208 | bool is_cntrl_mbchar(const char *c); |
David Lawrence Ramsey | 2515ccc | 2005-06-15 06:04:08 +0000 | [diff] [blame] | 209 | bool is_punct_mbchar(const char *c); |
David Lawrence Ramsey | e221311 | 2005-06-15 03:03:45 +0000 | [diff] [blame] | 210 | bool is_word_mbchar(const char *c, bool allow_punct); |
Benno Schulenberg | 03586c6 | 2016-05-30 11:28:16 +0200 | [diff] [blame] | 211 | char control_rep(const signed char c); |
Benno Schulenberg | eafae5d | 2016-12-18 09:40:09 +0100 | [diff] [blame] | 212 | char control_mbrep(const char *c, bool isdata); |
Benno Schulenberg | e33a0b6 | 2016-06-06 13:20:04 +0200 | [diff] [blame] | 213 | int length_of_char(const char *c, int *width); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 214 | int mbwidth(const char *c); |
| 215 | int mb_cur_max(void); |
David Lawrence Ramsey | 8b006c2 | 2005-08-08 23:03:25 +0000 | [diff] [blame] | 216 | char *make_mbchar(long chr, int *chr_mb_len); |
David Lawrence Ramsey | 96452cb | 2005-07-26 06:13:45 +0000 | [diff] [blame] | 217 | int parse_mbchar(const char *buf, char *chr, size_t *col); |
David Lawrence Ramsey | d24fbb7 | 2005-01-14 21:50:32 +0000 | [diff] [blame] | 218 | size_t move_mbleft(const char *buf, size_t pos); |
| 219 | size_t move_mbright(const char *buf, size_t pos); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 220 | #ifndef HAVE_STRCASECMP |
| 221 | int nstrcasecmp(const char *s1, const char *s2); |
| 222 | #endif |
| 223 | int mbstrcasecmp(const char *s1, const char *s2); |
| 224 | #ifndef HAVE_STRNCASECMP |
| 225 | int nstrncasecmp(const char *s1, const char *s2, size_t n); |
| 226 | #endif |
| 227 | int mbstrncasecmp(const char *s1, const char *s2, size_t n); |
| 228 | #ifndef HAVE_STRCASESTR |
David Lawrence Ramsey | ae46b91 | 2007-07-06 13:44:13 +0000 | [diff] [blame] | 229 | char *nstrcasestr(const char *haystack, const char *needle); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 230 | #endif |
David Lawrence Ramsey | ae46b91 | 2007-07-06 13:44:13 +0000 | [diff] [blame] | 231 | char *mbstrcasestr(const char *haystack, const char *needle); |
Benno Schulenberg | cd705a7 | 2016-12-18 21:45:47 +0100 | [diff] [blame] | 232 | char *revstrstr(const char *haystack, const char *needle, |
| 233 | const char *pointer); |
David Lawrence Ramsey | ae46b91 | 2007-07-06 13:44:13 +0000 | [diff] [blame] | 234 | char *revstrcasestr(const char *haystack, const char *needle, const char |
| 235 | *rev_start); |
| 236 | char *mbrevstrcasestr(const char *haystack, const char *needle, const |
| 237 | char *rev_start); |
David Lawrence Ramsey | 3f9c635 | 2005-01-25 19:21:11 +0000 | [diff] [blame] | 238 | size_t mbstrlen(const char *s); |
David Lawrence Ramsey | 3a1fc8f | 2005-01-16 18:49:19 +0000 | [diff] [blame] | 239 | #ifndef HAVE_STRNLEN |
| 240 | size_t nstrnlen(const char *s, size_t maxlen); |
| 241 | #endif |
| 242 | size_t mbstrnlen(const char *s, size_t maxlen); |
David Lawrence Ramsey | a248863 | 2006-01-06 07:10:30 +0000 | [diff] [blame] | 243 | #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) |
| 244 | char *mbstrchr(const char *s, const char *c); |
| 245 | #endif |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 246 | #ifndef NANO_TINY |
David Lawrence Ramsey | a248863 | 2006-01-06 07:10:30 +0000 | [diff] [blame] | 247 | char *mbstrpbrk(const char *s, const char *accept); |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 248 | char *revstrpbrk(const char *s, const char *accept, const char |
| 249 | *rev_start); |
David Lawrence Ramsey | a248863 | 2006-01-06 07:10:30 +0000 | [diff] [blame] | 250 | char *mbrevstrpbrk(const char *s, const char *accept, const char |
| 251 | *rev_start); |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 252 | #endif |
Benno Schulenberg | eea0908 | 2014-04-13 20:50:20 +0000 | [diff] [blame] | 253 | #if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)) |
David Lawrence Ramsey | d5d4dde | 2005-06-14 01:55:56 +0000 | [diff] [blame] | 254 | bool has_blank_chars(const char *s); |
| 255 | bool has_blank_mbchars(const char *s); |
| 256 | #endif |
David Lawrence Ramsey | 6ff695c | 2005-08-05 03:14:29 +0000 | [diff] [blame] | 257 | #ifdef ENABLE_UTF8 |
| 258 | bool is_valid_unicode(wchar_t wc); |
| 259 | #endif |
Benno Schulenberg | eea0908 | 2014-04-13 20:50:20 +0000 | [diff] [blame] | 260 | #ifndef DISABLE_NANORC |
David Lawrence Ramsey | bdfa927 | 2005-06-14 23:36:13 +0000 | [diff] [blame] | 261 | bool is_valid_mbstring(const char *s); |
| 262 | #endif |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 263 | |
Benno Schulenberg | 2163d96 | 2016-02-16 10:09:26 +0000 | [diff] [blame] | 264 | /* Most functions in color.c. */ |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 265 | #ifndef DISABLE_COLOR |
David Lawrence Ramsey | 1f28b8f | 2002-09-27 14:21:59 +0000 | [diff] [blame] | 266 | void set_colorpairs(void); |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 267 | void color_init(void); |
David Lawrence Ramsey | 43cf7a1 | 2005-07-14 18:31:45 +0000 | [diff] [blame] | 268 | void color_update(void); |
Benno Schulenberg | 9ec546d | 2017-02-13 19:11:04 +0100 | [diff] [blame] | 269 | void check_the_multis(filestruct *line); |
Benno Schulenberg | 31f0456 | 2015-12-22 16:51:00 +0000 | [diff] [blame] | 270 | void alloc_multidata_if_needed(filestruct *fileptr); |
| 271 | void precalc_multicolorinfo(void); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 272 | #endif |
Chris Allegretta | a2ea193 | 2000-06-06 05:53:49 +0000 | [diff] [blame] | 273 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 274 | /* All functions in cut.c. */ |
David Lawrence Ramsey | c833d9e | 2004-05-29 15:36:58 +0000 | [diff] [blame] | 275 | void cutbuffer_reset(void); |
Benno Schulenberg | a872709 | 2014-06-18 19:04:35 +0000 | [diff] [blame] | 276 | bool keeping_cutbuffer(void); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 277 | void cut_line(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 278 | #ifndef NANO_TINY |
Benno Schulenberg | d3429a7 | 2016-12-31 16:36:14 +0100 | [diff] [blame] | 279 | void cut_marked(bool *right_side_up); |
David Lawrence Ramsey | 93c8405 | 2004-11-23 04:08:28 +0000 | [diff] [blame] | 280 | void cut_to_eol(void); |
David Lawrence Ramsey | 41b8972 | 2006-05-21 20:03:43 +0000 | [diff] [blame] | 281 | void cut_to_eof(void); |
David Lawrence Ramsey | b80d49f | 2005-03-26 22:49:46 +0000 | [diff] [blame] | 282 | #endif |
Benno Schulenberg | 7287300 | 2016-10-23 19:42:05 +0200 | [diff] [blame] | 283 | void do_cut_text(bool copy_text, bool cut_till_eof); |
David Lawrence Ramsey | c87e0c0 | 2006-04-25 02:23:28 +0000 | [diff] [blame] | 284 | void do_cut_text_void(void); |
| 285 | #ifndef NANO_TINY |
| 286 | void do_copy_text(void); |
Benno Schulenberg | 95e77a9 | 2014-06-30 20:39:27 +0000 | [diff] [blame] | 287 | void do_cut_till_eof(void); |
David Lawrence Ramsey | 295d172 | 2005-01-01 07:43:32 +0000 | [diff] [blame] | 288 | #endif |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 289 | void do_uncut_text(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 290 | |
Benno Schulenberg | ba98735 | 2016-01-31 13:06:06 +0000 | [diff] [blame] | 291 | /* Most functions in files.c. */ |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 292 | void make_new_buffer(void); |
David Lawrence Ramsey | c00513b | 2005-07-23 00:41:45 +0000 | [diff] [blame] | 293 | void initialize_buffer_text(void); |
Benno Schulenberg | 37d8ad8 | 2015-12-30 10:11:20 +0000 | [diff] [blame] | 294 | bool open_buffer(const char *filename, bool undoable); |
David Lawrence Ramsey | 9c984e8 | 2005-11-08 19:15:58 +0000 | [diff] [blame] | 295 | #ifndef DISABLE_SPELLER |
| 296 | void replace_buffer(const char *filename); |
| 297 | #endif |
David Lawrence Ramsey | e5c7e92 | 2005-07-12 23:06:22 +0000 | [diff] [blame] | 298 | void display_buffer(void); |
Benno Schulenberg | 0636d7b | 2014-04-03 20:23:07 +0000 | [diff] [blame] | 299 | #ifndef DISABLE_MULTIBUFFER |
David Lawrence Ramsey | 6ad59cd | 2005-07-08 20:09:16 +0000 | [diff] [blame] | 300 | void switch_to_prev_buffer_void(void); |
| 301 | void switch_to_next_buffer_void(void); |
Benno Schulenberg | 906ada8 | 2016-05-17 13:37:53 +0200 | [diff] [blame] | 302 | bool close_buffer(void); |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 303 | #endif |
Benno Schulenberg | 22e9283 | 2015-12-18 19:18:23 +0000 | [diff] [blame] | 304 | filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode); |
David Lawrence Ramsey | f773d71 | 2017-02-09 12:17:54 -0600 | [diff] [blame] | 305 | void read_file(FILE *f, int fd, const char *filename, bool undoable, |
| 306 | bool checkwritable); |
Chris Allegretta | 5b1fb56 | 2015-01-20 06:15:34 +0000 | [diff] [blame] | 307 | int open_file(const char *filename, bool newfie, bool quiet, FILE **f); |
David Lawrence Ramsey | b9b5722 | 2005-05-29 02:22:55 +0000 | [diff] [blame] | 308 | char *get_next_filename(const char *name, const char *suffix); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 309 | void do_insertfile_void(void); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 310 | char *get_full_path(const char *origpath); |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 311 | char *check_writable_directory(const char *path); |
David Lawrence Ramsey | 5e068c6 | 2005-05-31 04:28:15 +0000 | [diff] [blame] | 312 | char *safe_tempfile(FILE **f); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 313 | #ifndef DISABLE_OPERATINGDIR |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 314 | void init_operating_dir(void); |
David Lawrence Ramsey | 1b9d3f9 | 2005-02-11 20:09:11 +0000 | [diff] [blame] | 315 | bool check_operating_dir(const char *currpath, bool allow_tabcomp); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 316 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 317 | #ifndef NANO_TINY |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 318 | void init_backup_dir(void); |
Chris Allegretta | bf88d27 | 2013-01-01 03:24:39 +0000 | [diff] [blame] | 319 | int delete_lockfile(const char *lockfilename); |
Chris Allegretta | 170607b | 2013-01-03 03:57:18 +0000 | [diff] [blame] | 320 | int write_lockfile(const char *lockfilename, const char *origfilename, bool modified); |
David Lawrence Ramsey | 04e42a6 | 2004-02-28 16:24:31 +0000 | [diff] [blame] | 321 | #endif |
David Lawrence Ramsey | 819c7f0 | 2004-07-30 03:54:34 +0000 | [diff] [blame] | 322 | int copy_file(FILE *inn, FILE *out); |
Benno Schulenberg | c2a0c78 | 2016-07-15 12:59:59 +0200 | [diff] [blame] | 323 | bool write_file(const char *name, FILE *f_open, bool tmp, |
| 324 | kind_of_writing_type method, bool nonamechange); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 325 | #ifndef NANO_TINY |
David Lawrence Ramsey | 4154d08 | 2007-01-11 21:36:29 +0000 | [diff] [blame] | 326 | bool write_marked_file(const char *name, FILE *f_open, bool tmp, |
Benno Schulenberg | c2a0c78 | 2016-07-15 12:59:59 +0200 | [diff] [blame] | 327 | kind_of_writing_type method); |
David Lawrence Ramsey | 35961c4 | 2004-01-23 19:34:03 +0000 | [diff] [blame] | 328 | #endif |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 329 | int do_writeout(bool exiting); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 330 | void do_writeout_void(void); |
Benno Schulenberg | ee7b095 | 2015-07-25 19:25:50 +0000 | [diff] [blame] | 331 | #ifndef NANO_TINY |
| 332 | void do_savefile(void); |
| 333 | #endif |
David Lawrence Ramsey | e21adfa | 2002-09-13 18:14:04 +0000 | [diff] [blame] | 334 | char *real_dir_from_tilde(const char *buf); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 335 | #if !defined(DISABLE_TABCOMP) || !defined(DISABLE_BROWSER) |
| 336 | int diralphasort(const void *va, const void *vb); |
David Lawrence Ramsey | ab41ab9 | 2005-06-15 06:30:05 +0000 | [diff] [blame] | 337 | void free_chararray(char **array, size_t len); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 338 | #endif |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 339 | #ifndef DISABLE_TABCOMP |
David Lawrence Ramsey | 4154d08 | 2007-01-11 21:36:29 +0000 | [diff] [blame] | 340 | bool is_dir(const char *buf); |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 341 | char **username_tab_completion(const char *buf, size_t *num_matches, |
David Lawrence Ramsey | 6e6c80b | 2007-10-11 15:38:32 +0000 | [diff] [blame] | 342 | size_t buf_len); |
David Lawrence Ramsey | 9d8c284 | 2006-02-07 21:11:05 +0000 | [diff] [blame] | 343 | char **cwd_tab_completion(const char *buf, bool allow_files, size_t |
David Lawrence Ramsey | 6e6c80b | 2007-10-11 15:38:32 +0000 | [diff] [blame] | 344 | *num_matches, size_t buf_len); |
Benno Schulenberg | 36ec76a | 2016-04-17 18:09:24 +0200 | [diff] [blame] | 345 | char *input_tab(char *buf, bool allow_files, size_t *place, |
Benno Schulenberg | 30f3c53 | 2016-04-26 17:50:25 +0200 | [diff] [blame] | 346 | bool *lastwastab, void (*refresh_func)(void), bool *listed); |
Chris Allegretta | 7662c86 | 2003-01-13 01:35:15 +0000 | [diff] [blame] | 347 | #endif |
Benno Schulenberg | 5c5fefc | 2016-04-23 13:23:49 +0200 | [diff] [blame] | 348 | const char *tail(const char *path); |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 349 | #ifndef DISABLE_HISTORIES |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 350 | char *histfilename(void); |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 351 | void load_history(void); |
Benno Schulenberg | c0aa5ad | 2017-01-09 18:25:25 +0100 | [diff] [blame] | 352 | bool writehist(FILE *hist, const filestruct *head); |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 353 | void save_history(void); |
Chris Allegretta | 9bfda91 | 2011-02-16 06:52:30 +0000 | [diff] [blame] | 354 | int check_dotnano(void); |
| 355 | void load_poshistory(void); |
| 356 | void save_poshistory(void); |
Benno Schulenberg | 4147c5e | 2014-06-20 07:55:24 +0000 | [diff] [blame] | 357 | void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos); |
Benno Schulenberg | dc18746 | 2016-12-23 13:49:14 +0100 | [diff] [blame] | 358 | bool has_old_position(const char *file, ssize_t *line, ssize_t *column); |
David Lawrence Ramsey | 6420d44 | 2004-08-11 05:13:08 +0000 | [diff] [blame] | 359 | #endif |
Benno Schulenberg | 03f37ad | 2014-06-20 10:34:52 +0000 | [diff] [blame] | 360 | |
| 361 | /* Some functions in global.c. */ |
| 362 | size_t length_of_list(int menu); |
Benno Schulenberg | 03f37ad | 2014-06-20 10:34:52 +0000 | [diff] [blame] | 363 | const sc *first_sc_for(int menu, void (*func)(void)); |
Benno Schulenberg | a9b5a0e | 2016-12-22 12:02:11 +0100 | [diff] [blame] | 364 | int the_code_for(void (*func)(void), int defaultval); |
Benno Schulenberg | 3933a30 | 2014-07-02 08:47:09 +0000 | [diff] [blame] | 365 | functionptrtype func_from_key(int *kbinput); |
Benno Schulenberg | 55878ef | 2016-10-15 17:55:19 +0200 | [diff] [blame] | 366 | void assign_keyinfo(sc *s, const char *keystring, const int keycode); |
Benno Schulenberg | 03f37ad | 2014-06-20 10:34:52 +0000 | [diff] [blame] | 367 | void print_sclist(void); |
| 368 | void shortcut_init(void); |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 369 | #ifndef DISABLE_COLOR |
Chris Allegretta | 4b3f277 | 2015-01-03 07:24:17 +0000 | [diff] [blame] | 370 | void set_lint_or_format_shortcuts(void); |
Chris Allegretta | 5575bfa | 2014-02-24 10:18:15 +0000 | [diff] [blame] | 371 | void set_spell_shortcuts(void); |
| 372 | #endif |
Benno Schulenberg | dd29c56 | 2016-01-04 09:52:43 +0000 | [diff] [blame] | 373 | const subnfunc *sctofunc(const sc *s); |
Benno Schulenberg | 03f37ad | 2014-06-20 10:34:52 +0000 | [diff] [blame] | 374 | const char *flagtostr(int flag); |
Benno Schulenberg | 539a4b4 | 2016-01-04 09:12:21 +0000 | [diff] [blame] | 375 | sc *strtosc(const char *input); |
| 376 | int strtomenu(const char *input); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 377 | #ifdef DEBUG |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 378 | void thanks_for_all_the_fish(void); |
Chris Allegretta | 6232d66 | 2002-05-12 19:52:15 +0000 | [diff] [blame] | 379 | #endif |
Chris Allegretta | dab017e | 2002-04-23 10:56:06 +0000 | [diff] [blame] | 380 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 381 | /* All functions in help.c. */ |
Chris Allegretta | 1d77823 | 2008-08-30 21:00:00 +0000 | [diff] [blame] | 382 | #ifndef DISABLE_HELP |
Benno Schulenberg | 7a1959f | 2015-08-16 09:28:33 +0000 | [diff] [blame] | 383 | void do_help(void); |
David Lawrence Ramsey | d420b5a | 2005-11-01 23:00:56 +0000 | [diff] [blame] | 384 | void help_init(void); |
Benno Schulenberg | 6418ffa | 2014-07-02 09:29:05 +0000 | [diff] [blame] | 385 | functionptrtype parse_help_input(int *kbinput); |
David Lawrence Ramsey | c359301 | 2005-11-01 20:11:55 +0000 | [diff] [blame] | 386 | size_t help_line_len(const char *ptr); |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 387 | #endif |
Benno Schulenberg | 24d9f31 | 2014-04-21 13:00:49 +0000 | [diff] [blame] | 388 | void do_help_void(void); |
David Lawrence Ramsey | 7e2d673 | 2005-11-01 19:32:45 +0000 | [diff] [blame] | 389 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 390 | /* All functions in move.c. */ |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 391 | void do_first_line(void); |
| 392 | void do_last_line(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 393 | void do_page_up(void); |
| 394 | void do_page_down(void); |
David Lawrence Ramsey | ca62f9f | 2005-07-20 19:24:11 +0000 | [diff] [blame] | 395 | #ifndef DISABLE_JUSTIFY |
| 396 | void do_para_begin(bool allow_update); |
| 397 | void do_para_begin_void(void); |
| 398 | void do_para_end(bool allow_update); |
| 399 | void do_para_end_void(void); |
| 400 | #endif |
Benno Schulenberg | c6dbcf9 | 2016-06-25 15:16:52 +0200 | [diff] [blame] | 401 | void do_prev_block(void); |
| 402 | void do_next_block(void); |
Benno Schulenberg | 6620de0 | 2015-09-05 09:22:50 +0000 | [diff] [blame] | 403 | void do_prev_word(bool allow_punct, bool allow_update); |
David Lawrence Ramsey | c4037f3 | 2005-07-20 21:31:19 +0000 | [diff] [blame] | 404 | void do_prev_word_void(void); |
Benno Schulenberg | c115166 | 2016-02-22 12:49:08 +0000 | [diff] [blame] | 405 | bool do_next_word(bool allow_punct, bool allow_update); |
| 406 | void do_next_word_void(void); |
Benno Schulenberg | 43f35fc | 2016-10-18 13:03:01 +0200 | [diff] [blame] | 407 | void ensure_line_is_visible(void); |
David Lawrence Ramsey | ca62f9f | 2005-07-20 19:24:11 +0000 | [diff] [blame] | 408 | void do_home(void); |
| 409 | void do_end(void); |
Benno Schulenberg | 0a3a644 | 2016-07-25 17:23:45 +0200 | [diff] [blame] | 410 | void do_up(bool scroll_only); |
David Lawrence Ramsey | 2c36e2e | 2006-07-06 22:17:47 +0000 | [diff] [blame] | 411 | void do_up_void(void); |
Benno Schulenberg | 0a3a644 | 2016-07-25 17:23:45 +0200 | [diff] [blame] | 412 | void do_down(bool scroll_only); |
David Lawrence Ramsey | 2c36e2e | 2006-07-06 22:17:47 +0000 | [diff] [blame] | 413 | void do_down_void(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 414 | #ifndef NANO_TINY |
Benno Schulenberg | 0a3a644 | 2016-07-25 17:23:45 +0200 | [diff] [blame] | 415 | void do_scroll_up(void); |
David Lawrence Ramsey | 2de84c1 | 2005-10-24 02:12:09 +0000 | [diff] [blame] | 416 | void do_scroll_down(void); |
| 417 | #endif |
David Lawrence Ramsey | 1c3bfa9 | 2005-09-13 04:53:44 +0000 | [diff] [blame] | 418 | void do_left(void); |
| 419 | void do_right(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 420 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 421 | /* All functions in nano.c. */ |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 422 | filestruct *make_new_node(filestruct *prevnode); |
| 423 | filestruct *copy_node(const filestruct *src); |
Benno Schulenberg | e0d0ca4 | 2015-11-24 13:28:32 +0000 | [diff] [blame] | 424 | void splice_node(filestruct *afterthis, filestruct *newnode); |
Benno Schulenberg | 72caa54 | 2015-11-22 16:14:42 +0000 | [diff] [blame] | 425 | void unlink_node(filestruct *fileptr); |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 426 | void delete_node(filestruct *fileptr); |
| 427 | filestruct *copy_filestruct(const filestruct *src); |
| 428 | void free_filestruct(filestruct *src); |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 429 | void renumber(filestruct *fileptr); |
| 430 | partition *partition_filestruct(filestruct *top, size_t top_x, |
| 431 | filestruct *bot, size_t bot_x); |
| 432 | void unpartition_filestruct(partition **p); |
David Lawrence Ramsey | 1cb945f | 2017-02-14 21:35:01 -0600 | [diff] [blame] | 433 | void extract_buffer(filestruct **file_top, filestruct **file_bot, |
David Lawrence Ramsey | 9057329 | 2005-07-08 02:47:05 +0000 | [diff] [blame] | 434 | filestruct *top, size_t top_x, filestruct *bot, size_t bot_x); |
David Lawrence Ramsey | a847d37 | 2017-02-10 00:17:33 -0600 | [diff] [blame] | 435 | void ingraft_buffer(filestruct *somebuffer); |
David Lawrence Ramsey | 1cb945f | 2017-02-14 21:35:01 -0600 | [diff] [blame] | 436 | void copy_from_buffer(filestruct *somebuffer); |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 437 | openfilestruct *make_new_opennode(void); |
David Lawrence Ramsey | e99494f | 2005-07-20 21:08:38 +0000 | [diff] [blame] | 438 | void unlink_opennode(openfilestruct *fileptr); |
| 439 | void delete_opennode(openfilestruct *fileptr); |
David Lawrence Ramsey | 5040666 | 2005-01-19 19:52:42 +0000 | [diff] [blame] | 440 | void print_view_warning(void); |
Benno Schulenberg | 6847616 | 2015-07-30 18:10:16 +0000 | [diff] [blame] | 441 | void show_restricted_warning(void); |
| 442 | #ifdef DISABLE_HELP |
| 443 | void say_there_is_no_help(void); |
| 444 | #endif |
David Lawrence Ramsey | da14106 | 2004-05-25 19:41:11 +0000 | [diff] [blame] | 445 | void finish(void); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 446 | void die(const char *msg, ...); |
Benno Schulenberg | f6dd0ad | 2016-08-02 17:26:25 +0200 | [diff] [blame] | 447 | void die_save_file(const char *die_filename, struct stat *die_stat); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 448 | void window_init(void); |
David Lawrence Ramsey | f5b256b | 2003-10-03 20:26:25 +0000 | [diff] [blame] | 449 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 503bad0 | 2006-06-09 18:24:37 +0000 | [diff] [blame] | 450 | void disable_mouse_support(void); |
| 451 | void enable_mouse_support(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 452 | void mouse_init(void); |
David Lawrence Ramsey | 9b13ff3 | 2002-12-22 16:30:00 +0000 | [diff] [blame] | 453 | #endif |
David Lawrence Ramsey | 660e05b | 2006-05-12 19:30:28 +0000 | [diff] [blame] | 454 | void print_opt_full(const char *shortflag |
David Lawrence Ramsey | 39e8ce6 | 2005-03-21 07:24:47 +0000 | [diff] [blame] | 455 | #ifdef HAVE_GETOPT_LONG |
| 456 | , const char *longflag |
| 457 | #endif |
| 458 | , const char *desc); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 459 | void usage(void); |
| 460 | void version(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 461 | void do_exit(void); |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 462 | void close_and_go(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 463 | void signal_init(void); |
David Lawrence Ramsey | 8befda6 | 2005-12-06 19:39:56 +0000 | [diff] [blame] | 464 | RETSIGTYPE handle_hupterm(int signal); |
| 465 | RETSIGTYPE do_suspend(int signal); |
| 466 | RETSIGTYPE do_continue(int signal); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 467 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8befda6 | 2005-12-06 19:39:56 +0000 | [diff] [blame] | 468 | RETSIGTYPE handle_sigwinch(int signal); |
Benno Schulenberg | 75d64e6 | 2015-05-28 13:02:29 +0000 | [diff] [blame] | 469 | void regenerate_screen(void); |
Benno Schulenberg | 9e6b9a2 | 2016-01-04 10:37:11 +0000 | [diff] [blame] | 470 | void allow_sigwinch(bool allow); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 471 | void do_toggle(int flag); |
Benno Schulenberg | 03bcaf6 | 2015-03-08 12:10:52 +0000 | [diff] [blame] | 472 | void do_toggle_void(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 473 | void enable_signals(void); |
| 474 | #endif |
| 475 | void disable_flow_control(void); |
| 476 | void enable_flow_control(void); |
David Lawrence Ramsey | 8aaf030 | 2004-07-27 16:46:35 +0000 | [diff] [blame] | 477 | void terminal_init(void); |
Benno Schulenberg | e0c4f9c | 2016-04-27 14:37:31 +0200 | [diff] [blame] | 478 | void unbound_key(int code); |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 479 | int do_input(bool allow_funcs); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 480 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 3a5eaeb | 2007-05-20 23:41:56 +0000 | [diff] [blame] | 481 | int do_mouse(void); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 482 | #endif |
David Lawrence Ramsey | efec641 | 2005-03-17 03:52:08 +0000 | [diff] [blame] | 483 | void do_output(char *output, size_t output_len, bool allow_cntrls); |
Chris Allegretta | f2387fb | 2002-04-10 02:31:20 +0000 | [diff] [blame] | 484 | |
Benno Schulenberg | 379b155 | 2016-12-03 20:37:30 +0100 | [diff] [blame] | 485 | /* Most functions in prompt.c. */ |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 486 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 3a5eaeb | 2007-05-20 23:41:56 +0000 | [diff] [blame] | 487 | int do_statusbar_mouse(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 488 | #endif |
Benno Schulenberg | e540053 | 2016-02-14 12:03:47 +0000 | [diff] [blame] | 489 | void do_statusbar_output(int *the_input, size_t input_len, |
Benno Schulenberg | 908663e | 2016-12-27 12:20:20 +0100 | [diff] [blame] | 490 | bool filtering); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 491 | void do_statusbar_home(void); |
| 492 | void do_statusbar_end(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 493 | void do_statusbar_left(void); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 494 | void do_statusbar_right(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 495 | void do_statusbar_backspace(void); |
| 496 | void do_statusbar_delete(void); |
| 497 | void do_statusbar_cut_text(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 498 | #ifndef NANO_TINY |
Benno Schulenberg | eed1aab | 2016-01-24 15:42:45 +0000 | [diff] [blame] | 499 | void do_statusbar_prev_word(void); |
Benno Schulenberg | c115166 | 2016-02-22 12:49:08 +0000 | [diff] [blame] | 500 | void do_statusbar_next_word(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 501 | #endif |
Benno Schulenberg | 908663e | 2016-12-27 12:20:20 +0100 | [diff] [blame] | 502 | void do_statusbar_verbatim_input(void); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 503 | size_t statusbar_xplustabs(void); |
| 504 | size_t get_statusbar_page_start(size_t start_col, size_t column); |
Benno Schulenberg | 34a20f8 | 2016-04-17 15:24:05 +0200 | [diff] [blame] | 505 | void reinit_statusbar_x(void); |
David Lawrence Ramsey | e19449e | 2005-11-07 21:45:44 +0000 | [diff] [blame] | 506 | void reset_statusbar_cursor(void); |
Benno Schulenberg | d844f05 | 2016-02-06 11:40:15 +0000 | [diff] [blame] | 507 | void update_the_statusbar(void); |
Benno Schulenberg | fd0589d | 2017-01-02 21:12:44 +0100 | [diff] [blame] | 508 | int do_prompt(bool allow_tabs, bool allow_files, |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 509 | int menu, const char *curranswer, |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 510 | #ifndef DISABLE_HISTORIES |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 511 | filestruct **history_list, |
| 512 | #endif |
David Lawrence Ramsey | 6816007 | 2006-02-18 21:32:29 +0000 | [diff] [blame] | 513 | void (*refresh_func)(void), const char *msg, ...); |
David Lawrence Ramsey | e19449e | 2005-11-07 21:45:44 +0000 | [diff] [blame] | 514 | int do_yesno_prompt(bool all, const char *msg); |
David Lawrence Ramsey | d24d0a4 | 2005-11-01 17:37:44 +0000 | [diff] [blame] | 515 | |
Benno Schulenberg | cf4f80d | 2014-05-12 13:52:50 +0000 | [diff] [blame] | 516 | /* Most functions in rcfile.c. */ |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 517 | #if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES) |
| 518 | char *parse_next_word(char *ptr); |
| 519 | #endif |
Benno Schulenberg | eea0908 | 2014-04-13 20:50:20 +0000 | [diff] [blame] | 520 | #ifndef DISABLE_NANORC |
Benno Schulenberg | 0038992 | 2014-04-04 11:59:03 +0000 | [diff] [blame] | 521 | #ifndef DISABLE_COLOR |
Benno Schulenberg | 1663994 | 2014-05-03 18:24:45 +0000 | [diff] [blame] | 522 | bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright); |
Benno Schulenberg | ed29652 | 2016-03-10 11:00:59 +0000 | [diff] [blame] | 523 | void grab_and_store(const char *kind, char *ptr, regexlisttype **storage); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 524 | #endif |
Benno Schulenberg | 77023a7 | 2016-11-27 16:34:34 +0100 | [diff] [blame] | 525 | void parse_rcfile(FILE *rcstream, bool syntax_only); |
Benno Schulenberg | c1a4842 | 2016-11-27 18:21:04 +0100 | [diff] [blame] | 526 | void do_rcfiles(void); |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 527 | #endif /* !DISABLE_NANORC */ |
Chris Allegretta | 8d8e012 | 2001-04-18 04:28:54 +0000 | [diff] [blame] | 528 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 529 | /* All functions in search.c. */ |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 530 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | 0ec34ac | 2007-01-09 23:35:02 +0000 | [diff] [blame] | 531 | bool regexp_init(const char *regexp); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 532 | void regexp_cleanup(void); |
| 533 | #endif |
| 534 | void not_found_msg(const char *str); |
David Lawrence Ramsey | 6d6a36c | 2005-12-08 07:09:08 +0000 | [diff] [blame] | 535 | void search_replace_abort(void); |
David Lawrence Ramsey | d532f19 | 2004-10-04 22:37:56 +0000 | [diff] [blame] | 536 | int search_init(bool replacing, bool use_answer); |
Benno Schulenberg | 8f10e36 | 2017-02-10 13:51:51 +0100 | [diff] [blame] | 537 | int findnextstr(const char *needle, bool whole_word_only, bool have_region, |
| 538 | size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 539 | void do_search(void); |
Benno Schulenberg | 4990f74 | 2015-07-26 09:23:24 +0000 | [diff] [blame] | 540 | #ifndef NANO_TINY |
| 541 | void do_findprevious(void); |
| 542 | void do_findnext(void); |
| 543 | #endif |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 544 | void do_research(void); |
Benno Schulenberg | 2848771 | 2016-04-04 19:38:57 +0200 | [diff] [blame] | 545 | void go_looking(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 546 | #ifdef HAVE_REGEX_H |
David Lawrence Ramsey | e3970f5 | 2005-05-26 03:47:24 +0000 | [diff] [blame] | 547 | int replace_regexp(char *string, bool create); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 548 | #endif |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 549 | char *replace_line(const char *needle); |
Benno Schulenberg | 2cd8ca4 | 2016-10-23 17:59:26 +0200 | [diff] [blame] | 550 | ssize_t do_replace_loop(const char *needle, bool whole_word_only, |
| 551 | const filestruct *real_current, size_t *real_current_x); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 552 | void do_replace(void); |
Benno Schulenberg | 8f0262f | 2015-12-31 16:49:07 +0000 | [diff] [blame] | 553 | void goto_line_posx(ssize_t line, size_t pos_x); |
David Lawrence Ramsey | 5beae58 | 2005-06-29 00:17:18 +0000 | [diff] [blame] | 554 | void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer, |
Benno Schulenberg | 46db638 | 2015-12-31 19:20:40 +0000 | [diff] [blame] | 555 | bool interactive); |
David Lawrence Ramsey | 9245f97 | 2005-05-17 18:06:26 +0000 | [diff] [blame] | 556 | void do_gotolinecolumn_void(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 557 | #ifndef NANO_TINY |
David Lawrence Ramsey | c5c5230 | 2005-11-15 23:45:29 +0000 | [diff] [blame] | 558 | bool find_bracket_match(bool reverse, const char *bracket_set); |
David Lawrence Ramsey | c4ca596 | 2005-06-16 20:58:19 +0000 | [diff] [blame] | 559 | void do_find_bracket(void); |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 560 | #ifndef DISABLE_TABCOMP |
Benno Schulenberg | e86dc03 | 2016-02-20 12:16:43 +0000 | [diff] [blame] | 561 | char *get_history_completion(filestruct **h, char *s, size_t len); |
David Lawrence Ramsey | 1addd60 | 2005-06-03 19:28:30 +0000 | [diff] [blame] | 562 | #endif |
Benno Schulenberg | b341f29 | 2014-06-19 20:05:24 +0000 | [diff] [blame] | 563 | #endif |
| 564 | #ifndef DISABLE_HISTORIES |
| 565 | bool history_has_changed(void); |
Chris Allegretta | 5beed50 | 2003-01-05 20:41:21 +0000 | [diff] [blame] | 566 | void history_init(void); |
David Lawrence Ramsey | 0e581b3 | 2005-07-18 07:48:50 +0000 | [diff] [blame] | 567 | void history_reset(const filestruct *h); |
David Lawrence Ramsey | 96e6d56 | 2005-07-19 04:53:45 +0000 | [diff] [blame] | 568 | filestruct *find_history(const filestruct *h_start, const filestruct |
| 569 | *h_end, const char *s, size_t len); |
David Lawrence Ramsey | 34bdc35 | 2005-06-02 18:41:31 +0000 | [diff] [blame] | 570 | void update_history(filestruct **h, const char *s); |
David Lawrence Ramsey | 934f968 | 2005-05-23 16:30:06 +0000 | [diff] [blame] | 571 | char *get_history_older(filestruct **h); |
| 572 | char *get_history_newer(filestruct **h); |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 573 | void get_history_older_void(void); |
| 574 | void get_history_newer_void(void); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 575 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 576 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 577 | /* All functions in text.c. */ |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 578 | #ifndef NANO_TINY |
David Lawrence Ramsey | 7ea09e5 | 2005-07-25 02:41:59 +0000 | [diff] [blame] | 579 | void do_mark(void); |
| 580 | #endif |
| 581 | void do_delete(void); |
| 582 | void do_backspace(void); |
Benno Schulenberg | b3e4051 | 2015-07-31 11:52:26 +0000 | [diff] [blame] | 583 | #ifndef NANO_TINY |
| 584 | void do_cut_prev_word(void); |
| 585 | void do_cut_next_word(void); |
| 586 | #endif |
David Lawrence Ramsey | 7ea09e5 | 2005-07-25 02:41:59 +0000 | [diff] [blame] | 587 | void do_tab(void); |
David Lawrence Ramsey | f85001a | 2006-04-28 13:19:56 +0000 | [diff] [blame] | 588 | #ifndef NANO_TINY |
David Lawrence Ramsey | aee00d4 | 2006-07-05 18:42:22 +0000 | [diff] [blame] | 589 | void do_indent(ssize_t cols); |
| 590 | void do_indent_void(void); |
| 591 | void do_unindent(void); |
David Lawrence Ramsey | f85001a | 2006-04-28 13:19:56 +0000 | [diff] [blame] | 592 | #endif |
Benno Schulenberg | 08cd197 | 2016-09-08 21:00:51 +0200 | [diff] [blame] | 593 | bool white_string(const char *s); |
| 594 | #ifdef ENABLE_COMMENT |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 595 | void do_comment(void); |
Benno Schulenberg | 9fa95a3 | 2016-12-15 13:04:52 +0100 | [diff] [blame] | 596 | bool comment_line(undo_type action, filestruct *f, const char *comment_seq); |
Mike Scalora | 6a2032f | 2016-05-25 22:13:50 +0200 | [diff] [blame] | 597 | #endif |
Benno Schulenberg | 9fa95a3 | 2016-12-15 13:04:52 +0100 | [diff] [blame] | 598 | void do_undo(void); |
| 599 | void do_redo(void); |
Benno Schulenberg | 54c2f6b | 2015-11-11 19:04:31 +0000 | [diff] [blame] | 600 | void do_enter(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 601 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8befda6 | 2005-12-06 19:39:56 +0000 | [diff] [blame] | 602 | RETSIGTYPE cancel_command(int signal); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 603 | bool execute_command(const char *command); |
Benno Schulenberg | 9fa95a3 | 2016-12-15 13:04:52 +0100 | [diff] [blame] | 604 | void discard_until(const undo *thisitem, openfilestruct *thefile); |
| 605 | void add_undo(undo_type action); |
| 606 | #ifndef DISABLE_COMMENT |
| 607 | void update_comment_undo(ssize_t lineno); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 608 | #endif |
Benno Schulenberg | 9fa95a3 | 2016-12-15 13:04:52 +0100 | [diff] [blame] | 609 | void update_undo(undo_type action); |
| 610 | #endif /* !NANO_TINY */ |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 611 | #ifndef DISABLE_WRAPPING |
| 612 | void wrap_reset(void); |
Benno Schulenberg | be10c2a | 2014-06-09 10:01:54 +0000 | [diff] [blame] | 613 | bool do_wrap(filestruct *line); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 614 | #endif |
David Lawrence Ramsey | c7c04bb | 2005-11-29 21:30:00 +0000 | [diff] [blame] | 615 | #if !defined(DISABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY) |
David Lawrence Ramsey | b9b2fd5 | 2005-11-22 21:13:36 +0000 | [diff] [blame] | 616 | ssize_t break_line(const char *line, ssize_t goal |
| 617 | #ifndef DISABLE_HELP |
Chris Allegretta | 8b6461f | 2008-05-31 23:09:40 +0000 | [diff] [blame] | 618 | , bool newln |
David Lawrence Ramsey | b9b2fd5 | 2005-11-22 21:13:36 +0000 | [diff] [blame] | 619 | #endif |
| 620 | ); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 621 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 622 | #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 623 | size_t indent_length(const char *line); |
| 624 | #endif |
| 625 | #ifndef DISABLE_JUSTIFY |
| 626 | void justify_format(filestruct *paragraph, size_t skip); |
| 627 | size_t quote_length(const char *line); |
| 628 | bool quotes_match(const char *a_line, size_t a_quote, const char |
| 629 | *b_line); |
| 630 | bool indents_match(const char *a_line, size_t a_indent, const char |
| 631 | *b_line, size_t b_indent); |
| 632 | bool begpar(const filestruct *const foo); |
| 633 | bool inpar(const filestruct *const foo); |
David Lawrence Ramsey | cd8f735 | 2005-11-10 21:20:32 +0000 | [diff] [blame] | 634 | void backup_lines(filestruct *first_line, size_t par_len); |
David Lawrence Ramsey | 79383be | 2005-11-29 18:34:45 +0000 | [diff] [blame] | 635 | bool find_paragraph(size_t *const quote, size_t *const par); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 636 | void do_justify(bool full_justify); |
| 637 | void do_justify_void(void); |
| 638 | void do_full_justify(void); |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 639 | #endif |
David Lawrence Ramsey | cc8185f | 2005-07-25 02:33:45 +0000 | [diff] [blame] | 640 | #ifndef DISABLE_SPELLER |
| 641 | bool do_int_spell_fix(const char *word); |
| 642 | const char *do_int_speller(const char *tempfile_name); |
| 643 | const char *do_alt_speller(char *tempfile_name); |
| 644 | void do_spell(void); |
| 645 | #endif |
Benno Schulenberg | 24d9f31 | 2014-04-21 13:00:49 +0000 | [diff] [blame] | 646 | #ifndef DISABLE_COLOR |
| 647 | void do_linter(void); |
Chris Allegretta | 4b3f277 | 2015-01-03 07:24:17 +0000 | [diff] [blame] | 648 | void do_formatter(void); |
Benno Schulenberg | 24d9f31 | 2014-04-21 13:00:49 +0000 | [diff] [blame] | 649 | #endif |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 650 | #ifndef NANO_TINY |
David Lawrence Ramsey | 8e94234 | 2005-07-25 04:21:46 +0000 | [diff] [blame] | 651 | void do_wordlinechar_count(void); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 652 | #endif |
David Lawrence Ramsey | 37ddfa9 | 2005-11-07 06:06:05 +0000 | [diff] [blame] | 653 | void do_verbatim_input(void); |
Sumedh Pendurkar | dca4ab5 | 2016-12-07 09:43:47 +0530 | [diff] [blame] | 654 | void complete_a_word(void); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 655 | |
David Lawrence Ramsey | 6335fb5 | 2007-01-01 05:15:32 +0000 | [diff] [blame] | 656 | /* All functions in utils.c. */ |
David Lawrence Ramsey | 65e6ecb | 2005-02-08 20:37:53 +0000 | [diff] [blame] | 657 | void get_homedir(void); |
David Lawrence Ramsey | bd920b1 | 2016-12-09 11:36:01 -0600 | [diff] [blame] | 658 | #ifdef ENABLE_LINENUMBERS |
| 659 | int digits(ssize_t n); |
| 660 | #endif |
David Lawrence Ramsey | c53ab2a | 2004-08-04 18:24:53 +0000 | [diff] [blame] | 661 | bool parse_num(const char *str, ssize_t *val); |
David Lawrence Ramsey | 2cf6d71 | 2005-06-28 06:25:34 +0000 | [diff] [blame] | 662 | bool parse_line_column(const char *str, ssize_t *line, ssize_t *column); |
Benno Schulenberg | 8c7e4f5 | 2016-12-16 20:34:38 +0100 | [diff] [blame] | 663 | void snuggly_fit(char **str); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 664 | void null_at(char **data, size_t index); |
| 665 | void unsunder(char *str, size_t true_len); |
| 666 | void sunder(char *str); |
Benno Schulenberg | eea0908 | 2014-04-13 20:50:20 +0000 | [diff] [blame] | 667 | #if !defined(NANO_TINY) && !defined(DISABLE_NANORC) |
David Lawrence Ramsey | a27bd65 | 2004-08-17 05:23:38 +0000 | [diff] [blame] | 668 | #ifndef HAVE_GETLINE |
| 669 | ssize_t ngetline(char **lineptr, size_t *n, FILE *stream); |
| 670 | #endif |
| 671 | #ifndef HAVE_GETDELIM |
| 672 | ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream); |
| 673 | #endif |
David Lawrence Ramsey | bbac1bb | 2005-11-14 21:32:42 +0000 | [diff] [blame] | 674 | #endif |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 675 | #ifdef HAVE_REGEX_H |
Chris Allegretta | 6b83e52 | 2008-08-30 05:16:20 +0000 | [diff] [blame] | 676 | const char *fixbounds(const char *r); |
David Lawrence Ramsey | 691698a | 2005-07-24 19:57:51 +0000 | [diff] [blame] | 677 | #endif |
David Lawrence Ramsey | cf9c34a | 2005-11-16 05:59:06 +0000 | [diff] [blame] | 678 | #ifndef DISABLE_SPELLER |
Benno Schulenberg | cc0a3d8 | 2016-05-02 22:20:19 +0200 | [diff] [blame] | 679 | bool is_separate_word(size_t position, size_t length, const char *buf); |
David Lawrence Ramsey | cf9c34a | 2005-11-16 05:59:06 +0000 | [diff] [blame] | 680 | #endif |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 681 | const char *strstrwrapper(const char *haystack, const char *needle, |
David Lawrence Ramsey | 1044d74 | 2004-02-24 20:41:39 +0000 | [diff] [blame] | 682 | const char *start); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 683 | void nperror(const char *s); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 684 | void *nmalloc(size_t howmuch); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 685 | void *nrealloc(void *ptr, size_t howmuch); |
David Lawrence Ramsey | 4a1fc55 | 2004-11-02 15:18:30 +0000 | [diff] [blame] | 686 | char *mallocstrncpy(char *dest, const char *src, size_t n); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 687 | char *mallocstrcpy(char *dest, const char *src); |
Benno Schulenberg | 8b28de1 | 2016-07-13 15:04:40 +0200 | [diff] [blame] | 688 | char *free_and_assign(char *dest, char *src); |
David Lawrence Ramsey | 2b9d6a0 | 2005-11-01 17:45:31 +0000 | [diff] [blame] | 689 | size_t get_page_start(size_t column); |
David Lawrence Ramsey | 81c4e18 | 2005-10-31 23:07:58 +0000 | [diff] [blame] | 690 | size_t xplustabs(void); |
| 691 | size_t actual_x(const char *s, size_t column); |
| 692 | size_t strnlenpt(const char *s, size_t maxlen); |
| 693 | size_t strlenpt(const char *s); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 694 | void new_magicline(void); |
David Lawrence Ramsey | ebe3425 | 2005-11-15 03:17:35 +0000 | [diff] [blame] | 695 | #ifndef NANO_TINY |
David Lawrence Ramsey | 40bdb68 | 2004-11-03 22:03:41 +0000 | [diff] [blame] | 696 | void remove_magicline(void); |
David Lawrence Ramsey | f708037 | 2004-07-08 17:15:10 +0000 | [diff] [blame] | 697 | void mark_order(const filestruct **top, size_t *top_x, const filestruct |
David Lawrence Ramsey | 90e59c1 | 2004-11-05 23:03:03 +0000 | [diff] [blame] | 698 | **bot, size_t *bot_x, bool *right_side_up); |
David Lawrence Ramsey | 5ffbec5 | 2003-09-16 01:16:49 +0000 | [diff] [blame] | 699 | #endif |
David Lawrence Ramsey | c104ef1 | 2005-07-17 01:44:35 +0000 | [diff] [blame] | 700 | size_t get_totsize(const filestruct *begin, const filestruct *end); |
Benno Schulenberg | d6cc2c4 | 2016-12-15 12:45:02 +0100 | [diff] [blame] | 701 | #ifndef NANO_TINY |
Chris Allegretta | 14c8620 | 2008-08-03 04:48:05 +0000 | [diff] [blame] | 702 | filestruct *fsfromline(ssize_t lineno); |
Benno Schulenberg | d6cc2c4 | 2016-12-15 12:45:02 +0100 | [diff] [blame] | 703 | #endif |
David Lawrence Ramsey | 00cc565 | 2005-11-02 15:44:01 +0000 | [diff] [blame] | 704 | #ifdef DEBUG |
| 705 | void dump_filestruct(const filestruct *inptr); |
| 706 | void dump_filestruct_reverse(void); |
| 707 | #endif |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 708 | |
Benno Schulenberg | 46082bd | 2015-12-22 19:00:25 +0000 | [diff] [blame] | 709 | /* Most functions in winio.c. */ |
David Lawrence Ramsey | db95802 | 2005-07-13 20:18:46 +0000 | [diff] [blame] | 710 | void get_key_buffer(WINDOW *win); |
| 711 | size_t get_key_buffer_len(void); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 712 | void unget_input(int *input, size_t input_len); |
Benno Schulenberg | 91951ab | 2016-07-23 14:01:38 +0200 | [diff] [blame] | 713 | void unget_kbinput(int kbinput, bool metakey); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 714 | int *get_input(WINDOW *win, size_t input_len); |
Benno Schulenberg | 7e5324d | 2014-06-30 18:04:33 +0000 | [diff] [blame] | 715 | int get_kbinput(WINDOW *win); |
| 716 | int parse_kbinput(WINDOW *win); |
Benno Schulenberg | 46082bd | 2015-12-22 19:00:25 +0000 | [diff] [blame] | 717 | int arrow_from_abcd(int kbinput); |
| 718 | int parse_escape_sequence(WINDOW *win, int kbinput); |
David Lawrence Ramsey | fc0f8f8 | 2006-05-10 13:41:53 +0000 | [diff] [blame] | 719 | int get_byte_kbinput(int kbinput); |
David Lawrence Ramsey | 6fb6689 | 2006-05-27 17:39:19 +0000 | [diff] [blame] | 720 | #ifdef ENABLE_UTF8 |
David Lawrence Ramsey | 12e3708 | 2006-05-27 15:52:26 +0000 | [diff] [blame] | 721 | long add_unicode_digit(int kbinput, long factor, long *uni); |
David Lawrence Ramsey | fc0ddab | 2016-07-24 12:34:56 +0200 | [diff] [blame] | 722 | long get_unicode_kbinput(WINDOW *win, int kbinput); |
David Lawrence Ramsey | 6fb6689 | 2006-05-27 17:39:19 +0000 | [diff] [blame] | 723 | #endif |
David Lawrence Ramsey | 48ae986 | 2004-05-28 17:23:33 +0000 | [diff] [blame] | 724 | int get_control_kbinput(int kbinput); |
David Lawrence Ramsey | b54155c | 2005-01-12 03:25:57 +0000 | [diff] [blame] | 725 | void unparse_kbinput(char *output, size_t output_len); |
David Lawrence Ramsey | 7483571 | 2004-12-04 17:41:52 +0000 | [diff] [blame] | 726 | int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len); |
Benno Schulenberg | 08c51cf | 2016-07-16 19:44:24 +0200 | [diff] [blame] | 727 | int *parse_verbatim_kbinput(WINDOW *win, size_t *count); |
David Lawrence Ramsey | 14bf803 | 2004-05-22 20:19:15 +0000 | [diff] [blame] | 728 | #ifndef DISABLE_MOUSE |
David Lawrence Ramsey | 3a5eaeb | 2007-05-20 23:41:56 +0000 | [diff] [blame] | 729 | int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts); |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 730 | #endif |
Benno Schulenberg | 49816fe | 2014-07-01 10:41:10 +0000 | [diff] [blame] | 731 | const sc *get_shortcut(int *kbinput); |
Benno Schulenberg | f7d320d | 2017-01-12 17:48:33 +0100 | [diff] [blame] | 732 | void blank_row(WINDOW *win, int y, int x, int n); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 733 | void blank_titlebar(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 734 | void blank_edit(void); |
| 735 | void blank_statusbar(void); |
David Lawrence Ramsey | d7fd200 | 2004-05-18 01:20:36 +0000 | [diff] [blame] | 736 | void blank_bottombars(void); |
David Lawrence Ramsey | b9ddb80 | 2005-03-17 17:56:48 +0000 | [diff] [blame] | 737 | void check_statusblank(void); |
Benno Schulenberg | a37cd9f | 2016-06-14 19:56:16 +0200 | [diff] [blame] | 738 | char *display_string(const char *buf, size_t start_col, size_t span, |
| 739 | bool dollars); |
Chris Allegretta | f717f98 | 2003-02-13 22:25:01 +0000 | [diff] [blame] | 740 | void titlebar(const char *path); |
Chris Allegretta | 4b3f277 | 2015-01-03 07:24:17 +0000 | [diff] [blame] | 741 | extern void set_modified(void); |
Benno Schulenberg | 2535f51 | 2016-04-30 17:31:43 +0200 | [diff] [blame] | 742 | void statusbar(const char *msg); |
David Lawrence Ramsey | e4d4524 | 2016-11-27 15:01:54 -0600 | [diff] [blame] | 743 | void warn_and_shortly_pause(const char *msg); |
Benno Schulenberg | c8f530a | 2016-05-19 20:43:08 +0200 | [diff] [blame] | 744 | void statusline(message_type importance, const char *msg, ...); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 745 | void bottombars(int menu); |
Benno Schulenberg | 7f3dc2d | 2016-03-23 20:21:36 +0000 | [diff] [blame] | 746 | void onekey(const char *keystroke, const char *desc, int length); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 747 | void reset_cursor(void); |
Benno Schulenberg | c0aa5ad | 2017-01-09 18:25:25 +0100 | [diff] [blame] | 748 | void edit_draw(filestruct *fileptr, const char *converted, |
| 749 | int line, size_t from_col); |
Chris Allegretta | 05417a2 | 2009-08-17 07:52:10 +0000 | [diff] [blame] | 750 | int update_line(filestruct *fileptr, size_t index); |
Benno Schulenberg | 2f66476 | 2016-07-26 19:47:00 +0200 | [diff] [blame] | 751 | bool need_horizontal_scroll(const size_t old_column, const size_t new_column); |
David Lawrence Ramsey | b1b9770 | 2017-01-15 12:17:19 -0600 | [diff] [blame] | 752 | void edit_scroll(scroll_dir direction, int nrows); |
Benno Schulenberg | aa1ae0a | 2016-04-10 21:16:19 +0200 | [diff] [blame] | 753 | void edit_redraw(filestruct *old_current); |
Chris Allegretta | 6df90f5 | 2002-07-19 01:08:59 +0000 | [diff] [blame] | 754 | void edit_refresh(void); |
Benno Schulenberg | 01bbf7e | 2016-10-20 21:11:11 +0200 | [diff] [blame] | 755 | void adjust_viewport(update_type location); |
David Lawrence Ramsey | c54c4d1 | 2005-06-18 15:49:17 +0000 | [diff] [blame] | 756 | void total_redraw(void); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 757 | void total_refresh(void); |
David Lawrence Ramsey | ad40fdb | 2002-09-06 20:35:28 +0000 | [diff] [blame] | 758 | void display_main_list(void); |
David Lawrence Ramsey | a0b5ba2 | 2004-08-25 15:39:10 +0000 | [diff] [blame] | 759 | void do_cursorpos(bool constant); |
David Lawrence Ramsey | 72e51ab | 2004-07-02 14:31:03 +0000 | [diff] [blame] | 760 | void do_cursorpos_void(void); |
Benno Schulenberg | c98afde | 2016-03-30 12:09:39 +0000 | [diff] [blame] | 761 | void spotlight(bool active, const char *word); |
Chris Allegretta | 79a33bb | 2008-03-05 07:34:01 +0000 | [diff] [blame] | 762 | void xon_complaint(void); |
| 763 | void xoff_complaint(void); |
Chris Allegretta | 0018d8e | 2008-03-13 08:23:52 +0000 | [diff] [blame] | 764 | void do_suspend_void(void); |
Chris Allegretta | 0dc26dc | 2009-01-24 22:40:41 +0000 | [diff] [blame] | 765 | void enable_nodelay(void); |
| 766 | void disable_nodelay(void); |
Benno Schulenberg | d17438b | 2014-04-03 20:57:44 +0000 | [diff] [blame] | 767 | #ifndef DISABLE_EXTRA |
Chris Allegretta | 34318ed | 2001-01-31 23:22:36 +0000 | [diff] [blame] | 768 | void do_credits(void); |
Chris Allegretta | 8a0de3b | 2000-11-24 20:45:14 +0000 | [diff] [blame] | 769 | #endif |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 770 | |
Benno Schulenberg | d19be5a | 2014-04-08 18:38:45 +0000 | [diff] [blame] | 771 | /* May as well throw these here, since they are just placeholders. */ |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 772 | void do_cancel(void); |
| 773 | void case_sens_void(void); |
| 774 | void regexp_void(void); |
| 775 | void gototext_void(void); |
| 776 | void to_files_void(void); |
| 777 | void dos_format_void(void); |
| 778 | void mac_format_void(void); |
| 779 | void append_void(void); |
| 780 | void prepend_void(void); |
| 781 | void backup_file_void(void); |
Benno Schulenberg | 8cc6308 | 2015-12-23 16:34:44 +0000 | [diff] [blame] | 782 | void discard_buffer(void); |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 783 | void new_buffer_void(void); |
| 784 | void backwards_void(void); |
| 785 | void goto_dir_void(void); |
Benno Schulenberg | a0f66c0 | 2014-06-23 18:30:35 +0000 | [diff] [blame] | 786 | void flip_replace_void(void); |
Benno Schulenberg | 04a38da | 2014-06-04 19:15:16 +0000 | [diff] [blame] | 787 | void flip_execute_void(void); |
Chris Allegretta | 637daa8 | 2011-02-07 14:45:56 +0000 | [diff] [blame] | 788 | |
David Lawrence Ramsey | e527e45 | 2005-04-15 18:07:26 +0000 | [diff] [blame] | 789 | #endif /* !PROTO_H */ |