blob: 5fe570b9319d59ad4c3cba0b8347bafa1501f30f [file] [log] [blame]
Chris Allegretta11b00112000-08-06 21:13:45 +00001/* $Id$ */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +00002/**************************************************************************
3 * global.c *
4 * *
5 * Copyright (C) 1999 Chris Allegretta *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 1, or (at your option) *
9 * any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
19 * *
20 **************************************************************************/
21
22#include <sys/stat.h>
23#include "config.h"
24#include "nano.h"
25#include "proto.h"
26
27#ifndef NANO_SMALL
28#include <libintl.h>
29#define _(string) gettext(string)
30#else
31#define _(string) (string)
32#endif
33
34/*
35 * Global variables
36 */
37int flags = 0; /* Our new flag containig many options */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000038WINDOW *edit; /* The file portion of the editor */
39WINDOW *topwin; /* Top line of screen */
40WINDOW *bottomwin; /* Bottom buffer */
Chris Allegretta1a6e9042000-12-14 13:56:28 +000041char *filename = NULL; /* Name of the file */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000042int editwinrows = 0; /* How many rows long is the edit
43 window? */
44filestruct *current; /* Current buffer pointer */
45int current_x = 0, current_y = 0; /* Current position of X and Y in
46 the editor - relative to edit
47 window (0,0) */
48filestruct *fileage = NULL; /* Our file buffer */
49filestruct *edittop = NULL; /* Pointer to the top of the edit
50 buffer with respect to the
51 file struct */
52filestruct *editbot = NULL; /* Same for the bottom */
53filestruct *filebot = NULL; /* Last node in the file struct */
54filestruct *cutbuffer = NULL; /* A place to store cut text */
55
Chris Allegretta31925e42000-11-02 04:40:39 +000056char *answer = NULL; /* Answer str to many questions */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000057int totlines = 0; /* Total number of lines in the file */
58int totsize = 0; /* Total number of bytes in the file */
59int placewewant = 0; /* The collum we'd like the cursor
60 to jump to when we go to the
61 next or previous line */
62
Chris Allegretta6d690a32000-08-03 22:51:21 +000063int tabsize = 8; /* Our internal tabsize variable */
64
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000065char *hblank; /* A horizontal blank line */
66char *help_text; /* The text in the help window */
67
68/* More stuff for the marker select */
69
70filestruct *mark_beginbuf; /* the begin marker buffer */
71int mark_beginx; /* X value in the string to start */
72
73shortcut main_list[MAIN_LIST_LEN];
74shortcut whereis_list[WHEREIS_LIST_LEN];
75shortcut replace_list[REPLACE_LIST_LEN];
Chris Allegretta105da332000-10-31 05:10:10 +000076shortcut replace_list_2[REPLACE_LIST_LEN]; /* 2nd half of replace dialog */
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000077shortcut goto_list[GOTO_LIST_LEN];
78shortcut writefile_list[WRITEFILE_LIST_LEN];
79shortcut help_list[HELP_LIST_LEN];
80shortcut spell_list[SPELL_LIST_LEN];
Rocco Corsiaf5c3022001-01-12 07:51:05 +000081#ifndef DISABLE_BROWSER
Chris Allegrettaf4b96012001-01-03 07:11:47 +000082shortcut browser_list[BROWSER_LIST_LEN];
83#endif
84
Chris Allegrettaf0b26df2001-01-20 22:18:18 +000085#ifndef NANO_SMALL
Chris Allegretta756f2202000-09-01 13:32:47 +000086toggle toggles[TOGGLE_LEN];
Chris Allegrettaf0b26df2001-01-20 22:18:18 +000087#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000088
Chris Allegretta9fc8d432000-07-07 01:49:52 +000089/* Regular expressions */
90
Chris Allegretta805c26d2000-09-06 13:39:17 +000091#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +000092regex_t search_regexp; /* Global to store compiled search regexp */
93regmatch_t regmatches[10]; /* Match positions for parenthetical
94 subexpressions, max of 10 */
Chris Allegretta805c26d2000-09-06 13:39:17 +000095#endif
Chris Allegretta9fc8d432000-07-07 01:49:52 +000096
Chris Allegrettaa2ea1932000-06-06 05:53:49 +000097/* Initialize a struct *without* our lovely braces =( */
98void sc_init_one(shortcut * s, int key, char *desc, char *help, int alt,
99 int misc1, int misc2, int view, int (*func) (void))
100{
101 s->val = key;
102 s->desc = desc;
103 s->help = help;
104 s->altval = alt;
105 s->misc1 = misc1;
106 s->misc2 = misc2;
107 s->viewok = view;
108 s->func = func;
109}
110
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000111#ifndef NANO_SMALL
Chris Allegretta756f2202000-09-01 13:32:47 +0000112/* Initialize the toggles in the same manner */
113void toggle_init_one(toggle * t, int val, char *desc, int flag)
114{
115 t->val = val;
116 t->desc = desc;
117 t->flag = flag;
118}
Chris Allegrettaf0b26df2001-01-20 22:18:18 +0000119#endif
Chris Allegretta756f2202000-09-01 13:32:47 +0000120
121void toggle_init(void)
122{
123#ifndef NANO_SMALL
124 char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
125 *toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
Chris Allegrettad7934d42000-10-03 05:39:29 +0000126 *toggle_cuttoend_msg, *toggle_wrap_msg;
127#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000128 char *toggle_regexp_msg;
Chris Allegrettad7934d42000-10-03 05:39:29 +0000129#endif
Chris Allegretta756f2202000-09-01 13:32:47 +0000130
131 toggle_const_msg = _("Constant cursor position");
Chris Allegrettaf8163dc2000-09-03 01:06:40 +0000132 toggle_autoindent_msg = _("Auto indent");
Chris Allegretta756f2202000-09-01 13:32:47 +0000133 toggle_suspend_msg = _("Suspend");
Chris Allegrettaf0f63a82000-09-02 18:44:21 +0000134 toggle_nohelp_msg = _("Help mode");
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000135 toggle_picomode_msg = _("Pico mode");
Chris Allegretta756f2202000-09-01 13:32:47 +0000136 toggle_mouse_msg = _("Mouse support");
137 toggle_cuttoend_msg = _("Cut to end");
Chris Allegretta805c26d2000-09-06 13:39:17 +0000138#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000139 toggle_regexp_msg = _("Regular expressions");
Chris Allegretta805c26d2000-09-06 13:39:17 +0000140#endif
Chris Allegrettaf0f63a82000-09-02 18:44:21 +0000141 toggle_wrap_msg = _("Auto wrap");
Chris Allegretta756f2202000-09-01 13:32:47 +0000142
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000143 toggle_init_one(&toggles[0], TOGGLE_CONST_KEY, toggle_const_msg,
144 CONSTUPDATE);
145 toggle_init_one(&toggles[1], TOGGLE_AUTOINDENT_KEY,
146 toggle_autoindent_msg, AUTOINDENT);
147 toggle_init_one(&toggles[2], TOGGLE_SUSPEND_KEY, toggle_suspend_msg,
148 SUSPEND);
149 toggle_init_one(&toggles[3], TOGGLE_NOHELP_KEY, toggle_nohelp_msg,
150 NO_HELP);
151 toggle_init_one(&toggles[4], TOGGLE_PICOMODE_KEY, toggle_picomode_msg,
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000152 PICO_MODE);
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000153 toggle_init_one(&toggles[5], TOGGLE_WRAP_KEY, toggle_wrap_msg,
154 NO_WRAP);
155 toggle_init_one(&toggles[6], TOGGLE_MOUSE_KEY, toggle_mouse_msg,
156 USE_MOUSE);
157 toggle_init_one(&toggles[7], TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg,
158 CUT_TO_END);
Chris Allegretta805c26d2000-09-06 13:39:17 +0000159#ifdef HAVE_REGEX_H
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000160 toggle_init_one(&toggles[8], TOGGLE_REGEXP_KEY, toggle_regexp_msg,
161 USE_REGEXP);
Chris Allegretta756f2202000-09-01 13:32:47 +0000162#endif
Chris Allegretta805c26d2000-09-06 13:39:17 +0000163#endif
Chris Allegretta756f2202000-09-01 13:32:47 +0000164}
165
Chris Allegretta07798352000-11-27 22:58:23 +0000166void shortcut_init(int unjustify)
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000167{
168 char *nano_help_msg = "", *nano_writeout_msg = "", *nano_exit_msg = "",
169 *nano_goto_msg = "", *nano_justify_msg = "", *nano_replace_msg =
170 "", *nano_insert_msg = "", *nano_whereis_msg =
171 "", *nano_prevpage_msg = "", *nano_nextpage_msg =
172 "", *nano_cut_msg = "", *nano_uncut_msg = "", *nano_cursorpos_msg =
173 "", *nano_spell_msg = "", *nano_up_msg = "", *nano_down_msg =
174 "", *nano_forward_msg = "", *nano_back_msg = "", *nano_home_msg =
175 "", *nano_end_msg = "", *nano_firstline_msg =
176 "", *nano_lastline_msg = "", *nano_refresh_msg =
177 "", *nano_mark_msg = "", *nano_delete_msg =
178 "", *nano_backspace_msg = "", *nano_tab_msg =
179 "", *nano_enter_msg = "", *nano_case_msg =
Chris Allegretta6636dc32001-01-05 05:41:07 +0000180 "", *nano_cancel_msg = "", *nano_unjustify_msg = "";
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000181
182#ifndef NANO_SMALL
Chris Allegretta6636dc32001-01-05 05:41:07 +0000183 char *nano_tofiles_msg = "";
184
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000185 nano_help_msg = _("Invoke the help menu");
186 nano_writeout_msg = _("Write the current file to disk");
187 nano_exit_msg = _("Exit from nano");
188 nano_goto_msg = _("Goto a specific line number");
189 nano_justify_msg = _("Justify the current paragraph");
Chris Allegretta07798352000-11-27 22:58:23 +0000190 nano_unjustify_msg = _("Unjustify after a justify");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000191 nano_replace_msg = _("Replace text within the editor");
192 nano_insert_msg = _("Insert another file into the current one");
193 nano_whereis_msg = _("Search for text within the editor");
194 nano_prevpage_msg = _("Move to the previous screen");
195 nano_nextpage_msg = _("Move to the next screen");
196 nano_cut_msg = _("Cut the current line and store it in the cutbuffer");
197 nano_uncut_msg = _("Uncut from the cutbuffer into the current line");
198 nano_cursorpos_msg = _("Show the posititon of the cursor");
199 nano_spell_msg = _("Invoke the spell checker (if available)");
200 nano_up_msg = _("Move up one line");
201 nano_down_msg = _("Move down one line");
202 nano_forward_msg = _("Move forward one character");
203 nano_back_msg = _("Move back one character");
204 nano_home_msg = _("Move to the beginning of the current line");
205 nano_end_msg = _("Move to the end of the current line");
206 nano_firstline_msg = _("Go to the first line of the file");
207 nano_lastline_msg = _("Go to the last line of the file");
208 nano_refresh_msg = _("Refresh (redraw) the current screen");
209 nano_mark_msg = _("Mark text at the current cursor location");
210 nano_delete_msg = _("Delete the character under the cursor");
211 nano_backspace_msg =
212 _("Delete the character to the left of the cursor");
213 nano_tab_msg = _("Insert a tab character");
214 nano_enter_msg = _("Insert a carriage return at the cursor position");
215 nano_case_msg =
216 _("Make the current search or replace case (in)sensitive");
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000217 nano_tofiles_msg = _("Go to file browser");
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000218 nano_cancel_msg = _("Cancel the current function");
219#endif
220
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000221 if (ISSET(PICO_MODE))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000222 sc_init_one(&main_list[0], NANO_HELP_KEY, _("Get Help"),
Chris Allegretta16e41682000-09-11 22:33:54 +0000223 nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000224 else
225 sc_init_one(&main_list[0], NANO_WRITEOUT_KEY, _("WriteOut"),
226 nano_writeout_msg,
227 0, NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
228
229 sc_init_one(&main_list[1], NANO_EXIT_KEY, _("Exit"),
230 nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
231
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000232 if (ISSET(PICO_MODE))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000233 sc_init_one(&main_list[2], NANO_WRITEOUT_KEY, _("WriteOut"),
234 nano_writeout_msg,
235 0, NANO_WRITEOUT_FKEY, 0, NOVIEW, do_writeout_void);
236 else
237 sc_init_one(&main_list[2], NANO_GOTO_KEY, _("Goto Line"),
238 nano_goto_msg,
239 NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
240
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000241 if (ISSET(PICO_MODE))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000242 sc_init_one(&main_list[3], NANO_JUSTIFY_KEY, _("Justify"),
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000243 nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
Chris Allegretta16e41682000-09-11 22:33:54 +0000244 NOVIEW, do_justify);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000245 else
246 sc_init_one(&main_list[3], NANO_REPLACE_KEY, _("Replace"),
247 nano_replace_msg,
248 NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
249
250 sc_init_one(&main_list[4], NANO_INSERTFILE_KEY, _("Read File"),
251 nano_insert_msg,
252 0, NANO_INSERTFILE_FKEY, 0, NOVIEW, do_insertfile);
253
254 sc_init_one(&main_list[5], NANO_WHEREIS_KEY, _("Where Is"),
255 nano_whereis_msg,
256 0, NANO_WHEREIS_FKEY, 0, VIEW, do_search);
257
258 sc_init_one(&main_list[6], NANO_PREVPAGE_KEY, _("Prev Page"),
259 nano_prevpage_msg,
260 0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
261
262 sc_init_one(&main_list[7], NANO_NEXTPAGE_KEY, _("Next Page"),
263 nano_nextpage_msg,
264 0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
265
266 sc_init_one(&main_list[8], NANO_CUT_KEY, _("Cut Text"),
267 nano_cut_msg, 0, NANO_CUT_FKEY, 0, NOVIEW, do_cut_text);
268
Chris Allegretta07798352000-11-27 22:58:23 +0000269 if (unjustify)
270 sc_init_one(&main_list[9], NANO_UNJUSTIFY_KEY, _("UnJustify"),
271 nano_unjustify_msg, 0, 0, 0, NOVIEW, do_uncut_text);
272 else
273 sc_init_one(&main_list[9], NANO_UNCUT_KEY, _("UnCut Txt"),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000274 nano_uncut_msg,
275 0, NANO_UNCUT_FKEY, 0, NOVIEW, do_uncut_text);
276
277 sc_init_one(&main_list[10], NANO_CURSORPOS_KEY, _("Cur Pos"),
278 nano_cursorpos_msg,
279 0, NANO_CURSORPOS_FKEY, 0, VIEW, do_cursorpos);
280
281 sc_init_one(&main_list[11], NANO_SPELL_KEY, _("To Spell"),
282 nano_spell_msg, 0, NANO_SPELL_FKEY, 0, NOVIEW, do_spell);
283
284
285 sc_init_one(&main_list[12], NANO_UP_KEY, _("Up"),
286 nano_up_msg, 0, KEY_UP, 0, VIEW, do_up);
287
288 sc_init_one(&main_list[13], NANO_DOWN_KEY, _("Down"),
289 nano_down_msg, 0, KEY_DOWN, 0, VIEW, do_down);
290
291 sc_init_one(&main_list[14], NANO_FORWARD_KEY, _("Forward"),
292 nano_forward_msg, 0, KEY_RIGHT, 0, VIEW, do_right);
293
294 sc_init_one(&main_list[15], NANO_BACK_KEY, _("Back"),
295 nano_back_msg, 0, KEY_LEFT, 0, VIEW, do_left);
296
297 sc_init_one(&main_list[16], NANO_HOME_KEY, _("Home"),
298 nano_home_msg, 0, KEY_HOME, 362, VIEW, do_home);
299
300 sc_init_one(&main_list[17], NANO_END_KEY, _("End"),
301 nano_end_msg, 0, KEY_END, 385, VIEW, do_end);
302
303 sc_init_one(&main_list[18], NANO_REFRESH_KEY, _("Refresh"),
304 nano_refresh_msg, 0, 0, 0, VIEW, total_refresh);
305
306 sc_init_one(&main_list[19], NANO_MARK_KEY, _("Mark Text"),
307 nano_mark_msg, 0, 0, 0, NOVIEW, do_mark);
308
309 sc_init_one(&main_list[20], NANO_DELETE_KEY, _("Delete"),
310 nano_delete_msg, 0, KEY_DC,
311 NANO_CONTROL_D, NOVIEW, do_delete);
312
313 sc_init_one(&main_list[21], NANO_BACKSPACE_KEY, _("Backspace"),
314 nano_backspace_msg, 0,
315 KEY_BACKSPACE, 127, NOVIEW, do_backspace);
316
317 sc_init_one(&main_list[22], NANO_TAB_KEY, _("Tab"),
318 nano_tab_msg, 0, 0, 0, NOVIEW, do_tab);
319
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000320 if (ISSET(PICO_MODE))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000321 sc_init_one(&main_list[23], NANO_REPLACE_KEY, _("Replace"),
322 nano_replace_msg,
323 NANO_ALT_R, NANO_REPLACE_FKEY, 0, NOVIEW, do_replace);
324 else
325 sc_init_one(&main_list[23], NANO_JUSTIFY_KEY, _("Justify"),
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000326 nano_justify_msg, 0, NANO_JUSTIFY_FKEY, 0,
Chris Allegretta16e41682000-09-11 22:33:54 +0000327 NOVIEW, do_justify);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000328
329 sc_init_one(&main_list[24], NANO_ENTER_KEY, _("Enter"),
330 nano_enter_msg,
331 0, KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void);
332
Chris Allegrettabf9a8cc2000-11-17 01:37:39 +0000333 if (ISSET(PICO_MODE))
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000334 sc_init_one(&main_list[25], NANO_GOTO_KEY, _("Goto Line"),
335 nano_goto_msg,
336 NANO_ALT_G, NANO_GOTO_FKEY, 0, VIEW, do_gotoline_void);
337 else
338 sc_init_one(&main_list[25], NANO_HELP_KEY, _("Get Help"),
Chris Allegretta16e41682000-09-11 22:33:54 +0000339 nano_help_msg, 0, NANO_HELP_FKEY, 0, VIEW, do_help);
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000340
341
342 sc_init_one(&whereis_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
343 nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
344
345 sc_init_one(&whereis_list[1], NANO_LASTLINE_KEY, _("Last Line"),
346 nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
347
348 sc_init_one(&whereis_list[2], NANO_CASE_KEY, _("Case Sens"),
349 nano_case_msg, 0, 0, 0, VIEW, 0);
350
351
Chris Allegretta715e7dd2000-06-30 20:35:26 +0000352 sc_init_one(&whereis_list[3], NANO_OTHERSEARCH_KEY, _("Replace"),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000353 nano_replace_msg, 0, 0, 0, VIEW, do_replace);
354
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000355 sc_init_one(&whereis_list[4], NANO_FROMSEARCHTOGOTO_KEY,
356 _("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
357 do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000358
359 sc_init_one(&whereis_list[5], NANO_CANCEL_KEY, _("Cancel"),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000360 nano_cancel_msg, 0, 0, 0, VIEW, 0);
361
362
363 sc_init_one(&replace_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
364 nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
365
366 sc_init_one(&replace_list[1], NANO_LASTLINE_KEY, _("Last Line"),
367 nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
368
369 sc_init_one(&replace_list[2], NANO_CASE_KEY, _("Case Sens"),
370 nano_case_msg, 0, 0, 0, VIEW, 0);
371
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000372 sc_init_one(&replace_list[3], NANO_OTHERSEARCH_KEY, _("No Replace"),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000373 nano_whereis_msg, 0, 0, 0, VIEW, do_search);
374
Chris Allegrettabd9e7c32000-10-26 01:44:42 +0000375 sc_init_one(&replace_list[4], NANO_FROMSEARCHTOGOTO_KEY,
376 _("Goto Line"), nano_goto_msg, 0, 0, 0, VIEW,
377 do_gotoline_void);
Chris Allegretta8c2b40f2000-06-29 01:30:04 +0000378
Chris Allegretta105da332000-10-31 05:10:10 +0000379 sc_init_one(&replace_list[5], NANO_CANCEL_KEY, _("Cancel"),
380 nano_cancel_msg, 0, 0, 0, VIEW, 0);
381
382
383
384 sc_init_one(&replace_list_2[0], NANO_FIRSTLINE_KEY, _("First Line"),
385 nano_firstline_msg, 0, 0, 0, VIEW, do_first_line);
386
387 sc_init_one(&replace_list_2[1], NANO_LASTLINE_KEY, _("Last Line"),
388 nano_lastline_msg, 0, 0, 0, VIEW, do_last_line);
389
Chris Allegretta4d29be12000-10-31 05:32:09 +0000390 sc_init_one(&replace_list_2[2], NANO_CANCEL_KEY, _("Cancel"),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000391 nano_cancel_msg, 0, 0, 0, VIEW, 0);
392
393
394 sc_init_one(&goto_list[0], NANO_FIRSTLINE_KEY, _("First Line"),
395 nano_firstline_msg, 0, 0, 0, VIEW, &do_first_line);
396
397 sc_init_one(&goto_list[1], NANO_LASTLINE_KEY, _("Last Line"),
398 nano_lastline_msg, 0, 0, 0, VIEW, &do_last_line);
399
400 sc_init_one(&goto_list[2], NANO_CANCEL_KEY, _("Cancel"),
401 nano_cancel_msg, 0, 0, 0, VIEW, 0);
402
403
404 sc_init_one(&help_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
405 nano_prevpage_msg,
406 0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, page_up);
407
408 sc_init_one(&help_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
409 nano_nextpage_msg,
410 0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, page_down);
411
412 sc_init_one(&help_list[2], NANO_EXIT_KEY, _("Exit"),
413 nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, do_exit);
414
415
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000416#ifndef DISABLE_BROWSER
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000417 sc_init_one(&writefile_list[0], NANO_TOFILES_KEY, _("To Files"),
418 nano_tofiles_msg, 0, 0, 0, NOVIEW, 0);
419#endif
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000420
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000421 sc_init_one(&writefile_list[WRITEFILE_LIST_LEN - 1], NANO_CANCEL_KEY, _("Cancel"),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000422 nano_cancel_msg, 0, 0, 0, VIEW, 0);
423
Chris Allegretta56b24b52000-11-29 23:57:20 +0000424 sc_init_one(&spell_list[0], NANO_CANCEL_KEY, _("Cancel"),
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000425 nano_cancel_msg, 0, 0, 0, VIEW, 0);
426
Rocco Corsiaf5c3022001-01-12 07:51:05 +0000427#ifndef DISABLE_BROWSER
Chris Allegrettaf4b96012001-01-03 07:11:47 +0000428 sc_init_one(&browser_list[0], NANO_PREVPAGE_KEY, _("Prev Page"),
429 nano_prevpage_msg,
430 0, NANO_PREVPAGE_FKEY, KEY_PPAGE, VIEW, 0);
431
432 sc_init_one(&browser_list[1], NANO_NEXTPAGE_KEY, _("Next Page"),
433 nano_nextpage_msg,
434 0, NANO_NEXTPAGE_FKEY, KEY_NPAGE, VIEW, 0);
435
436 sc_init_one(&browser_list[2], NANO_EXIT_KEY, _("Exit"),
437 nano_exit_msg, 0, NANO_EXIT_FKEY, 0, VIEW, 0);
438
439#endif
440
441
Chris Allegretta756f2202000-09-01 13:32:47 +0000442 toggle_init();
Chris Allegrettaa2ea1932000-06-06 05:53:49 +0000443}