commit 06c80b6ccdd65e9c8c12dc2c3c7223b17c5ac723
parent 7ce1f6d86d799d282b998394e54db7becbed16f2
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 2 Feb 2020 17:05:06 +0100
tweaks: rearrange a few global variables, to group things better
Diffstat:
M | src/global.c | | | 54 | ++++++++++++++++++++++++++---------------------------- |
M | src/proto.h | | | 30 | ++++++++++++++---------------- |
2 files changed, 40 insertions(+), 44 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -45,6 +45,21 @@ bool mute_modifiers = FALSE;
bool bracketed_paste = FALSE;
/* Whether text is being pasted into nano from outside. */
+bool started_curses = FALSE;
+ /* Becomes TRUE when curses mode has been entered the first time. */
+bool we_are_running = FALSE;
+ /* Becomes TRUE as soon as all options and files have been read. */
+bool more_than_one = FALSE;
+ /* Whether more than one buffer is or has been open. */
+
+bool inhelp = FALSE;
+ /* Whether we are in the help viewer. */
+char *title = NULL;
+ /* When not NULL: the title of the current help text. */
+
+bool refresh_needed = FALSE;
+ /* Did a command mangle enough of the buffer that we should
+ * repaint the screen? */
bool focusing = TRUE;
/* Whether an update of the edit window should center the cursor. */
@@ -54,34 +69,33 @@ bool as_an_at = TRUE;
bool control_C_was_pressed = FALSE;
/* Whether Ctrl+C was pressed (when a keyboard interrupt is enabled). */
-bool started_curses = FALSE;
-
bool suppress_cursorpos = FALSE;
/* Should we skip constant position display for current keystroke? */
-bool we_are_running = FALSE;
- /* Will become TRUE as soon as all options and files have been read. */
-
message_type lastmessage = HUSH;
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
linestruct *pletion_line = NULL;
/* The line where the last completion was found, if any. */
-bool inhelp = FALSE;
- /* Whether we are in the help viewer. */
-char *title = NULL;
- /* When not NULL: the title of the current help text. */
-
-bool more_than_one = FALSE;
- /* Whether more than one buffer is or has been open. */
bool also_the_last = FALSE;
/* Whether indenting/commenting should include the last line of
* the marked region. */
+char *answer = NULL;
+ /* The answer string used by the status-bar prompt. */
+
+char *last_search = NULL;
+ /* The last string we searched for. */
int didfind = 0;
/* Whether the last search found something. */
+char *present_path = NULL;
+ /* The current browser directory when trying to do tab completion. */
+
+unsigned flags[4] = {0, 0, 0, 0};
+ /* Our flags array, containing the states of all global options. */
+
int controlleft, controlright, controlup, controldown;
int controlhome, controlend;
#ifndef NANO_TINY
@@ -101,15 +115,6 @@ size_t wrap_at = 0;
/* The actual column where we will wrap lines, based on fill. */
#endif
-char *last_search = NULL;
- /* The last string we searched for. */
-
-char *present_path = NULL;
- /* The current browser directory when trying to do tab completion. */
-
-unsigned flags[4] = {0, 0, 0, 0};
- /* Our flag containing the states of all global options. */
-
WINDOW *topwin = NULL;
/* The top portion of the screen, showing the version number of nano,
* the name of the file, and whether the buffer was modified. */
@@ -168,9 +173,6 @@ regex_t quotereg;
char *word_chars = NULL;
/* Nonalphanumeric characters that also form words. */
-char *answer = NULL;
- /* The answer string used by the status-bar prompt. */
-
ssize_t tabsize = -1;
/* The width of a tab in spaces. The default is set in main(). */
@@ -197,10 +199,6 @@ bool have_palette = FALSE;
/* Whether the colors for the current syntax have been initialized. */
#endif
-bool refresh_needed = FALSE;
- /* Did a command mangle enough of the buffer that we should
- * repaint the screen? */
-
int currmenu = MMOST;
/* The currently active menu, initialized to a dummy value. */
keystruct *sclist = NULL;
diff --git a/src/proto.h b/src/proto.h
@@ -34,6 +34,13 @@ extern bool shift_held;
extern bool mute_modifiers;
extern bool bracketed_paste;
+extern bool started_curses;
+extern bool we_are_running;
+extern bool more_than_one;
+
+extern bool inhelp;
+extern char *title;
+
extern bool focusing;
extern bool as_an_at;
@@ -42,22 +49,21 @@ extern bool control_C_was_pressed;
extern bool suppress_cursorpos;
-extern bool started_curses;
-extern bool we_are_running;
-
extern message_type lastmessage;
extern linestruct *pletion_line;
-extern bool inhelp;
-extern char *title;
-
-extern bool more_than_one;
-
extern bool also_the_last;
+extern char *answer;
+
+extern char *last_search;
extern int didfind;
+extern char *present_path;
+
+extern unsigned flags[4];
+
extern int controlleft, controlright;
extern int controlup, controldown;
extern int controlhome, controlend;
@@ -80,12 +86,6 @@ extern ssize_t fill;
extern size_t wrap_at;
#endif
-extern char *last_search;
-
-extern char *present_path;
-
-extern unsigned flags[4];
-
extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
@@ -122,8 +122,6 @@ extern regex_t quotereg;
extern char *word_chars;
-extern char *answer;
-
extern ssize_t tabsize;
#ifndef NANO_TINY