Commit 6df90f57 authored by Chris Allegretta's avatar Chris Allegretta
Browse files

DLR and DB fixes mega-merge

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1235 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
No related merge requests found
Showing with 2190 additions and 2104 deletions
+2190 -2104
...@@ -105,7 +105,7 @@ ...@@ -105,7 +105,7 @@
higuita@cadernoverde.com) (54) [FIXED]. higuita@cadernoverde.com) (54) [FIXED].
- When using autoindent (-i), wrapped text does not get autoindented - When using autoindent (-i), wrapped text does not get autoindented
(55, discovered by Mark Senior) [FIXED]. (55, discovered by Mark Senior) [FIXED].
- When using -R (regex) and -p (pico mode), subsequent searches after - When using -R (regex) and -p (Pico mode), subsequent searches after
the first fail if no string is entered (56) [FIXED]. the first fail if no string is entered (56) [FIXED].
- Page down on a file of editwinrows fails (again). Reported by Ryan - Page down on a file of editwinrows fails (again). Reported by Ryan
Krebs (57) [FIXED]. Krebs (57) [FIXED].
......
...@@ -14,8 +14,9 @@ CVS Code - ...@@ -14,8 +14,9 @@ CVS Code -
- Many fixes to the help browser and shortcut lists: efficiency - Many fixes to the help browser and shortcut lists: efficiency
updates, consistency fixes, help text fixes and improvements, updates, consistency fixes, help text fixes and improvements,
and spacing improvements. (David Benbennick) and spacing improvements. (David Benbennick)
- Make more functions use const variables when possible. (David - Make some functions use const variables when possible, and
Benbennick) also make them static when necessary. (David Benbennick,
necessary redefined by Chris ;-)
- Add Carl Drinkwater's backup file option (-B or --backup on the - Add Carl Drinkwater's backup file option (-B or --backup on the
command line, M-B in nano's global shortcuts). If the original command line, M-B in nano's global shortcuts). If the original
file is unchanged from when it was loaded, it is backed up to file is unchanged from when it was loaded, it is backed up to
...@@ -33,20 +34,57 @@ CVS Code - ...@@ -33,20 +34,57 @@ CVS Code -
--regexp as an alternative for -R; they were listed in nano's --regexp as an alternative for -R; they were listed in nano's
usage information, but weren't actually in nano. Also, display usage information, but weren't actually in nano. Also, display
"-?" as an alternative for "-h" in nano's usage information, "-?" as an alternative for "-h" in nano's usage information,
put the command line options in a more consistent (i. e. mostly put the command line options in a more consistent (i.e. mostly
alphabetical) order in nano, put the long options in a more alphabetical) order in nano, put the long options in a more
consistent order in rcfile.c and nanorc.sample, don't include consistent order in rcfile.c and nanorc.sample, don't include
rcfile options if their equivalent command line options are rcfile options if their equivalent command line options are
disabled, and remove obsolete relative option from disabled, and remove obsolete relative option from
nanorc.sample. (DLR) nanorc.sample. (DLR)
- Removed much unnecessary parts to the color code and reworks
some of the color display (David Benbennick).
- Change "File Name to Append/Prepend" to "File Name to - Change "File Name to Append/Prepend" to "File Name to
Append/Prepend to". The original prompt could confusingly Append/Prepend to". The original prompt could confusingly
imply that we are appending/prepending another file to the imply that we are appending/prepending another file to the
current file, when we are actually appending/prepending the current file, when we are actually appending/prepending the
current file to another file. (DLR) current file to another file. (DLR)
- Put nano.1, nano.1.html, and nano.texi up to date. (DLR) - Put nano.1, nano.1.html, and nano.texi up to date, and fix a
- Typo fixes for the ChangeLog. (David Benbennick) few inconsistencies in them. (DLR)
- Typo fixes for the ChangeLog. (David Benbennick and DLR)
- Complete rewrite of justification code to fix some bugs and
improve its functionality. (David Benbennick)
- If a variable isn't going to be used in tiny mode, #define it
out when possible. (David Benbennick)
- Major reworking of the cutting/screen-updating code in cut.c,
some functions in utils.c, the cursor placement code in
winio.c, and many, many other areas to increase efficiency.
(David Benbennick)
- Rework handling of prompts when there's a list of partial
filename matches on the screen: remove kludgy case-by-case
handling (which didn't even handle every case), and have
statusq() handle it directly for all cases. (David Benbennick
and DLR)
- Fix some warnings and errors that show up when using gcc's
-pedantic option. (DLR)
- Add a comment to nanorc.sample warning that an out-of-range
negative value for fill can make nano die complaining that
the screen is too small (which may not be immediately
obvious. (DLR)
- There were some opendir() calls in files.c without
corresponding closedir() calls; add them. (DLR)
- Move align() and null_at() from nano.c to utils.c, and move
the openfilestruct handling functions from nano.c to files.c.
(DLR)
- In color.c, start the "#ifdef ENABLE_COLOR" block after
including all the header files, as rcfile.c does; this fixes
a warning about ANSI C'S inability to handle blank files.
(DLR)
- Add command line option -I/--ignorercfiles to ignore
/etc/nanorc and ~/.nanorc. (Carl Drinkwater)
- files.c: - files.c:
new_file():
- Make sure current_x is zero; this fixes a problem where the
current cursor position wasn't reset when reading in a file in
multibuffer mode. (David Benbennick)
read_file(), read_line(): read_file(), read_line():
- Rework to properly handle nulls in the input file, fix - Rework to properly handle nulls in the input file, fix
detection of binary files to properly mark a file as binary if detection of binary files to properly mark a file as binary if
...@@ -66,8 +104,19 @@ CVS Code - ...@@ -66,8 +104,19 @@ CVS Code -
--enable-tiny is used. Since formatstr isn't ever used in tiny --enable-tiny is used. Since formatstr isn't ever used in tiny
mode, don't bother even creating the variable. (David mode, don't bother even creating the variable. (David
Benbennick and DLR) Benbennick and DLR)
do_insertfile():
- Memory leak fix. (David Benbennick)
get_full_path():
- Memory leak fix. Also, make it properly interpret ~/ notation
so, among other things, the option "--operatingdir ~" works.
(David Benbennick)
check_operating_dir():
- Memory leak fix. (David Benbennick)
cwd_tab_completion():
- Changed a variable name: dirName -> dirname. (DLR)
append_slash_if_dir(), input_tab(): append_slash_if_dir(), input_tab():
- Changed a variable name: lastWasTab -> lastwastab. (DLR) - Changed variable names: lastWasTab -> lastwastab, matchBuf ->
matchbuf. (DLR)
- global.c: - global.c:
free_toggles(): free_toggles():
- Only include if we're not using tiny mode. (David Benbennick) - Only include if we're not using tiny mode. (David Benbennick)
...@@ -79,6 +128,8 @@ CVS Code - ...@@ -79,6 +128,8 @@ CVS Code -
do_toggle() if Pico emulation mode is the toggle in question. do_toggle() if Pico emulation mode is the toggle in question.
Don't free the toggles here, either; it's unnecessary after the Don't free the toggles here, either; it's unnecessary after the
above change. (David Benbennick) above change. (David Benbennick)
- If wrapping is disabled, don't include the toggle for it.
(DLR)
shortcut_init(): shortcut_init():
- Rework IFHELP macro (David Benbennick). - Rework IFHELP macro (David Benbennick).
- move.c: - move.c:
...@@ -90,6 +141,26 @@ CVS Code - ...@@ -90,6 +141,26 @@ CVS Code -
- nanorc.sample: - nanorc.sample:
- Put in much less crappy example regex rules for c-file. - Put in much less crappy example regex rules for c-file.
- nano.c: - nano.c:
do_char():
- Fix a problem where, if ENABLE_COLOR wasn't used, typing
characters on a marked line before the beginning of the mark
would make the highlight short by one. (David Benbennick)
die():
- Rework slightly to remove redundant printing of last message
and print all messages after resetting the terminal. (DLR)
global_init():
- Call die_too_small() when fill is 0. (DLR)
usage():
- List the options that are ignored for the purpose of Pico
compatibility, and make some minor consistency fixes. (DLR)
do_next_word(), do_prev_word():
- Fix a problem where highlighting isn't done properly after
calling either of these, and another problem where the cursor
would move back too far in certain cases with do_prev_word().
(David Benbennick)
do_backspace():
- Make sure placewewant is set properly, and that the mark is
moved backwards. (David Benbennick)
clear_filename(): clear_filename():
- Remove this function, as it has unneeded functionality, is - Remove this function, as it has unneeded functionality, is
short enough to be inlined, and is only called in two spots short enough to be inlined, and is only called in two spots
...@@ -97,6 +168,16 @@ CVS Code - ...@@ -97,6 +168,16 @@ CVS Code -
do_int_spell(), do_alt_spell(): do_int_spell(), do_alt_spell():
- Rework to save the marked selection before doing spell checking - Rework to save the marked selection before doing spell checking
and restore it afterward. (DLR) and restore it afterward. (DLR)
do_cont():
- Handle the case where the window was resized while we were
stopped. (David Benbennick)
handle_sigwinch():
- Make sure we adjust fill when the window is resized. (David
Benbennick)
- Call die_too_small() when fill is 0. (DLR)
help_init():
- Since the return value of snprintf() isn't well defined, use
sprintf() instead. (David Benbennick)
do_toggle(): do_toggle():
- Since the search mode toggles aren't global anymore, we don't - Since the search mode toggles aren't global anymore, we don't
need to explicitly block them here anymore (which will end up need to explicitly block them here anymore (which will end up
...@@ -109,8 +190,23 @@ CVS Code - ...@@ -109,8 +190,23 @@ CVS Code -
hold a line number. (DLR) hold a line number. (DLR)
- Properly handle multiple -r settings on the command line. (Carl - Properly handle multiple -r settings on the command line. (Carl
Drinkwater) Drinkwater)
- Fix a bug that prevented file insertion via the Insert key
from working at all when --enable-multibuffer wasn't used
(oops). (DLR)
- Adapt David Benbennick's fix to get fill to accept negative
numbers properly in parse_rcfile() (see below) to the
handlers for the -r and -T options as well, so that -r/-T 0
can be treated separately from -r/-T string. (DLR)
- proto.h:
- Remove external declaration of the global int fill, since
it's now static. (DLR)
- rcfile.c: - rcfile.c:
colortoint(): parse_rcfile():
- Add David Benbennick's fix that allows fill to accept
negative numbers properly. Specifically, use strtol() there
instead of atoi() so that errors can be detected. Also
adapted for tabsize by DLR.
parse_next_regex(), colortoint():
- Only include if ENABLE_COLOR is defined. (DLR) - Only include if ENABLE_COLOR is defined. (DLR)
- search.c: - search.c:
search_init(): search_init():
...@@ -118,6 +214,9 @@ CVS Code - ...@@ -118,6 +214,9 @@ CVS Code -
part of this function referencing them so that they still work. part of this function referencing them so that they still work.
(DLR) (DLR)
- Remove unneeded toggles variable. (David Benbennick) - Remove unneeded toggles variable. (David Benbennick)
- Fix a problem where the first character of buf was overwritten
if the last search string was one third the number of columns
plus one. (David Benbennick)
findnextstr(): findnextstr():
- Update the current line at current_x if we don't find a match. - Update the current line at current_x if we don't find a match.
Also, pass current_x_find to strstrwrapper() so we know whether Also, pass current_x_find to strstrwrapper() so we know whether
...@@ -134,10 +233,16 @@ CVS Code - ...@@ -134,10 +233,16 @@ CVS Code -
other than the terminating null in strings to newlines and other than the terminating null in strings to newlines and
back; they're used to handle null characters in files properly. back; they're used to handle null characters in files properly.
(DLR) (DLR)
lowercase():
- Remove, since it isn't actually used anywhere. (David
Benbennick)
strstrwrapper(): Set REG_NOTBOL when we're not at the beginning of a strstrwrapper(): Set REG_NOTBOL when we're not at the beginning of a
string, to avoid false positives when searching for regular string, to avoid false positives when searching for regular
expressions prefixed with ^. Make it take a new parameter, expressions prefixed with ^. Make it take a new parameter,
line_pos, to determine where we are in the string. (DLR) line_pos, to determine where we are in the string. (DLR)
check_wildcard_match():
- Changed variable names: retryPat -> retrypat, retryText ->
retrytext. (DLR)
- winio.c: - winio.c:
actual_x_from_start(): actual_x_from_start():
- Overhaul to make cursor placement more like that of Pico: add - Overhaul to make cursor placement more like that of Pico: add
...@@ -158,16 +263,28 @@ CVS Code - ...@@ -158,16 +263,28 @@ CVS Code -
(which should never occur under normal circumstances; they will (which should never occur under normal circumstances; they will
only be there if the line had nulls in it and was unsunder()ed only be there if the line had nulls in it and was unsunder()ed
beforehand) as ^@'s. (DLR) beforehand) as ^@'s. (DLR)
- Display ASCII 0x80-0x9f as backslashes followed by 3-digit
octal values to keep xterm from screwing up the display when
some of them are printed as-is. (David Benbennick)
statusbar():
- Limit statusbar display to the number of columns less four, and
don't allow it to go over its original row. (David Benbennick)
do_help(): do_help():
- Add support for the handled keyboard escape sequences in the - Add support for the handled keyboard escape sequences in the
help menu, as they are needed with some terminals (e.g. xterm help menu, as they are needed with some terminals (e.g. xterm
with TERM=ansi). (DLR) with TERM=ansi). (DLR)
do_replace_highlight():
- When using regexps, make sure the highlight is the length of
the search result and not the regexp string. (DLR)
- configure.ac: - configure.ac:
- Added ms to ALL_LINGUAS (Jordi). - Added ms to ALL_LINGUAS (Jordi).
- Merged acconfig.h in (Jordi). - Merged acconfig.h in (Jordi).
- Fixed so that --enable-debug defines DEBUG and undefines
NDEBUG. (Carl Drinkwater)
- THANKS: - THANKS:
- Completed a bit (Jordi). - Completed a bit (Jordi).
- Fixed David Benbennick's email address (David Benbennick). - Fixed David Benbennick's email address. (David Benbennick)
- Typo fix. (DLR)
GNU nano 1.1.9 - 05/12/2002 GNU nano 1.1.9 - 05/12/2002
- General: - General:
- Typos n misspellings all over the place (David Benbennick). - Typos n misspellings all over the place (David Benbennick).
...@@ -963,7 +1080,7 @@ nano-1.1.0 - 07/15/2001 ...@@ -963,7 +1080,7 @@ nano-1.1.0 - 07/15/2001
- Moved extension functions (Case Sensitive, Regexp, and Backwards - Moved extension functions (Case Sensitive, Regexp, and Backwards
Search, Append key in write file function) to Meta keys, as Search, Append key in write file function) to Meta keys, as
people are complaining loudly about nano not being control-key people are complaining loudly about nano not being control-key
compatible with Pico, which is a Bag Thing (TM). Changes to compatible with Pico, which is a Bad Thing (TM). Changes to
shortcut_init, toggle_init, new toggles for backwards and regexp shortcut_init, toggle_init, new toggles for backwards and regexp
(and you can now toggle all search options including regexp at (and you can now toggle all search options including regexp at
the Search: prompt!) Changes to nanogetstr to enable Meta the Search: prompt!) Changes to nanogetstr to enable Meta
...@@ -1420,7 +1537,7 @@ General ...@@ -1420,7 +1537,7 @@ General
by Rocco Corsi. by Rocco Corsi.
help_init() help_init()
- Fix off by one error that was making ^G help in normal mode and - Fix off by one error that was making ^G help in normal mode and
^_ in pico mode not be displayed in the help (bug discovered by ^_ in Pico mode not be displayed in the help (bug discovered by
Rocco Corsi). Rocco Corsi).
do_toggle() do_toggle()
- Added fix_editbot() call to fix improper redisplay of edit - Added fix_editbot() call to fix improper redisplay of edit
...@@ -2248,10 +2365,10 @@ nano-0.9.3 - 04/29/2000 ...@@ -2248,10 +2365,10 @@ nano-0.9.3 - 04/29/2000
nano-0.9.2 - 04/15/2000 nano-0.9.2 - 04/15/2000
- This release just fixes the serious segfault problem if nano is - This release just fixes the serious segfault problem if nano is
invoked any way other than using the absolute path. The bug was invoked any way other than using the absolute path. The bug was
in the new code for checking whether nano is invoked as pico. in the new code for checking whether nano is invoked as 'pico'.
nano-0.9.1 - 04/14/2000 nano-0.9.1 - 04/14/2000
- Added pico compatibility for ^T when in search or switch to switch - Added Pico compatibility for ^T when in search or switch to switch
to the opposite function. Added one to REPLACE_LIST_LEN and to the opposite function. Added one to REPLACE_LIST_LEN and
WHEREIS_LIST_LEN in nano.h, new args to sc_init_one in global.c and WHEREIS_LIST_LEN in nano.h, new args to sc_init_one in global.c and
new strings that will have to be gettext()ed. New argument 'replacing' new strings that will have to be gettext()ed. New argument 'replacing'
...@@ -2373,7 +2490,7 @@ nano-0.8.4 - 02/11/2000 ...@@ -2373,7 +2490,7 @@ nano-0.8.4 - 02/11/2000
- README: Updated my email address and the nano web page. - README: Updated my email address and the nano web page.
nano-0.8.3 - 02/08/2000 nano-0.8.3 - 02/08/2000
- New pico mode (-p, --pico), toggles (more) compatibility with the - New Pico mode (-p, --pico), toggles (more) compatibility with the
Pico messages displayed in the shortcut list. Note that there are still Pico messages displayed in the shortcut list. Note that there are still
small differences in this mode. small differences in this mode.
- nano.h: New shortcut struct format, for the benefit of i18n and - nano.h: New shortcut struct format, for the benefit of i18n and
......
...@@ -221,7 +221,7 @@ ...@@ -221,7 +221,7 @@
The --nofollow option also works again for those who The --nofollow option also works again for those who
are real security nuts. There are also some display and are real security nuts. There are also some display and
search fixes, and the --disable-spell function was renamed search fixes, and the --disable-spell function was renamed
to --disable-speller to be in line with nano and pico's to --disable-speller to be in line with nano and Pico's
"speller" term. "speller" term.
12/02/2000 - Nano 0.9.22 is released, with many more changes and 12/02/2000 - Nano 0.9.22 is released, with many more changes and
...@@ -416,13 +416,13 @@ ...@@ -416,13 +416,13 @@
04/15/2000 - Nano 0.9.2 just fixes the serious segfault problem if 04/15/2000 - Nano 0.9.2 just fixes the serious segfault problem if
nano is invoked any way other than using the absolute nano is invoked any way other than using the absolute
path. The bug was in the new code for checking whether path. The bug was in the new code for checking whether
nano is invoked as pico. nano is invoked as 'pico'.
04/14/2000 - 0.9.1 has some more Pico compatibility built-in. The 04/14/2000 - 0.9.1 has some more Pico compatibility built-in. The
option to switch to/from Search and Search/Replace option to switch to/from Search and Search/Replace
(^T) is now available, and nano now displays the (^T) is now available, and nano now displays the
more Pico-like shortcut list when invoked as 'pico' more Pico-like shortcut list when invoked as 'pico'
(i.e. if pico is a symlink to nano). There is an (i.e. if 'pico' is a symlink to nano). There is an
important change to the handling of symbolic links important change to the handling of symbolic links
as well. Now, nano does the "correct" thing and as well. Now, nano does the "correct" thing and
automatically writes to the object of the symlink, automatically writes to the object of the symlink,
......
The following people have helped GNU nano in some way or another. The following people have helped GNU nano in some way or another.
If we missed you here, let us now! If we missed you here, let us know!
Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com>
Bahasa Melayu Translator Bahasa Melayu Translator
......
...@@ -21,8 +21,6 @@ ...@@ -21,8 +21,6 @@
#include "config.h" #include "config.h"
#ifdef ENABLE_COLOR
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
...@@ -33,6 +31,8 @@ ...@@ -33,6 +31,8 @@
#include "proto.h" #include "proto.h"
#include "nano.h" #include "nano.h"
#ifdef ENABLE_COLOR
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
#include <libintl.h> #include <libintl.h>
#define _(string) gettext(string) #define _(string) gettext(string)
...@@ -40,62 +40,7 @@ ...@@ -40,62 +40,7 @@
#define _(string) (string) #define _(string) (string)
#endif #endif
void color_on(WINDOW *win, int whatever) void do_colorinit(void)
{
/* Temporary fallback, if the color value hasn't been set,
turn on highlighting */
if (!colors[whatever - FIRST_COLORNUM].set) {
wattron(win, A_REVERSE);
return;
}
if (colors[whatever - FIRST_COLORNUM].bold)
wattron(win, A_BOLD);
/* If the foreground color is black, we've switched fg and bg (see
the comment in colorinit_one() about this) so turn on reverse so
it looks like it's supposed to */
if (colors[whatever - FIRST_COLORNUM].fg == COLOR_BLACK)
wattron(win, A_REVERSE);
wattron(win, COLOR_PAIR(whatever));
}
void color_off(WINDOW *win, int whatever)
{
if (!colors[whatever - FIRST_COLORNUM].set) {
wattroff(win, A_REVERSE);
return;
}
wattroff(win, COLOR_PAIR(whatever));
if (colors[whatever - FIRST_COLORNUM].fg == COLOR_BLACK)
wattroff(win, A_REVERSE);
if (colors[whatever - FIRST_COLORNUM].bold)
wattroff(win, A_BOLD);
}
void colorinit_one(int colortoset, short fg, short bg, int bold)
{
colors[colortoset - FIRST_COLORNUM].fg = fg;
colors[colortoset - FIRST_COLORNUM].bg = bg;
colors[colortoset - FIRST_COLORNUM].bold = bold;
colors[colortoset - FIRST_COLORNUM].set = 1;
/* Okay, so if they want a black foreground, do a switch on the fg
and bg, because specifying black as the foreground color gives
this ugly grey color. Then in color_on we will turn A_REVERSE
which is probably what they want it to look like... */
if (fg == COLOR_BLACK)
init_pair(colortoset, bg, fg);
else
init_pair(colortoset, fg, bg);
}
int do_colorinit(void)
{ {
int i; int i;
colortype *tmpcolor = NULL, *beforenow = NULL; colortype *tmpcolor = NULL, *beforenow = NULL;
...@@ -142,38 +87,7 @@ int do_colorinit(void) ...@@ -142,38 +87,7 @@ int do_colorinit(void)
} }
} }
/* return;
if (use_default_colors() != ERR) {
init_pair(COLOR_BLACK, -1, -1);
init_pair(COLOR_GREEN, COLOR_GREEN, -1);
init_pair(COLOR_WHITE, COLOR_WHITE, -1);
init_pair(COLOR_RED, COLOR_RED, -1);
init_pair(COLOR_CYAN, COLOR_CYAN, -1);
init_pair(COLOR_MAGENTA, COLOR_MAGENTA, -1);
init_pair(COLOR_BLUE, COLOR_BLUE, -1);
init_pair(COLOR_YELLOW, COLOR_YELLOW, -1);
} else {
init_pair(COLOR_BLACK, COLOR_BLACK, COLOR_BLACK);
init_pair(COLOR_GREEN, COLOR_GREEN, COLOR_BLACK);
init_pair(COLOR_WHITE, COLOR_WHITE, COLOR_BLACK);
init_pair(COLOR_RED, COLOR_RED, COLOR_BLACK);
init_pair(COLOR_CYAN, COLOR_CYAN, COLOR_BLACK);
init_pair(COLOR_MAGENTA, COLOR_MAGENTA, COLOR_BLACK);
init_pair(COLOR_BLUE, COLOR_BLUE, COLOR_BLACK);
init_pair(COLOR_YELLOW, COLOR_YELLOW, COLOR_BLACK);
}
*/
/* Okay I'll be nice and comment these out for the commit =)
colorinit_one(COLOR_TITLEBAR, COLOR_GREEN, COLOR_BLUE, 1);
colorinit_one(COLOR_BOTTOMBARS, COLOR_GREEN, COLOR_BLUE, 1);
colorinit_one(COLOR_STATUSBAR, COLOR_BLACK, COLOR_CYAN, 0);
colorinit_one(COLOR_TEXT, COLOR_WHITE, COLOR_BLACK, 0);
colorinit_one(COLOR_MARKER, COLOR_BLACK, COLOR_CYAN, 0);
}
*/
return 0;
} }
/* Update the color information based on the current filename */ /* Update the color information based on the current filename */
......
...@@ -17,10 +17,18 @@ dnl Checks for header files. ...@@ -17,10 +17,18 @@ dnl Checks for header files.
AC_HEADER_STDC AC_HEADER_STDC
AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h regex.h) AC_CHECK_HEADERS(fcntl.h unistd.h malloc.h termios.h termio.h limits.h getopt.h regex.h)
dnl Turn off assert statements.
AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
dnl options dnl options
AC_ARG_ENABLE(debug,
[ --enable-debug Enable debugging (disabled by default)],
[if test x$enableval = xyes; then
AC_DEFINE(DEBUG, 1, [Define this to enable nano debug messages and assert warnings.])
debug_support=yes
fi])
if test "$debug_support" != "yes"; then
AC_DEFINE(NDEBUG, 1, [Shut up the assert warnings :-)])
fi
AC_ARG_ENABLE(tiny, AC_ARG_ENABLE(tiny,
[ --enable-tiny Disable features for the sake of size [ --enable-tiny Disable features for the sake of size
(currently disables detailed help and i18n)], (currently disables detailed help and i18n)],
...@@ -296,8 +304,6 @@ dnl Parse any configure options ...@@ -296,8 +304,6 @@ dnl Parse any configure options
LIBS="$LIBS $CURSES_LIB" LIBS="$LIBS $CURSES_LIB"
AC_ARG_ENABLE(debug, [ --enable-debug Enable debugging (def disabled)],)
AC_SUBST(CURSES_LIB) AC_SUBST(CURSES_LIB)
if test "x$glib_cflags" != "x" if test "x$glib_cflags" != "x"
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h>
#include "proto.h" #include "proto.h"
#include "nano.h" #include "nano.h"
...@@ -34,17 +35,21 @@ ...@@ -34,17 +35,21 @@
#define _(string) (string) #define _(string) (string)
#endif #endif
static int marked_cut; /* Is the cutbuffer from a mark */ static int marked_cut; /* Is the cutbuffer from a mark? */
static filestruct *cutbottom = NULL; /* Pointer to end of cutbuffer */ static filestruct *cutbottom = NULL; /* Pointer to end of cutbuffer */
void add_to_cutbuffer(filestruct * inptr) filestruct *get_cutbottom(void)
{
return cutbottom;
}
void add_to_cutbuffer(filestruct *inptr)
{ {
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, _("add_to_cutbuffer called with inptr->data = %s\n"), fprintf(stderr, _("add_to_cutbuffer called with inptr->data = %s\n"),
inptr->data); inptr->data);
#endif #endif
totsize -= strlen(inptr->data);
if (cutbuffer == NULL) { if (cutbuffer == NULL) {
cutbuffer = inptr; cutbuffer = inptr;
inptr->prev = NULL; inptr->prev = NULL;
...@@ -58,186 +63,168 @@ void add_to_cutbuffer(filestruct * inptr) ...@@ -58,186 +63,168 @@ void add_to_cutbuffer(filestruct * inptr)
} }
#ifndef NANO_SMALL #ifndef NANO_SMALL
/* Cut a marked segment instead of a whole line. Only called from /* Cut a marked segment instead of a whole line.
do_cut_text(). * The first cut character is top->data[top_x]. Unless top == bot, the
destructive is whether to actually modify the file structure, if not then * last cut line has length bot_x. That is, if bot_x > 0 then we cut to
just copy the buffer into cutbuffer and don't pull it from the file */ * bot->data[bot_x - 1].
*
void cut_marked_segment(filestruct * top, int top_x, filestruct * bot, * destructive is whether to actually modify the file structure, if not
int bot_x, int destructive) * then just copy the buffer into cutbuffer and don't pull it from the
* file.
*
* If destructive, then we maintain totsize, totlines, filebot, the
* magic line, and line numbers. Also, we set current and current_x so
* the cursor will be on the first character after what was cut. We do
* not do any screen updates. */
void cut_marked_segment(filestruct *top, size_t top_x, filestruct *bot,
size_t bot_x, int destructive)
{ {
filestruct *tmp, *next, *botcopy; filestruct *tmp, *next;
char *tmpstr; size_t newsize;
int newsize;
/* Special case for cutting part of one line */ if (top == bot && top_x == bot_x)
if (top == bot) { return;
int swap; assert(top != NULL && bot != NULL);
tmp = copy_node(top); /* Make top be no later than bot. */
newsize = abs(bot_x - top_x) + 1; if (top->lineno > bot->lineno) {
tmpstr = charalloc(newsize + 1); filestruct *swap = top;
int swap2 = top_x;
top = bot;
bot = swap;
top_x = bot_x;
bot_x = swap2;
} else if (top == bot && top_x > bot_x) {
/* And bot_x can't be an earlier character than top_x. */
int swap = top_x;
/* Make top_x always be before bot_x */
if (top_x > bot_x) {
swap = top_x;
top_x = bot_x; top_x = bot_x;
bot_x = swap; bot_x = swap;
} }
strncpy(tmpstr, &top->data[top_x], newsize); /* Make the first cut line manually. */
tmp = copy_node(top);
newsize = (top == bot ? bot_x - top_x : strlen(top->data + top_x));
memmove(tmp->data, top->data + top_x, newsize);
null_at(&tmp->data, newsize);
add_to_cutbuffer(tmp);
/* And make the remainder line manually too. */
if (destructive) { if (destructive) {
memmove(&top->data[top_x], &top->data[bot_x],
strlen(&top->data[bot_x]) + 1);
align(&top->data);
current_x = top_x; current_x = top_x;
update_cursor(); totsize -= newsize;
} totlines -= bot->lineno - top->lineno;
tmpstr[newsize - 1] = '\0';
tmp->data = tmpstr;
add_to_cutbuffer(tmp);
dump_buffer(cutbuffer);
return; newsize = top_x + strlen(bot->data + bot_x) + 1;
if (top == bot) {
/* In this case, the remainder line is shorter, so we must
move text from the end forward first. */
memmove(top->data + top_x, bot->data + bot_x,
newsize - top_x);
top->data = (char *)nrealloc(top->data,
sizeof(char) * newsize);
} else {
totsize -= bot_x;
/* Here, the remainder line might get longer, so we realloc
it first. */
top->data = (char *)nrealloc(top->data,
sizeof(char) * newsize);
memmove(top->data + top_x, bot->data + bot_x,
newsize - top_x);
}
} }
/* Set up the beginning of the cutbuffer */ if (top == bot) {
tmp = copy_node(top); #ifdef DEBUG
tmpstr = charalloc(strlen(&top->data[top_x]) + 1); dump_buffer(cutbuffer);
strcpy(tmpstr, &top->data[top_x]); #endif
free(tmp->data); return;
tmp->data = tmpstr;
/* Chop off the end of the first line */
tmpstr = charalloc(top_x + 1);
strncpy(tmpstr, top->data, top_x);
if (destructive) {
free(top->data);
top->data = tmpstr;
} }
do { tmp = top->next;
while (tmp != bot) {
next = tmp->next; next = tmp->next;
if (destructive) if (!destructive)
tmp = copy_node(tmp);
else
totsize -= strlen(tmp->data);
add_to_cutbuffer(tmp); add_to_cutbuffer(tmp);
else {
filestruct *tmpcopy = NULL;
tmpcopy = copy_node(tmp);
add_to_cutbuffer(tmpcopy);
}
totlines--;
totsize--; /* newline (add_to_cutbuffer doesn't count newlines) */
tmp = next; tmp = next;
} }
while (next != bot && next != NULL);
/* Make the last cut line manually. */
tmp = copy_node(bot);
null_at(&tmp->data, bot_x);
add_to_cutbuffer(tmp);
#ifdef DEBUG
dump_buffer(cutbuffer); dump_buffer(cutbuffer);
if (next == NULL) #endif
return;
/* Now, paste bot[bot_x] into top[top_x] */
if (destructive) {
tmpstr = charalloc(top_x + strlen(&bot->data[bot_x]) + 1);
strncpy(tmpstr, top->data, top_x);
strcpy(&tmpstr[top_x], &bot->data[bot_x]);
free(top->data);
top->data = tmpstr;
/* We explicitly don't decrement totlines here because we don't snarf
* up a newline when we're grabbing the last line of the mark. For
* the same reason, we don't do an extra totsize decrement. */
}
/* I honestly do not know why this is needed. After many hours of
using gdb on an OpenBSD box, I can honestly say something is
screwed somewhere. Not doing this causes update_line to annihilate
the last line copied into the cutbuffer when the mark is set ?!?!? */
botcopy = copy_node(bot);
null_at(&botcopy->data, bot_x);
next = botcopy->next;
add_to_cutbuffer(botcopy);
if (destructive) { if (destructive) {
free(bot); top->next = bot->next;
if (top->next != NULL)
top->next = next; top->next->prev = top;
if (next != NULL) delete_node(bot);
next->prev = top;
dump_buffer(cutbuffer);
renumber(top); renumber(top);
current = top; current = top;
current_x = top_x;
/* If we're hitting the end of the buffer, we should clean that up. */
if (bot == filebot) { if (bot == filebot) {
if (next != NULL) {
filebot = next;
} else {
filebot = top; filebot = top;
assert(bot_x == 0);
if (top_x > 0) if (top_x > 0)
new_magicline(); new_magicline();
} }
} }
if (top->lineno < edittop->lineno)
edit_update(top, CENTER);
}
} }
#endif #endif
int do_cut_text(void) int do_cut_text(void)
{ {
filestruct *tmp, *fileptr = current; filestruct *fileptr;
#ifndef NANO_SMALL #ifndef NANO_SMALL
int dontupdate = 0; int dontupdate = 0;
int cuttingtoend = 0;
#endif #endif
assert(current != NULL && current->data != NULL);
check_statblank(); check_statblank();
if (fileptr == NULL || fileptr->data == NULL)
return 0;
tmp = fileptr->next;
if (!ISSET(KEEP_CUTBUFFER)) { if (!ISSET(KEEP_CUTBUFFER)) {
free_filestruct(cutbuffer); free_filestruct(cutbuffer);
cutbuffer = NULL; cutbuffer = NULL;
marked_cut = 0; marked_cut = 0;
#ifdef DEBUG #ifdef DEBUG
fprintf(stderr, _("Blew away cutbuffer =)\n")); fprintf(stderr, _("Blew away cutbuffer =)\n"));
#endif #endif
} }
/* Must let cutbuffer get blown away first before we do this... */ /* You can't cut the magic line except with the mark. But
if (fileptr == filebot && !ISSET(MARK_ISSET)) trying does clear the cutbuffer if KEEP_CUTBUFFER is not set. */
if (current == filebot
#ifndef NANO_SMALL
&& !ISSET(MARK_ISSET)
#endif
)
return 0; return 0;
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) { if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
if (current_x == strlen(current->data)) { assert(current_x >= 0 && current_x <= strlen(current->data));
if (current->data[current_x] == '\0') {
/* If the line is empty and we didn't just cut a non-blank /* If the line is empty and we didn't just cut a non-blank
line, create a dummy line and add it to the cutbuffer */ line, create a dummy line and add it to the cutbuffer */
if (marked_cut != 1 && current->next != filebot) { if (marked_cut != 1 && current->next != filebot) {
filestruct *junk = make_new_node(current);
filestruct *junk;
junk = NULL;
junk = make_new_node(current);
junk->data = charalloc(1); junk->data = charalloc(1);
junk->data[0] = '\0'; junk->data[0] = '\0';
add_to_cutbuffer(junk); add_to_cutbuffer(junk);
#ifdef DEBUG
dump_buffer(cutbuffer); dump_buffer(cutbuffer);
#endif
} }
do_delete(); do_delete();
...@@ -250,104 +237,69 @@ int do_cut_text(void) ...@@ -250,104 +237,69 @@ int do_cut_text(void)
mark_beginx = strlen(current->data); mark_beginx = strlen(current->data);
mark_beginbuf = current; mark_beginbuf = current;
cuttingtoend = 1; dontupdate = 1;
} }
} }
if (ISSET(MARK_ISSET)) { if (ISSET(MARK_ISSET)) {
if (current->lineno <= mark_beginbuf->lineno) { /* Don't do_update() and move the screen position if the marked
/* Don't do_update and move the screen position if the marked
area lies entirely within the screen buffer */ area lies entirely within the screen buffer */
if (current->lineno == mark_beginbuf->lineno dontupdate |= current->lineno >= edittop->lineno &&
|| (current->lineno >= edittop->lineno current->lineno <= editbot->lineno &&
&& mark_beginbuf->lineno <= editbot->lineno)) mark_beginbuf->lineno >= edittop->lineno &&
dontupdate = 1; mark_beginbuf->lineno <= editbot->lineno;
cut_marked_segment(current, current_x, mark_beginbuf, cut_marked_segment(current, current_x, mark_beginbuf,
mark_beginx, 1); mark_beginx, 1);
}
else {
/* Same as above, easier logic since we know it's a multi-line
cut and mark_beginbuf is before current */
if (mark_beginbuf->lineno >= edittop->lineno
&& current->lineno <= editbot->lineno)
dontupdate = 1;
cut_marked_segment(mark_beginbuf, mark_beginx, current,
current_x, 1);
}
placewewant = xplustabs(); placewewant = xplustabs();
UNSET(MARK_ISSET); UNSET(MARK_ISSET);
marked_cut = 1; marked_cut = 1;
set_modified(); set_modified();
if (dontupdate || cuttingtoend) { if (dontupdate) {
fix_editbot(); fix_editbot();
edit_refresh(); edit_refresh();
} else } else
edit_update(current, CENTER); edit_update(current, CENTER);
return 1; return 1;
#else
if (0) {
#endif
} else if (fileptr == fileage) {
/* we're cutting the first line */
if (fileptr->next != NULL) {
fileptr = fileptr->next;
tmp = fileptr;
fileage = fileptr;
add_to_cutbuffer(fileptr->prev);
totsize--; /* get the newline */
totlines--;
fileptr->prev = NULL;
current = fileptr;
edit_update(fileage, CENTER);
} else {
add_to_cutbuffer(fileptr);
fileage = make_new_node(NULL);
fileage->data = charalloc(1);
fileage->data[0] = '\0';
current = fileage;
} }
} else { #endif /* !NANO_SMALL */
if (fileptr->prev != NULL)
fileptr->prev->next = fileptr->next;
if (fileptr->next != NULL) {
(fileptr->next)->prev = fileptr->prev;
current = fileptr->next;
totlines--; totlines--;
totsize--; /* get the newline */ totsize -= strlen(current->data) + 1;
} fileptr = current;
/* No longer an else here, because we never get here anymore... current = current->next;
No need to cut the magic line, as it's empty */ current->prev = fileptr->prev;
add_to_cutbuffer(fileptr); add_to_cutbuffer(fileptr);
} #ifdef DEBUG
dump_buffer(cutbuffer);
#endif
if (fileptr == fileage)
fileage = current;
else
current->prev->next = current;
if (fileptr == edittop) if (fileptr == edittop)
edittop = current; edittop = current;
renumber(current);
edit_refresh(); edit_refresh();
dump_buffer(cutbuffer);
reset_cursor();
set_modified(); set_modified();
marked_cut = 0; marked_cut = 0;
current_x = 0; current_x = 0;
placewewant = 0; placewewant = 0;
update_cursor(); reset_cursor();
renumber(tmp);
SET(KEEP_CUTBUFFER); SET(KEEP_CUTBUFFER);
return 1; return 1;
} }
int do_uncut_text(void) int do_uncut_text(void)
{ {
filestruct *tmp = current, *fileptr = current, *newbuf, *newend; filestruct *tmp = current, *fileptr = current;
filestruct *newbuf = NULL;
filestruct *newend = NULL;
#ifndef NANO_SMALL #ifndef NANO_SMALL
char *tmpstr, *tmpstr2; char *tmpstr, *tmpstr2;
filestruct *hold = current; filestruct *hold = current;
...@@ -359,29 +311,35 @@ int do_uncut_text(void) ...@@ -359,29 +311,35 @@ int do_uncut_text(void)
if (cutbuffer == NULL || fileptr == NULL) if (cutbuffer == NULL || fileptr == NULL)
return 0; /* AIEEEEEEEEEEEE */ return 0; /* AIEEEEEEEEEEEE */
#ifndef NANO_SMALL
if (!marked_cut || cutbuffer->next != NULL)
#endif
{
newbuf = copy_filestruct(cutbuffer); newbuf = copy_filestruct(cutbuffer);
for (newend = newbuf; newend->next != NULL && newend != NULL; for (newend = newbuf; newend->next != NULL && newend != NULL;
newend = newend->next) { newend = newend->next)
totlines++; totlines++;
} }
/* Hook newbuf into fileptr */ /* Hook newbuf into fileptr */
#ifndef NANO_SMALL #ifndef NANO_SMALL
if (marked_cut) { if (marked_cut) {
int recenter_me = 0;
/* Should we eventually use edit_update(CENTER)? */
/* If there's only one line in the cutbuffer */ /* If there's only one line in the cutbuffer */
if (cutbuffer->next == NULL) { if (cutbuffer->next == NULL) {
tmpstr = size_t buf_len = strlen(cutbuffer->data);
charalloc(strlen(current->data) + strlen(cutbuffer->data) + size_t cur_len = strlen(current->data);
1);
strncpy(tmpstr, current->data, current_x); current->data = nrealloc(current->data, cur_len + buf_len + 1);
strcpy(&tmpstr[current_x], cutbuffer->data); memmove(current->data + current_x + buf_len,
strcat(tmpstr, &current->data[current_x]); current->data + current_x, cur_len - current_x + 1);
free(current->data); strncpy(current->data + current_x, cutbuffer->data, buf_len);
current->data = tmpstr; /* Use strncpy to not copy the terminal '\0'. */
current_x += strlen(cutbuffer->data);
totsize += strlen(cutbuffer->data); current_x += buf_len;
if (strlen(cutbuffer->data) == 0) totsize += buf_len;
totlines++;
/* If we've uncut a line, make sure there's a magicline after /* If we've uncut a line, make sure there's a magicline after
it */ it */
if (current->next == NULL) if (current->next == NULL)
...@@ -417,8 +375,8 @@ int do_uncut_text(void) ...@@ -417,8 +375,8 @@ int do_uncut_text(void)
newend->next = tmp; newend->next = tmp;
/* If tmp isn't null, we're in the middle: update the /* If tmp isn't null, we're in the middle: update the
* prev pointer. If it IS null, we're at the end; update prev pointer. If it IS null, we're at the end; update
* the filebot pointer */ the filebot pointer */
if (tmp != NULL) if (tmp != NULL)
tmp->prev = newend; tmp->prev = newend;
...@@ -434,21 +392,16 @@ int do_uncut_text(void) ...@@ -434,21 +392,16 @@ int do_uncut_text(void)
for (tmp = current->next; tmp != newend; tmp = tmp->next) for (tmp = current->next; tmp != newend; tmp = tmp->next)
totsize += strlen(tmp->data) + 1; totsize += strlen(tmp->data) + 1;
i = editbot->lineno;
current = newend; current = newend;
if (i < newend->lineno) { if (editbot->lineno < newend->lineno)
edit_update(current, CENTER); recenter_me = 1;
}
else {
edit_refresh();
}
} }
/* If marked cut == 2, that means that we're doing a cut to end /* If marked cut == 2, that means that we're doing a cut to end
and we don't want anything else on the line, so we have to and we don't want anything else on the line, so we have to
screw up all the work we just did and separate the line. There screw up all the work we just did and separate the line.
must be a better way to do this, but not at 1AM on a work night. */ There must be a better way to do this, but not at 1AM on a
work night. */
if (marked_cut == 2) { if (marked_cut == 2) {
tmp = make_new_node(current); tmp = make_new_node(current);
...@@ -467,24 +420,27 @@ int do_uncut_text(void) ...@@ -467,24 +420,27 @@ int do_uncut_text(void)
/* Renumber from BEFORE where we pasted ;) */ /* Renumber from BEFORE where we pasted ;) */
renumber(hold); renumber(hold);
#ifdef DEBUG
dump_buffer(fileage); dump_buffer(fileage);
dump_buffer(cutbuffer); dump_buffer(cutbuffer);
#endif
set_modified(); set_modified();
if (recenter_me)
edit_update(current, CENTER);
else
edit_refresh(); edit_refresh();
UNSET(KEEP_CUTBUFFER); UNSET(KEEP_CUTBUFFER);
return 0; return 0;
#else }
if (0) {
#endif #endif
} else if (fileptr != fileage) {
if (fileptr != fileage) {
tmp = fileptr->prev; tmp = fileptr->prev;
tmp->next = newbuf; tmp->next = newbuf;
newbuf->prev = tmp; newbuf->prev = tmp;
totlines++; /* Unmarked uncuts don't split lines */ } else
} else {
fileage = newbuf; fileage = newbuf;
totlines++; /* Unmarked uncuts don't split lines */ totlines++; /* Unmarked uncuts don't split lines */
}
/* This is so uncutting at the top of the buffer will work => */ /* This is so uncutting at the top of the buffer will work => */
if (current_y == 0) if (current_y == 0)
...@@ -494,23 +450,22 @@ int do_uncut_text(void) ...@@ -494,23 +450,22 @@ int do_uncut_text(void)
newend->next = fileptr; newend->next = fileptr;
fileptr->prev = newend; fileptr->prev = newend;
/* recalculate size *sigh* */ /* Recalculate size *sigh* */
for (tmp = newbuf; tmp != fileptr; tmp = tmp->next) for (tmp = newbuf; tmp != fileptr; tmp = tmp->next)
totsize += strlen(tmp->data) + 1; totsize += strlen(tmp->data) + 1;
i = editbot->lineno; i = editbot->lineno;
renumber(newbuf); renumber(newbuf);
if (i < newend->lineno) { if (i < newend->lineno)
edit_update(fileptr, CENTER); edit_update(fileptr, CENTER);
} else
else {
edit_refresh(); edit_refresh();
}
dump_buffer_reverse(fileptr); #ifdef DEBUG
dump_buffer_reverse();
#endif
set_modified(); set_modified();
UNSET(KEEP_CUTBUFFER); UNSET(KEEP_CUTBUFFER);
edit_refresh();
return 1; return 1;
} }
...@@ -474,7 +474,7 @@ to have a completely consistent user interface across all user input ...@@ -474,7 +474,7 @@ to have a completely consistent user interface across all user input
functions. This means that regardless of whether you're being asked for functions. This means that regardless of whether you're being asked for
a filename to insert or write, or a string to search for, the a filename to insert or write, or a string to search for, the
previous value is already inserted before the cursor. If you prefer the previous value is already inserted before the cursor. If you prefer the
old behavior, use the pico emulation mode (-p or --pico) or just hit old behavior, use the Pico emulation mode (-p or --pico) or just hit
Meta-P while in nano (see the ^G help text for more Meta-P while in nano (see the ^G help text for more
details).</font></blockquote> details).</font></blockquote>
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include <errno.h> #include <errno.h>
#include <ctype.h> #include <ctype.h>
#include <dirent.h> #include <dirent.h>
#include <assert.h>
#include <pwd.h> #include <pwd.h>
#include "proto.h" #include "proto.h"
#include "nano.h" #include "nano.h"
...@@ -501,7 +502,9 @@ int do_insertfile(int loading_file) ...@@ -501,7 +502,9 @@ int do_insertfile(int loading_file)
free(realname); free(realname);
#ifdef DEBUG
dump_buffer(fileage); dump_buffer(fileage);
#endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
if (loading_file) if (loading_file)
...@@ -578,6 +581,75 @@ int do_insertfile_void(void) ...@@ -578,6 +581,75 @@ int do_insertfile_void(void)
} }
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
/* Create a new openfilestruct node. */
openfilestruct *make_new_opennode(openfilestruct *prevnode)
{
openfilestruct *newnode = nmalloc(sizeof(openfilestruct));
newnode->filename = NULL;
newnode->fileage = NULL;
newnode->filebot = NULL;
newnode->prev = prevnode;
newnode->next = NULL;
return newnode;
}
/* Splice a node into an existing openfilestruct. */
void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
openfilestruct *end)
{
newnode->next = end;
newnode->prev = begin;
begin->next = newnode;
if (end != NULL)
end->prev = newnode;
}
/* Unlink a node from the rest of the openfilestruct. */
void unlink_opennode(const openfilestruct *fileptr)
{
assert(fileptr != NULL);
if (fileptr->prev != NULL)
fileptr->prev->next = fileptr->next;
if (fileptr->next != NULL)
fileptr->next->prev = fileptr->prev;
}
/* Delete a node from the openfilestruct. */
void delete_opennode(openfilestruct *fileptr)
{
if (fileptr != NULL) {
if (fileptr->filename != NULL)
free(fileptr->filename);
if (fileptr->fileage != NULL)
free_filestruct(fileptr->fileage);
free(fileptr);
}
}
/* Deallocate all memory associated with this and later files,
* including the lines of text. */
void free_openfilestruct(openfilestruct *src)
{
if (src != NULL) {
while (src->next != NULL) {
src = src->next;
delete_opennode(src->prev);
#ifdef DEBUG
fprintf(stderr, _("delete_opennode(): free'd a node, YAY!\n"));
#endif
}
delete_opennode(src);
#ifdef DEBUG
fprintf(stderr, _("delete_opennode(): free'd last node.\n"));
#endif
}
}
/* /*
* Add/update an entry to the open_files openfilestruct. If update is * Add/update an entry to the open_files openfilestruct. If update is
* zero, a new entry is created; otherwise, the current entry is updated. * zero, a new entry is created; otherwise, the current entry is updated.
...@@ -1414,7 +1486,9 @@ int write_file(char *name, int tmp, int append, int nonamechange) ...@@ -1414,7 +1486,9 @@ int write_file(char *name, int tmp, int append, int nonamechange)
} }
} }
#ifdef DEBUG
dump_buffer(fileage); dump_buffer(fileage);
#endif
f = fdopen(fd, append == 1 ? "ab" : "wb"); f = fdopen(fd, append == 1 ? "ab" : "wb");
if (!f) { if (!f) {
...@@ -2742,20 +2816,11 @@ char *do_browser(char *inpath) ...@@ -2742,20 +2816,11 @@ char *do_browser(char *inpath)
/* Hilight the currently selected file/dir */ /* Hilight the currently selected file/dir */
if (j == selected) { if (j == selected) {
#ifdef ENABLE_COLOR
color_on(edit, COLOR_STATUSBAR);
#else
wattron(edit, A_REVERSE); wattron(edit, A_REVERSE);
#endif
} }
waddnstr(edit, foo, strlen(foo)); waddnstr(edit, foo, strlen(foo));
if (j == selected) { if (j == selected) {
#ifdef ENABLE_COLOR
color_off(edit, COLOR_STATUSBAR);
#else
wattroff(edit, A_REVERSE); wattroff(edit, A_REVERSE);
#endif
} }
/* And add some space between the cols */ /* And add some space between the cols */
......
...@@ -37,6 +37,12 @@ ...@@ -37,6 +37,12 @@
* Global variables * Global variables
*/ */
/* wrap_at might be set in rcfile.c or nano.c */
int wrap_at = -CHARS_FROM_EOL;/* Right justified fill value, allows resize */
char *last_search = NULL; /* Last string we searched for */
char *last_replace = NULL; /* Last replacement string */
int search_last_line; /* Is this the last search line? */
int flags = 0; /* Our new flag containing many options */ int flags = 0; /* Our new flag containing many options */
WINDOW *edit; /* The file portion of the editor */ WINDOW *edit; /* The file portion of the editor */
WINDOW *topwin; /* Top line of screen */ WINDOW *topwin; /* Top line of screen */
...@@ -66,8 +72,12 @@ openfilestruct *open_files = NULL; /* The list of open files */ ...@@ -66,8 +72,12 @@ openfilestruct *open_files = NULL; /* The list of open files */
#endif #endif
#ifndef DISABLE_JUSTIFY #ifndef DISABLE_JUSTIFY
#ifdef HAVE_REGEX_H
char *quotestr = "^([ \t]*[|>:}#])+";
#else
char *quotestr = "> "; /* Quote string */ char *quotestr = "> "; /* Quote string */
#endif #endif
#endif
char *answer = NULL; /* Answer str to many questions */ char *answer = NULL; /* Answer str to many questions */
int totlines = 0; /* Total number of lines in the file */ int totlines = 0; /* Total number of lines in the file */
...@@ -79,7 +89,9 @@ int placewewant = 0; /* The column we'd like the cursor ...@@ -79,7 +89,9 @@ int placewewant = 0; /* The column we'd like the cursor
int tabsize = 8; /* Our internal tabsize variable */ int tabsize = 8; /* Our internal tabsize variable */
char *hblank; /* A horizontal blank line */ char *hblank; /* A horizontal blank line */
#ifndef DISABLE_HELP
char *help_text; /* The text in the help window */ char *help_text; /* The text in the help window */
#endif
/* More stuff for the marker select */ /* More stuff for the marker select */
...@@ -113,14 +125,13 @@ shortcut *browser_list = NULL; ...@@ -113,14 +125,13 @@ shortcut *browser_list = NULL;
#endif #endif
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
colorstruct colors[NUM_NCOLORS];
colortype *colorstrings = NULL; colortype *colorstrings = NULL;
syntaxtype *syntaxes = NULL; syntaxtype *syntaxes = NULL;
char *syntaxstr = NULL; char *syntaxstr = NULL;
#endif #endif
#if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined(DISABLE_HELP) #if !defined(DISABLE_BROWSER) || !defined(DISABLE_MOUSE) || !defined(DISABLE_HELP)
shortcut *currshortcut; /* Current shortcut list we're using */ const shortcut *currshortcut; /* Current shortcut list we're using */
#endif #endif
#ifndef NANO_SMALL #ifndef NANO_SMALL
...@@ -133,6 +144,7 @@ toggle *toggles = NULL; ...@@ -133,6 +144,7 @@ toggle *toggles = NULL;
regex_t search_regexp; /* Global to store compiled search regexp */ regex_t search_regexp; /* Global to store compiled search regexp */
regmatch_t regmatches[10]; /* Match positions for parenthetical regmatch_t regmatches[10]; /* Match positions for parenthetical
subexpressions, max of 10 */ subexpressions, max of 10 */
#endif
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
regex_t color_regexp; /* Global to store compiled search regexp */ regex_t color_regexp; /* Global to store compiled search regexp */
regmatch_t colormatches[1]; /* Match positions for parenthetical */ regmatch_t colormatches[1]; /* Match positions for parenthetical */
...@@ -141,15 +153,12 @@ regex_t syntaxfile_regexp; /* Global to store compiled search regexp */ ...@@ -141,15 +153,12 @@ regex_t syntaxfile_regexp; /* Global to store compiled search regexp */
regmatch_t synfilematches[1]; /* Match positions for parenthetical */ regmatch_t synfilematches[1]; /* Match positions for parenthetical */
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
#endif
int length_of_list(const shortcut *s) int length_of_list(const shortcut *s)
{ {
int i = 0; int i = 0;
for (; s != NULL; s = s->next) for (; s != NULL; s = s->next)
i++; i++;
return i; return i;
} }
...@@ -211,17 +220,15 @@ static void toggle_init_one(int val, const char *desc, int flag) ...@@ -211,17 +220,15 @@ static void toggle_init_one(int val, const char *desc, int flag)
} }
#ifdef DEBUG #ifdef DEBUG
/* Deallocate all of the toggles */ /* Deallocate all of the toggles. */
static void free_toggles(void) static void free_toggles(void)
{ {
toggle *pt; /* Think "previous toggle" */
while (toggles != NULL) { while (toggles != NULL) {
pt = toggles; toggle *pt = toggles; /* Think "previous toggle" */
toggles = toggles->next; toggles = toggles->next;
free(pt); free(pt);
} }
toggles = NULL;
} }
#endif #endif
...@@ -229,10 +236,11 @@ static void toggle_init(void) ...@@ -229,10 +236,11 @@ static void toggle_init(void)
{ {
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg, char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg, *toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
*toggle_cuttoend_msg, *toggle_wrap_msg, *toggle_noconvert_msg, *toggle_cuttoend_msg, *toggle_noconvert_msg, *toggle_dos_msg,
*toggle_dos_msg, *toggle_mac_msg, *toggle_backup_msg, *toggle_mac_msg, *toggle_backup_msg, *toggle_smooth_msg;
*toggle_smooth_msg; #ifndef DISABLE_WRAPPING
char *toggle_wrap_msg;
#endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
char *toggle_load_msg; char *toggle_load_msg;
#endif #endif
...@@ -256,7 +264,9 @@ static void toggle_init(void) ...@@ -256,7 +264,9 @@ static void toggle_init(void)
toggle_mac_msg = _("Writing file in Mac format"); toggle_mac_msg = _("Writing file in Mac format");
toggle_backup_msg = _("Backing up file"); toggle_backup_msg = _("Backing up file");
toggle_smooth_msg = _("Smooth scrolling"); toggle_smooth_msg = _("Smooth scrolling");
#ifndef DISABLE_WRAPPING
toggle_wrap_msg = _("Auto wrap"); toggle_wrap_msg = _("Auto wrap");
#endif
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
toggle_load_msg = _("Multiple file buffers"); toggle_load_msg = _("Multiple file buffers");
#endif #endif
...@@ -266,7 +276,9 @@ static void toggle_init(void) ...@@ -266,7 +276,9 @@ static void toggle_init(void)
toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND); toggle_init_one(TOGGLE_SUSPEND_KEY, toggle_suspend_msg, SUSPEND);
toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP); toggle_init_one(TOGGLE_NOHELP_KEY, toggle_nohelp_msg, NO_HELP);
toggle_init_one(TOGGLE_PICOMODE_KEY, toggle_picomode_msg, PICO_MODE); toggle_init_one(TOGGLE_PICOMODE_KEY, toggle_picomode_msg, PICO_MODE);
#ifndef DISABLE_WRAPPING
toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP); toggle_init_one(TOGGLE_WRAP_KEY, toggle_wrap_msg, NO_WRAP);
#endif
toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE); toggle_init_one(TOGGLE_MOUSE_KEY, toggle_mouse_msg, USE_MOUSE);
toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END); toggle_init_one(TOGGLE_CUTTOEND_KEY, toggle_cuttoend_msg, CUT_TO_END);
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
...@@ -283,16 +295,12 @@ static void toggle_init(void) ...@@ -283,16 +295,12 @@ static void toggle_init(void)
/* Deallocate the given shortcut. */ /* Deallocate the given shortcut. */
static void free_shortcutage(shortcut **shortcutage) static void free_shortcutage(shortcut **shortcutage)
{ {
shortcut *s, *ps;
assert(shortcutage != NULL); assert(shortcutage != NULL);
s = *shortcutage; while (*shortcutage != NULL) {
while (s != NULL) { shortcut *ps = *shortcutage;
ps = s; *shortcutage = (*shortcutage)->next;
s = s->next;
free(ps); free(ps);
} }
*shortcutage = NULL;
} }
void shortcut_init(int unjustify) void shortcut_init(int unjustify)
...@@ -432,7 +440,6 @@ void shortcut_init(int unjustify) ...@@ -432,7 +440,6 @@ void shortcut_init(int unjustify)
#endif #endif
if (ISSET(PICO_MODE)) if (ISSET(PICO_MODE))
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
/* this is so we can view multiple files */ /* this is so we can view multiple files */
sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"), sc_init_one(&main_list, NANO_INSERTFILE_KEY, _("Read File"),
...@@ -535,7 +542,7 @@ void shortcut_init(int unjustify) ...@@ -535,7 +542,7 @@ void shortcut_init(int unjustify)
sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"), sc_init_one(&main_list, NANO_ENTER_KEY, _("Enter"),
IFHELP(nano_enter_msg, 0), IFHELP(nano_enter_msg, 0),
KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter_void); KEY_ENTER, NANO_CONTROL_M, NOVIEW, do_enter);
sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"), sc_init_one(&main_list, NANO_GOTO_KEY, _("Go To Line"),
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY),
...@@ -544,11 +551,11 @@ void shortcut_init(int unjustify) ...@@ -544,11 +551,11 @@ void shortcut_init(int unjustify)
#ifndef NANO_SMALL #ifndef NANO_SMALL
sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"), sc_init_one(&main_list, NANO_NEXTWORD_KEY, _("Next Word"),
IFHELP(_("Move forward one word"), 0), IFHELP(_("Move forward one word"), 0),
0, 0, VIEW, do_next_word_void); 0, 0, VIEW, do_next_word);
sc_init_one(&main_list, -9, _("Prev Word"), sc_init_one(&main_list, -9, _("Prev Word"),
IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0, IFHELP(_("Move backward one word"), NANO_PREVWORD_KEY), 0, 0,
VIEW, do_prev_word_void); VIEW, do_prev_word);
#endif #endif
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H) #if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
sc_init_one(&main_list, -9, _("Find Other Bracket"), sc_init_one(&main_list, -9, _("Find Other Bracket"),
...@@ -654,10 +661,10 @@ void shortcut_init(int unjustify) ...@@ -654,10 +661,10 @@ void shortcut_init(int unjustify)
IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0); IFHELP(nano_cancel_msg, 0), 0, 0, VIEW, 0);
sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"), sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, _("First Line"),
IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, &do_first_line); IFHELP(nano_firstline_msg, 0), 0, 0, VIEW, do_first_line);
sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"), sc_init_one(&goto_list, NANO_LASTLINE_KEY, _("Last Line"),
IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, &do_last_line); IFHELP(nano_lastline_msg, 0), 0, 0, VIEW, do_last_line);
free_shortcutage(&help_list); free_shortcutage(&help_list);
...@@ -781,8 +788,7 @@ void shortcut_init(int unjustify) ...@@ -781,8 +788,7 @@ void shortcut_init(int unjustify)
/* This function is called just before calling exit(). Practically, the /* This function is called just before calling exit(). Practically, the
* only effect is to cause a segmentation fault if the various data * only effect is to cause a segmentation fault if the various data
* structures got bolloxed earlier. Thus, we don't bother having this * structures got bolloxed earlier. Thus, we don't bother having this
* function unless debugging is turned on. * function unless debugging is turned on. */
*/
#ifdef DEBUG #ifdef DEBUG
/* added by SPK for memory cleanup, gracefully return our malloc()s */ /* added by SPK for memory cleanup, gracefully return our malloc()s */
void thanks_for_all_the_fish(void) void thanks_for_all_the_fish(void)
...@@ -816,15 +822,18 @@ void thanks_for_all_the_fish(void) ...@@ -816,15 +822,18 @@ void thanks_for_all_the_fish(void)
free_shortcutage(&whereis_list); free_shortcutage(&whereis_list);
free_shortcutage(&replace_list); free_shortcutage(&replace_list);
free_shortcutage(&replace_list_2); free_shortcutage(&replace_list_2);
free_shortcutage(&help_list); free_shortcutage(&goto_list);
free_shortcutage(&gotodir_list);
free_shortcutage(&writefile_list); free_shortcutage(&writefile_list);
free_shortcutage(&insertfile_list); free_shortcutage(&insertfile_list);
free_shortcutage(&help_list);
free_shortcutage(&spell_list); free_shortcutage(&spell_list);
#ifndef NANO_SMALL
free_shortcutage(&extcmd_list);
#endif
#ifndef DISABLE_BROWSER #ifndef DISABLE_BROWSER
free_shortcutage(&browser_list); free_shortcutage(&browser_list);
#endif #endif
free_shortcutage(&gotodir_list);
free_shortcutage(&goto_list);
#ifndef NANO_SMALL #ifndef NANO_SMALL
free_toggles(); free_toggles();
...@@ -833,19 +842,39 @@ void thanks_for_all_the_fish(void) ...@@ -833,19 +842,39 @@ void thanks_for_all_the_fish(void)
#ifdef ENABLE_MULTIBUFFER #ifdef ENABLE_MULTIBUFFER
if (open_files != NULL) { if (open_files != NULL) {
/* We free the memory associated with each open file. */ /* We free the memory associated with each open file. */
openfilestruct *next;
while (open_files->prev != NULL) while (open_files->prev != NULL)
open_files = open_files->prev; open_files = open_files->prev;
do {
next = open_files->next;
free_openfilestruct(open_files); free_openfilestruct(open_files);
open_files = next;
} while (open_files != NULL);
} }
#else #else
if (fileage != NULL) if (fileage != NULL)
free_filestruct(fileage); free_filestruct(fileage);
#endif #endif
#ifdef ENABLE_COLOR
free(syntaxstr);
while (syntaxes != NULL) {
syntaxtype *bill = syntaxes;
free(syntaxes->desc);
while (syntaxes->extensions != NULL) {
exttype *bob = syntaxes->extensions;
syntaxes->extensions = bob->next;
free(bob->val);
free(bob);
}
while (syntaxes->color != NULL) {
colortype *bob = syntaxes->color;
syntaxes->color = bob->next;
free(bob->start);
free(bob->end);
free(bob);
}
syntaxes = syntaxes->next;
free(bill);
}
#endif /* ENABLE_COLOR */
} }
#endif /* DEBUG */ #endif /* DEBUG */
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <assert.h>
#include "proto.h" #include "proto.h"
#include "nano.h" #include "nano.h"
...@@ -34,23 +35,6 @@ ...@@ -34,23 +35,6 @@
#define _(string) (string) #define _(string) (string)
#endif #endif
void page_down(void)
{
if (!ISSET(SMOOTHSCROLL)) {
if (editbot != filebot) {
edit_update(editbot->next, CENTER);
center_cursor();
} else {
while (current != filebot)
current = current->next;
edit_update(current, CENTER);
}
} else {
edit_update(editbot, NONE);
}
update_cursor();
}
int do_page_down(void) int do_page_down(void)
{ {
wrap_reset(); wrap_reset();
...@@ -103,42 +87,18 @@ int do_end(void) ...@@ -103,42 +87,18 @@ int do_end(void)
current_x = strlen(current->data); current_x = strlen(current->data);
placewewant = xplustabs(); placewewant = xplustabs();
update_line(current, current_x); update_line(current, current_x);
return 1;
}
/* What happens when we want to go past the bottom of the buffer */
int do_down(void)
{
wrap_reset();
if (current->next != NULL) {
if (placewewant > 0)
current_x = actual_x(current->next, placewewant);
else if (current_x > strlen(current->next->data))
current_x = strlen(current->next->data);
} else {
UNSET(KEEP_CUTBUFFER);
check_statblank();
return 0;
}
if (current_y < editwinrows - 1 && current != editbot)
current_y++;
else
page_down();
update_cursor();
update_line(current->prev, 0);
update_line(current, current_x);
UNSET(KEEP_CUTBUFFER);
check_statblank();
return 1; return 1;
} }
void page_up(void) void page_up(void)
{ {
if (edittop != fileage) { if (edittop != fileage) {
if (!ISSET(SMOOTHSCROLL)) { #ifndef NANO_SMALL
if (ISSET(SMOOTHSCROLL))
edit_update(edittop->prev, TOP);
else
#endif
{
edit_update(edittop, CENTER); edit_update(edittop, CENTER);
/* Now that we've updated the edit window, edittop might be /* Now that we've updated the edit window, edittop might be
at the top of the file; if so, just move the cursor up one at the top of the file; if so, just move the cursor up one
...@@ -149,8 +109,6 @@ void page_up(void) ...@@ -149,8 +109,6 @@ void page_up(void)
current = current->prev; current = current->prev;
reset_cursor(); reset_cursor();
} }
} else {
edit_update(edittop->prev, NONE);
} }
} else } else
current_y = 0; current_y = 0;
...@@ -186,35 +144,72 @@ int do_up(void) ...@@ -186,35 +144,72 @@ int do_up(void)
{ {
wrap_reset(); wrap_reset();
if (current->prev != NULL) { if (current->prev != NULL) {
if (placewewant > 0)
current_x = actual_x(current->prev, placewewant); current_x = actual_x(current->prev, placewewant);
else if (current_x > strlen(current->prev->data)) current = current->prev;
current_x = strlen(current->prev->data); if (current_y > 0) {
} update_line(current->next, 0);
if (current_y > 0) /* It is necessary to change current first, so the mark
display will change! */
current_y--; current_y--;
else update_line(current, current_x);
} else
page_up(); page_up();
UNSET(KEEP_CUTBUFFER);
check_statblank();
}
return 1;
}
update_cursor(); /* Return value 1 means we moved down, 0 means we were already at the
update_line(current->next, 0); * bottom. */
update_line(current, current_x); int do_down(void) {
wrap_reset();
UNSET(KEEP_CUTBUFFER); UNSET(KEEP_CUTBUFFER);
check_statblank(); check_statblank();
if (current->next == NULL)
return 0;
current = current->next;
current_x = actual_x(current, placewewant);
/* Note current_y is zero-based. This test checks for the cursor
* being on the last row of the edit window. */
if (current_y == editwinrows - 1) {
#ifndef NANO_SMALL
if (ISSET(SMOOTHSCROLL)) {
/* In this case current_y does not change. The cursor
* remains at the bottom of the edit window. */
edittop = edittop->next;
editbot = editbot->next;
edit_refresh();
} else
#endif
{
edit_update(editbot->next, CENTER);
/* sets edittop so editbot->next is centered */
center_cursor();
/* sets current_y = editwinrows / 2 */
}
} else {
update_line(current->prev, 0);
update_line(current, current_x);
current_y++;
}
return 1; return 1;
} }
int do_right(void) int do_right(void)
{ {
if (current_x < strlen(current->data)) { assert(current_x <= strlen(current->data));
if (current->data[current_x] != '\0')
current_x++; current_x++;
} else { else if (current->next) {
if (do_down()) do_down();
current_x = 0; current_x = 0;
} }
placewewant = xplustabs(); placewewant = xplustabs();
update_cursor();
update_line(current, current_x); update_line(current, current_x);
UNSET(KEEP_CUTBUFFER); UNSET(KEEP_CUTBUFFER);
check_statblank(); check_statblank();
...@@ -226,13 +221,10 @@ int do_left(void) ...@@ -226,13 +221,10 @@ int do_left(void)
if (current_x > 0) if (current_x > 0)
current_x--; current_x--;
else if (current != fileage) { else if (current != fileage) {
placewewant = 0;
current_x = strlen(current->prev->data);
do_up(); do_up();
current_x = strlen(current->data);
} }
placewewant = xplustabs(); placewewant = xplustabs();
update_cursor();
update_line(current, current_x); update_line(current, current_x);
UNSET(KEEP_CUTBUFFER); UNSET(KEEP_CUTBUFFER);
check_statblank(); check_statblank();
......
...@@ -6,31 +6,31 @@ ...@@ -6,31 +6,31 @@
.\" Public License for copying conditions. There is NO warranty. .\" Public License for copying conditions. There is NO warranty.
.\" .\"
.\" $Id$ .\" $Id$
.TH NANO 1 "June 27, 2002" .TH NANO 1 "July 6, 2002"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.SH NAME .SH NAME
nano \- Nano's ANOther editor, an enhanced free Pico Clone nano \- Nano's ANOther editor, an enhanced free Pico Clone
.SH SYNOPSIS .SH SYNOPSIS
.B nano .B nano
.RI [options]\ [+LINE] " file" .I [\+LINE]\ [options]\ [file]
.br .br
.SH DESCRIPTION .SH DESCRIPTION
This manual page documents briefly the This manual page documents briefly the \fBnano\fP command.
.B nano
command.
.PP .PP
.\" TeX users may be more comfortable with the \fB<whatever>\fP and .\" TeX users may be more comfortable with the \fB<whatever>\fP and
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics, .\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
.\" respectively. .\" respectively.
\fBnano\fP is a small, free and friendly editor which aims to replace \fBnano\fP is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package. Rather Pico, the default editor included in the non-free Pine package. Rather
than just copying Pico's look and feel, than just copying Pico's look and feel, \fBnano\fP also implements some
.B nano missing (or disabled by default) features in Pico, such as "search and
also implements some missing (or disabled by default) features in Pico, replace" and "go to line number".
such as "search and replace" and "goto line number".
.SH OPTIONS .SH OPTIONS
.TP .TP
.B \+\fILINE\fP
Places cursor at \fILINE\fP on startup.
.TP
.B \-B (\-\-backup) .B \-B (\-\-backup)
When saving a file, back up the previous version of it to the current When saving a file, back up the previous version of it to the current
filename suffixed with a ~. filename suffixed with a ~.
...@@ -52,7 +52,7 @@ Write file in Mac format. ...@@ -52,7 +52,7 @@ Write file in Mac format.
.B \-N (\-\-noconvert) .B \-N (\-\-noconvert)
Disable automatic conversion of files from DOS/Mac format. Disable automatic conversion of files from DOS/Mac format.
.TP .TP
.B \-Q [str] (\-\-quotestr=[str]) .B \-Q \fI[str]\fP (\-\-quotestr=\fI[str]\fP)
Set the quoting string for justifying. The default is "> ". Set the quoting string for justifying. The default is "> ".
.TP .TP
.B \-R (\-\-regexp) .B \-R (\-\-regexp)
...@@ -61,15 +61,15 @@ Enable regular expression matching for search strings, as well as ...@@ -61,15 +61,15 @@ Enable regular expression matching for search strings, as well as
.TP .TP
.B \-S (\-\-smooth) .B \-S (\-\-smooth)
Enable smooth scrolling. Text will scroll line-by-line, instead of the Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behaviour. usual chunk-by-chunk behavior.
.TP .TP
.B \-T [num] (\-\-tabsize=[num]) .B \-T \fI[num]\fP (\-\-tabsize=\fI[num]\fP)
Set the size (width) of a tab. Set the size (width) of a tab.
.TP .TP
.B \-V (\-\-version) .B \-V (\-\-version)
Show the current version number and author. Show the current version number and author.
.TP .TP
.B \-Y (\-\-syntax=[str]) .B \-Y \fI[str]\fP (\-\-syntax=\fI[str]\fP)
Specify a specific syntax highlighting from the .nanorc to use, if Specify a specific syntax highlighting from the .nanorc to use, if
available. available.
.TP .TP
...@@ -93,7 +93,7 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps? ...@@ -93,7 +93,7 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
.B \-m (\-\-mouse) .B \-m (\-\-mouse)
Enable mouse support (if available for your system). Enable mouse support (if available for your system).
.TP .TP
.B \-o [dir] (\-\-operatingdir=[dir]) .B \-o \fI[dir]\fP (\-\-operatingdir=\fI[dir]\fP)
Set operating directory. Makes nano set up something similar to a Set operating directory. Makes nano set up something similar to a
chroot. chroot.
.TP .TP
...@@ -102,13 +102,13 @@ Emulate Pico as closely as possible. This affects both the "shortcut ...@@ -102,13 +102,13 @@ Emulate Pico as closely as possible. This affects both the "shortcut
list" at the bottom of the screen, as well as the display and entry of list" at the bottom of the screen, as well as the display and entry of
previous search and replace strings. previous search and replace strings.
.TP .TP
.B \-r [#cols] (\-\-fill=[#cols]) .B \-r \fI[#cols]\fP (\-\-fill=\fI[#cols]\fP)
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. If this value is negative, wrapping will occur at 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 #cols from the right of the screen, allowing it to vary along with the
screen width if the screen is resized. screen width if the screen is resized.
.TP .TP
.B \-s [prog] (\-\-speller=[prog]) .B \-s \fI[prog]\fP (\-\-speller=\fI[prog]\fP)
Enable alternative spell checker command. Enable alternative spell checker command.
.TP .TP
.B \-t (\-\-tempfile) .B \-t (\-\-tempfile)
...@@ -128,25 +128,22 @@ Enable suspend ability. ...@@ -128,25 +128,22 @@ Enable suspend ability.
.TP .TP
.B \-a, \-b, \-e, \-f, \-g, \-j .B \-a, \-b, \-e, \-f, \-g, \-j
Ignored, for compatibility with Pico. Ignored, for compatibility with Pico.
.TP
.B \+LINE
Places cursor at LINE on startup.
.SH NOTES .SH NOTES
Nano will try to dump the buffer into an emergency file in some cases. \fBnano\fP will try to dump the buffer into an emergency file in some
Mainly, this will happen if Nano receives a SIGHUP or runs out of cases. Mainly, this will happen if \fBnano\fP receives a SIGHUP or runs
memory, when it will write the buffer into a file named "nano.save" if out of memory, when it will write the buffer into a file named
the buffer didn't have a name already, or will add a ".save" suffix to "nano.save" if the buffer didn't have a name already, or will add a
the current filename. If an emergency file with that name already exists ".save" suffix to the current filename. If an emergency file with that
in the current directory, ".save" and a number (e.g. ".save.1") will be name already exists in the current directory, ".save" and a number (e.g.
suffixed to the current filename in order to make it unique. In ".save.1") will be suffixed to the current filename in order to make it
multibuffer mode, nano will write all the open buffers to the respective unique. In multibuffer mode, \fBnano\fP will write all the open buffers
emergency files. to the respective emergency files.
.SH BUGS .SH BUGS
Please send any comments or bug reports to Please send any comments or bug reports to
.br .br
.B nano@nano-editor.org. .B nano@nano-editor.org.
.br .br
The nano mailing list is available from The \fBnano\fP mailing list is available from
.br .br
.B nano-devel@gnu.org. .B nano-devel@gnu.org.
To subscribe, email to nano-devel-request@gnu.org with a To subscribe, email to nano-devel-request@gnu.org with a
......
...@@ -3,7 +3,7 @@ Content-type: text/html ...@@ -3,7 +3,7 @@ Content-type: text/html
<HTML><HEAD><TITLE>Manpage of NANO</TITLE> <HTML><HEAD><TITLE>Manpage of NANO</TITLE>
</HEAD><BODY> </HEAD><BODY>
<H1>NANO</H1> <H1>NANO</H1>
Section: User Commands (1)<BR>Updated: June 27, 2002<BR><A HREF="#index">Index</A> Section: User Commands (1)<BR>Updated: July 5, 2002<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR> <A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
...@@ -17,17 +17,14 @@ nano - Nano's ANOther editor, an enhanced free Pico Clone ...@@ -17,17 +17,14 @@ nano - Nano's ANOther editor, an enhanced free Pico Clone
<B>nano</B> <B>nano</B>
[options]&nbsp;[+LINE]<I> file</I> <I>[+LINE]&nbsp;[options]&nbsp;[file]</I>
<BR> <BR>
<A NAME="lbAD">&nbsp;</A> <A NAME="lbAD">&nbsp;</A>
<H2>DESCRIPTION</H2> <H2>DESCRIPTION</H2>
This manual page documents briefly the This manual page documents briefly the <B>nano</B> command.
<B>nano</B>
command.
<P> <P>
...@@ -35,15 +32,17 @@ command. ...@@ -35,15 +32,17 @@ command.
<B>nano</B> is a small, free and friendly editor which aims to replace <B>nano</B> is a small, free and friendly editor which aims to replace
Pico, the default editor included in the non-free Pine package. Rather Pico, the default editor included in the non-free Pine package. Rather
than just copying Pico's look and feel, than just copying Pico's look and feel, <B>nano</B> also implements some
<B>nano</B> missing (or disabled by default) features in Pico, such as &quot;search and
replace&quot; and &quot;go to line number&quot;.
also implements some missing (or disabled by default) features in Pico,
such as &quot;search and replace&quot; and &quot;goto line number&quot;.
<A NAME="lbAE">&nbsp;</A> <A NAME="lbAE">&nbsp;</A>
<H2>OPTIONS</H2> <H2>OPTIONS</H2>
<DL COMPACT> <DL COMPACT>
<DT><B>+</B><I>LINE</I>
<DD>
Places cursor at <I>LINE</I> on startup.
<DT><B>-B (--backup)</B> <DT><B>-B (--backup)</B>
<DD> <DD>
...@@ -71,7 +70,7 @@ Write file in Mac format. ...@@ -71,7 +70,7 @@ Write file in Mac format.
<DD> <DD>
Disable automatic conversion of files from DOS/Mac format. Disable automatic conversion of files from DOS/Mac format.
<DT><B>-Q [str] (--quotestr=[str])</B> <DT><B>-Q </B><I>[str]</I> (--quotestr=<I>[str]</I>)
<DD> <DD>
Set the quoting string for justifying. The default is &quot;&gt; &quot;. Set the quoting string for justifying. The default is &quot;&gt; &quot;.
...@@ -84,8 +83,8 @@ Enable regular expression matching for search strings, as well as ...@@ -84,8 +83,8 @@ Enable regular expression matching for search strings, as well as
<DD> <DD>
Enable smooth scrolling. Text will scroll line-by-line, instead of the Enable smooth scrolling. Text will scroll line-by-line, instead of the
usual chunk-by-chunk behaviour. usual chunk-by-chunk behavior.
<DT><B>-T [num] (--tabsize=[num])</B> <DT><B>-T </B><I>[num]</I> (--tabsize=<I>[num]</I>)
<DD> <DD>
Set the size (width) of a tab. Set the size (width) of a tab.
...@@ -93,7 +92,7 @@ Set the size (width) of a tab. ...@@ -93,7 +92,7 @@ Set the size (width) of a tab.
<DD> <DD>
Show the current version number and author. Show the current version number and author.
<DT><B>-Y (--syntax=[str])</B> <DT><B>-Y </B><I>[str]</I> (--syntax=<I>[str]</I>)
<DD> <DD>
Specify a specific syntax highlighting from the .nanorc to use, if Specify a specific syntax highlighting from the .nanorc to use, if
...@@ -124,7 +123,7 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps? ...@@ -124,7 +123,7 @@ a new file, do not follow it. Good for editing files in /tmp, perhaps?
<DD> <DD>
Enable mouse support (if available for your system). Enable mouse support (if available for your system).
<DT><B>-o [dir] (--operatingdir=[dir])</B> <DT><B>-o </B><I>[dir]</I> (--operatingdir=<I>[dir]</I>)
<DD> <DD>
Set operating directory. Makes nano set up something similar to a Set operating directory. Makes nano set up something similar to a
...@@ -135,14 +134,14 @@ chroot. ...@@ -135,14 +134,14 @@ chroot.
Emulate Pico as closely as possible. This affects both the &quot;shortcut Emulate Pico as closely as possible. This affects both the &quot;shortcut
list&quot; at the bottom of the screen, as well as the display and entry of list&quot; at the bottom of the screen, as well as the display and entry of
previous search and replace strings. previous search and replace strings.
<DT><B>-r [#cols] (--fill=[#cols])</B> <DT><B>-r </B><I>[#cols]</I> (--fill=<I>[#cols]</I>)
<DD> <DD>
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. If this value is negative, wrapping will occur at 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 #cols from the right of the screen, allowing it to vary along with the
screen width if the screen is resized. screen width if the screen is resized.
<DT><B>-s [prog] (--speller=[prog])</B> <DT><B>-s </B><I>[prog]</I> (--speller=<I>[prog]</I>)
<DD> <DD>
Enable alternative spell checker command. Enable alternative spell checker command.
...@@ -170,23 +169,19 @@ Enable suspend ability. ...@@ -170,23 +169,19 @@ Enable suspend ability.
<DD> <DD>
Ignored, for compatibility with Pico. Ignored, for compatibility with Pico.
<DT><B>+LINE</B>
<DD>
Places cursor at LINE on startup.
</DL> </DL>
<A NAME="lbAF">&nbsp;</A> <A NAME="lbAF">&nbsp;</A>
<H2>NOTES</H2> <H2>NOTES</H2>
Nano will try to dump the buffer into an emergency file in some cases. <B>nano</B> will try to dump the buffer into an emergency file in some
Mainly, this will happen if Nano receives a SIGHUP or runs out of cases. Mainly, this will happen if <B>nano</B> receives a SIGHUP or runs
memory, when it will write the buffer into a file named &quot;nano.save&quot; if out of memory, when it will write the buffer into a file named
the buffer didn't have a name already, or will add a &quot;.save&quot; suffix to &quot;nano.save&quot; if the buffer didn't have a name already, or will add a
the current filename. If an emergency file with that name already exists &quot;.save&quot; suffix to the current filename. If an emergency file with that
in the current directory, &quot;.save&quot; and a number (e.g. &quot;.save.1&quot;) will be name already exists in the current directory, &quot;.save&quot; and a number (e.g.
suffixed to the current filename in order to make it unique. In &quot;.save.1&quot;) will be suffixed to the current filename in order to make it
multibuffer mode, nano will write all the open buffers to the respective unique. In multibuffer mode, <B>nano</B> will write all the open buffers
emergency files. to the respective emergency files.
<A NAME="lbAG">&nbsp;</A> <A NAME="lbAG">&nbsp;</A>
<H2>BUGS</H2> <H2>BUGS</H2>
...@@ -197,7 +192,7 @@ Please send any comments or bug reports to ...@@ -197,7 +192,7 @@ Please send any comments or bug reports to
<BR> <BR>
The nano mailing list is available from The <B>nano</B> mailing list is available from
<BR> <BR>
<B><A HREF="mailto:nano-devel@gnu.org">nano-devel@gnu.org</A>.</B> <B><A HREF="mailto:nano-devel@gnu.org">nano-devel@gnu.org</A>.</B>
...@@ -234,6 +229,6 @@ used by others). ...@@ -234,6 +229,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: 21:45:15 GMT, June 27, 2002 Time: 03:38:25 GMT, July 06, 2002
</BODY> </BODY>
</HTML> </HTML>
This diff is collapsed.
...@@ -124,6 +124,7 @@ typedef struct shortcut { ...@@ -124,6 +124,7 @@ typedef struct shortcut {
struct shortcut *next; struct shortcut *next;
} shortcut; } shortcut;
#ifndef NANO_SMALL
typedef struct toggle { typedef struct toggle {
int val; /* Sequence to toggle the key. Should only need 1 */ int val; /* Sequence to toggle the key. Should only need 1 */
const char *desc; /* Description for when toggle is, uh, toggled, const char *desc; /* Description for when toggle is, uh, toggled,
...@@ -132,19 +133,17 @@ typedef struct toggle { ...@@ -132,19 +133,17 @@ typedef struct toggle {
int flag; /* What flag actually gets toggled */ int flag; /* What flag actually gets toggled */
struct toggle *next; struct toggle *next;
} toggle; } toggle;
#endif /* !NANO_SMALL */
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
typedef struct rcoption { typedef struct rcoption {
char *name; char *name;
int flag; int flag;
} rcoption; } rcoption;
#endif /* ENABLE_NANORC */ #endif /* ENABLE_NANORC */
#ifdef ENABLE_COLOR #ifdef ENABLE_COLOR
#define COLORSTRNUM 16
typedef struct colortype { typedef struct colortype {
int fg; /* fg color */ int fg; /* fg color */
int bg; /* bg color */ int bg; /* bg color */
...@@ -162,9 +161,10 @@ typedef struct exttype { ...@@ -162,9 +161,10 @@ typedef struct exttype {
typedef struct syntaxtype { typedef struct syntaxtype {
char *desc; /* Name of this syntax type */ char *desc; /* Name of this syntax type */
struct exttype *extensions; /* List of extensions that this applies to */ exttype *extensions; /* List of extensions that this applies to */
colortype *color; /* color struct for this syntax */ colortype *color; /* color struct for this syntax */
struct syntaxtype *next; struct syntaxtype *next;
} syntaxtype; } syntaxtype;
#endif /* ENABLE_COLOR */ #endif /* ENABLE_COLOR */
...@@ -200,12 +200,11 @@ typedef struct syntaxtype { ...@@ -200,12 +200,11 @@ typedef struct syntaxtype {
#define ALT_KEYPAD (1<<25) #define ALT_KEYPAD (1<<25)
#define NO_CONVERT (1<<26) #define NO_CONVERT (1<<26)
#define BACKUP_FILE (1<<27) #define BACKUP_FILE (1<<27)
#define NO_RCFILE (1<<28)
/* Control key sequences, changing these would be very very bad */ /* Control key sequences, changing these would be very very bad */
#ifndef NANO_SMALL #define NANO_CONTROL_SPACE 0
# define NANO_CONTROL_SPACE 0
#endif
#define NANO_CONTROL_A 1 #define NANO_CONTROL_A 1
#define NANO_CONTROL_B 2 #define NANO_CONTROL_B 2
#define NANO_CONTROL_C 3 #define NANO_CONTROL_C 3
...@@ -336,6 +335,8 @@ know what you're doing */ ...@@ -336,6 +335,8 @@ know what you're doing */
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE #define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
#define NANO_PREVWORD_KEY NANO_ALT_SPACE #define NANO_PREVWORD_KEY NANO_ALT_SPACE
#ifndef NANO_SMALL
/* Toggles do not exist with NANO_SMALL. */
#define TOGGLE_CONST_KEY NANO_ALT_C #define TOGGLE_CONST_KEY NANO_ALT_C
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I #define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z #define TOGGLE_SUSPEND_KEY NANO_ALT_Z
...@@ -353,18 +354,18 @@ know what you're doing */ ...@@ -353,18 +354,18 @@ know what you're doing */
#define TOGGLE_SMOOTH_KEY NANO_ALT_S #define TOGGLE_SMOOTH_KEY NANO_ALT_S
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N #define TOGGLE_NOCONVERT_KEY NANO_ALT_N
#define TOGGLE_BACKUP_KEY NANO_ALT_B #define TOGGLE_BACKUP_KEY NANO_ALT_B
#endif /* !NANO_SMALL */
#define MAIN_VISIBLE 12 #define MAIN_VISIBLE 12
#define VIEW 1 #define VIEW 1
#define NOVIEW 0 #define NOVIEW 0
#define NONE 3 typedef enum {
#define TOP 2 CENTER, TOP, NONE
#define CENTER 1 } topmidbotnone;
#define BOTTOM 0
/* Minimum editor window rows required for Nano to work correctly */ /* Minimum editor window rows required for nano to work correctly */
#define MIN_EDITOR_ROWS 3 #define MIN_EDITOR_ROWS 3
/* Default number of characters from end-of-line where text wrapping occurs */ /* Default number of characters from end-of-line where text wrapping occurs */
...@@ -373,25 +374,4 @@ know what you're doing */ ...@@ -373,25 +374,4 @@ know what you're doing */
/* Minimum fill length (space available for text before wrapping occurs) */ /* Minimum fill length (space available for text before wrapping occurs) */
#define MIN_FILL_LENGTH 10 #define MIN_FILL_LENGTH 10
/* Color specific defines */ #endif /* !NANO_H */
#ifdef ENABLE_COLOR
typedef struct colorstruct {
int fg;
int bg;
int bold;
int set;
} colorstruct;
#define FIRST_COLORNUM 16
#define COLOR_TITLEBAR 16
#define COLOR_BOTTOMBARS 17
#define COLOR_STATUSBAR 18
#define COLOR_TEXT 19
#define COLOR_MARKER 20
#define NUM_NCOLORS 5
#endif /* ENABLE_COLOR */
#endif /* ifndef NANO_H */
This diff is collapsed.
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
# set cut # set cut
# Use this value instead of the default # Use this value instead of the default
# An out-of-range negative value can make nano die complaining that the
# screen is too small
# set fill -8 # set fill -8
# Use alternate keypad routines # Use alternate keypad routines
...@@ -46,9 +48,12 @@ ...@@ -46,9 +48,12 @@
# Use Pico Compatibility mode for the shortcut lists and search text # Use Pico Compatibility mode for the shortcut lists and search text
# set pico # set pico
# Use this as the quoting string. You shouldn't need to change this, # The email-quote string. This is a "regular expression" if your
# but...... default "> " # system supports them, otherwise a literal string. Default
# set quotestr "// " # set quotestr "^([ \t]*[|>:}#])+" if you have regexps, otherwise
# set quotestr "> ".
# You can get old nano quoted-justify behavior via:
# set quotestr "(> )+"
# Do regular expression searches by default # Do regular expression searches by default
# set regexp # set regexp
...@@ -62,7 +67,7 @@ ...@@ -62,7 +67,7 @@
# Allow nano to be suspended with ^Z # Allow nano to be suspended with ^Z
# set suspend # set suspend
# Use this tab size instead of the default # Use this tab size instead of the default; it must be greater than 0
# set tabsize 4 # set tabsize 4
# Save automatically on exit, don't prompt # Save automatically on exit, don't prompt
...@@ -85,7 +90,7 @@ ...@@ -85,7 +90,7 @@
# color will use a transparent color. If you don't want this, be sure # color will use a transparent color. If you don't want this, be sure
# to set the background color to black or white. # to set the background color to black or white.
# syntax "c-file" ".*\.c" ".*\.h" # syntax "c-file" ".*\.c$" ".*\.h$"
# color red "\<[A-Z_]\{2,\}\>" # color red "\<[A-Z_]\{2,\}\>"
# color green "\<float\>" "\<char\>" "\<int\>" "\<void\>" # color green "\<float\>" "\<char\>" "\<int\>" "\<void\>"
# color green "\<static\>" "\<const\>" "\<struct\>" # color green "\<static\>" "\<const\>" "\<struct\>"
...@@ -99,7 +104,7 @@ ...@@ -99,7 +104,7 @@
# color brightyellow "<[^= ]*>" "\"[^"]*\"" # color brightyellow "<[^= ]*>" "\"[^"]*\""
# color brightblue "//.*" # color brightblue "//.*"
# color brightblue start="/\*.*" end="\*/" # color brightblue start="/\*" end="\*/"
# For this you will probably want to set your editor to "nano -Y mutt" # For this you will probably want to set your editor to "nano -Y mutt"
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment