commit 8151ba5a1acab273b36d07c6f3f659b3b75a37fe
parent 4b376a4982fd5e78781dd79e214af4a46078d21a
Author: Chris Allegretta <chrisa@asty.org>
Date: Sat, 19 Apr 2003 19:34:05 +0000
DLR's patch to change justify_mode to a flag
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1491 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
6 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -23,6 +23,7 @@ CVS code -
instead of putting it on a new line, as Pico does. (DLR)
- Convert instances of "(char *)nrealloc()" to the macro
charealloc(), which does the same thing. (DLR)
+ - Change justify_mode from a boolean int to a flag (DLR).
- cut.c:
do_cut_text()
- Tweak where KEEP_CUTBUFFER is set so that a marked cut
diff --git a/cut.c b/cut.c
@@ -54,7 +54,7 @@ void add_to_cutbuffer(filestruct *inptr)
cutbuffer = inptr;
inptr->prev = NULL;
#ifndef NANO_SMALL
- } else if (concatenate_cut && !justify_mode) {
+ } else if (concatenate_cut && !ISSET(JUSTIFY_MODE)) {
/* Just tack the text in inptr onto the text in cutbottom,
unless we're backing up lines while justifying text. */
cutbottom->data = charealloc(cutbottom->data,
diff --git a/global.c b/global.c
@@ -65,7 +65,6 @@ openfilestruct *open_files = NULL; /* The list of open files */
#endif
#ifndef DISABLE_JUSTIFY
-int justify_mode = 0; /* Whether we're justifying now. */
char *quotestr = NULL; /* Quote string. The default value is
set in main(). */
#endif
diff --git a/nano.c b/nano.c
@@ -2424,7 +2424,7 @@ int do_justify(void)
/* Next step, we loop through the lines of this paragraph, justifying
* each one individually. */
- justify_mode = 1;
+ SET(JUSTIFY_MODE);
for(; par_len > 0; current_y++, par_len--) {
size_t line_len;
size_t display_len;
@@ -2576,7 +2576,7 @@ int do_justify(void)
continue_loc:
current = current->next;
}
- justify_mode = 0;
+ UNSET(JUSTIFY_MODE);
/* We are now done justifying the paragraph. There are cleanup things to
* do, and we check for unjustify. */
diff --git a/nano.h b/nano.h
@@ -252,6 +252,7 @@ typedef struct historyheadtype {
#define PRESERVE (1<<28)
#define HISTORY_CHANGED (1<<29)
#define HISTORYLOG (1<<30)
+#define JUSTIFY_MODE (1<<31)
/* Control key sequences, changing these would be very very bad */
diff --git a/proto.h b/proto.h
@@ -44,7 +44,6 @@ extern int search_offscreen;
extern int currslen;
#ifndef DISABLE_JUSTIFY
-extern int justify_mode;
extern char *quotestr;
#endif
@@ -107,7 +106,6 @@ extern const shortcut *currshortcut;
#endif
#ifdef HAVE_REGEX_H
-extern int use_regexp, regexp_compiled;
extern regex_t search_regexp;
extern regmatch_t regmatches[10];
#ifdef ENABLE_COLOR