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
- New global variables currshortcut and currslen to support using
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
to its own flag, --disable-mouse. The --tiny option defines
this automatically, but now just mouse support can be disabled
@ -23,6 +23,14 @@ Cvs code -
- Changed all string allocations to charalloc(), new function
designed to take nmalloc argument but call calloc based on
(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:
- New option, --enable-nanorc, which allows people to have a .nanorc
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
keystroke to ungetch(). [DONE].
- 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$

15
files.c
View File

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

View File

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

4
nano.1
View File

@ -70,7 +70,9 @@ search and replace strings.
.TP
.B \-r (\-\-fill)
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
.B \-s (\-\-speller)
Enable alternative spell checker command.

View File

@ -93,7 +93,9 @@ search and replace strings.
<DD>
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>
<DD>
@ -182,6 +184,6 @@ used by others).
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
Time: 11:22:15 GMT, April 30, 2001
Time: 02:47:57 GMT, May 20, 2001
</BODY>
</HTML>

32
nano.c
View File

@ -62,8 +62,11 @@
#include <getopt.h>
#endif
#ifndef DISABLE_WRAPJUSTIFY
/* Former globals, now static */
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 */
static struct sigaction act; /* For all our fun signal handlers */
@ -181,11 +184,15 @@ void global_init(void)
totlines = 0;
placewewant = 0;
if (!fill)
#ifndef DISABLE_WRAPJUSTIFY
if (wrap_at)
fill = COLS + wrap_at;
else if (!fill)
fill = COLS - CHARS_FROM_EOL;
if (fill < MIN_FILL_LENGTH)
die_too_small();
#endif
hblank = charalloc(COLS + 1);
memset(hblank, ' ', COLS);
@ -381,9 +388,12 @@ void usage(void)
#endif
printf(_
(" -p --pico Emulate Pico as closely as possible\n"));
#ifndef DISABLE_WRAPJUSTIFY
printf
(_
(" -r [#cols] --fill=[#cols] Set fill cols to (wrap lines at) #cols\n"));
#endif
#ifndef DISABLE_SPELLER
printf(_
(" -s [prog] --speller=[prog] Enable alternate speller\n"));
@ -422,8 +432,11 @@ void usage(void)
#endif
#endif
printf(_(" -p Emulate Pico as closely as possible\n"));
#ifndef DISABLE_WRAPJUSTIFY
printf(_
(" -r [#cols] Set fill cols to (wrap lines at) #cols\n"));
#endif
#ifndef DISABLE_SPELLER
printf(_(" -s [prog] Enable alternate speller\n"));
#endif
@ -1672,8 +1685,10 @@ void handle_sigwinch(int s)
if ((editwinrows = LINES - 5 + no_help()) < MIN_EDITOR_ROWS)
die_too_small();
#ifndef DISABLE_WRAPJUSTIFY
if ((fill = COLS - CHARS_FROM_EOL) < MIN_FILL_LENGTH)
die_too_small();
#endif
hblank = nrealloc(hblank, COLS + 1);
memset(hblank, ' ', COLS);
@ -2243,7 +2258,10 @@ int main(int argc, char *argv[])
#ifndef DISABLE_SPELLER
{"speller", 1, 0, 's'},
#endif
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 1, 0, 'r'},
#endif
{"mouse", 0, 0, 'm'},
{"pico", 0, 0, 'p'},
{"nofollow", 0, 0, 'l'},
@ -2323,12 +2341,20 @@ int main(int argc, char *argv[])
SET(PICO_MODE);
break;
case 'r':
#ifndef DISABLE_WRAPJUSTIFY
fill = atoi(optarg);
if (fill <= 0) {
if (fill < 0)
wrap_at = fill;
else if (fill == 0) {
usage(); /* To stop bogus data (like a string) */
finish(1);
}
break;
#else
usage();
exit(0);
#endif
#ifndef DISABLE_SPELLER
case 's':
alt_speller = charalloc(strlen(optarg) + 1);
@ -2461,8 +2487,10 @@ int main(int argc, char *argv[])
while (1) {
#ifndef DISABLE_MOUSE
currshortcut = main_list;
currslen = MAIN_VISIBLE;
#endif
#ifndef _POSIX_VDISABLE
/* 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
#if defined(DISABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
#endif
/* Structure types */
typedef struct filestruct {
char *data;

View File

@ -97,7 +97,9 @@ Command Line Options
`-r [#cols], --fill=[#cols].'
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]'
Invoke [prog] as the spell checker. By default, `nano' uses its
@ -393,17 +395,17 @@ Node: Top199
Node: Introduction507
Node: Overview933
Node: Command Line Options1513
Ref: Expert Mode3235
Node: Editor Basics4078
Node: Entering Text4303
Node: Special Functions4643
Node: The Titlebar5498
Node: The Statusbar6196
Node: Shortcut Lists6777
Node: Online Help7170
Node: Feature Toggles7546
Node: The File Browser8689
Node: Pico Compatibility9398
Node: Building and Configure Options11440
Ref: Expert Mode3405
Node: Editor Basics4248
Node: Entering Text4473
Node: Special Functions4813
Node: The Titlebar5668
Node: The Statusbar6366
Node: Shortcut Lists6947
Node: Online Help7340
Node: Feature Toggles7716
Node: The File Browser8859
Node: Pico Compatibility9568
Node: Building and Configure Options11610

End Tag Table

View File

@ -145,7 +145,9 @@ emulation. @xref{Pico Compatibility}, for more info.
@item -r [#cols], --fill=[#cols].
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]
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 mark_beginx, samelinewrap;
extern int totsize, temp_opt;
extern int fill, flags,tabsize;
extern int fill, wrap_at, flags,tabsize;
extern int search_last_line;
extern int currslen;

View File

@ -50,7 +50,11 @@ rcoption rcopts[NUM_RCOPTS] =
{"nofollow", FOLLOW_SYMLINKS},
{"mouse", USE_MOUSE},
{"pico", PICO_MODE},
#ifndef DISABLE_WRAPJUSTIFY
{"fill", 0},
#endif
{"speller", 0},
{"tempfile", TEMP_OPT},
{"view", VIEW_MODE},
@ -160,8 +164,16 @@ void parse_rcfile(FILE *rcstream, char *filename)
rcopts[i].name);
#endif
if (set == 1 || rcopts[i].flag == FOLLOW_SYMLINKS) {
if (!strcasecmp(rcopts[i].name, "fill") ||
!strcasecmp(rcopts[i].name, "speller")) {
if (
#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') {
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;
ptr = parse_next_word(ptr);
if (!strcasecmp(rcopts[i].name, "fill")) {
#ifndef DISABLE_WRAPJUSTIFY
if ((i = atoi(option)) < MIN_FILL_LENGTH) {
rcfile_msg(&errors,
_("Error in %s on line %d: requested fill size %d too small"),
@ -178,10 +192,13 @@ void parse_rcfile(FILE *rcstream, char *filename)
}
else
fill = i;
#endif
}
else {
#ifndef DISABLE_SPELLER
alt_speller = charalloc(strlen(option) + 1);
strcpy(alt_speller, option);
#endif
}
} else
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 = strlen(def) + x_left;
#ifndef DISABLE_MOUSE
currshortcut = s;
currslen = slen;
#endif
/* Get the input! */
if (strlen(def) > 0)
strcpy(inputbuf, def);
@ -1420,8 +1423,11 @@ int do_help(void)
curs_set(0);
blank_statusbar();
#ifndef DISABLE_MOUSE
currshortcut = help_list;
currslen = HELP_LIST_LEN;
#endif
kp = keypad_on(edit, 1);
kp2 = keypad_on(bottomwin, 1);