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
This commit is contained in:
Chris Allegretta 2003-04-19 19:34:05 +00:00
parent 4b376a4982
commit 8151ba5a1a
6 changed files with 5 additions and 6 deletions

View File

@ -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

2
cut.c
View File

@ -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,

View File

@ -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

4
nano.c
View File

@ -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. */

1
nano.h
View File

@ -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 */

View File

@ -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