All the updates that I've been waiting all weekend to commit, no desc, tough

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@668 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
master
Chris Allegretta 2001-05-21 12:56:25 +00:00
parent 9a46f3cf56
commit 6fe61499e8
25 changed files with 2801 additions and 2634 deletions

View File

@ -2,7 +2,7 @@ Cvs code -
- General - General
- New global variables currshortcut and currslen to support using - New global variables currshortcut and currslen to support using
the mouse with the shortcuts. Also supports clicking on files the mouse with the shortcuts. Also supports clicking on files
in browser. in browser. Added #ifdef DISABLE_MOUSE around this code also.
- Changed mouse disabling code from depending on --enable-tiny - Changed mouse disabling code from depending on --enable-tiny
to its own flag, --disable-mouse. The --tiny option defines to its own flag, --disable-mouse. The --tiny option defines
this automatically, but now just mouse support can be disabled this automatically, but now just mouse support can be disabled
@ -23,6 +23,14 @@ Cvs code -
- Changed all string allocations to charalloc(), new function - Changed all string allocations to charalloc(), new function
designed to take nmalloc argument but call calloc based on designed to take nmalloc argument but call calloc based on
(char *) size. (char *) size.
- New macro DISABLE_WRAPJUSTIFY to easily check for both wrapping
and justify being disabled. This allows us to compile out the
-r flag if neither are set, and will also allow us to comment
out -W when it is written.
- Allow fill to take a negative value ot signify a "from right side"
value. This allows the value to vary with the screen size yet
still be correct. New static value wrap_at to minimize code
inpact. Updated man page and info file.
- configure.in: - configure.in:
- New option, --enable-nanorc, which allows people to have a .nanorc - New option, --enable-nanorc, which allows people to have a .nanorc
initialization file and set options normally used on the command initialization file and set options normally used on the command

3
TODO
View File

@ -30,6 +30,7 @@ For Next Version:
make global variable pointing to current shortcut list to determine what make global variable pointing to current shortcut list to determine what
keystroke to ungetch(). [DONE]. keystroke to ungetch(). [DONE].
- Implement -o (chroot of sorts) - Implement -o (chroot of sorts)
- Implement -W (wrap at # less than width of screen), mark -r as deprecated. - Allow -r to take a negative argument, meaning right margin instead of
left (allows resizing that way), formerly -W arg. [DONE]
$Id$ $Id$

15
files.c
View File

@ -259,8 +259,12 @@ int do_insertfile(void)
char *realname = NULL; char *realname = NULL;
wrap_reset(); wrap_reset();
#ifndef DISABLE_MOUSE
currshortcut = writefile_list; currshortcut = writefile_list;
currslen = WRITEFILE_LIST_LEN; currslen = WRITEFILE_LIST_LEN;
#endif
i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "", i = statusq(1, writefile_list, WRITEFILE_LIST_LEN, "",
_("File to insert [from ./] ")); _("File to insert [from ./] "));
if (i != -1) { if (i != -1) {
@ -279,8 +283,10 @@ int do_insertfile(void)
if (i == NANO_TOFILES_KEY) { if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(realname); char *tmp = do_browse_from(realname);
#ifndef DISABLE_MOUSE
currshortcut = writefile_list; currshortcut = writefile_list;
currslen = WRITEFILE_LIST_LEN; currslen = WRITEFILE_LIST_LEN;
#endif
#ifdef DISABLE_TABCOMP #ifdef DISABLE_TABCOMP
realname = NULL; realname = NULL;
@ -508,8 +514,11 @@ int do_writeout(char *path, int exiting)
static int did_cred = 0; static int did_cred = 0;
#endif #endif
#ifndef DISABLE_MOUSE
currshortcut = writefile_list; currshortcut = writefile_list;
currslen = WRITEFILE_LIST_LEN; currslen = WRITEFILE_LIST_LEN;
#endif
answer = mallocstrcpy(answer, path); answer = mallocstrcpy(answer, path);
if ((exiting) && (ISSET(TEMP_OPT))) { if ((exiting) && (ISSET(TEMP_OPT))) {
@ -536,8 +545,11 @@ int do_writeout(char *path, int exiting)
if (i == NANO_TOFILES_KEY) { if (i == NANO_TOFILES_KEY) {
char *tmp = do_browse_from(answer); char *tmp = do_browse_from(answer);
#ifndef DISABLE_MOUSE
currshortcut = writefile_list; currshortcut = writefile_list;
currslen = WRITEFILE_LIST_LEN; currslen = WRITEFILE_LIST_LEN;
#endif
if (tmp != NULL) if (tmp != NULL)
answer = mallocstrcpy(answer, tmp); answer = mallocstrcpy(answer, tmp);
@ -1178,8 +1190,11 @@ char *do_browser(char *inpath)
blank_statusbar_refresh(); blank_statusbar_refresh();
#ifndef DISABLE_MOUSE
currshortcut = browser_list; currshortcut = browser_list;
currslen = BROWSER_LIST_LEN; currslen = BROWSER_LIST_LEN;
#endif
editline = 0; editline = 0;
col = 0; col = 0;

View File

@ -92,8 +92,10 @@ shortcut browser_list[BROWSER_LIST_LEN];
colorstruct colors[NUM_NCOLORS]; colorstruct colors[NUM_NCOLORS];
#endif #endif
#ifndef DISABLE_MOUSE
shortcut *currshortcut = main_list; /* Current shortcut list we're using */ shortcut *currshortcut = main_list; /* Current shortcut list we're using */
int currslen = MAIN_VISIBLE; /* Length of current shortcut list */ int currslen = MAIN_VISIBLE; /* Length of current shortcut list */
#endif
#ifndef NANO_SMALL #ifndef NANO_SMALL
toggle toggles[TOGGLE_LEN]; toggle toggles[TOGGLE_LEN];

4
nano.1
View File

@ -70,7 +70,9 @@ search and replace strings.
.TP .TP
.B \-r (\-\-fill) .B \-r (\-\-fill)
Wrap lines at column #cols. By default, this is the width of the screen, Wrap lines at column #cols. By default, this is the width of the screen,
less eight. less eight. If this value is negative, wrapping will occur at #cols from
the right of the screen, allowing it to vary along with the screen width
if the screen is resized.
.TP .TP
.B \-s (\-\-speller) .B \-s (\-\-speller)
Enable alternative spell checker command. Enable alternative spell checker command.

View File

@ -93,7 +93,9 @@ search and replace strings.
<DD> <DD>
Wrap lines at column #cols. By default, this is the width of the screen, Wrap lines at column #cols. By default, this is the width of the screen,
less eight. less eight. If this value is negative, wrapping will occur at #cols from
the right of the screen, allowing it to vary along with the screen width
if the screen is resized.
<DT><B>-s (--speller)</B> <DT><B>-s (--speller)</B>
<DD> <DD>
@ -182,6 +184,6 @@ used by others).
This document was created by This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>, <A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR> using the manual pages.<BR>
Time: 11:22:15 GMT, April 30, 2001 Time: 02:47:57 GMT, May 20, 2001
</BODY> </BODY>
</HTML> </HTML>

32
nano.c
View File

@ -62,8 +62,11 @@
#include <getopt.h> #include <getopt.h>
#endif #endif
#ifndef DISABLE_WRAPJUSTIFY
/* Former globals, now static */ /* Former globals, now static */
int fill = 0; /* Fill - where to wrap lines, basically */ int fill = 0; /* Fill - where to wrap lines, basically */
int wrap_at = 0; /* Right justified fill value, allows resize */
#endif
struct termios oldterm; /* The user's original term settings */ struct termios oldterm; /* The user's original term settings */
static struct sigaction act; /* For all our fun signal handlers */ static struct sigaction act; /* For all our fun signal handlers */
@ -181,11 +184,15 @@ void global_init(void)
totlines = 0; totlines = 0;
placewewant = 0; placewewant = 0;
if (!fill) #ifndef DISABLE_WRAPJUSTIFY
if (wrap_at)
fill = COLS + wrap_at;
else if (!fill)
fill = COLS - CHARS_FROM_EOL; fill = COLS - CHARS_FROM_EOL;
if (fill < MIN_FILL_LENGTH) if (fill < MIN_FILL_LENGTH)
die_too_small(); die_too_small();
#endif
hblank = charalloc(COLS + 1); hblank = charalloc(COLS + 1);
memset(hblank, ' ', COLS); memset(hblank, ' ', COLS);
@ -381,9 +388,12 @@ void usage(void)
#endif #endif
printf(_ printf(_
(" -p --pico Emulate Pico as closely as possible\n")); (" -p --pico Emulate Pico as closely as possible\n"));
#ifndef DISABLE_WRAPJUSTIFY
printf printf
(_ (_
(" -r [#cols] --fill=[#cols] Set fill cols to (wrap lines at) #cols\n")); (" -r [#cols] --fill=[#cols] Set fill cols to (wrap lines at) #cols\n"));
#endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
printf(_ printf(_
(" -s [prog] --speller=[prog] Enable alternate speller\n")); (" -s [prog] --speller=[prog] Enable alternate speller\n"));
@ -422,8 +432,11 @@ void usage(void)
#endif #endif
#endif #endif
printf(_(" -p Emulate Pico as closely as possible\n")); printf(_(" -p Emulate Pico as closely as possible\n"));
#ifndef DISABLE_WRAPJUSTIFY
printf(_ printf(_
(" -r [#cols] Set fill cols to (wrap lines at) #cols\n")); (" -r [#cols] Set fill cols to (wrap lines at) #cols\n"));
#endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
printf(_(" -s [prog] Enable alternate speller\n")); printf(_(" -s [prog] Enable alternate speller\n"));
#endif #endif
@ -1672,8 +1685,10 @@ void handle_sigwinch(int s)
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS) if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
die_too_small(); die_too_small();
#ifndef DISABLE_WRAPJUSTIFY
if ((fill = COLS - CHARS_FROM_EOL) < MIN_FILL_LENGTH) if ((fill = COLS - CHARS_FROM_EOL) < MIN_FILL_LENGTH)
die_too_small(); die_too_small();
#endif
hblank = nrealloc(hblank, COLS + 1); hblank = nrealloc(hblank, COLS + 1);
memset(hblank, ' ', COLS); memset(hblank, ' ', COLS);
@ -2243,7 +2258,10 @@ int main(int argc, char *argv[])
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
{"speller", 1, 0, 's'}, {"speller", 1, 0, 's'},
#endif #endif
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 1, 0, 'r'}, {"fill", 1, 0, 'r'},
#endif
{"mouse", 0, 0, 'm'}, {"mouse", 0, 0, 'm'},
{"pico", 0, 0, 'p'}, {"pico", 0, 0, 'p'},
{"nofollow", 0, 0, 'l'}, {"nofollow", 0, 0, 'l'},
@ -2323,12 +2341,20 @@ int main(int argc, char *argv[])
SET(PICO_MODE); SET(PICO_MODE);
break; break;
case 'r': case 'r':
#ifndef DISABLE_WRAPJUSTIFY
fill = atoi(optarg); fill = atoi(optarg);
if (fill <= 0) { if (fill < 0)
wrap_at = fill;
else if (fill == 0) {
usage(); /* To stop bogus data (like a string) */ usage(); /* To stop bogus data (like a string) */
finish(1); finish(1);
} }
break; break;
#else
usage();
exit(0);
#endif
#ifndef DISABLE_SPELLER #ifndef DISABLE_SPELLER
case 's': case 's':
alt_speller = charalloc(strlen(optarg) + 1); alt_speller = charalloc(strlen(optarg) + 1);
@ -2461,8 +2487,10 @@ int main(int argc, char *argv[])
while (1) { while (1) {
#ifndef DISABLE_MOUSE
currshortcut = main_list; currshortcut = main_list;
currslen = MAIN_VISIBLE; currslen = MAIN_VISIBLE;
#endif
#ifndef _POSIX_VDISABLE #ifndef _POSIX_VDISABLE
/* We're going to have to do it the old way, i.e. on cygwin */ /* We're going to have to do it the old way, i.e. on cygwin */

4
nano.h
View File

@ -63,6 +63,10 @@
#define VERMSG "GNU nano " VERSION #define VERMSG "GNU nano " VERSION
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
#endif
/* Structure types */ /* Structure types */
typedef struct filestruct { typedef struct filestruct {
char *data; char *data;

View File

@ -97,7 +97,9 @@ Command Line Options
`-r [#cols], --fill=[#cols].' `-r [#cols], --fill=[#cols].'
Wrap lines at column #cols. By default this is the width of the Wrap lines at column #cols. By default this is the width of the
screen, less eight. screen, less eight. If this value is negative, wrapping will occur
at #cols from the right of the screen, allowing it to vary along
with the screen width if the screen is resized.
`-s [prog], --speller=[prog]' `-s [prog], --speller=[prog]'
Invoke [prog] as the spell checker. By default, `nano' uses its Invoke [prog] as the spell checker. By default, `nano' uses its
@ -393,17 +395,17 @@ Node: Top199
Node: Introduction507 Node: Introduction507
Node: Overview933 Node: Overview933
Node: Command Line Options1513 Node: Command Line Options1513
Ref: Expert Mode3235 Ref: Expert Mode3405
Node: Editor Basics4078 Node: Editor Basics4248
Node: Entering Text4303 Node: Entering Text4473
Node: Special Functions4643 Node: Special Functions4813
Node: The Titlebar5498 Node: The Titlebar5668
Node: The Statusbar6196 Node: The Statusbar6366
Node: Shortcut Lists6777 Node: Shortcut Lists6947
Node: Online Help7170 Node: Online Help7340
Node: Feature Toggles7546 Node: Feature Toggles7716
Node: The File Browser8689 Node: The File Browser8859
Node: Pico Compatibility9398 Node: Pico Compatibility9568
Node: Building and Configure Options11440 Node: Building and Configure Options11610
 
End Tag Table End Tag Table

View File

@ -145,7 +145,9 @@ emulation. @xref{Pico Compatibility}, for more info.
@item -r [#cols], --fill=[#cols]. @item -r [#cols], --fill=[#cols].
Wrap lines at column #cols. By default this is the width of the screen, Wrap lines at column #cols. By default this is the width of the screen,
less eight. less eight. If this value is negative, wrapping will occur at #cols from
the right of the screen, allowing it to vary along with the screen width
if the screen is resized.
@item -s [prog], --speller=[prog] @item -s [prog], --speller=[prog]
Invoke [prog] as the spell checker. By default, @code{nano} uses its Invoke [prog] as the spell checker. By default, @code{nano} uses its

421
po/ca.po

File diff suppressed because it is too large Load Diff

421
po/cs.po

File diff suppressed because it is too large Load Diff

431
po/de.po

File diff suppressed because it is too large Load Diff

421
po/es.po

File diff suppressed because it is too large Load Diff

421
po/fi.po

File diff suppressed because it is too large Load Diff

427
po/fr.po

File diff suppressed because it is too large Load Diff

421
po/gl.po

File diff suppressed because it is too large Load Diff

421
po/hu.po

File diff suppressed because it is too large Load Diff

425
po/id.po

File diff suppressed because it is too large Load Diff

495
po/it.po

File diff suppressed because it is too large Load Diff

496
po/ru.po

File diff suppressed because it is too large Load Diff

498
po/uk.po

File diff suppressed because it is too large Load Diff

View File

@ -34,7 +34,7 @@ extern int current_x, current_y, posible_max, totlines;
extern int placewewant; extern int placewewant;
extern int mark_beginx, samelinewrap; extern int mark_beginx, samelinewrap;
extern int totsize, temp_opt; extern int totsize, temp_opt;
extern int fill, flags,tabsize; extern int fill, wrap_at, flags,tabsize;
extern int search_last_line; extern int search_last_line;
extern int currslen; extern int currslen;

View File

@ -50,7 +50,11 @@ rcoption rcopts[NUM_RCOPTS] =
{"nofollow", FOLLOW_SYMLINKS}, {"nofollow", FOLLOW_SYMLINKS},
{"mouse", USE_MOUSE}, {"mouse", USE_MOUSE},
{"pico", PICO_MODE}, {"pico", PICO_MODE},
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 0}, {"fill", 0},
#endif
{"speller", 0}, {"speller", 0},
{"tempfile", TEMP_OPT}, {"tempfile", TEMP_OPT},
{"view", VIEW_MODE}, {"view", VIEW_MODE},
@ -160,8 +164,16 @@ void parse_rcfile(FILE *rcstream, char *filename)
rcopts[i].name); rcopts[i].name);
#endif #endif
if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) { if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) {
if (!strcasecmp(rcopts[i].name, "fill") || if (
!strcasecmp(rcopts[i].name, "speller")) { #ifndef DISABLE_WRAPJUSTIFY
!strcasecmp(rcopts[i].name, "fill") ||
#endif
#ifndef DISABLE_SPELLER
!strcasecmp(rcopts[i].name, "speller")
#else
0
#endif
) {
if (*ptr == '\n' || *ptr == '\0') { if (*ptr == '\n' || *ptr == '\0') {
rcfile_msg(&errors, _("Error in %s on line %d: option %s requires an argument"), rcfile_msg(&errors, _("Error in %s on line %d: option %s requires an argument"),
@ -171,6 +183,8 @@ void parse_rcfile(FILE *rcstream, char *filename)
option = ptr; option = ptr;
ptr = parse_next_word(ptr); ptr = parse_next_word(ptr);
if (!strcasecmp(rcopts[i].name, "fill")) { if (!strcasecmp(rcopts[i].name, "fill")) {
#ifndef DISABLE_WRAPJUSTIFY
if ((i = atoi(option)) < MIN_FILL_LENGTH) { if ((i = atoi(option)) < MIN_FILL_LENGTH) {
rcfile_msg(&errors, rcfile_msg(&errors,
_("Error in %s on line %d: requested fill size %d too small"), _("Error in %s on line %d: requested fill size %d too small"),
@ -178,10 +192,13 @@ void parse_rcfile(FILE *rcstream, char *filename)
} }
else else
fill = i; fill = i;
#endif
} }
else { else {
#ifndef DISABLE_SPELLER
alt_speller = charalloc(strlen(option) + 1); alt_speller = charalloc(strlen(option) + 1);
strcpy(alt_speller, option); strcpy(alt_speller, option);
#endif
} }
} else } else
SET(rcopts[i].flag); SET(rcopts[i].flag);

View File

@ -271,8 +271,11 @@ int nanogetstr(int allowtabs, char *buf, char *def, shortcut s[], int slen,
x_left = strlen(buf); x_left = strlen(buf);
x = strlen(def) + x_left; x = strlen(def) + x_left;
#ifndef DISABLE_MOUSE
currshortcut = s; currshortcut = s;
currslen = slen; currslen = slen;
#endif
/* Get the input! */ /* Get the input! */
if (strlen(def) > 0) if (strlen(def) > 0)
strcpy(inputbuf, def); strcpy(inputbuf, def);
@ -1420,8 +1423,11 @@ int do_help(void)
curs_set(0); curs_set(0);
blank_statusbar(); blank_statusbar();
#ifndef DISABLE_MOUSE
currshortcut = help_list; currshortcut = help_list;
currslen = HELP_LIST_LEN; currslen = HELP_LIST_LEN;
#endif
kp = keypad_on(edit, 1); kp = keypad_on(edit, 1);
kp2 = keypad_on(bottomwin, 1); kp2 = keypad_on(bottomwin, 1);