1
1

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
Этот коммит содержится в:
Chris Allegretta 2003-04-19 19:34:05 +00:00
родитель 4b376a4982
Коммит 8151ba5a1a
6 изменённых файлов: 5 добавлений и 6 удалений

Просмотреть файл

@ -23,6 +23,7 @@ CVS code -
instead of putting it on a new line, as Pico does. (DLR) instead of putting it on a new line, as Pico does. (DLR)
- Convert instances of "(char *)nrealloc()" to the macro - Convert instances of "(char *)nrealloc()" to the macro
charealloc(), which does the same thing. (DLR) charealloc(), which does the same thing. (DLR)
- Change justify_mode from a boolean int to a flag (DLR).
- cut.c: - cut.c:
do_cut_text() do_cut_text()
- Tweak where KEEP_CUTBUFFER is set so that a marked cut - Tweak where KEEP_CUTBUFFER is set so that a marked cut

2
cut.c
Просмотреть файл

@ -54,7 +54,7 @@ void add_to_cutbuffer(filestruct *inptr)
cutbuffer = inptr; cutbuffer = inptr;
inptr->prev = NULL; inptr->prev = NULL;
#ifndef NANO_SMALL #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, /* Just tack the text in inptr onto the text in cutbottom,
unless we're backing up lines while justifying text. */ unless we're backing up lines while justifying text. */
cutbottom->data = charealloc(cutbottom->data, cutbottom->data = charealloc(cutbottom->data,

Просмотреть файл

@ -65,7 +65,6 @@ openfilestruct *open_files = NULL; /* The list of open files */
#endif #endif
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
int justify_mode = 0; /* Whether we're justifying now. */
char *quotestr = NULL; /* Quote string. The default value is char *quotestr = NULL; /* Quote string. The default value is
set in main(). */ set in main(). */
#endif #endif

4
nano.c
Просмотреть файл

@ -2424,7 +2424,7 @@ int do_justify(void)
/* Next step, we loop through the lines of this paragraph, justifying /* Next step, we loop through the lines of this paragraph, justifying
* each one individually. */ * each one individually. */
justify_mode = 1; SET(JUSTIFY_MODE);
for(; par_len > 0; current_y++, par_len--) { for(; par_len > 0; current_y++, par_len--) {
size_t line_len; size_t line_len;
size_t display_len; size_t display_len;
@ -2576,7 +2576,7 @@ int do_justify(void)
continue_loc: continue_loc:
current = current->next; current = current->next;
} }
justify_mode = 0; UNSET(JUSTIFY_MODE);
/* We are now done justifying the paragraph. There are cleanup things to /* We are now done justifying the paragraph. There are cleanup things to
* do, and we check for unjustify. */ * do, and we check for unjustify. */

1
nano.h
Просмотреть файл

@ -252,6 +252,7 @@ typedef struct historyheadtype {
#define PRESERVE (1<<28) #define PRESERVE (1<<28)
#define HISTORY_CHANGED (1<<29) #define HISTORY_CHANGED (1<<29)
#define HISTORYLOG (1<<30) #define HISTORYLOG (1<<30)
#define JUSTIFY_MODE (1<<31)
/* Control key sequences, changing these would be very very bad */ /* Control key sequences, changing these would be very very bad */

Просмотреть файл

@ -44,7 +44,6 @@ extern int search_offscreen;
extern int currslen; extern int currslen;
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
extern int justify_mode;
extern char *quotestr; extern char *quotestr;
#endif #endif
@ -107,7 +106,6 @@ extern const shortcut *currshortcut;
#endif #endif
#ifdef HAVE_REGEX_H #ifdef HAVE_REGEX_H
extern int use_regexp, regexp_compiled;
extern regex_t search_regexp; extern regex_t search_regexp;
extern regmatch_t regmatches[10]; extern regmatch_t regmatches[10];
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR