proto.h 21.8 KB
Newer Older
Chris Allegretta's avatar
Chris Allegretta committed
1
/**************************************************************************
2
 *   proto.h  --  This file is part of GNU nano.                          *
Chris Allegretta's avatar
Chris Allegretta committed
3
 *                                                                        *
4
 *   Copyright (C) 1999-2011, 2013-2018 Free Software Foundation, Inc.    *
Chris Allegretta's avatar
Chris Allegretta committed
5
 *                                                                        *
6
7
8
9
10
11
12
13
14
 *   GNU nano 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.                               *
 *                                                                        *
 *   GNU nano is distributed in the hope that it will be useful,          *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty          *
 *   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.              *
 *   See the GNU General Public License for more details.                 *
Chris Allegretta's avatar
Chris Allegretta committed
15
16
 *                                                                        *
 *   You should have received a copy of the GNU General Public License    *
17
 *   along with this program.  If not, see http://www.gnu.org/licenses/.  *
Chris Allegretta's avatar
Chris Allegretta committed
18
19
20
 *                                                                        *
 **************************************************************************/

21
22
23
#ifndef PROTO_H
#define PROTO_H 1

Chris Allegretta's avatar
Chris Allegretta committed
24
25
#include "nano.h"

26
/* All external variables.  See global.c for their descriptions. */
27

28
#ifndef NANO_TINY
29
extern volatile sig_atomic_t the_window_resized;
30
31
#endif

32
#ifdef __linux__
33
extern bool on_a_vt;
34
35
#endif

36
extern bool meta_key;
37
38
extern bool shift_held;

39
extern bool focusing;
40

41
42
extern bool as_an_at;

43
44
45
extern int margin;
extern int editwincols;

46
47
extern bool suppress_cursorpos;

48
extern message_type lastmessage;
49

50
51
extern filestruct *pletion_line;

52
53
54
extern bool inhelp;
extern char *title;

55
56
extern bool more_than_one;

57
58
extern bool also_the_last;

59
60
extern int didfind;

61
62
extern int controlleft;
extern int controlright;
63
64
extern int controlup;
extern int controldown;
65
66
extern int controlhome;
extern int controlend;
67
#ifndef NANO_TINY
68
69
70
71
extern int shiftcontrolleft;
extern int shiftcontrolright;
extern int shiftcontrolup;
extern int shiftcontroldown;
72
73
extern int shiftcontrolhome;
extern int shiftcontrolend;
74
75
76
77
extern int altleft;
extern int altright;
extern int altup;
extern int altdown;
78
79
80
81
extern int shiftaltleft;
extern int shiftaltright;
extern int shiftaltup;
extern int shiftaltdown;
82
83
#endif

84
#ifdef ENABLED_WRAPORJUSTIFY
85
extern ssize_t fill;
86
extern ssize_t wrap_at;
87
#endif
88
89
90

extern char *last_search;

91
92
extern char *present_path;

93
extern unsigned flags[4];
94
95
96
97
98
99
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;

extern filestruct *cutbuffer;
100
extern filestruct *cutbottom;
101
102
extern partition *filepart;
extern openfilestruct *openfile;
103
extern openfilestruct *firstfile;
Chris Allegretta's avatar
Chris Allegretta committed
104

105
106
#ifndef NANO_TINY
extern char *matchbrackets;
107
extern char *whitespace;
108
extern int whitespace_len[2];
109
110
#endif

111
112
extern const char *exit_tag;
extern const char *close_tag;
113
extern const char *uncut_tag;
114
#ifdef ENABLE_JUSTIFY
115
extern const char *unjust_tag;
116
117
extern char *punct;
extern char *brackets;
Chris Allegretta's avatar
Chris Allegretta committed
118
extern char *quotestr;
119
120
121
extern regex_t quotereg;
extern int quoterc;
extern char *quoteerr;
122
#endif
123

124
125
extern char *word_chars;

126
127
128
129
extern char *answer;

extern ssize_t tabsize;

130
#ifndef NANO_TINY
131
extern char *backup_dir;
132
133
extern const char *locking_prefix;
extern const char *locking_suffix;
134
#endif
135
#ifdef ENABLE_OPERATINGDIR
136
137
extern char *operating_dir;
#endif
138

139
#ifdef ENABLE_SPELLER
140
extern char *alt_speller;
Chris Allegretta's avatar
Chris Allegretta committed
141
142
#endif

143
#ifdef ENABLE_COLOR
144
145
extern syntaxtype *syntaxes;
extern char *syntaxstr;
146
extern bool have_palette;
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
147
#endif
148

149
extern bool refresh_needed;
150

151
extern int currmenu;
152
153
154
155
extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern subnfunc *uncutfunc;
156

157
extern filestruct *search_history;
158
159
extern filestruct *replace_history;
extern filestruct *execute_history;
160
#ifdef ENABLE_HISTORIES
161
extern filestruct *searchtop;
162
extern filestruct *searchbot;
163
extern filestruct *replacetop;
164
extern filestruct *replacebot;
165
166
extern filestruct *executetop;
extern filestruct *executebot;
167
extern poshiststruct *position_history;
168
169
#endif

170
171
172
extern regex_t search_regexp;
extern regmatch_t regmatches[10];

173
extern int hilite_attribute;
174
#ifdef ENABLE_COLOR
175
extern colortype *color_combo[NUMBER_OF_ELEMENTS];
176
#endif
177
extern int interface_color_pair[NUMBER_OF_ELEMENTS];
178

179
extern char *homedir;
180
extern char *statedir;
181
extern char *rcfile_with_errors;
182

183
184
typedef void (*functionptrtype)(void);

185
/* Most functions in browser.c. */
186
#ifdef ENABLE_BROWSER
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
187
char *do_browse_from(const char *inpath);
188
void read_the_list(const char *path, DIR *dir);
189
functionptrtype parse_browser_input(int *kbinput);
190
void browser_refresh(void);
191
void browser_select_dirname(const char *needle);
192
void do_filesearch(void);
193
void do_fileresearch(bool forwards);
194
195
void to_first_file(void);
void to_last_file(void);
196
char *strip_last_component(const char *path);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
197
198
#endif

199
/* Most functions in chars.c. */
200
201
202
203
#ifdef ENABLE_UTF8
void utf8_init(void);
bool using_utf8(void);
#endif
204
char *addstrings(char* str1, size_t len1, char* str2, size_t len2);
205
bool is_byte(int c);
206
bool is_alpha_mbchar(const char *c);
207
bool is_blank_mbchar(const char *c);
208
bool is_ascii_cntrl_char(int c);
209
bool is_cntrl_mbchar(const char *c);
210
bool is_word_mbchar(const char *c, bool allow_punct);
211
char control_mbrep(const char *c, bool isdata);
212
int length_of_char(const char *c, int *width);
213
int mbwidth(const char *c);
214
char *make_mbchar(long chr, int *chr_mb_len);
215
int parse_mbchar(const char *buf, char *chr, size_t *col);
216
217
size_t move_mbleft(const char *buf, size_t pos);
size_t move_mbright(const char *buf, size_t pos);
218
219
int mbstrcasecmp(const char *s1, const char *s2);
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
220
char *mbstrcasestr(const char *haystack, const char *needle);
221
222
char *revstrstr(const char *haystack, const char *needle, const char *index);
char *mbrevstrcasestr(const char *haystack, const char *needle, const char *index);
223
size_t mbstrlen(const char *s);
224
size_t mbstrnlen(const char *s, size_t maxlen);
225
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
226
227
char *mbstrchr(const char *s, const char *c);
#endif
228
#ifndef NANO_TINY
229
char *mbstrpbrk(const char *s, const char *accept);
230
231
char *revstrpbrk(const char *head, const char *accept, const char *index);
char *mbrevstrpbrk(const char *head, const char *accept, const char *index);
232
#endif
233
#if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY))
234
235
bool has_blank_mbchars(const char *s);
#endif
236
237
238
#ifdef ENABLE_UTF8
bool is_valid_unicode(wchar_t wc);
#endif
239
#ifdef ENABLE_NANORC
240
241
bool is_valid_mbstring(const char *s);
#endif
242

243
/* Most functions in color.c. */
244
#ifdef ENABLE_COLOR
245
void set_colorpairs(void);
246
void color_init(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
247
void color_update(void);
248
void check_the_multis(filestruct *line);
249
250
void alloc_multidata_if_needed(filestruct *fileptr);
void precalc_multicolorinfo(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
251
#endif
252

253
/* Most functions in cut.c. */
254
void cutbuffer_reset(void);
255
bool keeping_cutbuffer(void);
256
#ifndef NANO_TINY
257
void cut_marked(bool *right_side_up);
258
#endif
259
void do_cut_text(bool copy_text, bool cut_till_eof);
260
261
262
void do_cut_text_void(void);
#ifndef NANO_TINY
void do_copy_text(void);
263
void do_cut_till_eof(void);
264
#endif
265
void do_uncut_text(void);
Chris Allegretta's avatar
Chris Allegretta committed
266

267
/* Most functions in files.c. */
268
void initialize_buffer_text(void);
269
void set_modified(void);
270
bool open_buffer(const char *filename, bool new_buffer);
271
#ifdef ENABLE_SPELLER
272
void replace_buffer(const char *filename);
273
274
#ifndef NANO_TINY
void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
275
		filestruct *bot, size_t bot_x);
276
#endif
277
#endif
278
void prepare_for_display(void);
279
#ifdef ENABLE_MULTIBUFFER
280
281
void switch_to_prev_buffer(void);
void switch_to_next_buffer(void);
282
bool close_buffer(void);
283
#endif
284
void read_file(FILE *f, int fd, const char *filename, bool undoable);
285
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
286
char *get_next_filename(const char *name, const char *suffix);
287
void do_insertfile_void(void);
288
char *get_full_path(const char *origpath);
289
char *safe_tempfile(FILE **f);
290
#ifdef ENABLE_OPERATINGDIR
291
void init_operating_dir(void);
292
bool outside_of_confinement(const char *currpath, bool allow_tabcomp);
293
#endif
294
#ifndef NANO_TINY
295
void init_backup_dir(void);
296
int delete_lockfile(const char *lockfilename);
297
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
298
#endif
299
int copy_file(FILE *inn, FILE *out, bool close_out);
300
bool write_file(const char *name, FILE *f_open, bool tmp,
301
		kind_of_writing_type method, bool fullbuffer);
302
#ifndef NANO_TINY
303
bool write_marked_file(const char *name, FILE *f_open, bool tmp,
304
		kind_of_writing_type method);
305
#endif
306
int do_writeout(bool exiting, bool withprompt);
307
void do_writeout_void(void);
308
void do_savefile(void);
309
char *real_dir_from_tilde(const char *buf);
310
#if defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
311
312
int diralphasort(const void *va, const void *vb);
#endif
313
#ifdef ENABLE_TABCOMP
314
char *input_tab(char *buf, bool allow_files, size_t *place,
315
		bool *lastwastab, void (*refresh_func)(void), bool *listed);
Chris Allegretta's avatar
Chris Allegretta committed
316
#endif
317

318
/* Some functions in global.c. */
319
size_t length_of_list(int menu);
320
const sc *first_sc_for(int menu, void (*func)(void));
321
int the_code_for(void (*func)(void), int defaultval);
322
functionptrtype func_from_key(int *kbinput);
323
int keycode_from_string(const char *keystring);
324
void assign_keyinfo(sc *s, const char *keystring, const int keycode);
325
void print_sclist(void);
326
void shortcut_init(void);
327
#ifdef ENABLE_COLOR
328
void set_lint_or_format_shortcuts(void);
329
330
void set_spell_shortcuts(void);
#endif
331
const subnfunc *sctofunc(const sc *s);
332
const char *flagtostr(int flag);
333
334
sc *strtosc(const char *input);
int strtomenu(const char *input);
Chris Allegretta's avatar
Chris Allegretta committed
335
336
#ifdef DEBUG
void thanks_for_all_the_fish(void);
337
338
#endif

339
/* All functions in help.c. */
340
#ifdef ENABLE_HELP
341
void wrap_the_help_text(bool redisplaying);
342
void do_help(void);
343
void help_init(void);
344
functionptrtype parse_help_input(int *kbinput);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
345
size_t help_line_len(const char *ptr);
346
#endif
347
void do_help_void(void);
348

349
/* Most functions in history.c. */
350
#ifdef ENABLE_HISTORIES
351
352
353
354
355
356
357
358
359
360
void history_init(void);
void history_reset(const filestruct *h);
void update_history(filestruct **h, const char *s);
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
void get_history_older_void(void);
void get_history_newer_void(void);
#ifdef ENABLE_TABCOMP
char *get_history_completion(filestruct **h, char *s, size_t len);
#endif
361
bool have_statedir(void);
362
363
364
365
366
367
368
void load_history(void);
void save_history(void);
void load_poshistory(void);
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos);
bool has_old_position(const char *file, ssize_t *line, ssize_t *column);
#endif

369
/* Most functions in move.c. */
370
371
void to_first_line(void);
void to_last_line(void);
372
373
void do_page_up(void);
void do_page_down(void);
374
#ifdef ENABLE_JUSTIFY
375
376
void do_para_begin(bool update_screen);
void do_para_end(bool update_screen);
377
void do_para_begin_void(void);
378
379
void do_para_end_void(void);
#endif
380
381
void do_prev_block(void);
void do_next_block(void);
382
383
void do_prev_word(bool allow_punct, bool update_screen);
bool do_next_word(bool allow_punct, bool update_screen);
384
void do_prev_word_void(void);
385
void do_next_word_void(void);
386
387
void do_home(void);
void do_end(void);
388
389
void do_up(void);
void do_down(void);
390
#ifdef ENABLE_HELP
391
void do_scroll_up(void);
392
393
void do_scroll_down(void);
#endif
394
395
void do_left(void);
void do_right(void);
Chris Allegretta's avatar
Chris Allegretta committed
396

397
/* Most functions in nano.c. */
398
filestruct *make_new_node(filestruct *prevnode);
399
void splice_node(filestruct *afterthis, filestruct *newnode);
400
void unlink_node(filestruct *fileptr);
401
402
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
Chris Allegretta's avatar
Chris Allegretta committed
403
void free_filestruct(filestruct *src);
404
void renumber(filestruct *line);
405
partition *partition_filestruct(filestruct *top, size_t top_x,
406
		filestruct *bot, size_t bot_x);
407
void unpartition_filestruct(partition **p);
408
void extract_buffer(filestruct **file_top, filestruct **file_bot,
409
		filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
410
void ingraft_buffer(filestruct *somebuffer);
411
void copy_from_buffer(filestruct *somebuffer);
412
openfilestruct *make_new_opennode(void);
413
#ifdef ENABLE_MULTIBUFFER
414
415
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
416
#endif
417
void print_view_warning(void);
418
void show_restricted_warning(void);
419
#ifndef ENABLE_HELP
420
421
void say_there_is_no_help(void);
#endif
422
423
void finish(void);
void die(const char *msg, ...);
424
void emergency_save(const char *die_filename, struct stat *die_stat);
425
void window_init(void);
426
void do_exit(void);
427
void close_and_go(void);
428
429
430
RETSIGTYPE handle_hupterm(int signal);
RETSIGTYPE do_suspend(int signal);
RETSIGTYPE do_continue(int signal);
431
#ifndef NANO_TINY
432
RETSIGTYPE handle_sigwinch(int signal);
433
void regenerate_screen(void);
434
void allow_sigwinch(bool allow);
435
void do_toggle(int flag);
436
void do_toggle_void(void);
437
438
439
440
void enable_signals(void);
#endif
void disable_flow_control(void);
void enable_flow_control(void);
441
void terminal_init(void);
442
void unbound_key(int code);
443
bool okay_for_view(const sc *shortcut);
444
int do_input(bool allow_funcs);
445
void do_output(char *output, size_t output_len, bool allow_cntrls);
446

447
/* Most functions in prompt.c. */
448
void do_statusbar_output(int *the_input, size_t input_len, bool filtering);
449
450
451
void do_statusbar_home(void);
void do_statusbar_end(void);
void do_statusbar_left(void);
452
void do_statusbar_right(void);
453
454
455
void do_statusbar_backspace(void);
void do_statusbar_delete(void);
void do_statusbar_cut_text(void);
456
void do_statusbar_uncut_text(void);
457
#ifndef NANO_TINY
458
void do_statusbar_prev_word(void);
459
void do_statusbar_next_word(void);
460
#endif
461
void do_statusbar_verbatim_input(void);
462
463
size_t statusbar_xplustabs(void);
size_t get_statusbar_page_start(size_t start_col, size_t column);
464
void reinit_statusbar_x(void);
465
void update_the_statusbar(void);
466
int do_prompt(bool allow_tabs, bool allow_files,
467
468
		int menu, const char *curranswer, filestruct **history_list,
		void (*refresh_func)(void), const char *msg, ...);
469
int do_yesno_prompt(bool all, const char *msg);
470

471
/* Most functions in rcfile.c. */
472
#ifdef ENABLE_NANORC
473
#ifdef ENABLE_COLOR
474
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
475
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
476
#endif
477
void parse_rcfile(FILE *rcstream, bool syntax_only);
478
void do_rcfiles(void);
479
#endif /* ENABLE_NANORC */
480

481
/* Most functions in search.c. */
482
void not_found_msg(const char *str);
483
void search_replace_abort(void);
484
int findnextstr(const char *needle, bool whole_word_only, int modus,
485
		size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
486
void do_search(void);
487
488
void do_search_forward(void);
void do_search_backward(void);
489
490
491
492
#ifndef NANO_TINY
void do_findprevious(void);
void do_findnext(void);
#endif
493
void do_research(void);
494
void go_looking(void);
495
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
496
		const filestruct *real_current, size_t *real_current_x);
497
void do_replace(void);
498
void ask_for_replacement(void);
499
void goto_line_posx(ssize_t line, size_t pos_x);
500
void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
501
		bool interactive);
502
void do_gotolinecolumn_void(void);
503
#ifndef NANO_TINY
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
504
void do_find_bracket(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
505
#endif
Chris Allegretta's avatar
Chris Allegretta committed
506

507
/* Most functions in text.c. */
508
#ifndef NANO_TINY
509
510
511
512
void do_mark(void);
#endif
void do_delete(void);
void do_backspace(void);
513
514
515
516
#ifndef NANO_TINY
void do_cut_prev_word(void);
void do_cut_next_word(void);
#endif
517
void do_tab(void);
518
#ifndef NANO_TINY
519
520
void do_indent(void);
void do_unindent(void);
521
#endif
522
523
bool white_string(const char *s);
#ifdef ENABLE_COMMENT
524
void do_comment(void);
525
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
526
#endif
527
528
void do_undo(void);
void do_redo(void);
529
void do_enter(void);
530
#ifndef NANO_TINY
531
RETSIGTYPE cancel_command(int signal);
532
bool execute_command(const char *command);
533
void discard_until(const undo *thisitem, openfilestruct *thefile, bool keep);
534
void add_undo(undo_type action);
535
void update_multiline_undo(ssize_t lineno, char *indentation);
536
537
void update_undo(undo_type action);
#endif /* !NANO_TINY */
538
#ifdef ENABLE_WRAPPING
539
void wrap_reset(void);
540
bool do_wrap(filestruct *line);
541
#endif
542
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
543
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
544
#endif
545
#if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY)
546
547
size_t indent_length(const char *line);
#endif
548
#ifdef ENABLE_JUSTIFY
549
550
551
552
553
554
void justify_format(filestruct *paragraph, size_t skip);
bool begpar(const filestruct *const foo);
bool inpar(const filestruct *const foo);
void do_justify(bool full_justify);
void do_justify_void(void);
void do_full_justify(void);
David Lawrence Ramsey's avatar
David Lawrence Ramsey committed
555
#endif
556
#ifdef ENABLE_SPELLER
557
558
void do_spell(void);
#endif
559
#ifdef ENABLE_COLOR
560
void do_linter(void);
561
void do_formatter(void);
562
#endif
563
#ifndef NANO_TINY
564
void do_wordlinechar_count(void);
565
#endif
566
void do_verbatim_input(void);
567
void complete_a_word(void);
568

569
/* All functions in utils.c. */
570
void get_homedir(void);
571
const char *tail(const char *path);
572
char *concatenate(const char *path, const char *name);
573
574
575
#ifdef ENABLE_LINENUMBERS
int digits(ssize_t n);
#endif
576
bool parse_num(const char *str, ssize_t *val);
577
bool parse_line_column(const char *str, ssize_t *line, ssize_t *column);
578
void snuggly_fit(char **str);
Chris Allegretta's avatar
Chris Allegretta committed
579
580
581
void null_at(char **data, size_t index);
void unsunder(char *str, size_t true_len);
void sunder(char *str);
582
583
584
#if !defined(ENABLE_TINY) || defined(ENABLE_TABCOMP) || defined(ENABLE_BROWSER)
void free_chararray(char **array, size_t len);
#endif
585
const char *fixbounds(const char *r);
586
#ifdef ENABLE_SPELLER
587
bool is_separate_word(size_t position, size_t length, const char *buf);
588
#endif
589
const char *strstrwrapper(const char *haystack, const char *needle,
590
		const char *start);
Chris Allegretta's avatar
Chris Allegretta committed
591
592
593
void nperror(const char *s);
void *nmalloc(size_t howmuch);
void *nrealloc(void *ptr, size_t howmuch);
594
char *mallocstrncpy(char *dest, const char *src, size_t n);
595
char *mallocstrcpy(char *dest, const char *src);
596
char *free_and_assign(char *dest, char *src);
597
size_t get_page_start(size_t column);
598
size_t xplustabs(void);
599
600
601
size_t actual_x(const char *text, size_t column);
size_t strnlenpt(const char *text, size_t maxlen);
size_t strlenpt(const char *text);
Chris Allegretta's avatar
Chris Allegretta committed
602
void new_magicline(void);
603
#if !defined(NANO_TINY) || defined(ENABLE_HELP)
604
void remove_magicline(void);
605
606
#endif
#ifndef NANO_TINY
607
void mark_order(const filestruct **top, size_t *top_x,
608
		const filestruct **bot, size_t *bot_x, bool *right_side_up);
609
void get_range(const filestruct **top, const filestruct **bot);
610
#endif
611
size_t get_totsize(const filestruct *begin, const filestruct *end);
612
#ifndef NANO_TINY
613
filestruct *fsfromline(ssize_t lineno);
614
#endif
615
616
617
#ifdef DEBUG
void dump_filestruct(const filestruct *inptr);
#endif
Chris Allegretta's avatar
Chris Allegretta committed
618

619
/* Most functions in winio.c. */
620
621
void record_macro(void);
void run_macro(void);
622
size_t get_key_buffer_len(void);
623
void put_back(int keycode);
624
void unget_kbinput(int kbinput, bool metakey);
625
626
627
#ifdef ENABLE_NANORC
void implant(const char *string);
#endif
628
int get_kbinput(WINDOW *win, bool showcursor);
629
int parse_kbinput(WINDOW *win);
630
631
int arrow_from_abcd(int kbinput);
int parse_escape_sequence(WINDOW *win, int kbinput);
632
int get_byte_kbinput(int kbinput);
633
634
int get_control_kbinput(int kbinput);
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
635
int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
636
#ifdef ENABLE_MOUSE
637
int get_mouseinput(int *mouse_row, int *mouse_col, bool allow_shortcuts);
638
#endif
639
const sc *get_shortcut(int *kbinput);
640
void blank_row(WINDOW *win, int y, int x, int n);
641
642
void blank_edit(void);
void blank_statusbar(void);
643
void wipe_statusbar(void);
644
void blank_bottombars(void);
645
void check_statusblank(void);
646
char *display_string(const char *buf, size_t column, size_t span, bool isdata);
647
void titlebar(const char *path);
648
void statusbar(const char *msg);
649
void warn_and_shortly_pause(const char *msg);
650
void statusline(message_type importance, const char *msg, ...);
651
void bottombars(int menu);
652
void post_one_key(const char *keystroke, const char *tag, int width);
653
void place_the_cursor(void);
654
void edit_draw(filestruct *fileptr, const char *converted,
655
		int line, size_t from_col);
656
int update_line(filestruct *fileptr, size_t index);
657
658
659
#ifndef NANO_TINY
int update_softwrapped_line(filestruct *fileptr);
#endif
660
bool line_needs_update(const size_t old_column, const size_t new_column);
661
662
int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
663
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
664
void edit_scroll(bool direction);
665
#ifndef NANO_TINY
666
size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
667
								bool *end_of_line);
668
669
670
671
size_t get_chunk_and_edge(size_t column, filestruct *line, size_t *leftedge);
size_t chunk_for(size_t column, filestruct *line);
size_t leftedge_for(size_t column, filestruct *line);
size_t number_of_chunks_in(filestruct *line);
672
void ensure_firstcolumn_is_aligned(void);
673
#endif
674
size_t actual_last_column(size_t leftedge, size_t column);
675
void edit_redraw(filestruct *old_current, update_type manner);
Chris Allegretta's avatar
Chris Allegretta committed
676
void edit_refresh(void);
677
void adjust_viewport(update_type location);
678
void total_redraw(void);
679
void total_refresh(void);
680
void display_main_list(void);
681
void do_cursorpos(bool force);
682
void do_cursorpos_void(void);
683
684
685
686
void spotlight(bool active, size_t from_col, size_t to_col);
#ifndef NANO_TINY
void spotlight_softwrapped(bool active, size_t from_col, size_t to_col);
#endif
687
void do_suspend_void(void);
688
689
void disable_waiting(void);
void enable_waiting(void);
690
#ifdef ENABLE_EXTRA
Chris Allegretta's avatar
Chris Allegretta committed
691
void do_credits(void);
692
#endif
693

694
/* These are just name definitions. */
695
696
697
void do_cancel(void);
void case_sens_void(void);
void regexp_void(void);
698
699
void backwards_void(void);
void flip_replace(void);
700
void flip_goto(void);
701
#ifdef ENABLE_BROWSER
702
void to_files_void(void);
703
704
void goto_dir_void(void);
#endif
705
#ifndef NANO_TINY
706
707
708
709
710
void dos_format_void(void);
void mac_format_void(void);
void append_void(void);
void prepend_void(void);
void backup_file_void(void);
711
void flip_execute(void);
712
#endif
713
#ifdef ENABLE_MULTIBUFFER
714
void flip_newbuffer(void);
715
#endif
716
void discard_buffer(void);
717

718
#endif /* !PROTO_H */