rename the NANO_SMALL #define to NANO_TINY
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3176 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
@@ -100,6 +100,7 @@ CVS code -
|
|||||||
- Don't install the localized versions of the manpages if
|
- Don't install the localized versions of the manpages if
|
||||||
nano is built with --disable-nls. Changes to Makefile.am and
|
nano is built with --disable-nls. Changes to Makefile.am and
|
||||||
doc/man/Makefile.am. (Mike Frysinger)
|
doc/man/Makefile.am. (Mike Frysinger)
|
||||||
|
- Rename the NANO_SMALL #define to NANO_TINY. (DLR)
|
||||||
- chars.c:
|
- chars.c:
|
||||||
mbwidth()
|
mbwidth()
|
||||||
- If wcwidth() returns -1 for the character passed in, treat the
|
- If wcwidth() returns -1 for the character passed in, treat the
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ 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],
|
||||||
[if test x$enableval = xyes; then
|
[if test x$enableval = xyes; then
|
||||||
AC_DEFINE(NANO_SMALL, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
|
AC_DEFINE(NANO_TINY, 1, [Define this to make the nano executable as small as possible.]) tiny_support=yes
|
||||||
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
AC_DEFINE(DISABLE_BROWSER, 1, [Define this to disable the built-in file browser.])
|
||||||
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
AC_DEFINE(DISABLE_HELP, 1, [Define this to disable the help menu.])
|
||||||
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routine.])
|
||||||
|
|||||||
@@ -247,7 +247,7 @@ char *do_browser(char *path, DIR *dir)
|
|||||||
curs_set(1);
|
curs_set(1);
|
||||||
|
|
||||||
j = do_prompt(FALSE, gotodir_list, "",
|
j = do_prompt(FALSE, gotodir_list, "",
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
_("Go To Directory"));
|
_("Go To Directory"));
|
||||||
|
|||||||
@@ -655,7 +655,7 @@ const char *mbstrcasestr(const char *haystack, const char *needle)
|
|||||||
return strcasestr(haystack, needle);
|
return strcasestr(haystack, needle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
|
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
|
||||||
/* This function is equivalent to strstr(), except in that it scans the
|
/* This function is equivalent to strstr(), except in that it scans the
|
||||||
* string in reverse, starting at rev_start. */
|
* string in reverse, starting at rev_start. */
|
||||||
const char *revstrstr(const char *haystack, const char *needle, const
|
const char *revstrstr(const char *haystack, const char *needle, const
|
||||||
@@ -675,9 +675,9 @@ const char *revstrstr(const char *haystack, const char *needle, const
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL || !DISABLE_TABCOMP */
|
#endif /* !NANO_TINY || !DISABLE_TABCOMP */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* This function is equivalent to strcasestr(), except in that it scans
|
/* This function is equivalent to strcasestr(), except in that it scans
|
||||||
* the string in reverse, starting at rev_start. */
|
* the string in reverse, starting at rev_start. */
|
||||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||||
@@ -764,7 +764,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
|||||||
#endif
|
#endif
|
||||||
return revstrcasestr(haystack, needle, rev_start);
|
return revstrcasestr(haystack, needle, rev_start);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* This function is equivalent to strlen() for multibyte strings. */
|
/* This function is equivalent to strlen() for multibyte strings. */
|
||||||
size_t mbstrlen(const char *s)
|
size_t mbstrlen(const char *s)
|
||||||
|
|||||||
10
src/cut.c
10
src/cut.c
@@ -54,7 +54,7 @@ void cut_line(void)
|
|||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Move all currently marked text to the cutbuffer, and set the current
|
/* Move all currently marked text to the cutbuffer, and set the current
|
||||||
* place we want to where the text used to start. */
|
* place we want to where the text used to start. */
|
||||||
void cut_marked(void)
|
void cut_marked(void)
|
||||||
@@ -97,7 +97,7 @@ void cut_to_eol(void)
|
|||||||
openfile->placewewant = xplustabs();
|
openfile->placewewant = xplustabs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* Move text from the current filestruct into the cutbuffer. */
|
/* Move text from the current filestruct into the cutbuffer. */
|
||||||
void do_cut_text(void)
|
void do_cut_text(void)
|
||||||
@@ -121,7 +121,7 @@ void do_cut_text(void)
|
|||||||
* cutbuffer instead of replacing it. */
|
* cutbuffer instead of replacing it. */
|
||||||
keep_cutbuffer = TRUE;
|
keep_cutbuffer = TRUE;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set) {
|
if (openfile->mark_set) {
|
||||||
/* If the mark is on, move the marked text to the cutbuffer and
|
/* If the mark is on, move the marked text to the cutbuffer and
|
||||||
* turn the mark off. */
|
* turn the mark off. */
|
||||||
@@ -144,7 +144,7 @@ void do_cut_text(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Cut from the current cursor position to the end of the file. */
|
/* Cut from the current cursor position to the end of the file. */
|
||||||
void do_cut_till_end(void)
|
void do_cut_till_end(void)
|
||||||
{
|
{
|
||||||
@@ -163,7 +163,7 @@ void do_cut_till_end(void)
|
|||||||
dump_filestruct(cutbuffer);
|
dump_filestruct(cutbuffer);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* Copy text from the cutbuffer into the current filestruct. */
|
/* Copy text from the cutbuffer into the current filestruct. */
|
||||||
void do_uncut_text(void)
|
void do_uncut_text(void)
|
||||||
|
|||||||
76
src/files.c
76
src/files.c
@@ -68,7 +68,7 @@ void initialize_buffer(void)
|
|||||||
openfile->current_y = 0;
|
openfile->current_y = 0;
|
||||||
|
|
||||||
openfile->modified = FALSE;
|
openfile->modified = FALSE;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
openfile->mark_set = FALSE;
|
openfile->mark_set = FALSE;
|
||||||
|
|
||||||
openfile->mark_begin = NULL;
|
openfile->mark_begin = NULL;
|
||||||
@@ -143,7 +143,7 @@ void open_buffer(const char *filename)
|
|||||||
* no stat, update the stat, if applicable. */
|
* no stat, update the stat, if applicable. */
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
read_file(f, filename);
|
read_file(f, filename);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->current_stat == NULL) {
|
if (openfile->current_stat == NULL) {
|
||||||
openfile->current_stat =
|
openfile->current_stat =
|
||||||
(struct stat *)nmalloc(sizeof(struct stat));
|
(struct stat *)nmalloc(sizeof(struct stat));
|
||||||
@@ -304,7 +304,7 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
|
|||||||
|
|
||||||
fileptr->data = mallocstrcpy(NULL, buf);
|
fileptr->data = mallocstrcpy(NULL, buf);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If it's a DOS file ("\r\n"), and file conversion isn't disabled,
|
/* If it's a DOS file ("\r\n"), and file conversion isn't disabled,
|
||||||
* strip the '\r' part from fileptr->data. */
|
* strip the '\r' part from fileptr->data. */
|
||||||
if (!ISSET(NO_CONVERT) && buf_len > 0 && buf[buf_len - 1] == '\r')
|
if (!ISSET(NO_CONVERT) && buf_len > 0 && buf[buf_len - 1] == '\r')
|
||||||
@@ -359,7 +359,7 @@ void read_file(FILE *f, const char *filename)
|
|||||||
int input_int;
|
int input_int;
|
||||||
/* The current value we read from the file, whether an input
|
/* The current value we read from the file, whether an input
|
||||||
* character or EOF. */
|
* character or EOF. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
int format = 0;
|
int format = 0;
|
||||||
/* 0 = *nix, 1 = DOS, 2 = Mac, 3 = both DOS and Mac. */
|
/* 0 = *nix, 1 = DOS, 2 = Mac, 3 = both DOS and Mac. */
|
||||||
#endif
|
#endif
|
||||||
@@ -381,7 +381,7 @@ void read_file(FILE *f, const char *filename)
|
|||||||
/* If it's a *nix file ("\n") or a DOS file ("\r\n"), and file
|
/* If it's a *nix file ("\n") or a DOS file ("\r\n"), and file
|
||||||
* conversion isn't disabled, handle it! */
|
* conversion isn't disabled, handle it! */
|
||||||
if (input == '\n') {
|
if (input == '\n') {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If there's a '\r' before the '\n', set format to DOS if
|
/* If there's a '\r' before the '\n', set format to DOS if
|
||||||
* we currently think this is a *nix file, or to both if we
|
* we currently think this is a *nix file, or to both if we
|
||||||
* currently think it's a Mac file. */
|
* currently think it's a Mac file. */
|
||||||
@@ -400,7 +400,7 @@ void read_file(FILE *f, const char *filename)
|
|||||||
num_lines++;
|
num_lines++;
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
i = 0;
|
i = 0;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If it's a Mac file ('\r' without '\n'), and file conversion
|
/* If it's a Mac file ('\r' without '\n'), and file conversion
|
||||||
* isn't disabled, handle it! */
|
* isn't disabled, handle it! */
|
||||||
} else if (!ISSET(NO_CONVERT) && i > 0 && buf[i - 1] == '\r') {
|
} else if (!ISSET(NO_CONVERT) && i > 0 && buf[i - 1] == '\r') {
|
||||||
@@ -449,7 +449,7 @@ void read_file(FILE *f, const char *filename)
|
|||||||
nperror(filename);
|
nperror(filename);
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If file conversion isn't disabled and the last character in this
|
/* If file conversion isn't disabled and the last character in this
|
||||||
* file is '\r', read it in properly as a Mac format line. */
|
* file is '\r', read it in properly as a Mac format line. */
|
||||||
if (len == 0 && !ISSET(NO_CONVERT) && input == '\r') {
|
if (len == 0 && !ISSET(NO_CONVERT) && input == '\r') {
|
||||||
@@ -462,7 +462,7 @@ void read_file(FILE *f, const char *filename)
|
|||||||
|
|
||||||
/* Did we not get a newline and still have stuff to do? */
|
/* Did we not get a newline and still have stuff to do? */
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If file conversion isn't disabled and the last character in
|
/* If file conversion isn't disabled and the last character in
|
||||||
* this file is '\r', set format to Mac if we currently think
|
* this file is '\r', set format to Mac if we currently think
|
||||||
* the file is a *nix file, or to both DOS and Mac if we
|
* the file is a *nix file, or to both DOS and Mac if we
|
||||||
@@ -553,7 +553,7 @@ void read_file(FILE *f, const char *filename)
|
|||||||
* file we inserted. */
|
* file we inserted. */
|
||||||
openfile->placewewant = xplustabs();
|
openfile->placewewant = xplustabs();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (format == 3)
|
if (format == 3)
|
||||||
statusbar(
|
statusbar(
|
||||||
P_("Read %lu line (Converted from DOS and Mac format)",
|
P_("Read %lu line (Converted from DOS and Mac format)",
|
||||||
@@ -664,7 +664,7 @@ char *get_next_filename(const char *name, const char *suffix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void do_insertfile(
|
void do_insertfile(
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool execute
|
bool execute
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
@@ -685,7 +685,7 @@ void do_insertfile(
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (execute) {
|
if (execute) {
|
||||||
msg =
|
msg =
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
@@ -701,16 +701,16 @@ void do_insertfile(
|
|||||||
N_("File to insert into new buffer [from %s] ") :
|
N_("File to insert into new buffer [from %s] ") :
|
||||||
#endif
|
#endif
|
||||||
N_("File to insert [from %s] ");
|
N_("File to insert [from %s] ");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
i = do_prompt(TRUE,
|
i = do_prompt(TRUE,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
execute ? extcmd_list :
|
execute ? extcmd_list :
|
||||||
#endif
|
#endif
|
||||||
insertfile_list, ans,
|
insertfile_list, ans,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
_(msg),
|
_(msg),
|
||||||
@@ -734,7 +734,7 @@ void do_insertfile(
|
|||||||
|
|
||||||
ans = mallocstrcpy(ans, answer);
|
ans = mallocstrcpy(ans, answer);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
if (i == TOGGLE_MULTIBUFFER_KEY) {
|
if (i == TOGGLE_MULTIBUFFER_KEY) {
|
||||||
/* Don't allow toggling if we're in view mode. */
|
/* Don't allow toggling if we're in view mode. */
|
||||||
@@ -750,7 +750,7 @@ void do_insertfile(
|
|||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
if (i == NANO_TOFILES_KEY) {
|
if (i == NANO_TOFILES_KEY) {
|
||||||
@@ -795,7 +795,7 @@ void do_insertfile(
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (execute) {
|
if (execute) {
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
if (ISSET(MULTIBUFFER))
|
if (ISSET(MULTIBUFFER))
|
||||||
@@ -815,7 +815,7 @@ void do_insertfile(
|
|||||||
/* Save the file specified in answer in the current
|
/* Save the file specified in answer in the current
|
||||||
* buffer. */
|
* buffer. */
|
||||||
open_buffer(answer);
|
open_buffer(answer);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -877,7 +877,7 @@ void do_insertfile_void(void)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
do_insertfile(
|
do_insertfile(
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
FALSE
|
FALSE
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -1156,7 +1156,7 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void init_backup_dir(void)
|
void init_backup_dir(void)
|
||||||
{
|
{
|
||||||
char *full_backup_dir;
|
char *full_backup_dir;
|
||||||
@@ -1297,7 +1297,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
* one). */
|
* one). */
|
||||||
realexists = (stat(realname, &st) != -1);
|
realexists = (stat(realname, &st) != -1);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* We backup only if the backup toggle is set, the file isn't
|
/* We backup only if the backup toggle is set, the file isn't
|
||||||
* temporary, and the file already exists. Furthermore, if we
|
* temporary, and the file already exists. Furthermore, if we
|
||||||
* aren't appending, prepending, or writing a selection, we backup
|
* aren't appending, prepending, or writing a selection, we backup
|
||||||
@@ -1412,7 +1412,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
|
|
||||||
free(backupname);
|
free(backupname);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't
|
/* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't
|
||||||
* doing prepend or append. So we delete the link first, and just
|
* doing prepend or append. So we delete the link first, and just
|
||||||
@@ -1532,7 +1532,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
if (fileptr->data[0] == '\0')
|
if (fileptr->data[0] == '\0')
|
||||||
lineswritten--;
|
lineswritten--;
|
||||||
} else {
|
} else {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->fmt == DOS_FILE || openfile->fmt ==
|
if (openfile->fmt == DOS_FILE || openfile->fmt ==
|
||||||
MAC_FILE) {
|
MAC_FILE) {
|
||||||
if (putc('\r', f) == EOF) {
|
if (putc('\r', f) == EOF) {
|
||||||
@@ -1551,7 +1551,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
fclose(f);
|
fclose(f);
|
||||||
goto cleanup_and_exit;
|
goto cleanup_and_exit;
|
||||||
}
|
}
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1610,7 +1610,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Update current_stat to reference the file as it is now. */
|
/* Update current_stat to reference the file as it is now. */
|
||||||
if (openfile->current_stat == NULL)
|
if (openfile->current_stat == NULL)
|
||||||
openfile->current_stat =
|
openfile->current_stat =
|
||||||
@@ -1634,7 +1634,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Write a marked selection from a file out. */
|
/* Write a marked selection from a file out. */
|
||||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||||
append_type append)
|
append_type append)
|
||||||
@@ -1679,7 +1679,7 @@ int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
|||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
int do_writeout(bool exiting)
|
int do_writeout(bool exiting)
|
||||||
{
|
{
|
||||||
@@ -1703,14 +1703,14 @@ int do_writeout(bool exiting)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ans = mallocstrcpy(NULL,
|
ans = mallocstrcpy(NULL,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
(openfile->mark_set && !exiting) ? "" :
|
(openfile->mark_set && !exiting) ? "" :
|
||||||
#endif
|
#endif
|
||||||
openfile->filename);
|
openfile->filename);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
const char *msg;
|
const char *msg;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *formatstr, *backupstr;
|
const char *formatstr, *backupstr;
|
||||||
|
|
||||||
formatstr = (openfile->fmt == DOS_FILE) ?
|
formatstr = (openfile->fmt == DOS_FILE) ?
|
||||||
@@ -1725,7 +1725,7 @@ int do_writeout(bool exiting)
|
|||||||
N_("Append Selection to File") :
|
N_("Append Selection to File") :
|
||||||
N_("Write Selection to File");
|
N_("Write Selection to File");
|
||||||
else
|
else
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
msg = (append == PREPEND) ? N_("File Name to Prepend to") :
|
msg = (append == PREPEND) ? N_("File Name to Prepend to") :
|
||||||
(append == APPEND) ? N_("File Name to Append to") :
|
(append == APPEND) ? N_("File Name to Append to") :
|
||||||
N_("File Name to Write");
|
N_("File Name to Write");
|
||||||
@@ -1735,7 +1735,7 @@ int do_writeout(bool exiting)
|
|||||||
* completion. */
|
* completion. */
|
||||||
i = do_prompt(!ISSET(RESTRICTED) ||
|
i = do_prompt(!ISSET(RESTRICTED) ||
|
||||||
openfile->filename[0] == '\0', writefile_list, ans,
|
openfile->filename[0] == '\0', writefile_list, ans,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
NULL, "%s%s%s", _(msg), formatstr, backupstr
|
NULL, "%s%s%s", _(msg), formatstr, backupstr
|
||||||
#else
|
#else
|
||||||
"%s", _(msg)
|
"%s", _(msg)
|
||||||
@@ -1766,7 +1766,7 @@ int do_writeout(bool exiting)
|
|||||||
do_prompt_abort();
|
do_prompt_abort();
|
||||||
} else
|
} else
|
||||||
#endif /* !DISABLE_BROWSER */
|
#endif /* !DISABLE_BROWSER */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (i == TOGGLE_DOS_KEY) {
|
if (i == TOGGLE_DOS_KEY) {
|
||||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||||
DOS_FILE;
|
DOS_FILE;
|
||||||
@@ -1779,7 +1779,7 @@ int do_writeout(bool exiting)
|
|||||||
TOGGLE(BACKUP_FILE);
|
TOGGLE(BACKUP_FILE);
|
||||||
continue;
|
continue;
|
||||||
} else
|
} else
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
if (i == NANO_PREPEND_KEY) {
|
if (i == NANO_PREPEND_KEY) {
|
||||||
append = (append == PREPEND) ? OVERWRITE : PREPEND;
|
append = (append == PREPEND) ? OVERWRITE : PREPEND;
|
||||||
continue;
|
continue;
|
||||||
@@ -1817,7 +1817,7 @@ int do_writeout(bool exiting)
|
|||||||
* bother showing the "Different Name" prompt. */
|
* bother showing the "Different Name" prompt. */
|
||||||
} else if (!ISSET(RESTRICTED) &&
|
} else if (!ISSET(RESTRICTED) &&
|
||||||
openfile->filename[0] != '\0'
|
openfile->filename[0] != '\0'
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
&& (exiting || !openfile->mark_set)
|
&& (exiting || !openfile->mark_set)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
@@ -1828,7 +1828,7 @@ int do_writeout(bool exiting)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Here's where we allow the selected text to be written to
|
/* Here's where we allow the selected text to be written to
|
||||||
* a separate file. If we're using restricted mode, this is
|
* a separate file. If we're using restricted mode, this is
|
||||||
* disabled since it allows reading from or writing to files
|
* disabled since it allows reading from or writing to files
|
||||||
@@ -1836,7 +1836,7 @@ int do_writeout(bool exiting)
|
|||||||
if (!ISSET(RESTRICTED) && !exiting && openfile->mark_set)
|
if (!ISSET(RESTRICTED) && !exiting && openfile->mark_set)
|
||||||
retval = write_marked_file(answer, NULL, FALSE, append);
|
retval = write_marked_file(answer, NULL, FALSE, append);
|
||||||
else
|
else
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
retval = write_file(answer, NULL, FALSE, append, FALSE);
|
retval = write_file(answer, NULL, FALSE, append, FALSE);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -2281,7 +2281,7 @@ const char *tail(const char *foo)
|
|||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
/* Return $HOME/.nano_history, or NULL if we can't find the homedir.
|
/* Return $HOME/.nano_history, or NULL if we can't find the homedir.
|
||||||
* The string is dynamically allocated, and should be freed. */
|
* The string is dynamically allocated, and should be freed. */
|
||||||
char *histfilename(void)
|
char *histfilename(void)
|
||||||
@@ -2399,4 +2399,4 @@ void save_history(void)
|
|||||||
free(nanohist);
|
free(nanohist);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
#endif /* !NANO_TINY && ENABLE_NANORC */
|
||||||
|
|||||||
74
src/global.c
74
src/global.c
@@ -57,7 +57,7 @@ partition *filepart = NULL; /* A place to store a portion of the
|
|||||||
openfilestruct *openfile = NULL;
|
openfilestruct *openfile = NULL;
|
||||||
/* The list of open file buffers */
|
/* The list of open file buffers */
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
char *whitespace = NULL; /* Characters used when displaying
|
char *whitespace = NULL; /* Characters used when displaying
|
||||||
the first characters of tabs and
|
the first characters of tabs and
|
||||||
spaces. */
|
spaces. */
|
||||||
@@ -81,7 +81,7 @@ size_t quotelen; /* strlen(quotestr) */
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
char *backup_dir = NULL; /* Backup directory. */
|
char *backup_dir = NULL; /* Backup directory. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -113,7 +113,7 @@ shortcut *help_list = NULL;
|
|||||||
#ifndef DISABLE_SPELLER
|
#ifndef DISABLE_SPELLER
|
||||||
shortcut *spell_list = NULL;
|
shortcut *spell_list = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
shortcut *extcmd_list = NULL;
|
shortcut *extcmd_list = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
@@ -128,11 +128,11 @@ char *syntaxstr = NULL;
|
|||||||
|
|
||||||
const shortcut *currshortcut; /* Current shortcut list we're using */
|
const shortcut *currshortcut; /* Current shortcut list we're using */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
toggle *toggles = NULL;
|
toggle *toggles = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
filestruct *search_history = NULL;
|
filestruct *search_history = NULL;
|
||||||
filestruct *searchage = NULL;
|
filestruct *searchage = NULL;
|
||||||
filestruct *searchbot = NULL;
|
filestruct *searchbot = NULL;
|
||||||
@@ -209,7 +209,7 @@ void shortcut_init(bool unjustify)
|
|||||||
const char *first_line_msg = N_("First Line");
|
const char *first_line_msg = N_("First Line");
|
||||||
const char *last_line_msg = N_("Last Line");
|
const char *last_line_msg = N_("Last Line");
|
||||||
const char *refresh_msg = N_("Refresh");
|
const char *refresh_msg = N_("Refresh");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *cut_till_end_msg = N_("CutTillEnd");
|
const char *cut_till_end_msg = N_("CutTillEnd");
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
@@ -217,14 +217,14 @@ void shortcut_init(bool unjustify)
|
|||||||
const char *end_of_par_msg = N_("End of Par");
|
const char *end_of_par_msg = N_("End of Par");
|
||||||
const char *fulljstify_msg = N_("FullJstify");
|
const char *fulljstify_msg = N_("FullJstify");
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *case_sens_msg = N_("Case Sens");
|
const char *case_sens_msg = N_("Case Sens");
|
||||||
const char *backwards_msg = N_("Backwards");
|
const char *backwards_msg = N_("Backwards");
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
const char *regexp_msg = N_("Regexp");
|
const char *regexp_msg = N_("Regexp");
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *history_msg = N_("History");
|
const char *history_msg = N_("History");
|
||||||
#ifdef ENABLE_MULTIBUFFER
|
#ifdef ENABLE_MULTIBUFFER
|
||||||
const char *new_buffer_msg = N_("New Buffer");
|
const char *new_buffer_msg = N_("New Buffer");
|
||||||
@@ -261,7 +261,7 @@ void shortcut_init(bool unjustify)
|
|||||||
N_("Invoke the spell checker, if available");
|
N_("Invoke the spell checker, if available");
|
||||||
const char *nano_gotoline_msg = N_("Go to line and column number");
|
const char *nano_gotoline_msg = N_("Go to line and column number");
|
||||||
const char *nano_replace_msg = N_("Replace text within the editor");
|
const char *nano_replace_msg = N_("Replace text within the editor");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *nano_mark_msg = N_("Mark text at the cursor position");
|
const char *nano_mark_msg = N_("Mark text at the cursor position");
|
||||||
const char *nano_whereis_next_msg = N_("Repeat last search");
|
const char *nano_whereis_next_msg = N_("Repeat last search");
|
||||||
#endif
|
#endif
|
||||||
@@ -283,7 +283,7 @@ void shortcut_init(bool unjustify)
|
|||||||
N_("Insert a tab character at the cursor position");
|
N_("Insert a tab character at the cursor position");
|
||||||
const char *nano_enter_msg =
|
const char *nano_enter_msg =
|
||||||
N_("Insert a carriage return at the cursor position");
|
N_("Insert a carriage return at the cursor position");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *nano_nextword_msg = N_("Move forward one word");
|
const char *nano_nextword_msg = N_("Move forward one word");
|
||||||
const char *nano_prevword_msg = N_("Move backward one word");
|
const char *nano_prevword_msg = N_("Move backward one word");
|
||||||
const char *nano_wordcount_msg =
|
const char *nano_wordcount_msg =
|
||||||
@@ -306,14 +306,14 @@ void shortcut_init(bool unjustify)
|
|||||||
N_("Switch to the next file buffer");
|
N_("Switch to the next file buffer");
|
||||||
#endif
|
#endif
|
||||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *nano_cut_till_end_msg =
|
const char *nano_cut_till_end_msg =
|
||||||
N_("Cut from the cursor position to the end of the file");
|
N_("Cut from the cursor position to the end of the file");
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
#if !defined(NANO_TINY) && defined(HAVE_REGEX_H)
|
||||||
const char *nano_bracket_msg = N_("Find other bracket");
|
const char *nano_bracket_msg = N_("Find other bracket");
|
||||||
#endif
|
#endif
|
||||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||||
@@ -321,7 +321,7 @@ void shortcut_init(bool unjustify)
|
|||||||
N_("Go to the first line of the file");
|
N_("Go to the first line of the file");
|
||||||
const char *nano_lastline_msg =
|
const char *nano_lastline_msg =
|
||||||
N_("Go to the last line of the file");
|
N_("Go to the last line of the file");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *nano_case_msg =
|
const char *nano_case_msg =
|
||||||
N_("Make the current search/replace case (in)sensitive");
|
N_("Make the current search/replace case (in)sensitive");
|
||||||
const char *nano_reverse_msg =
|
const char *nano_reverse_msg =
|
||||||
@@ -330,25 +330,25 @@ void shortcut_init(bool unjustify)
|
|||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
const char *nano_regexp_msg = N_("Use regular expressions");
|
const char *nano_regexp_msg = N_("Use regular expressions");
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *nano_history_msg =
|
const char *nano_history_msg =
|
||||||
N_("Edit the previous search/replace strings");
|
N_("Edit the previous search/replace strings");
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *nano_dos_msg = N_("Write file out in DOS format");
|
const char *nano_dos_msg = N_("Write file out in DOS format");
|
||||||
const char *nano_mac_msg = N_("Write file out in Mac format");
|
const char *nano_mac_msg = N_("Write file out in Mac format");
|
||||||
#endif
|
#endif
|
||||||
const char *nano_append_msg = N_("Append to the current file");
|
const char *nano_append_msg = N_("Append to the current file");
|
||||||
const char *nano_prepend_msg = N_("Prepend to the current file");
|
const char *nano_prepend_msg = N_("Prepend to the current file");
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *nano_backup_msg =
|
const char *nano_backup_msg =
|
||||||
N_("Back up original file when saving");
|
N_("Back up original file when saving");
|
||||||
const char *nano_execute_msg = N_("Execute external command");
|
const char *nano_execute_msg = N_("Execute external command");
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_MULTIBUFFER)
|
#if !defined(NANO_TINY) && defined(ENABLE_MULTIBUFFER)
|
||||||
const char *nano_multibuffer_msg = N_("Insert into new buffer");
|
const char *nano_multibuffer_msg = N_("Insert into new buffer");
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
@@ -478,7 +478,7 @@ void shortcut_init(bool unjustify)
|
|||||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||||
NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
|
NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
||||||
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
|
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
|
||||||
NANO_NO_KEY, VIEW, do_mark);
|
NANO_NO_KEY, VIEW, do_mark);
|
||||||
@@ -532,7 +532,7 @@ void shortcut_init(bool unjustify)
|
|||||||
IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_enter_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, NOVIEW, do_enter);
|
NANO_NO_KEY, NOVIEW, do_enter);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
|
sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
|
||||||
IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, do_next_word_void);
|
NANO_NO_KEY, VIEW, do_next_word_void);
|
||||||
@@ -580,7 +580,7 @@ void shortcut_init(bool unjustify)
|
|||||||
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
|
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg,
|
sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg,
|
||||||
IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
|
IFHELP(nano_cut_till_end_msg, NANO_CUTTILLEND_ALTKEY),
|
||||||
@@ -594,7 +594,7 @@ void shortcut_init(bool unjustify)
|
|||||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
|
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
#if !defined(NANO_TINY) && defined(HAVE_REGEX_H)
|
||||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
|
sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
|
||||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
|
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, do_find_bracket);
|
NANO_NO_KEY, VIEW, do_find_bracket);
|
||||||
@@ -649,7 +649,7 @@ void shortcut_init(bool unjustify)
|
|||||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
|
sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
|
||||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||||
@@ -668,7 +668,7 @@ void shortcut_init(bool unjustify)
|
|||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Translators: try to keep this string under 10 characters long */
|
/* Translators: try to keep this string under 10 characters long */
|
||||||
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
||||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||||
@@ -720,7 +720,7 @@ void shortcut_init(bool unjustify)
|
|||||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
|
sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
|
||||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
@@ -736,7 +736,7 @@ void shortcut_init(bool unjustify)
|
|||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
||||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
@@ -766,7 +766,7 @@ void shortcut_init(bool unjustify)
|
|||||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, do_last_line);
|
NANO_NO_KEY, VIEW, do_last_line);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
||||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
@@ -854,7 +854,7 @@ void shortcut_init(bool unjustify)
|
|||||||
NANO_NO_KEY, NOVIEW, NULL);
|
NANO_NO_KEY, NOVIEW, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If we're using restricted mode, the DOS format, Mac format,
|
/* If we're using restricted mode, the DOS format, Mac format,
|
||||||
* append, prepend, and backup toggles are disabled. The first and
|
* append, prepend, and backup toggles are disabled. The first and
|
||||||
* second are useless since inserting files is disabled, the third
|
* second are useless since inserting files is disabled, the third
|
||||||
@@ -886,7 +886,7 @@ void shortcut_init(bool unjustify)
|
|||||||
IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
|
IFHELP(nano_prepend_msg, NANO_PREPEND_KEY), NANO_NO_KEY,
|
||||||
NANO_NO_KEY, NOVIEW, NULL);
|
NANO_NO_KEY, NOVIEW, NULL);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Translators: try to keep this string under 16 characters long */
|
/* Translators: try to keep this string under 16 characters long */
|
||||||
if (!ISSET(RESTRICTED))
|
if (!ISSET(RESTRICTED))
|
||||||
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
|
sc_init_one(&writefile_list, NANO_NO_KEY, N_("Backup File"),
|
||||||
@@ -919,7 +919,7 @@ void shortcut_init(bool unjustify)
|
|||||||
NANO_NO_KEY, NOVIEW, NULL);
|
NANO_NO_KEY, NOVIEW, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If we're using restricted mode, command execution is disabled.
|
/* If we're using restricted mode, command execution is disabled.
|
||||||
* It's useless since inserting files is disabled. */
|
* It's useless since inserting files is disabled. */
|
||||||
/* Translators: try to keep this string under 22 characters long */
|
/* Translators: try to keep this string under 22 characters long */
|
||||||
@@ -957,7 +957,7 @@ void shortcut_init(bool unjustify)
|
|||||||
NANO_NO_KEY, VIEW, NULL);
|
NANO_NO_KEY, VIEW, NULL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
free_shortcutage(&extcmd_list);
|
free_shortcutage(&extcmd_list);
|
||||||
|
|
||||||
sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg,
|
sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg,
|
||||||
@@ -1034,7 +1034,7 @@ void shortcut_init(bool unjustify)
|
|||||||
|
|
||||||
currshortcut = main_list;
|
currshortcut = main_list;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
toggle_init();
|
toggle_init();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -1051,7 +1051,7 @@ void free_shortcutage(shortcut **shortcutage)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Create a new toggle structure, at the end of the toggles linked
|
/* Create a new toggle structure, at the end of the toggles linked
|
||||||
* list. */
|
* list. */
|
||||||
void toggle_init_one(int val, const char *desc, long flag)
|
void toggle_init_one(int val, const char *desc, long flag)
|
||||||
@@ -1132,7 +1132,7 @@ void toggle_init(void)
|
|||||||
WHITESPACE_DISPLAY);
|
WHITESPACE_DISPLAY);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* 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
|
||||||
@@ -1155,7 +1155,7 @@ void thanks_for_all_the_fish(void)
|
|||||||
free(quoteerr);
|
free(quoteerr);
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (backup_dir != NULL)
|
if (backup_dir != NULL)
|
||||||
free(backup_dir);
|
free(backup_dir);
|
||||||
#endif
|
#endif
|
||||||
@@ -1194,14 +1194,14 @@ void thanks_for_all_the_fish(void)
|
|||||||
#ifndef DISABLE_SPELLER
|
#ifndef DISABLE_SPELLER
|
||||||
free_shortcutage(&spell_list);
|
free_shortcutage(&spell_list);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
free_shortcutage(&extcmd_list);
|
free_shortcutage(&extcmd_list);
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_BROWSER
|
#ifndef DISABLE_BROWSER
|
||||||
free_shortcutage(&browser_list);
|
free_shortcutage(&browser_list);
|
||||||
free_shortcutage(&gotodir_list);
|
free_shortcutage(&gotodir_list);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Free the memory associated with each toggle. */
|
/* Free the memory associated with each toggle. */
|
||||||
while (toggles != NULL) {
|
while (toggles != NULL) {
|
||||||
toggle *t = toggles;
|
toggle *t = toggles;
|
||||||
@@ -1252,7 +1252,7 @@ void thanks_for_all_the_fish(void)
|
|||||||
free(bill);
|
free(bill);
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Free the search and replace history lists. */
|
/* Free the search and replace history lists. */
|
||||||
if (searchage != NULL)
|
if (searchage != NULL)
|
||||||
free_filestruct(searchage);
|
free_filestruct(searchage);
|
||||||
|
|||||||
@@ -181,7 +181,7 @@ void help_init(void)
|
|||||||
* compiler to handle. */
|
* compiler to handle. */
|
||||||
char *ptr;
|
char *ptr;
|
||||||
const shortcut *s;
|
const shortcut *s;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const toggle *t;
|
const toggle *t;
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||||
@@ -285,7 +285,7 @@ void help_init(void)
|
|||||||
htx[2] = NULL;
|
htx[2] = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
else if (currshortcut == extcmd_list) {
|
else if (currshortcut == extcmd_list) {
|
||||||
htx[0] = N_("Execute Command Help Text\n\n "
|
htx[0] = N_("Execute Command Help Text\n\n "
|
||||||
"This menu allows you to insert the output of a "
|
"This menu allows you to insert the output of a "
|
||||||
@@ -343,7 +343,7 @@ void help_init(void)
|
|||||||
allocsize += (COLS < 24 ? (24 * mb_cur_max()) :
|
allocsize += (COLS < 24 ? (24 * mb_cur_max()) :
|
||||||
((COLS + 1) * mb_cur_max())) * length_of_list(currshortcut);
|
((COLS + 1) * mb_cur_max())) * length_of_list(currshortcut);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If we're on the main list, we also count the toggle help text.
|
/* If we're on the main list, we also count the toggle help text.
|
||||||
* Each line has "M-%c\t\t\t", which fills 24 columns, plus a space,
|
* Each line has "M-%c\t\t\t", which fills 24 columns, plus a space,
|
||||||
* plus translated text, plus '\n'. */
|
* plus translated text, plus '\n'. */
|
||||||
@@ -469,7 +469,7 @@ void help_init(void)
|
|||||||
ptr += sprintf(ptr, "\n");
|
ptr += sprintf(ptr, "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* And the toggles... */
|
/* And the toggles... */
|
||||||
if (currshortcut == main_list) {
|
if (currshortcut == main_list) {
|
||||||
for (t = toggles; t != NULL; t = t->next) {
|
for (t = toggles; t != NULL; t = t->next) {
|
||||||
|
|||||||
28
src/move.c
28
src/move.c
@@ -77,12 +77,12 @@ void do_page_up(void)
|
|||||||
|
|
||||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||||
* beginning of the top line of the edit window, as Pico does. */
|
* beginning of the top line of the edit window, as Pico does. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (!ISSET(SMOOTH_SCROLL)) {
|
if (!ISSET(SMOOTH_SCROLL)) {
|
||||||
#endif
|
#endif
|
||||||
openfile->current = openfile->edittop;
|
openfile->current = openfile->edittop;
|
||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -118,12 +118,12 @@ void do_page_down(void)
|
|||||||
|
|
||||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||||
* beginning of the top line of the edit window, as Pico does. */
|
* beginning of the top line of the edit window, as Pico does. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (!ISSET(SMOOTH_SCROLL)) {
|
if (!ISSET(SMOOTH_SCROLL)) {
|
||||||
#endif
|
#endif
|
||||||
openfile->current = openfile->edittop;
|
openfile->current = openfile->edittop;
|
||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ void do_para_end_void(void)
|
|||||||
}
|
}
|
||||||
#endif /* !DISABLE_JUSTIFY */
|
#endif /* !DISABLE_JUSTIFY */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Move to the next word in the current filestruct. If allow_punct is
|
/* Move to the next word in the current filestruct. If allow_punct is
|
||||||
* TRUE, treat punctuation as part of a word. If allow_update is TRUE,
|
* TRUE, treat punctuation as part of a word. If allow_update is TRUE,
|
||||||
* update the screen afterward. Return TRUE if we started on a word,
|
* update the screen afterward. Return TRUE if we started on a word,
|
||||||
@@ -435,7 +435,7 @@ void do_prev_word_void(void)
|
|||||||
{
|
{
|
||||||
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
|
do_prev_word(ISSET(WORD_BOUNDS), TRUE);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
void do_home(void)
|
void do_home(void)
|
||||||
{
|
{
|
||||||
@@ -443,7 +443,7 @@ void do_home(void)
|
|||||||
|
|
||||||
check_statusblank();
|
check_statusblank();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(SMART_HOME)) {
|
if (ISSET(SMART_HOME)) {
|
||||||
size_t current_x_save = openfile->current_x;
|
size_t current_x_save = openfile->current_x;
|
||||||
|
|
||||||
@@ -458,7 +458,7 @@ void do_home(void)
|
|||||||
#endif
|
#endif
|
||||||
openfile->current_x = 0;
|
openfile->current_x = 0;
|
||||||
openfile->placewewant = 0;
|
openfile->placewewant = 0;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -503,7 +503,7 @@ void do_up(void)
|
|||||||
* a page if we're not. */
|
* a page if we're not. */
|
||||||
if (openfile->current_y == 0)
|
if (openfile->current_y == 0)
|
||||||
edit_scroll(UP,
|
edit_scroll(UP,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||||
#endif
|
#endif
|
||||||
editwinrows / 2);
|
editwinrows / 2);
|
||||||
@@ -517,7 +517,7 @@ void do_up(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_scroll_up(void)
|
void do_scroll_up(void)
|
||||||
{
|
{
|
||||||
check_statusblank();
|
check_statusblank();
|
||||||
@@ -540,7 +540,7 @@ void do_scroll_up(void)
|
|||||||
/* Scroll the edit window up one line. */
|
/* Scroll the edit window up one line. */
|
||||||
edit_scroll(UP, 1);
|
edit_scroll(UP, 1);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
void do_down(void)
|
void do_down(void)
|
||||||
{
|
{
|
||||||
@@ -566,7 +566,7 @@ void do_down(void)
|
|||||||
* half a page if we're not. */
|
* half a page if we're not. */
|
||||||
if (openfile->current_y == editwinrows - 1)
|
if (openfile->current_y == editwinrows - 1)
|
||||||
edit_scroll(DOWN,
|
edit_scroll(DOWN,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||||
#endif
|
#endif
|
||||||
editwinrows / 2);
|
editwinrows / 2);
|
||||||
@@ -580,7 +580,7 @@ void do_down(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_scroll_down(void)
|
void do_scroll_down(void)
|
||||||
{
|
{
|
||||||
check_statusblank();
|
check_statusblank();
|
||||||
@@ -603,7 +603,7 @@ void do_scroll_down(void)
|
|||||||
/* Scroll the edit window down one line. */
|
/* Scroll the edit window down one line. */
|
||||||
edit_scroll(DOWN, 1);
|
edit_scroll(DOWN, 1);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
void do_left(void)
|
void do_left(void)
|
||||||
{
|
{
|
||||||
|
|||||||
90
src/nano.c
90
src/nano.c
@@ -45,14 +45,14 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
#include <setjmp.h>
|
#include <setjmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct termios oldterm; /* The user's original term settings. */
|
static struct termios oldterm; /* The user's original term settings. */
|
||||||
static struct sigaction act; /* For all our fun signal handlers. */
|
static struct sigaction act; /* For all our fun signal handlers. */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
static sigjmp_buf jmpbuf; /* Used to return to main() after a
|
static sigjmp_buf jmpbuf; /* Used to return to main() after a
|
||||||
* SIGWINCH. */
|
* SIGWINCH. */
|
||||||
#endif
|
#endif
|
||||||
@@ -283,7 +283,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
|||||||
{
|
{
|
||||||
filestruct *top_save;
|
filestruct *top_save;
|
||||||
bool edittop_inside;
|
bool edittop_inside;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool mark_inside = FALSE;
|
bool mark_inside = FALSE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -301,7 +301,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
|||||||
edittop_inside = (openfile->edittop->lineno >=
|
edittop_inside = (openfile->edittop->lineno >=
|
||||||
openfile->fileage->lineno && openfile->edittop->lineno <=
|
openfile->fileage->lineno && openfile->edittop->lineno <=
|
||||||
openfile->filebot->lineno);
|
openfile->filebot->lineno);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set)
|
if (openfile->mark_set)
|
||||||
mark_inside = (openfile->mark_begin->lineno >=
|
mark_inside = (openfile->mark_begin->lineno >=
|
||||||
openfile->fileage->lineno &&
|
openfile->fileage->lineno &&
|
||||||
@@ -357,7 +357,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
|||||||
openfile->fileage = (filestruct *)nmalloc(sizeof(filestruct));
|
openfile->fileage = (filestruct *)nmalloc(sizeof(filestruct));
|
||||||
openfile->fileage->data = mallocstrcpy(NULL, "");
|
openfile->fileage->data = mallocstrcpy(NULL, "");
|
||||||
openfile->filebot = openfile->fileage;
|
openfile->filebot = openfile->fileage;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (mark_inside) {
|
if (mark_inside) {
|
||||||
openfile->mark_begin = openfile->fileage;
|
openfile->mark_begin = openfile->fileage;
|
||||||
openfile->mark_begin_x = top_x;
|
openfile->mark_begin_x = top_x;
|
||||||
@@ -378,7 +378,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
|||||||
* it in range of current. */
|
* it in range of current. */
|
||||||
if (edittop_inside)
|
if (edittop_inside)
|
||||||
edit_update(
|
edit_update(
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||||
#endif
|
#endif
|
||||||
CENTER);
|
CENTER);
|
||||||
@@ -501,7 +501,7 @@ void delete_opennode(openfilestruct *fileptr)
|
|||||||
|
|
||||||
free(fileptr->filename);
|
free(fileptr->filename);
|
||||||
free_filestruct(fileptr->fileage);
|
free_filestruct(fileptr->fileage);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (fileptr->current_stat != NULL)
|
if (fileptr->current_stat != NULL)
|
||||||
free(fileptr->current_stat);
|
free(fileptr->current_stat);
|
||||||
#endif
|
#endif
|
||||||
@@ -544,7 +544,7 @@ void finish(void)
|
|||||||
/* Restore the old terminal settings. */
|
/* Restore the old terminal settings. */
|
||||||
tcsetattr(0, TCSANOW, &oldterm);
|
tcsetattr(0, TCSANOW, &oldterm);
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||||
save_history();
|
save_history();
|
||||||
#endif
|
#endif
|
||||||
@@ -726,7 +726,7 @@ void usage(void)
|
|||||||
print1opt("-h, -?", "--help", N_("Show this message"));
|
print1opt("-h, -?", "--help", N_("Show this message"));
|
||||||
print1opt(_("+LINE,COLUMN"), "",
|
print1opt(_("+LINE,COLUMN"), "",
|
||||||
N_("Start at line LINE, column COLUMN"));
|
N_("Start at line LINE, column COLUMN"));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
print1opt("-A", "--smarthome", N_("Enable smart home key"));
|
print1opt("-A", "--smarthome", N_("Enable smart home key"));
|
||||||
print1opt("-B", "--backup", N_("Save backups of existing files"));
|
print1opt("-B", "--backup", N_("Save backups of existing files"));
|
||||||
print1opt(_("-C [dir]"), _("--backupdir=[dir]"),
|
print1opt(_("-C [dir]"), _("--backupdir=[dir]"),
|
||||||
@@ -738,7 +738,7 @@ void usage(void)
|
|||||||
print1opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
|
print1opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
print1opt("-H", "--historylog",
|
print1opt("-H", "--historylog",
|
||||||
N_("Log & read search/replace string history"));
|
N_("Log & read search/replace string history"));
|
||||||
#endif
|
#endif
|
||||||
@@ -749,7 +749,7 @@ void usage(void)
|
|||||||
N_("Fix numeric keypad key confusion problem"));
|
N_("Fix numeric keypad key confusion problem"));
|
||||||
print1opt("-L", "--nonewlines",
|
print1opt("-L", "--nonewlines",
|
||||||
N_("Don't add newlines to the ends of files"));
|
N_("Don't add newlines to the ends of files"));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
print1opt("-N", "--noconvert",
|
print1opt("-N", "--noconvert",
|
||||||
N_("Don't convert files from DOS/Mac format"));
|
N_("Don't convert files from DOS/Mac format"));
|
||||||
#endif
|
#endif
|
||||||
@@ -759,17 +759,17 @@ void usage(void)
|
|||||||
N_("Quoting string"));
|
N_("Quoting string"));
|
||||||
#endif
|
#endif
|
||||||
print1opt("-R", "--restricted", N_("Restricted mode"));
|
print1opt("-R", "--restricted", N_("Restricted mode"));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
print1opt("-S", "--smooth", N_("Smooth scrolling"));
|
print1opt("-S", "--smooth", N_("Smooth scrolling"));
|
||||||
#endif
|
#endif
|
||||||
print1opt(_("-T [#cols]"), _("--tabsize=[#cols]"),
|
print1opt(_("-T [#cols]"), _("--tabsize=[#cols]"),
|
||||||
N_("Set width of a tab in cols to #cols"));
|
N_("Set width of a tab in cols to #cols"));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
print1opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
|
print1opt("-U", "--quickblank", N_("Do quick statusbar blanking"));
|
||||||
#endif
|
#endif
|
||||||
print1opt("-V", "--version",
|
print1opt("-V", "--version",
|
||||||
N_("Print version information and exit"));
|
N_("Print version information and exit"));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
print1opt("-W", "--wordbounds",
|
print1opt("-W", "--wordbounds",
|
||||||
N_("Detect word boundaries more accurately"));
|
N_("Detect word boundaries more accurately"));
|
||||||
#endif
|
#endif
|
||||||
@@ -780,7 +780,7 @@ void usage(void)
|
|||||||
print1opt("-c", "--const", N_("Constantly show cursor position"));
|
print1opt("-c", "--const", N_("Constantly show cursor position"));
|
||||||
print1opt("-d", "--rebinddelete",
|
print1opt("-d", "--rebinddelete",
|
||||||
N_("Fix Backspace/Delete confusion problem"));
|
N_("Fix Backspace/Delete confusion problem"));
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
print1opt("-i", "--autoindent",
|
print1opt("-i", "--autoindent",
|
||||||
N_("Automatically indent new lines"));
|
N_("Automatically indent new lines"));
|
||||||
print1opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
print1opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||||
@@ -873,7 +873,7 @@ void version(void)
|
|||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
printf(" --enable-nanorc");
|
printf(" --enable-nanorc");
|
||||||
#endif
|
#endif
|
||||||
#ifdef NANO_SMALL
|
#ifdef NANO_TINY
|
||||||
printf(" --enable-tiny");
|
printf(" --enable-tiny");
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_UTF8
|
#ifdef ENABLE_UTF8
|
||||||
@@ -943,7 +943,7 @@ void signal_init(void)
|
|||||||
sigaction(SIGHUP, &act, NULL);
|
sigaction(SIGHUP, &act, NULL);
|
||||||
sigaction(SIGTERM, &act, NULL);
|
sigaction(SIGTERM, &act, NULL);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Trap SIGWINCH because we want to handle window resizes. */
|
/* Trap SIGWINCH because we want to handle window resizes. */
|
||||||
act.sa_handler = handle_sigwinch;
|
act.sa_handler = handle_sigwinch;
|
||||||
sigaction(SIGWINCH, &act, NULL);
|
sigaction(SIGWINCH, &act, NULL);
|
||||||
@@ -996,7 +996,7 @@ void do_suspend(int signal)
|
|||||||
/* Handler for SIGCONT (continue after suspend). */
|
/* Handler for SIGCONT (continue after suspend). */
|
||||||
void do_cont(int signal)
|
void do_cont(int signal)
|
||||||
{
|
{
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Perhaps the user resized the window while we slept. Handle it,
|
/* Perhaps the user resized the window while we slept. Handle it,
|
||||||
* and update the screen in the process. */
|
* and update the screen in the process. */
|
||||||
handle_sigwinch(0);
|
handle_sigwinch(0);
|
||||||
@@ -1006,7 +1006,7 @@ void do_cont(int signal)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void handle_sigwinch(int s)
|
void handle_sigwinch(int s)
|
||||||
{
|
{
|
||||||
const char *tty = ttyname(0);
|
const char *tty = ttyname(0);
|
||||||
@@ -1088,9 +1088,9 @@ void allow_pending_sigwinch(bool allow)
|
|||||||
sigaddset(&winch, SIGWINCH);
|
sigaddset(&winch, SIGWINCH);
|
||||||
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
|
sigprocmask(allow ? SIG_UNBLOCK : SIG_BLOCK, &winch, NULL);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_toggle(const toggle *which)
|
void do_toggle(const toggle *which)
|
||||||
{
|
{
|
||||||
bool enabled;
|
bool enabled;
|
||||||
@@ -1139,7 +1139,7 @@ void do_toggle(const toggle *which)
|
|||||||
statusbar("%s %s", which->desc, enabled ? _("enabled") :
|
statusbar("%s %s", which->desc, enabled ? _("enabled") :
|
||||||
_("disabled"));
|
_("disabled"));
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
void disable_extended_io(void)
|
void disable_extended_io(void)
|
||||||
{
|
{
|
||||||
@@ -1160,7 +1160,7 @@ void disable_signals(void)
|
|||||||
tcsetattr(0, TCSANOW, &term);
|
tcsetattr(0, TCSANOW, &term);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void enable_signals(void)
|
void enable_signals(void)
|
||||||
{
|
{
|
||||||
struct termios term;
|
struct termios term;
|
||||||
@@ -1219,7 +1219,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||||||
/* The length of the input buffer. */
|
/* The length of the input buffer. */
|
||||||
const shortcut *s;
|
const shortcut *s;
|
||||||
bool have_shortcut;
|
bool have_shortcut;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const toggle *t;
|
const toggle *t;
|
||||||
bool have_toggle;
|
bool have_toggle;
|
||||||
#endif
|
#endif
|
||||||
@@ -1250,7 +1250,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||||||
have_shortcut = (s != NULL || input == NANO_XON_KEY ||
|
have_shortcut = (s != NULL || input == NANO_XON_KEY ||
|
||||||
input == NANO_XOFF_KEY || input == NANO_SUSPEND_KEY);
|
input == NANO_XOFF_KEY || input == NANO_SUSPEND_KEY);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Check for a toggle in the main list. */
|
/* Check for a toggle in the main list. */
|
||||||
t = get_toggle(input, *meta_key);
|
t = get_toggle(input, *meta_key);
|
||||||
|
|
||||||
@@ -1261,7 +1261,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||||||
|
|
||||||
/* Set s_or_t to TRUE if we got a shortcut or toggle. */
|
/* Set s_or_t to TRUE if we got a shortcut or toggle. */
|
||||||
*s_or_t = (have_shortcut
|
*s_or_t = (have_shortcut
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
|| have_toggle
|
|| have_toggle
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -1318,7 +1318,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||||||
case NANO_XOFF_KEY:
|
case NANO_XOFF_KEY:
|
||||||
statusbar(_("XOFF ignored, mumble mumble."));
|
statusbar(_("XOFF ignored, mumble mumble."));
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case NANO_SUSPEND_KEY:
|
case NANO_SUSPEND_KEY:
|
||||||
if (ISSET(SUSPEND))
|
if (ISSET(SUSPEND))
|
||||||
do_suspend(0);
|
do_suspend(0);
|
||||||
@@ -1346,7 +1346,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
else if (have_toggle) {
|
else if (have_toggle) {
|
||||||
/* Blow away the text in the cutbuffer, since we aren't
|
/* Blow away the text in the cutbuffer, since we aren't
|
||||||
* cutting text. */
|
* cutting text. */
|
||||||
@@ -1400,7 +1400,7 @@ bool do_mouse(void)
|
|||||||
get_page_start(xplustabs()) + mouse_x);
|
get_page_start(xplustabs()) + mouse_x);
|
||||||
openfile->placewewant = xplustabs();
|
openfile->placewewant = xplustabs();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Clicking where the cursor is toggles the mark, as does
|
/* Clicking where the cursor is toggles the mark, as does
|
||||||
* clicking beyond the line length with the cursor at the
|
* clicking beyond the line length with the cursor at the
|
||||||
* end of the line. */
|
* end of the line. */
|
||||||
@@ -1479,7 +1479,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
|||||||
openfile->totsize++;
|
openfile->totsize++;
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Note that current_x has not yet been incremented. */
|
/* Note that current_x has not yet been incremented. */
|
||||||
if (openfile->mark_set && openfile->current ==
|
if (openfile->mark_set && openfile->current ==
|
||||||
openfile->mark_begin && openfile->current_x <
|
openfile->mark_begin && openfile->current_x <
|
||||||
@@ -1581,7 +1581,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
{"nohelp", 0, NULL, 'x'},
|
{"nohelp", 0, NULL, 'x'},
|
||||||
{"suspend", 0, NULL, 'z'},
|
{"suspend", 0, NULL, 'z'},
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
{"smarthome", 0, NULL, 'A'},
|
{"smarthome", 0, NULL, 'A'},
|
||||||
{"backup", 0, NULL, 'B'},
|
{"backup", 0, NULL, 'B'},
|
||||||
{"backupdir", 1, NULL, 'C'},
|
{"backupdir", 1, NULL, 'C'},
|
||||||
@@ -1647,7 +1647,7 @@ int main(int argc, char **argv)
|
|||||||
case 'j':
|
case 'j':
|
||||||
/* Pico compatibility flags. */
|
/* Pico compatibility flags. */
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case 'A':
|
case 'A':
|
||||||
SET(SMART_HOME);
|
SET(SMART_HOME);
|
||||||
break;
|
break;
|
||||||
@@ -1667,7 +1667,7 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case 'H':
|
case 'H':
|
||||||
SET(HISTORYLOG);
|
SET(HISTORYLOG);
|
||||||
break;
|
break;
|
||||||
@@ -1682,7 +1682,7 @@ int main(int argc, char **argv)
|
|||||||
case 'L':
|
case 'L':
|
||||||
SET(NO_NEWLINES);
|
SET(NO_NEWLINES);
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case 'N':
|
case 'N':
|
||||||
SET(NO_CONVERT);
|
SET(NO_CONVERT);
|
||||||
break;
|
break;
|
||||||
@@ -1698,7 +1698,7 @@ int main(int argc, char **argv)
|
|||||||
case 'R':
|
case 'R':
|
||||||
SET(RESTRICTED);
|
SET(RESTRICTED);
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case 'S':
|
case 'S':
|
||||||
SET(SMOOTH_SCROLL);
|
SET(SMOOTH_SCROLL);
|
||||||
break;
|
break;
|
||||||
@@ -1710,7 +1710,7 @@ int main(int argc, char **argv)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case 'U':
|
case 'U':
|
||||||
SET(QUICK_BLANK);
|
SET(QUICK_BLANK);
|
||||||
break;
|
break;
|
||||||
@@ -1718,7 +1718,7 @@ int main(int argc, char **argv)
|
|||||||
case 'V':
|
case 'V':
|
||||||
version();
|
version();
|
||||||
exit(0);
|
exit(0);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case 'W':
|
case 'W':
|
||||||
SET(WORD_BOUNDS);
|
SET(WORD_BOUNDS);
|
||||||
break;
|
break;
|
||||||
@@ -1734,7 +1734,7 @@ int main(int argc, char **argv)
|
|||||||
case 'd':
|
case 'd':
|
||||||
SET(REBIND_DELETE);
|
SET(REBIND_DELETE);
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case 'i':
|
case 'i':
|
||||||
SET(AUTOINDENT);
|
SET(AUTOINDENT);
|
||||||
break;
|
break;
|
||||||
@@ -1820,7 +1820,7 @@ int main(int argc, char **argv)
|
|||||||
#ifndef DISABLE_WRAPJUSTIFY
|
#ifndef DISABLE_WRAPJUSTIFY
|
||||||
ssize_t wrap_at_cpy = wrap_at;
|
ssize_t wrap_at_cpy = wrap_at;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
char *backup_dir_cpy = backup_dir;
|
char *backup_dir_cpy = backup_dir;
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
@@ -1835,7 +1835,7 @@ int main(int argc, char **argv)
|
|||||||
#ifndef DISABLE_OPERATINGDIR
|
#ifndef DISABLE_OPERATINGDIR
|
||||||
operating_dir = NULL;
|
operating_dir = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
backup_dir = NULL;
|
backup_dir = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
@@ -1857,7 +1857,7 @@ int main(int argc, char **argv)
|
|||||||
if (fill_used)
|
if (fill_used)
|
||||||
wrap_at = wrap_at_cpy;
|
wrap_at = wrap_at_cpy;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (backup_dir_cpy != NULL) {
|
if (backup_dir_cpy != NULL) {
|
||||||
free(backup_dir);
|
free(backup_dir);
|
||||||
backup_dir = backup_dir_cpy;
|
backup_dir = backup_dir_cpy;
|
||||||
@@ -1885,7 +1885,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
#endif /* ENABLE_NANORC */
|
#endif /* ENABLE_NANORC */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
history_init();
|
history_init();
|
||||||
#ifdef ENABLE_NANORC
|
#ifdef ENABLE_NANORC
|
||||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||||
@@ -1893,7 +1893,7 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Set up the backup directory (unless we're using restricted mode,
|
/* Set up the backup directory (unless we're using restricted mode,
|
||||||
* in which case backups are disabled, since they would allow
|
* in which case backups are disabled, since they would allow
|
||||||
* reading from or writing to files not specified on the command
|
* reading from or writing to files not specified on the command
|
||||||
@@ -1955,7 +1955,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
/* If whitespace wasn't specified, set its default value. */
|
/* If whitespace wasn't specified, set its default value. */
|
||||||
if (whitespace == NULL) {
|
if (whitespace == NULL) {
|
||||||
whitespace = mallocstrcpy(NULL, " ");
|
whitespace = mallocstrcpy(NULL, " ");
|
||||||
@@ -2071,7 +2071,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
display_main_list();
|
display_main_list();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Return here after a SIGWINCH. */
|
/* Return here after a SIGWINCH. */
|
||||||
sigsetjmp(jmpbuf, 1);
|
sigsetjmp(jmpbuf, 1);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
10
src/nano.h
10
src/nano.h
@@ -235,7 +235,7 @@ typedef struct openfilestruct {
|
|||||||
* position. */
|
* position. */
|
||||||
bool modified; /* Current file's modification
|
bool modified; /* Current file's modification
|
||||||
* status. */
|
* status. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool mark_set; /* Current file's marking status. */
|
bool mark_set; /* Current file's marking status. */
|
||||||
filestruct *mark_begin; /* Current file's beginning marked
|
filestruct *mark_begin; /* Current file's beginning marked
|
||||||
* line. */
|
* line. */
|
||||||
@@ -269,7 +269,7 @@ typedef struct shortcut {
|
|||||||
struct shortcut *next;
|
struct shortcut *next;
|
||||||
} shortcut;
|
} shortcut;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
typedef struct toggle {
|
typedef struct toggle {
|
||||||
int val; /* Sequence to toggle the key. Should only need
|
int val; /* Sequence to toggle the key. Should only need
|
||||||
* one. */
|
* one. */
|
||||||
@@ -494,8 +494,8 @@ typedef struct rcoption {
|
|||||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Toggles do not exist with NANO_SMALL. */
|
/* Toggles do not exist with NANO_TINY. */
|
||||||
#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
|
||||||
@@ -516,7 +516,7 @@ typedef struct rcoption {
|
|||||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#define MAIN_VISIBLE 12
|
#define MAIN_VISIBLE 12
|
||||||
|
|
||||||
|
|||||||
44
src/prompt.c
44
src/prompt.c
@@ -80,11 +80,11 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||||||
input == NANO_FORWARD_KEY || input == NANO_BACK_KEY ||
|
input == NANO_FORWARD_KEY || input == NANO_BACK_KEY ||
|
||||||
input == NANO_BACKSPACE_KEY || input == NANO_DELETE_KEY ||
|
input == NANO_BACKSPACE_KEY || input == NANO_DELETE_KEY ||
|
||||||
input == NANO_CUT_KEY ||
|
input == NANO_CUT_KEY ||
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
input == NANO_NEXTWORD_KEY ||
|
input == NANO_NEXTWORD_KEY ||
|
||||||
#endif
|
#endif
|
||||||
(*meta_key == TRUE && (
|
(*meta_key == TRUE && (
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
input == NANO_PREVWORD_KEY ||
|
input == NANO_PREVWORD_KEY ||
|
||||||
#endif
|
#endif
|
||||||
input == NANO_VERBATIM_KEY)));
|
input == NANO_VERBATIM_KEY)));
|
||||||
@@ -180,7 +180,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *s_or_t,
|
|||||||
'\0' || currshortcut != writefile_list)
|
'\0' || currshortcut != writefile_list)
|
||||||
do_statusbar_cut_text();
|
do_statusbar_cut_text();
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case NANO_NEXTWORD_KEY:
|
case NANO_NEXTWORD_KEY:
|
||||||
do_statusbar_next_word(FALSE);
|
do_statusbar_next_word(FALSE);
|
||||||
break;
|
break;
|
||||||
@@ -338,7 +338,7 @@ void do_statusbar_home(void)
|
|||||||
{
|
{
|
||||||
size_t pww_save = statusbar_pww;
|
size_t pww_save = statusbar_pww;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(SMART_HOME)) {
|
if (ISSET(SMART_HOME)) {
|
||||||
size_t statusbar_x_save = statusbar_x;
|
size_t statusbar_x_save = statusbar_x;
|
||||||
|
|
||||||
@@ -353,7 +353,7 @@ void do_statusbar_home(void)
|
|||||||
#endif
|
#endif
|
||||||
statusbar_x = 0;
|
statusbar_x = 0;
|
||||||
statusbar_pww = statusbar_xplustabs();
|
statusbar_pww = statusbar_xplustabs();
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -432,7 +432,7 @@ void do_statusbar_cut_text(void)
|
|||||||
{
|
{
|
||||||
assert(answer != NULL);
|
assert(answer != NULL);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(CUT_TO_END))
|
if (ISSET(CUT_TO_END))
|
||||||
null_at(&answer, statusbar_x);
|
null_at(&answer, statusbar_x);
|
||||||
else {
|
else {
|
||||||
@@ -440,14 +440,14 @@ void do_statusbar_cut_text(void)
|
|||||||
null_at(&answer, 0);
|
null_at(&answer, 0);
|
||||||
statusbar_x = 0;
|
statusbar_x = 0;
|
||||||
statusbar_pww = statusbar_xplustabs();
|
statusbar_pww = statusbar_xplustabs();
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
update_statusbar_line(answer, statusbar_x);
|
update_statusbar_line(answer, statusbar_x);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Move to the next word at the statusbar prompt. If allow_punct is
|
/* Move to the next word at the statusbar prompt. If allow_punct is
|
||||||
* TRUE, treat punctuation as part of a word. Return TRUE if we started
|
* TRUE, treat punctuation as part of a word. Return TRUE if we started
|
||||||
* on a word, and FALSE otherwise. */
|
* on a word, and FALSE otherwise. */
|
||||||
@@ -607,7 +607,7 @@ bool do_statusbar_prev_word(bool allow_punct)
|
|||||||
/* Return whether we started on a word. */
|
/* Return whether we started on a word. */
|
||||||
return started_on_word;
|
return started_on_word;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
void do_statusbar_verbatim_input(bool *got_enter)
|
void do_statusbar_verbatim_input(bool *got_enter)
|
||||||
{
|
{
|
||||||
@@ -712,7 +712,7 @@ bool need_statusbar_horizontal_update(size_t old_pww)
|
|||||||
/* Get a string of input at the statusbar prompt. This should only be
|
/* Get a string of input at the statusbar prompt. This should only be
|
||||||
* called from do_prompt(). */
|
* called from do_prompt(). */
|
||||||
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
filestruct **history_list,
|
filestruct **history_list,
|
||||||
#endif
|
#endif
|
||||||
const shortcut *s
|
const shortcut *s
|
||||||
@@ -728,7 +728,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
bool tabbed = FALSE;
|
bool tabbed = FALSE;
|
||||||
/* Whether we've pressed Tab. */
|
/* Whether we've pressed Tab. */
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
char *history = NULL;
|
char *history = NULL;
|
||||||
/* The current history string. */
|
/* The current history string. */
|
||||||
char *magichistory = NULL;
|
char *magichistory = NULL;
|
||||||
@@ -741,7 +741,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
/* The length of the original string that we're trying to
|
/* The length of the original string that we're trying to
|
||||||
* tab complete, if any. */
|
* tab complete, if any. */
|
||||||
#endif
|
#endif
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
answer = mallocstrcpy(answer, curranswer);
|
answer = mallocstrcpy(answer, curranswer);
|
||||||
curranswer_len = strlen(answer);
|
curranswer_len = strlen(answer);
|
||||||
@@ -785,7 +785,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
switch (kbinput) {
|
switch (kbinput) {
|
||||||
case NANO_TAB_KEY:
|
case NANO_TAB_KEY:
|
||||||
#ifndef DISABLE_TABCOMP
|
#ifndef DISABLE_TABCOMP
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
if (last_kbinput != NANO_TAB_KEY)
|
if (last_kbinput != NANO_TAB_KEY)
|
||||||
complete_len = strlen(answer);
|
complete_len = strlen(answer);
|
||||||
@@ -797,7 +797,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
statusbar_x = strlen(answer);
|
statusbar_x = strlen(answer);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
if (allow_tabs)
|
if (allow_tabs)
|
||||||
answer = input_tab(answer, &statusbar_x, &tabbed,
|
answer = input_tab(answer, &statusbar_x, &tabbed,
|
||||||
list);
|
list);
|
||||||
@@ -806,7 +806,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
#endif /* !DISABLE_TABCOMP */
|
#endif /* !DISABLE_TABCOMP */
|
||||||
break;
|
break;
|
||||||
case NANO_PREVLINE_KEY:
|
case NANO_PREVLINE_KEY:
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
/* If we're scrolling up at the bottom of the
|
/* If we're scrolling up at the bottom of the
|
||||||
* history list and answer isn't blank, save answer
|
* history list and answer isn't blank, save answer
|
||||||
@@ -834,10 +834,10 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
* statusbar prompt. */
|
* statusbar prompt. */
|
||||||
finished = FALSE;
|
finished = FALSE;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
break;
|
break;
|
||||||
case NANO_NEXTLINE_KEY:
|
case NANO_NEXTLINE_KEY:
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
/* Get the newer search from the history list and
|
/* Get the newer search from the history list and
|
||||||
* save it in answer. If there is no newer search,
|
* save it in answer. If there is no newer search,
|
||||||
@@ -860,7 +860,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
|
|
||||||
update_statusbar_line(answer, statusbar_x);
|
update_statusbar_line(answer, statusbar_x);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -870,14 +870,14 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
if (finished)
|
if (finished)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && !defined(DISABLE_TABCOMP)
|
#if !defined(NANO_TINY) && !defined(DISABLE_TABCOMP)
|
||||||
last_kbinput = kbinput;
|
last_kbinput = kbinput;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
reset_statusbar_cursor();
|
reset_statusbar_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Set the current position in the history list to the bottom and
|
/* Set the current position in the history list to the bottom and
|
||||||
* free magichistory, if we need to. */
|
* free magichistory, if we need to. */
|
||||||
if (history_list != NULL) {
|
if (history_list != NULL) {
|
||||||
@@ -909,7 +909,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
* interpreted. */
|
* interpreted. */
|
||||||
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||||
*curranswer,
|
*curranswer,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
filestruct **history_list,
|
filestruct **history_list,
|
||||||
#endif
|
#endif
|
||||||
const char *msg, ...)
|
const char *msg, ...)
|
||||||
@@ -935,7 +935,7 @@ int do_prompt(bool allow_tabs, const shortcut *s, const char
|
|||||||
null_at(&prompt, actual_x(prompt, COLS - 4));
|
null_at(&prompt, actual_x(prompt, COLS - 4));
|
||||||
|
|
||||||
retval = get_prompt_string(allow_tabs, curranswer,
|
retval = get_prompt_string(allow_tabs, curranswer,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
history_list,
|
history_list,
|
||||||
#endif
|
#endif
|
||||||
s
|
s
|
||||||
|
|||||||
72
src/proto.h
72
src/proto.h
@@ -35,7 +35,7 @@ extern long flags;
|
|||||||
extern ssize_t tabsize;
|
extern ssize_t tabsize;
|
||||||
extern int currslen;
|
extern int currslen;
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
extern char *whitespace;
|
extern char *whitespace;
|
||||||
extern int whitespace_len[2];
|
extern int whitespace_len[2];
|
||||||
#endif
|
#endif
|
||||||
@@ -53,7 +53,7 @@ extern size_t quotelen;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
extern char *backup_dir;
|
extern char *backup_dir;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -88,7 +88,7 @@ extern shortcut *main_list, *whereis_list;
|
|||||||
extern shortcut *replace_list, *gotoline_list;
|
extern shortcut *replace_list, *gotoline_list;
|
||||||
extern shortcut *writefile_list, *insertfile_list;
|
extern shortcut *writefile_list, *insertfile_list;
|
||||||
extern shortcut *replace_list_2;
|
extern shortcut *replace_list_2;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
extern shortcut *extcmd_list;
|
extern shortcut *extcmd_list;
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_HELP
|
#ifndef DISABLE_HELP
|
||||||
@@ -112,11 +112,11 @@ extern regmatch_t synfilematches[1];
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
extern toggle *toggles;
|
extern toggle *toggles;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
extern filestruct *search_history;
|
extern filestruct *search_history;
|
||||||
extern filestruct *searchage;
|
extern filestruct *searchage;
|
||||||
extern filestruct *searchbot;
|
extern filestruct *searchbot;
|
||||||
@@ -181,11 +181,11 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
|||||||
const char *nstrcasestr(const char *haystack, const char *needle);
|
const char *nstrcasestr(const char *haystack, const char *needle);
|
||||||
#endif
|
#endif
|
||||||
const char *mbstrcasestr(const char *haystack, const char *needle);
|
const char *mbstrcasestr(const char *haystack, const char *needle);
|
||||||
#if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP)
|
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
|
||||||
const char *revstrstr(const char *haystack, const char *needle, const
|
const char *revstrstr(const char *haystack, const char *needle, const
|
||||||
char *rev_start);
|
char *rev_start);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||||
const char *rev_start);
|
const char *rev_start);
|
||||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||||
@@ -220,12 +220,12 @@ void color_update(void);
|
|||||||
/* Public functions in cut.c. */
|
/* Public functions in cut.c. */
|
||||||
void cutbuffer_reset(void);
|
void cutbuffer_reset(void);
|
||||||
void cut_line(void);
|
void cut_line(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void cut_marked(void);
|
void cut_marked(void);
|
||||||
void cut_to_eol(void);
|
void cut_to_eol(void);
|
||||||
#endif
|
#endif
|
||||||
void do_cut_text(void);
|
void do_cut_text(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_cut_till_end(void);
|
void do_cut_till_end(void);
|
||||||
#endif
|
#endif
|
||||||
void do_uncut_text(void);
|
void do_uncut_text(void);
|
||||||
@@ -251,7 +251,7 @@ void read_file(FILE *f, const char *filename);
|
|||||||
int open_file(const char *filename, bool newfie, FILE **f);
|
int open_file(const char *filename, bool newfie, FILE **f);
|
||||||
char *get_next_filename(const char *name, const char *suffix);
|
char *get_next_filename(const char *name, const char *suffix);
|
||||||
void do_insertfile(
|
void do_insertfile(
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool execute
|
bool execute
|
||||||
#else
|
#else
|
||||||
void
|
void
|
||||||
@@ -265,13 +265,13 @@ char *safe_tempfile(FILE **f);
|
|||||||
void init_operating_dir(void);
|
void init_operating_dir(void);
|
||||||
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void init_backup_dir(void);
|
void init_backup_dir(void);
|
||||||
#endif
|
#endif
|
||||||
int copy_file(FILE *inn, FILE *out);
|
int copy_file(FILE *inn, FILE *out);
|
||||||
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||||
append, bool nonamechange);
|
append, bool nonamechange);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||||
append_type append);
|
append_type append);
|
||||||
#endif
|
#endif
|
||||||
@@ -290,7 +290,7 @@ char **cwd_tab_completion(const char *buf, size_t *num_matches, size_t
|
|||||||
char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
|
char *input_tab(char *buf, size_t *place, bool *lastwastab, bool *list);
|
||||||
#endif
|
#endif
|
||||||
const char *tail(const char *foo);
|
const char *tail(const char *foo);
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
char *histfilename(void);
|
char *histfilename(void);
|
||||||
void load_history(void);
|
void load_history(void);
|
||||||
bool writehist(FILE *hist, filestruct *histhead);
|
bool writehist(FILE *hist, filestruct *histhead);
|
||||||
@@ -299,7 +299,7 @@ void save_history(void);
|
|||||||
|
|
||||||
/* Public functions in global.c. */
|
/* Public functions in global.c. */
|
||||||
size_t length_of_list(const shortcut *s);
|
size_t length_of_list(const shortcut *s);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void toggle_init_one(int val, const char *desc, long flag);
|
void toggle_init_one(int val, const char *desc, long flag);
|
||||||
void toggle_init(void);
|
void toggle_init(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -333,7 +333,7 @@ void do_para_begin_void(void);
|
|||||||
void do_para_end(bool allow_update);
|
void do_para_end(bool allow_update);
|
||||||
void do_para_end_void(void);
|
void do_para_end_void(void);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool do_next_word(bool allow_punct, bool allow_update);
|
bool do_next_word(bool allow_punct, bool allow_update);
|
||||||
void do_next_word_void(void);
|
void do_next_word_void(void);
|
||||||
bool do_prev_word(bool allow_punct, bool allow_update);
|
bool do_prev_word(bool allow_punct, bool allow_update);
|
||||||
@@ -342,11 +342,11 @@ void do_prev_word_void(void);
|
|||||||
void do_home(void);
|
void do_home(void);
|
||||||
void do_end(void);
|
void do_end(void);
|
||||||
void do_up(void);
|
void do_up(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_scroll_up(void);
|
void do_scroll_up(void);
|
||||||
#endif
|
#endif
|
||||||
void do_down(void);
|
void do_down(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_scroll_down(void);
|
void do_scroll_down(void);
|
||||||
#endif
|
#endif
|
||||||
void do_left(void);
|
void do_left(void);
|
||||||
@@ -399,16 +399,16 @@ void signal_init(void);
|
|||||||
void handle_hupterm(int signal);
|
void handle_hupterm(int signal);
|
||||||
void do_suspend(int signal);
|
void do_suspend(int signal);
|
||||||
void do_cont(int signal);
|
void do_cont(int signal);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void handle_sigwinch(int s);
|
void handle_sigwinch(int s);
|
||||||
void allow_pending_sigwinch(bool allow);
|
void allow_pending_sigwinch(bool allow);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_toggle(const toggle *which);
|
void do_toggle(const toggle *which);
|
||||||
#endif
|
#endif
|
||||||
void disable_extended_io(void);
|
void disable_extended_io(void);
|
||||||
void disable_signals(void);
|
void disable_signals(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void enable_signals(void);
|
void enable_signals(void);
|
||||||
#endif
|
#endif
|
||||||
void disable_flow_control(void);
|
void disable_flow_control(void);
|
||||||
@@ -436,7 +436,7 @@ void do_statusbar_left(void);
|
|||||||
void do_statusbar_backspace(void);
|
void do_statusbar_backspace(void);
|
||||||
void do_statusbar_delete(void);
|
void do_statusbar_delete(void);
|
||||||
void do_statusbar_cut_text(void);
|
void do_statusbar_cut_text(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool do_statusbar_next_word(bool allow_punct);
|
bool do_statusbar_next_word(bool allow_punct);
|
||||||
bool do_statusbar_prev_word(bool allow_punct);
|
bool do_statusbar_prev_word(bool allow_punct);
|
||||||
#endif
|
#endif
|
||||||
@@ -447,7 +447,7 @@ void update_statusbar_line(const char *curranswer, size_t index);
|
|||||||
void reset_statusbar_cursor(void);
|
void reset_statusbar_cursor(void);
|
||||||
bool need_statusbar_horizontal_update(size_t old_pww);
|
bool need_statusbar_horizontal_update(size_t old_pww);
|
||||||
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
filestruct **history_list,
|
filestruct **history_list,
|
||||||
#endif
|
#endif
|
||||||
const shortcut *s
|
const shortcut *s
|
||||||
@@ -457,7 +457,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
|||||||
);
|
);
|
||||||
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||||
*curranswer,
|
*curranswer,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
filestruct **history_list,
|
filestruct **history_list,
|
||||||
#endif
|
#endif
|
||||||
const char *msg, ...);
|
const char *msg, ...);
|
||||||
@@ -494,7 +494,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
*needle, size_t *needle_len);
|
*needle, size_t *needle_len);
|
||||||
void findnextstr_wrap_reset(void);
|
void findnextstr_wrap_reset(void);
|
||||||
void do_search(void);
|
void do_search(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_research(void);
|
void do_research(void);
|
||||||
#endif
|
#endif
|
||||||
void replace_abort(void);
|
void replace_abort(void);
|
||||||
@@ -513,7 +513,7 @@ void do_gotolinecolumn_void(void);
|
|||||||
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
||||||
pos_pww);
|
pos_pww);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
void do_find_bracket(void);
|
void do_find_bracket(void);
|
||||||
#endif
|
#endif
|
||||||
@@ -533,14 +533,14 @@ char *get_history_completion(filestruct **h, const char *s, size_t len);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Public functions in text.c. */
|
/* Public functions in text.c. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_mark(void);
|
void do_mark(void);
|
||||||
#endif
|
#endif
|
||||||
void do_delete(void);
|
void do_delete(void);
|
||||||
void do_backspace(void);
|
void do_backspace(void);
|
||||||
void do_tab(void);
|
void do_tab(void);
|
||||||
void do_enter(void);
|
void do_enter(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void cancel_command(int signal);
|
void cancel_command(int signal);
|
||||||
bool execute_command(const char *command);
|
bool execute_command(const char *command);
|
||||||
#endif
|
#endif
|
||||||
@@ -551,7 +551,7 @@ bool do_wrap(filestruct *line);
|
|||||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
|
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
|
||||||
ssize_t break_line(const char *line, ssize_t goal, bool newline);
|
ssize_t break_line(const char *line, ssize_t goal, bool newline);
|
||||||
#endif
|
#endif
|
||||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||||
size_t indent_length(const char *line);
|
size_t indent_length(const char *line);
|
||||||
#endif
|
#endif
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
@@ -575,7 +575,7 @@ const char *do_int_speller(const char *tempfile_name);
|
|||||||
const char *do_alt_speller(char *tempfile_name);
|
const char *do_alt_speller(char *tempfile_name);
|
||||||
void do_spell(void);
|
void do_spell(void);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_wordlinechar_count(void);
|
void do_wordlinechar_count(void);
|
||||||
#endif
|
#endif
|
||||||
void do_verbatim_input(void);
|
void do_verbatim_input(void);
|
||||||
@@ -589,7 +589,7 @@ void align(char **str);
|
|||||||
void null_at(char **data, size_t index);
|
void null_at(char **data, size_t index);
|
||||||
void unsunder(char *str, size_t true_len);
|
void unsunder(char *str, size_t true_len);
|
||||||
void sunder(char *str);
|
void sunder(char *str);
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
#ifndef HAVE_GETLINE
|
#ifndef HAVE_GETLINE
|
||||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
|
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
|
||||||
#endif
|
#endif
|
||||||
@@ -619,7 +619,7 @@ size_t actual_x(const char *s, size_t column);
|
|||||||
size_t strnlenpt(const char *s, size_t maxlen);
|
size_t strnlenpt(const char *s, size_t maxlen);
|
||||||
size_t strlenpt(const char *s);
|
size_t strlenpt(const char *s);
|
||||||
void new_magicline(void);
|
void new_magicline(void);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void remove_magicline(void);
|
void remove_magicline(void);
|
||||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||||
**bot, size_t *bot_x, bool *right_side_up);
|
**bot, size_t *bot_x, bool *right_side_up);
|
||||||
@@ -634,7 +634,7 @@ void dump_filestruct_reverse(void);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Public functions in winio.c. */
|
/* Public functions in winio.c. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void reset_kbinput(void);
|
void reset_kbinput(void);
|
||||||
#endif
|
#endif
|
||||||
void get_key_buffer(WINDOW *win);
|
void get_key_buffer(WINDOW *win);
|
||||||
@@ -644,7 +644,7 @@ void unget_kbinput(int kbinput, bool meta_key, bool func_key);
|
|||||||
int *get_input(WINDOW *win, size_t input_len);
|
int *get_input(WINDOW *win, size_t input_len);
|
||||||
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, bool reset
|
, bool reset
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -652,12 +652,12 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
|||||||
*ignore_seq);
|
*ignore_seq);
|
||||||
int get_escape_seq_abcd(int kbinput);
|
int get_escape_seq_abcd(int kbinput);
|
||||||
int get_byte_kbinput(int kbinput
|
int get_byte_kbinput(int kbinput
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, bool reset
|
, bool reset
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
long get_unicode_kbinput(int kbinput
|
long get_unicode_kbinput(int kbinput
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, bool reset
|
, bool reset
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -670,7 +670,7 @@ bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
|||||||
#endif
|
#endif
|
||||||
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
||||||
*meta_key, bool *func_key);
|
*meta_key, bool *func_key);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const toggle *get_toggle(int kbinput, bool meta_key);
|
const toggle *get_toggle(int kbinput, bool meta_key);
|
||||||
#endif
|
#endif
|
||||||
void blank_line(WINDOW *win, int y, int x, int n);
|
void blank_line(WINDOW *win, int y, int x, int n);
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ const static rcoption rcopts[] = {
|
|||||||
{"tabsize", 0},
|
{"tabsize", 0},
|
||||||
{"tempfile", TEMP_FILE},
|
{"tempfile", TEMP_FILE},
|
||||||
{"view", VIEW_MODE},
|
{"view", VIEW_MODE},
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
{"autoindent", AUTOINDENT},
|
{"autoindent", AUTOINDENT},
|
||||||
{"backup", BACKUP_FILE},
|
{"backup", BACKUP_FILE},
|
||||||
{"backupdir", 0},
|
{"backupdir", 0},
|
||||||
@@ -639,7 +639,7 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
free(option);
|
free(option);
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||||
whitespace = option;
|
whitespace = option;
|
||||||
if (mbstrlen(whitespace) != 2 ||
|
if (mbstrlen(whitespace) != 2 ||
|
||||||
@@ -681,7 +681,7 @@ void parse_rcfile(FILE *rcstream)
|
|||||||
quotestr = option;
|
quotestr = option;
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (strcasecmp(rcopts[i].name,
|
if (strcasecmp(rcopts[i].name,
|
||||||
"backupdir") == 0)
|
"backupdir") == 0)
|
||||||
backup_dir = option;
|
backup_dir = option;
|
||||||
|
|||||||
58
src/search.c
58
src/search.c
@@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
static bool search_last_line = FALSE;
|
static bool search_last_line = FALSE;
|
||||||
/* Have we gone past the last line while searching? */
|
/* Have we gone past the last line while searching? */
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
static bool history_changed = FALSE;
|
static bool history_changed = FALSE;
|
||||||
/* Have any of the history lists changed? */
|
/* Have any of the history lists changed? */
|
||||||
#endif
|
#endif
|
||||||
@@ -49,7 +49,7 @@ static bool regexp_compiled = FALSE;
|
|||||||
int regexp_init(const char *regexp)
|
int regexp_init(const char *regexp)
|
||||||
{
|
{
|
||||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -98,7 +98,7 @@ void not_found_msg(const char *str)
|
|||||||
void search_abort(void)
|
void search_abort(void)
|
||||||
{
|
{
|
||||||
display_main_list();
|
display_main_list();
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set)
|
if (openfile->mark_set)
|
||||||
edit_refresh();
|
edit_refresh();
|
||||||
#endif
|
#endif
|
||||||
@@ -163,12 +163,12 @@ int search_init(bool replacing, bool use_answer)
|
|||||||
/* This is now one simple call. It just does a lot. */
|
/* This is now one simple call. It just does a lot. */
|
||||||
i = do_prompt(FALSE, replacing ? replace_list : whereis_list,
|
i = do_prompt(FALSE, replacing ? replace_list : whereis_list,
|
||||||
backupstring,
|
backupstring,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
&search_history,
|
&search_history,
|
||||||
#endif
|
#endif
|
||||||
"%s%s%s%s%s%s", _("Search"),
|
"%s%s%s%s%s%s", _("Search"),
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* This string is just a modifier for the search prompt; no
|
/* This string is just a modifier for the search prompt; no
|
||||||
* grammar is implied. */
|
* grammar is implied. */
|
||||||
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") :
|
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") :
|
||||||
@@ -182,7 +182,7 @@ int search_init(bool replacing, bool use_answer)
|
|||||||
#endif
|
#endif
|
||||||
"",
|
"",
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* This string is just a modifier for the search prompt; no
|
/* This string is just a modifier for the search prompt; no
|
||||||
* grammar is implied. */
|
* grammar is implied. */
|
||||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
|
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
|
||||||
@@ -190,7 +190,7 @@ int search_init(bool replacing, bool use_answer)
|
|||||||
"",
|
"",
|
||||||
|
|
||||||
replacing ?
|
replacing ?
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
openfile->mark_set ? _(" (to replace) in selection") :
|
openfile->mark_set ? _(" (to replace) in selection") :
|
||||||
#endif
|
#endif
|
||||||
_(" (to replace)") : "",
|
_(" (to replace)") : "",
|
||||||
@@ -221,7 +221,7 @@ int search_init(bool replacing, bool use_answer)
|
|||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
case TOGGLE_CASE_KEY:
|
case TOGGLE_CASE_KEY:
|
||||||
TOGGLE(CASE_SENSITIVE);
|
TOGGLE(CASE_SENSITIVE);
|
||||||
backupstring = mallocstrcpy(backupstring, answer);
|
backupstring = mallocstrcpy(backupstring, answer);
|
||||||
@@ -279,7 +279,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
* rev_start will be properly set when the search continues on the
|
* rev_start will be properly set when the search continues on the
|
||||||
* previous or next line. */
|
* previous or next line. */
|
||||||
rev_start =
|
rev_start =
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
ISSET(BACKWARDS_SEARCH) ?
|
ISSET(BACKWARDS_SEARCH) ?
|
||||||
fileptr->data + (openfile->current_x - 1) :
|
fileptr->data + (openfile->current_x - 1) :
|
||||||
#endif
|
#endif
|
||||||
@@ -329,7 +329,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(BACKWARDS_SEARCH)) {
|
if (ISSET(BACKWARDS_SEARCH)) {
|
||||||
fileptr = fileptr->prev;
|
fileptr = fileptr->prev;
|
||||||
current_y_find--;
|
current_y_find--;
|
||||||
@@ -337,7 +337,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
#endif
|
#endif
|
||||||
fileptr = fileptr->next;
|
fileptr = fileptr->next;
|
||||||
current_y_find++;
|
current_y_find++;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
if (!can_display_wrap)
|
if (!can_display_wrap)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(BACKWARDS_SEARCH)) {
|
if (ISSET(BACKWARDS_SEARCH)) {
|
||||||
fileptr = openfile->filebot;
|
fileptr = openfile->filebot;
|
||||||
current_y_find = editwinrows - 1;
|
current_y_find = editwinrows - 1;
|
||||||
@@ -354,7 +354,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
#endif
|
#endif
|
||||||
fileptr = openfile->fileage;
|
fileptr = openfile->fileage;
|
||||||
current_y_find = 0;
|
current_y_find = 0;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -367,7 +367,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
search_last_line = TRUE;
|
search_last_line = TRUE;
|
||||||
|
|
||||||
rev_start = fileptr->data;
|
rev_start = fileptr->data;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(BACKWARDS_SEARCH))
|
if (ISSET(BACKWARDS_SEARCH))
|
||||||
rev_start += strlen(fileptr->data);
|
rev_start += strlen(fileptr->data);
|
||||||
#endif
|
#endif
|
||||||
@@ -378,7 +378,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
|||||||
|
|
||||||
/* Ensure we haven't wrapped around again! */
|
/* Ensure we haven't wrapped around again! */
|
||||||
if (search_last_line &&
|
if (search_last_line &&
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
((!ISSET(BACKWARDS_SEARCH) && current_x_find > begin_x) ||
|
((!ISSET(BACKWARDS_SEARCH) && current_x_find > begin_x) ||
|
||||||
(ISSET(BACKWARDS_SEARCH) && current_x_find < begin_x))
|
(ISSET(BACKWARDS_SEARCH) && current_x_find < begin_x))
|
||||||
#else
|
#else
|
||||||
@@ -427,7 +427,7 @@ void do_search(void)
|
|||||||
search_abort();
|
search_abort();
|
||||||
else if (i == -2) /* Replace. */
|
else if (i == -2) /* Replace. */
|
||||||
do_replace();
|
do_replace();
|
||||||
#if !defined(NANO_SMALL) || defined(HAVE_REGEX_H)
|
#if !defined(NANO_TINY) || defined(HAVE_REGEX_H)
|
||||||
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
|
else if (i == 1) /* Case Sensitive, Backwards, or Regexp search
|
||||||
* toggle. */
|
* toggle. */
|
||||||
do_search();
|
do_search();
|
||||||
@@ -442,7 +442,7 @@ void do_search(void)
|
|||||||
else
|
else
|
||||||
last_search = mallocstrcpy(last_search, answer);
|
last_search = mallocstrcpy(last_search, answer);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If answer is not "", add this search string to the search history
|
/* If answer is not "", add this search string to the search history
|
||||||
* list. */
|
* list. */
|
||||||
if (answer[0] != '\0')
|
if (answer[0] != '\0')
|
||||||
@@ -483,7 +483,7 @@ void do_search(void)
|
|||||||
search_abort();
|
search_abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Search for the next string without prompting. */
|
/* Search for the next string without prompting. */
|
||||||
void do_research(void)
|
void do_research(void)
|
||||||
{
|
{
|
||||||
@@ -661,7 +661,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
|||||||
/* The starting-line match and bol/eol regex flags. */
|
/* The starting-line match and bol/eol regex flags. */
|
||||||
bool begin_line = FALSE, bol_or_eol = FALSE;
|
bool begin_line = FALSE, bol_or_eol = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool old_mark_set = openfile->mark_set;
|
bool old_mark_set = openfile->mark_set;
|
||||||
filestruct *edittop_save = openfile->edittop, *top, *bot;
|
filestruct *edittop_save = openfile->edittop, *top, *bot;
|
||||||
size_t top_x, bot_x;
|
size_t top_x, bot_x;
|
||||||
@@ -769,7 +769,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
|||||||
length_change = strlen(copy) -
|
length_change = strlen(copy) -
|
||||||
strlen(openfile->current->data);
|
strlen(openfile->current->data);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If the mark was on and (mark_begin, mark_begin_x) was the
|
/* If the mark was on and (mark_begin, mark_begin_x) was the
|
||||||
* top of it, don't change mark_begin_x. */
|
* top of it, don't change mark_begin_x. */
|
||||||
if (!old_mark_set || !right_side_up) {
|
if (!old_mark_set || !right_side_up) {
|
||||||
@@ -797,7 +797,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
|||||||
match_len;
|
match_len;
|
||||||
*real_current_x += length_change;
|
*real_current_x += length_change;
|
||||||
}
|
}
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -805,7 +805,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
|||||||
* text, so searching will resume after the replacement
|
* text, so searching will resume after the replacement
|
||||||
* text. Note that current_x might be set to (size_t)-1
|
* text. Note that current_x might be set to (size_t)-1
|
||||||
* here. */
|
* here. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (!ISSET(BACKWARDS_SEARCH))
|
if (!ISSET(BACKWARDS_SEARCH))
|
||||||
#endif
|
#endif
|
||||||
openfile->current_x += match_len + length_change - 1;
|
openfile->current_x += match_len + length_change - 1;
|
||||||
@@ -832,7 +832,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (old_mark_set) {
|
if (old_mark_set) {
|
||||||
/* If the mark was on, unpartition the filestruct so that it
|
/* If the mark was on, unpartition the filestruct so that it
|
||||||
* contains all the text again, set edittop back to what it was
|
* contains all the text again, set edittop back to what it was
|
||||||
@@ -884,7 +884,7 @@ void do_replace(void)
|
|||||||
/* If answer is not "", add answer to the search history list and
|
/* If answer is not "", add answer to the search history list and
|
||||||
* copy answer into last_search. */
|
* copy answer into last_search. */
|
||||||
if (answer[0] != '\0') {
|
if (answer[0] != '\0') {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
update_history(&search_history, answer);
|
update_history(&search_history, answer);
|
||||||
#endif
|
#endif
|
||||||
last_search = mallocstrcpy(last_search, answer);
|
last_search = mallocstrcpy(last_search, answer);
|
||||||
@@ -893,12 +893,12 @@ void do_replace(void)
|
|||||||
last_replace = mallocstrcpy(last_replace, "");
|
last_replace = mallocstrcpy(last_replace, "");
|
||||||
|
|
||||||
i = do_prompt(FALSE, replace_list_2, last_replace,
|
i = do_prompt(FALSE, replace_list_2, last_replace,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
&replace_history,
|
&replace_history,
|
||||||
#endif
|
#endif
|
||||||
_("Replace with"));
|
_("Replace with"));
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Add this replace string to the replace history list. i == 0
|
/* Add this replace string to the replace history list. i == 0
|
||||||
* means that the string is not "". */
|
* means that the string is not "". */
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
@@ -954,7 +954,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
|||||||
|
|
||||||
/* Ask for it. */
|
/* Ask for it. */
|
||||||
int i = do_prompt(FALSE, gotoline_list, use_answer ? ans : "",
|
int i = do_prompt(FALSE, gotoline_list, use_answer ? ans : "",
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
_("Enter line number, column number"));
|
_("Enter line number, column number"));
|
||||||
@@ -1034,7 +1034,7 @@ void do_gotopos(ssize_t line, size_t pos_x, ssize_t pos_y, size_t
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
void do_find_bracket(void)
|
void do_find_bracket(void)
|
||||||
{
|
{
|
||||||
@@ -1326,4 +1326,4 @@ char *get_history_completion(filestruct **h, const char *s, size_t len)
|
|||||||
return (char *)s;
|
return (char *)s;
|
||||||
}
|
}
|
||||||
#endif /* !DISABLE_TABCOMP */
|
#endif /* !DISABLE_TABCOMP */
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|||||||
96
src/text.c
96
src/text.c
@@ -33,7 +33,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "proto.h"
|
#include "proto.h"
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
static pid_t pid = -1;
|
static pid_t pid = -1;
|
||||||
/* The PID of the newly forked process in execute_command(), for
|
/* The PID of the newly forked process in execute_command(), for
|
||||||
* use with the cancel_command() signal handler. */
|
* use with the cancel_command() signal handler. */
|
||||||
@@ -47,7 +47,7 @@ static filestruct *jusbottom = NULL;
|
|||||||
/* Pointer to the end of the justify buffer. */
|
/* Pointer to the end of the justify buffer. */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void do_mark(void)
|
void do_mark(void)
|
||||||
{
|
{
|
||||||
openfile->mark_set = !openfile->mark_set;
|
openfile->mark_set = !openfile->mark_set;
|
||||||
@@ -62,7 +62,7 @@ void do_mark(void)
|
|||||||
edit_refresh();
|
edit_refresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
void do_delete(void)
|
void do_delete(void)
|
||||||
{
|
{
|
||||||
@@ -89,7 +89,7 @@ void do_delete(void)
|
|||||||
|
|
||||||
null_at(&openfile->current->data, openfile->current_x +
|
null_at(&openfile->current->data, openfile->current_x +
|
||||||
line_len - char_buf_len);
|
line_len - char_buf_len);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set && openfile->mark_begin ==
|
if (openfile->mark_set && openfile->mark_begin ==
|
||||||
openfile->current && openfile->current_x <
|
openfile->current && openfile->current_x <
|
||||||
openfile->mark_begin_x)
|
openfile->mark_begin_x)
|
||||||
@@ -110,7 +110,7 @@ void do_delete(void)
|
|||||||
openfile->current_x + strlen(foo->data) + 1);
|
openfile->current_x + strlen(foo->data) + 1);
|
||||||
strcpy(openfile->current->data + openfile->current_x,
|
strcpy(openfile->current->data + openfile->current_x,
|
||||||
foo->data);
|
foo->data);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set && openfile->mark_begin ==
|
if (openfile->mark_set && openfile->mark_begin ==
|
||||||
openfile->current->next) {
|
openfile->current->next) {
|
||||||
openfile->mark_begin = openfile->current;
|
openfile->mark_begin = openfile->current;
|
||||||
@@ -163,7 +163,7 @@ void do_backspace(void)
|
|||||||
|
|
||||||
void do_tab(void)
|
void do_tab(void)
|
||||||
{
|
{
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(TABS_TO_SPACES)) {
|
if (ISSET(TABS_TO_SPACES)) {
|
||||||
char *output;
|
char *output;
|
||||||
size_t output_len = 0, new_pww = xplustabs();
|
size_t output_len = 0, new_pww = xplustabs();
|
||||||
@@ -184,7 +184,7 @@ void do_tab(void)
|
|||||||
} else {
|
} else {
|
||||||
#endif
|
#endif
|
||||||
do_output("\t", 1, TRUE);
|
do_output("\t", 1, TRUE);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -197,7 +197,7 @@ void do_enter(void)
|
|||||||
|
|
||||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Do auto-indenting, like the neolithic Turbo Pascal editor. */
|
/* Do auto-indenting, like the neolithic Turbo Pascal editor. */
|
||||||
if (ISSET(AUTOINDENT)) {
|
if (ISSET(AUTOINDENT)) {
|
||||||
/* If we are breaking the line in the indentation, the new
|
/* If we are breaking the line in the indentation, the new
|
||||||
@@ -212,14 +212,14 @@ void do_enter(void)
|
|||||||
openfile->current_x) + extra + 1);
|
openfile->current_x) + extra + 1);
|
||||||
strcpy(&newnode->data[extra], openfile->current->data +
|
strcpy(&newnode->data[extra], openfile->current->data +
|
||||||
openfile->current_x);
|
openfile->current_x);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(AUTOINDENT)) {
|
if (ISSET(AUTOINDENT)) {
|
||||||
strncpy(newnode->data, openfile->current->data, extra);
|
strncpy(newnode->data, openfile->current->data, extra);
|
||||||
openfile->totsize += mbstrlen(newnode->data);
|
openfile->totsize += mbstrlen(newnode->data);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
null_at(&openfile->current->data, openfile->current_x);
|
null_at(&openfile->current->data, openfile->current_x);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set && openfile->current ==
|
if (openfile->mark_set && openfile->current ==
|
||||||
openfile->mark_begin && openfile->current_x <
|
openfile->mark_begin && openfile->current_x <
|
||||||
openfile->mark_begin_x) {
|
openfile->mark_begin_x) {
|
||||||
@@ -245,7 +245,7 @@ void do_enter(void)
|
|||||||
edit_refresh();
|
edit_refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
void cancel_command(int signal)
|
void cancel_command(int signal)
|
||||||
{
|
{
|
||||||
if (kill(pid, SIGKILL) == -1)
|
if (kill(pid, SIGKILL) == -1)
|
||||||
@@ -332,7 +332,7 @@ bool execute_command(const char *command)
|
|||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
void wrap_reset(void)
|
void wrap_reset(void)
|
||||||
@@ -349,7 +349,7 @@ bool do_wrap(filestruct *line)
|
|||||||
/* The length of the line we wrap. */
|
/* The length of the line we wrap. */
|
||||||
ssize_t wrap_loc;
|
ssize_t wrap_loc;
|
||||||
/* The index of line->data where we wrap. */
|
/* The index of line->data where we wrap. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const char *indent_string = NULL;
|
const char *indent_string = NULL;
|
||||||
/* Indentation to prepend to the new line. */
|
/* Indentation to prepend to the new line. */
|
||||||
size_t indent_len = 0;
|
size_t indent_len = 0;
|
||||||
@@ -403,7 +403,7 @@ bool do_wrap(filestruct *line)
|
|||||||
if (line->data[wrap_loc] == '\0')
|
if (line->data[wrap_loc] == '\0')
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If autoindent is turned on, and we're on the character just after
|
/* If autoindent is turned on, and we're on the character just after
|
||||||
* the indentation, we don't wrap. */
|
* the indentation, we don't wrap. */
|
||||||
if (ISSET(AUTOINDENT)) {
|
if (ISSET(AUTOINDENT)) {
|
||||||
@@ -462,7 +462,7 @@ bool do_wrap(filestruct *line)
|
|||||||
* the text of the next line. */
|
* the text of the next line. */
|
||||||
new_line_len += after_break_len;
|
new_line_len += after_break_len;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(AUTOINDENT)) {
|
if (ISSET(AUTOINDENT)) {
|
||||||
if (wrapping) {
|
if (wrapping) {
|
||||||
/* If we're wrapping, the indentation will come from the
|
/* If we're wrapping, the indentation will come from the
|
||||||
@@ -483,7 +483,7 @@ bool do_wrap(filestruct *line)
|
|||||||
new_line = charalloc(new_line_len + 1);
|
new_line = charalloc(new_line_len + 1);
|
||||||
new_line[0] = '\0';
|
new_line[0] = '\0';
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(AUTOINDENT)) {
|
if (ISSET(AUTOINDENT)) {
|
||||||
/* Copy the indentation. */
|
/* Copy the indentation. */
|
||||||
strncpy(new_line, indent_string, indent_len);
|
strncpy(new_line, indent_string, indent_len);
|
||||||
@@ -534,14 +534,14 @@ bool do_wrap(filestruct *line)
|
|||||||
same_line_wrap = FALSE;
|
same_line_wrap = FALSE;
|
||||||
openfile->current = openfile->current->next;
|
openfile->current = openfile->current->next;
|
||||||
openfile->current_x -= wrap_loc
|
openfile->current_x -= wrap_loc
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
- indent_len
|
- indent_len
|
||||||
#endif
|
#endif
|
||||||
;
|
;
|
||||||
openfile->placewewant = xplustabs();
|
openfile->placewewant = xplustabs();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If the mark was on this line after the wrap point, we move it
|
/* If the mark was on this line after the wrap point, we move it
|
||||||
* down. If it was on the next line and we wrapped onto that line,
|
* down. If it was on the next line and we wrapped onto that line,
|
||||||
* we move it right. */
|
* we move it right. */
|
||||||
@@ -637,7 +637,7 @@ ssize_t break_line(const char *line, ssize_t goal, bool newline)
|
|||||||
}
|
}
|
||||||
#endif /* !DISABLE_HELP || !DISABLE_JUSTIFY || !DISABLE_WRAPPING */
|
#endif /* !DISABLE_HELP || !DISABLE_JUSTIFY || !DISABLE_WRAPPING */
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||||
/* The "indentation" of a line is the whitespace between the quote part
|
/* The "indentation" of a line is the whitespace between the quote part
|
||||||
* and the non-whitespace of the line. */
|
* and the non-whitespace of the line. */
|
||||||
size_t indent_length(const char *line)
|
size_t indent_length(const char *line)
|
||||||
@@ -664,7 +664,7 @@ size_t indent_length(const char *line)
|
|||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL || !DISABLE_JUSTIFY */
|
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
|
||||||
|
|
||||||
#ifndef DISABLE_JUSTIFY
|
#ifndef DISABLE_JUSTIFY
|
||||||
/* justify_format() replaces blanks with spaces and multiple spaces by 1
|
/* justify_format() replaces blanks with spaces and multiple spaces by 1
|
||||||
@@ -681,7 +681,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
|||||||
{
|
{
|
||||||
char *end, *new_end, *new_paragraph_data;
|
char *end, *new_end, *new_paragraph_data;
|
||||||
size_t shift = 0;
|
size_t shift = 0;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
size_t mark_shift = 0;
|
size_t mark_shift = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -714,7 +714,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
|||||||
end += end_len;
|
end += end_len;
|
||||||
shift += end_len;
|
shift += end_len;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Keep track of the change in the current line. */
|
/* Keep track of the change in the current line. */
|
||||||
if (openfile->mark_set && openfile->mark_begin ==
|
if (openfile->mark_set && openfile->mark_begin ==
|
||||||
paragraph && openfile->mark_begin_x >= end -
|
paragraph && openfile->mark_begin_x >= end -
|
||||||
@@ -769,7 +769,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
|||||||
end += end_len;
|
end += end_len;
|
||||||
shift += end_len;
|
shift += end_len;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Keep track of the change in the current line. */
|
/* Keep track of the change in the current line. */
|
||||||
if (openfile->mark_set && openfile->mark_begin ==
|
if (openfile->mark_set && openfile->mark_begin ==
|
||||||
paragraph && openfile->mark_begin_x >= end -
|
paragraph && openfile->mark_begin_x >= end -
|
||||||
@@ -808,7 +808,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
|||||||
free(paragraph->data);
|
free(paragraph->data);
|
||||||
paragraph->data = new_paragraph_data;
|
paragraph->data = new_paragraph_data;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Adjust the mark coordinates to compensate for the change in
|
/* Adjust the mark coordinates to compensate for the change in
|
||||||
* the current line. */
|
* the current line. */
|
||||||
if (openfile->mark_set && openfile->mark_begin == paragraph) {
|
if (openfile->mark_set && openfile->mark_begin == paragraph) {
|
||||||
@@ -923,7 +923,7 @@ bool begpar(const filestruct *const foo)
|
|||||||
/* Case 2) or 5) or 4). */
|
/* Case 2) or 5) or 4). */
|
||||||
if (foo->prev->data[quote_len + temp_id_len] == '\0' ||
|
if (foo->prev->data[quote_len + temp_id_len] == '\0' ||
|
||||||
(quote_len == 0 && indent_len > 0
|
(quote_len == 0 && indent_len > 0
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
&& !ISSET(AUTOINDENT)
|
&& !ISSET(AUTOINDENT)
|
||||||
#endif
|
#endif
|
||||||
) || !indents_match(foo->prev->data + quote_len, temp_id_len,
|
) || !indents_match(foo->prev->data + quote_len, temp_id_len,
|
||||||
@@ -963,7 +963,7 @@ void backup_lines(filestruct *first_line, size_t par_len)
|
|||||||
ssize_t fl_lineno_save = first_line->lineno;
|
ssize_t fl_lineno_save = first_line->lineno;
|
||||||
ssize_t edittop_lineno_save = openfile->edittop->lineno;
|
ssize_t edittop_lineno_save = openfile->edittop->lineno;
|
||||||
ssize_t current_lineno_save = openfile->current->lineno;
|
ssize_t current_lineno_save = openfile->current->lineno;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool old_mark_set = openfile->mark_set;
|
bool old_mark_set = openfile->mark_set;
|
||||||
ssize_t mb_lineno_save = 0;
|
ssize_t mb_lineno_save = 0;
|
||||||
size_t mark_begin_x_save = 0;
|
size_t mark_begin_x_save = 0;
|
||||||
@@ -1009,7 +1009,7 @@ void backup_lines(filestruct *first_line, size_t par_len)
|
|||||||
openfile->edittop = top;
|
openfile->edittop = top;
|
||||||
if (top->lineno == current_lineno_save)
|
if (top->lineno == current_lineno_save)
|
||||||
openfile->current = top;
|
openfile->current = top;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (old_mark_set && top->lineno == mb_lineno_save) {
|
if (old_mark_set && top->lineno == mb_lineno_save) {
|
||||||
openfile->mark_begin = top;
|
openfile->mark_begin = top;
|
||||||
openfile->mark_begin_x = mark_begin_x_save;
|
openfile->mark_begin_x = mark_begin_x_save;
|
||||||
@@ -1134,7 +1134,7 @@ void do_justify(bool full_justify)
|
|||||||
size_t pww_save = openfile->placewewant;
|
size_t pww_save = openfile->placewewant;
|
||||||
ssize_t current_y_save = openfile->current_y;
|
ssize_t current_y_save = openfile->current_y;
|
||||||
size_t totsize_save = openfile->totsize;
|
size_t totsize_save = openfile->totsize;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
filestruct *mark_begin_save = openfile->mark_begin;
|
filestruct *mark_begin_save = openfile->mark_begin;
|
||||||
size_t mark_begin_x_save = openfile->mark_begin_x;
|
size_t mark_begin_x_save = openfile->mark_begin_x;
|
||||||
#endif
|
#endif
|
||||||
@@ -1287,7 +1287,7 @@ void do_justify(bool full_justify)
|
|||||||
if (next_line == openfile->filebot)
|
if (next_line == openfile->filebot)
|
||||||
openfile->filebot = openfile->current;
|
openfile->filebot = openfile->current;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Adjust the mark coordinates to compensate for the change
|
/* Adjust the mark coordinates to compensate for the change
|
||||||
* in the next line. */
|
* in the next line. */
|
||||||
if (openfile->mark_set && openfile->mark_begin ==
|
if (openfile->mark_set && openfile->mark_begin ==
|
||||||
@@ -1347,7 +1347,7 @@ void do_justify(bool full_justify)
|
|||||||
* turned on, set the indentation length to zero so that the
|
* turned on, set the indentation length to zero so that the
|
||||||
* indentation is treated as part of the line. */
|
* indentation is treated as part of the line. */
|
||||||
if (quote_len == 0
|
if (quote_len == 0
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
&& !ISSET(AUTOINDENT)
|
&& !ISSET(AUTOINDENT)
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
@@ -1365,7 +1365,7 @@ void do_justify(bool full_justify)
|
|||||||
par_len++;
|
par_len++;
|
||||||
openfile->totsize += indent_len + 1;
|
openfile->totsize += indent_len + 1;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Adjust the mark coordinates to compensate for the change
|
/* Adjust the mark coordinates to compensate for the change
|
||||||
* in the current line. */
|
* in the current line. */
|
||||||
if (openfile->mark_set && openfile->mark_begin ==
|
if (openfile->mark_set && openfile->mark_begin ==
|
||||||
@@ -1474,7 +1474,7 @@ void do_justify(bool full_justify)
|
|||||||
openfile->placewewant = pww_save;
|
openfile->placewewant = pww_save;
|
||||||
openfile->current_y = current_y_save;
|
openfile->current_y = current_y_save;
|
||||||
openfile->totsize = totsize_save;
|
openfile->totsize = totsize_save;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set) {
|
if (openfile->mark_set) {
|
||||||
openfile->mark_begin = mark_begin_save;
|
openfile->mark_begin = mark_begin_save;
|
||||||
openfile->mark_begin_x = mark_begin_x_save;
|
openfile->mark_begin_x = mark_begin_x_save;
|
||||||
@@ -1529,13 +1529,13 @@ bool do_int_spell_fix(const char *word)
|
|||||||
bool canceled = FALSE;
|
bool canceled = FALSE;
|
||||||
/* The return value. */
|
/* The return value. */
|
||||||
bool case_sens_set = ISSET(CASE_SENSITIVE);
|
bool case_sens_set = ISSET(CASE_SENSITIVE);
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool backwards_search_set = ISSET(BACKWARDS_SEARCH);
|
bool backwards_search_set = ISSET(BACKWARDS_SEARCH);
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
bool regexp_set = ISSET(USE_REGEXP);
|
bool regexp_set = ISSET(USE_REGEXP);
|
||||||
#endif
|
#endif
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool old_mark_set = openfile->mark_set;
|
bool old_mark_set = openfile->mark_set;
|
||||||
bool added_magicline = FALSE;
|
bool added_magicline = FALSE;
|
||||||
/* Whether we added a magicline after filebot. */
|
/* Whether we added a magicline after filebot. */
|
||||||
@@ -1549,7 +1549,7 @@ bool do_int_spell_fix(const char *word)
|
|||||||
/* Make sure spell-check is case sensitive. */
|
/* Make sure spell-check is case sensitive. */
|
||||||
SET(CASE_SENSITIVE);
|
SET(CASE_SENSITIVE);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Make sure spell-check goes forward only. */
|
/* Make sure spell-check goes forward only. */
|
||||||
UNSET(BACKWARDS_SEARCH);
|
UNSET(BACKWARDS_SEARCH);
|
||||||
#endif
|
#endif
|
||||||
@@ -1567,7 +1567,7 @@ bool do_int_spell_fix(const char *word)
|
|||||||
last_search = mallocstrcpy(NULL, word);
|
last_search = mallocstrcpy(NULL, word);
|
||||||
last_replace = mallocstrcpy(NULL, word);
|
last_replace = mallocstrcpy(NULL, word);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (old_mark_set) {
|
if (old_mark_set) {
|
||||||
/* If the mark is on, partition the filestruct so that it
|
/* If the mark is on, partition the filestruct so that it
|
||||||
* contains only the marked text; if the NO_NEWLINES flag isn't
|
* contains only the marked text; if the NO_NEWLINES flag isn't
|
||||||
@@ -1606,7 +1606,7 @@ bool do_int_spell_fix(const char *word)
|
|||||||
|
|
||||||
/* Allow all instances of the word to be corrected. */
|
/* Allow all instances of the word to be corrected. */
|
||||||
canceled = (do_prompt(FALSE, spell_list, word,
|
canceled = (do_prompt(FALSE, spell_list, word,
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
NULL,
|
NULL,
|
||||||
#endif
|
#endif
|
||||||
_("Edit a replacement")) == -1);
|
_("Edit a replacement")) == -1);
|
||||||
@@ -1625,7 +1625,7 @@ bool do_int_spell_fix(const char *word)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (old_mark_set) {
|
if (old_mark_set) {
|
||||||
/* If the mark was on, the NO_NEWLINES flag isn't set, and we
|
/* If the mark was on, the NO_NEWLINES flag isn't set, and we
|
||||||
* added a magicline, remove it now. */
|
* added a magicline, remove it now. */
|
||||||
@@ -1667,7 +1667,7 @@ bool do_int_spell_fix(const char *word)
|
|||||||
if (!case_sens_set)
|
if (!case_sens_set)
|
||||||
UNSET(CASE_SENSITIVE);
|
UNSET(CASE_SENSITIVE);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Restore search/replace direction. */
|
/* Restore search/replace direction. */
|
||||||
if (backwards_search_set)
|
if (backwards_search_set)
|
||||||
SET(BACKWARDS_SEARCH);
|
SET(BACKWARDS_SEARCH);
|
||||||
@@ -1876,7 +1876,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||||||
char *ptr;
|
char *ptr;
|
||||||
static int arglen = 3;
|
static int arglen = 3;
|
||||||
static char **spellargs = NULL;
|
static char **spellargs = NULL;
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
bool old_mark_set = openfile->mark_set;
|
bool old_mark_set = openfile->mark_set;
|
||||||
bool added_magicline = FALSE;
|
bool added_magicline = FALSE;
|
||||||
/* Whether we added a magicline after filebot. */
|
/* Whether we added a magicline after filebot. */
|
||||||
@@ -1932,7 +1932,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||||||
if (pid_spell < 0)
|
if (pid_spell < 0)
|
||||||
return _("Could not fork");
|
return _("Could not fork");
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Don't handle a pending SIGWINCH until the alternate spell checker
|
/* Don't handle a pending SIGWINCH until the alternate spell checker
|
||||||
* is finished and we've loaded the spell-checked file back in. */
|
* is finished and we've loaded the spell-checked file back in. */
|
||||||
allow_pending_sigwinch(FALSE);
|
allow_pending_sigwinch(FALSE);
|
||||||
@@ -1959,7 +1959,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||||||
char *altspell_error;
|
char *altspell_error;
|
||||||
char *invoke_error = _("Error invoking \"%s\"");
|
char *invoke_error = _("Error invoking \"%s\"");
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Turn the mark back on if it was on before. */
|
/* Turn the mark back on if it was on before. */
|
||||||
openfile->mark_set = old_mark_set;
|
openfile->mark_set = old_mark_set;
|
||||||
#endif
|
#endif
|
||||||
@@ -1971,7 +1971,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||||||
return altspell_error;
|
return altspell_error;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (old_mark_set) {
|
if (old_mark_set) {
|
||||||
/* If the mark is on, partition the filestruct so that it
|
/* If the mark is on, partition the filestruct so that it
|
||||||
* contains only the marked text; if the NO_NEWLINES flag isn't
|
* contains only the marked text; if the NO_NEWLINES flag isn't
|
||||||
@@ -1994,7 +1994,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||||||
* text. */
|
* text. */
|
||||||
replace_buffer(tempfile_name);
|
replace_buffer(tempfile_name);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (old_mark_set) {
|
if (old_mark_set) {
|
||||||
filestruct *top_save = openfile->fileage;
|
filestruct *top_save = openfile->fileage;
|
||||||
|
|
||||||
@@ -2048,7 +2048,7 @@ const char *do_alt_speller(char *tempfile_name)
|
|||||||
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
|
do_gotopos(lineno_save, current_x_save, current_y_save, pww_save);
|
||||||
set_modified();
|
set_modified();
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Handle a pending SIGWINCH again. */
|
/* Handle a pending SIGWINCH again. */
|
||||||
allow_pending_sigwinch(TRUE);
|
allow_pending_sigwinch(TRUE);
|
||||||
#endif
|
#endif
|
||||||
@@ -2068,7 +2068,7 @@ void do_spell(void)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (openfile->mark_set)
|
if (openfile->mark_set)
|
||||||
i = write_marked_file(temp, temp_file, TRUE, OVERWRITE);
|
i = write_marked_file(temp, temp_file, TRUE, OVERWRITE);
|
||||||
else
|
else
|
||||||
@@ -2102,7 +2102,7 @@ void do_spell(void)
|
|||||||
}
|
}
|
||||||
#endif /* !DISABLE_SPELLER */
|
#endif /* !DISABLE_SPELLER */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Our own version of "wc". Note that its character counts are in
|
/* Our own version of "wc". Note that its character counts are in
|
||||||
* multibyte characters instead of single-byte characters. */
|
* multibyte characters instead of single-byte characters. */
|
||||||
void do_wordlinechar_count(void)
|
void do_wordlinechar_count(void)
|
||||||
@@ -2167,7 +2167,7 @@ void do_wordlinechar_count(void)
|
|||||||
_("In Selection: ") : "", (unsigned long)words, (long)lines,
|
_("In Selection: ") : "", (unsigned long)words, (long)lines,
|
||||||
(unsigned long)chars);
|
(unsigned long)chars);
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
void do_verbatim_input(void)
|
void do_verbatim_input(void)
|
||||||
{
|
{
|
||||||
|
|||||||
18
src/utils.c
18
src/utils.c
@@ -179,7 +179,7 @@ void sunder(char *str)
|
|||||||
* along with this library; if not, write to the Free Software
|
* along with this library; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
#ifndef HAVE_GETLINE
|
#ifndef HAVE_GETLINE
|
||||||
/* This function is equivalent to getline(). */
|
/* This function is equivalent to getline(). */
|
||||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
|
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream)
|
||||||
@@ -235,7 +235,7 @@ ssize_t ngetdelim(char **lineptr, size_t *n, int delim, FILE *stream)
|
|||||||
return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
|
return (c == EOF && (indx - 1) == 0) ? -1 : indx - 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
#endif /* !NANO_TINY && ENABLE_NANORC */
|
||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
#ifdef BROKEN_REGEXEC
|
#ifdef BROKEN_REGEXEC
|
||||||
@@ -301,7 +301,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
|||||||
|
|
||||||
#ifdef HAVE_REGEX_H
|
#ifdef HAVE_REGEX_H
|
||||||
if (ISSET(USE_REGEXP)) {
|
if (ISSET(USE_REGEXP)) {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(BACKWARDS_SEARCH)) {
|
if (ISSET(BACKWARDS_SEARCH)) {
|
||||||
if (regexec(&search_regexp, haystack, 1, regmatches,
|
if (regexec(&search_regexp, haystack, 1, regmatches,
|
||||||
0) == 0 && haystack + regmatches[0].rm_so <= start) {
|
0) == 0 && haystack + regmatches[0].rm_so <= start) {
|
||||||
@@ -319,7 +319,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
|||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
if (regexec(&search_regexp, start, 10, regmatches,
|
if (regexec(&search_regexp, start, 10, regmatches,
|
||||||
(start > haystack) ? REG_NOTBOL : 0) == 0) {
|
(start > haystack) ? REG_NOTBOL : 0) == 0) {
|
||||||
const char *retval = start + regmatches[0].rm_so;
|
const char *retval = start + regmatches[0].rm_so;
|
||||||
@@ -330,17 +330,17 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_REGEX_H */
|
#endif /* HAVE_REGEX_H */
|
||||||
#if !defined(NANO_SMALL) || !defined(DISABLE_SPELLER)
|
#if !defined(NANO_TINY) || !defined(DISABLE_SPELLER)
|
||||||
if (ISSET(CASE_SENSITIVE)) {
|
if (ISSET(CASE_SENSITIVE)) {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (ISSET(BACKWARDS_SEARCH))
|
if (ISSET(BACKWARDS_SEARCH))
|
||||||
return revstrstr(haystack, needle, start);
|
return revstrstr(haystack, needle, start);
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
return strstr(start, needle);
|
return strstr(start, needle);
|
||||||
}
|
}
|
||||||
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
|
#endif /* !DISABLE_SPELLER || !NANO_TINY */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
else if (ISSET(BACKWARDS_SEARCH))
|
else if (ISSET(BACKWARDS_SEARCH))
|
||||||
return mbrevstrcasestr(haystack, needle, start);
|
return mbrevstrcasestr(haystack, needle, start);
|
||||||
#endif
|
#endif
|
||||||
@@ -508,7 +508,7 @@ void new_magicline(void)
|
|||||||
openfile->totsize++;
|
openfile->totsize++;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Remove the magicline from filebot, if there is one and it isn't the
|
/* Remove the magicline from filebot, if there is one and it isn't the
|
||||||
* only line in the file. */
|
* only line in the file. */
|
||||||
void remove_magicline(void)
|
void remove_magicline(void)
|
||||||
|
|||||||
72
src/winio.c
72
src/winio.c
@@ -109,7 +109,7 @@ static bool disable_cursorpos = FALSE;
|
|||||||
* Note that Center (5) on the numeric keypad with NumLock off can also
|
* Note that Center (5) on the numeric keypad with NumLock off can also
|
||||||
* be the Begin key. */
|
* be the Begin key. */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* Reset all the input routines that rely on character sequences. */
|
/* Reset all the input routines that rely on character sequences. */
|
||||||
void reset_kbinput(void)
|
void reset_kbinput(void)
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ void get_key_buffer(WINDOW *win)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
/* Read in the first character using blocking input. */
|
/* Read in the first character using blocking input. */
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
allow_pending_sigwinch(TRUE);
|
allow_pending_sigwinch(TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ void get_key_buffer(WINDOW *win)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
allow_pending_sigwinch(FALSE);
|
allow_pending_sigwinch(FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -162,7 +162,7 @@ void get_key_buffer(WINDOW *win)
|
|||||||
nodelay(win, TRUE);
|
nodelay(win, TRUE);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
allow_pending_sigwinch(TRUE);
|
allow_pending_sigwinch(TRUE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ void get_key_buffer(WINDOW *win)
|
|||||||
sizeof(int));
|
sizeof(int));
|
||||||
key_buffer[key_buffer_len - 1] = input;
|
key_buffer[key_buffer_len - 1] = input;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
allow_pending_sigwinch(FALSE);
|
allow_pending_sigwinch(FALSE);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ size_t get_key_buffer_len(void)
|
|||||||
* keystroke buffer. */
|
* keystroke buffer. */
|
||||||
void unget_input(int *input, size_t input_len)
|
void unget_input(int *input, size_t input_len)
|
||||||
{
|
{
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
allow_pending_sigwinch(TRUE);
|
allow_pending_sigwinch(TRUE);
|
||||||
allow_pending_sigwinch(FALSE);
|
allow_pending_sigwinch(FALSE);
|
||||||
#endif
|
#endif
|
||||||
@@ -263,7 +263,7 @@ int *get_input(WINDOW *win, size_t input_len)
|
|||||||
{
|
{
|
||||||
int *input;
|
int *input;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
allow_pending_sigwinch(TRUE);
|
allow_pending_sigwinch(TRUE);
|
||||||
allow_pending_sigwinch(FALSE);
|
allow_pending_sigwinch(FALSE);
|
||||||
#endif
|
#endif
|
||||||
@@ -325,7 +325,7 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||||||
/* Read in a character and interpret it. Continue doing this until
|
/* Read in a character and interpret it. Continue doing this until
|
||||||
* we get a recognized value or sequence. */
|
* we get a recognized value or sequence. */
|
||||||
while ((kbinput = parse_kbinput(win, meta_key, func_key
|
while ((kbinput = parse_kbinput(win, meta_key, func_key
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, FALSE
|
, FALSE
|
||||||
#endif
|
#endif
|
||||||
)) == ERR);
|
)) == ERR);
|
||||||
@@ -338,7 +338,7 @@ int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key)
|
|||||||
* when we get a meta key sequence, and set func_key to TRUE when we get
|
* when we get a meta key sequence, and set func_key to TRUE when we get
|
||||||
* a function key. Assume nodelay(win) is FALSE. */
|
* a function key. Assume nodelay(win) is FALSE. */
|
||||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, bool reset
|
, bool reset
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
@@ -347,7 +347,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
|||||||
static int escapes = 0, byte_digits = 0;
|
static int escapes = 0, byte_digits = 0;
|
||||||
int *kbinput, retval = ERR;
|
int *kbinput, retval = ERR;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (reset) {
|
if (reset) {
|
||||||
escapes = 0;
|
escapes = 0;
|
||||||
byte_digits = 0;
|
byte_digits = 0;
|
||||||
@@ -379,9 +379,9 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
|||||||
escapes = 0;
|
escapes = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
#if !defined(NANO_SMALL) && defined(KEY_RESIZE)
|
#if !defined(NANO_TINY) && defined(KEY_RESIZE)
|
||||||
/* Since we don't change the default SIGWINCH handler when
|
/* Since we don't change the default SIGWINCH handler when
|
||||||
* NANO_SMALL is defined, KEY_RESIZE is never generated. Also,
|
* NANO_TINY is defined, KEY_RESIZE is never generated. Also,
|
||||||
* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
* Slang and SunOS 5.7-5.9 don't support KEY_RESIZE. */
|
||||||
case KEY_RESIZE:
|
case KEY_RESIZE:
|
||||||
break;
|
break;
|
||||||
@@ -548,7 +548,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
|||||||
|
|
||||||
byte_digits++;
|
byte_digits++;
|
||||||
byte = get_byte_kbinput(*kbinput
|
byte = get_byte_kbinput(*kbinput
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, FALSE
|
, FALSE
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -1149,7 +1149,7 @@ int get_escape_seq_abcd(int kbinput)
|
|||||||
/* Translate a byte sequence: turn a three-digit decimal number from
|
/* Translate a byte sequence: turn a three-digit decimal number from
|
||||||
* 000 to 255 into its corresponding byte value. */
|
* 000 to 255 into its corresponding byte value. */
|
||||||
int get_byte_kbinput(int kbinput
|
int get_byte_kbinput(int kbinput
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, bool reset
|
, bool reset
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
@@ -1157,7 +1157,7 @@ int get_byte_kbinput(int kbinput
|
|||||||
static int byte_digits = 0, byte = 0;
|
static int byte_digits = 0, byte = 0;
|
||||||
int retval = ERR;
|
int retval = ERR;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (reset) {
|
if (reset) {
|
||||||
byte_digits = 0;
|
byte_digits = 0;
|
||||||
byte = 0;
|
byte = 0;
|
||||||
@@ -1233,7 +1233,7 @@ int get_byte_kbinput(int kbinput
|
|||||||
* from 000000 to 10FFFF (case-insensitive) into its corresponding
|
* from 000000 to 10FFFF (case-insensitive) into its corresponding
|
||||||
* multibyte value. */
|
* multibyte value. */
|
||||||
long get_unicode_kbinput(int kbinput
|
long get_unicode_kbinput(int kbinput
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, bool reset
|
, bool reset
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
@@ -1242,7 +1242,7 @@ long get_unicode_kbinput(int kbinput
|
|||||||
static long uni = 0;
|
static long uni = 0;
|
||||||
long retval = ERR;
|
long retval = ERR;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (reset) {
|
if (reset) {
|
||||||
uni_digits = 0;
|
uni_digits = 0;
|
||||||
uni = 0;
|
uni = 0;
|
||||||
@@ -1450,7 +1450,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||||||
|
|
||||||
/* Check whether the first keystroke is a hexadecimal digit. */
|
/* Check whether the first keystroke is a hexadecimal digit. */
|
||||||
uni = get_unicode_kbinput(*kbinput
|
uni = get_unicode_kbinput(*kbinput
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, FALSE
|
, FALSE
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -1469,7 +1469,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
|||||||
while ((kbinput = get_input(win, 1)) == NULL);
|
while ((kbinput = get_input(win, 1)) == NULL);
|
||||||
|
|
||||||
uni = get_unicode_kbinput(*kbinput
|
uni = get_unicode_kbinput(*kbinput
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
, FALSE
|
, FALSE
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
@@ -1639,7 +1639,7 @@ const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
const toggle *get_toggle(int kbinput, bool meta_key)
|
const toggle *get_toggle(int kbinput, bool meta_key)
|
||||||
{
|
{
|
||||||
const toggle *t = toggles;
|
const toggle *t = toggles;
|
||||||
@@ -1658,7 +1658,7 @@ const toggle *get_toggle(int kbinput, bool meta_key)
|
|||||||
|
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* Move to (x, y) in win, and display a line of n spaces with the
|
/* Move to (x, y) in win, and display a line of n spaces with the
|
||||||
* current attributes. */
|
* current attributes. */
|
||||||
@@ -1795,7 +1795,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
|||||||
|
|
||||||
/* If buf contains a tab character, interpret it. */
|
/* If buf contains a tab character, interpret it. */
|
||||||
if (*buf_mb == '\t') {
|
if (*buf_mb == '\t') {
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
if (ISSET(WHITESPACE_DISPLAY)) {
|
if (ISSET(WHITESPACE_DISPLAY)) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1830,7 +1830,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
|||||||
free(ctrl_buf_mb);
|
free(ctrl_buf_mb);
|
||||||
/* If buf contains a space character, interpret it. */
|
/* If buf contains a space character, interpret it. */
|
||||||
} else if (*buf_mb == ' ') {
|
} else if (*buf_mb == ' ') {
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
if (ISSET(WHITESPACE_DISPLAY)) {
|
if (ISSET(WHITESPACE_DISPLAY)) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -2049,7 +2049,7 @@ void statusbar(const char *msg, ...)
|
|||||||
va_list ap;
|
va_list ap;
|
||||||
char *bar, *foo;
|
char *bar, *foo;
|
||||||
size_t start_x, foo_len;
|
size_t start_x, foo_len;
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
bool old_whitespace;
|
bool old_whitespace;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -2066,7 +2066,7 @@ void statusbar(const char *msg, ...)
|
|||||||
/* Blank out the line. */
|
/* Blank out the line. */
|
||||||
blank_statusbar();
|
blank_statusbar();
|
||||||
|
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||||
UNSET(WHITESPACE_DISPLAY);
|
UNSET(WHITESPACE_DISPLAY);
|
||||||
#endif
|
#endif
|
||||||
@@ -2074,7 +2074,7 @@ void statusbar(const char *msg, ...)
|
|||||||
vsnprintf(bar, mb_cur_max() * (COLS - 3), msg, ap);
|
vsnprintf(bar, mb_cur_max() * (COLS - 3), msg, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
foo = display_string(bar, 0, COLS - 4, FALSE);
|
foo = display_string(bar, 0, COLS - 4, FALSE);
|
||||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||||
if (old_whitespace)
|
if (old_whitespace)
|
||||||
SET(WHITESPACE_DISPLAY);
|
SET(WHITESPACE_DISPLAY);
|
||||||
#endif
|
#endif
|
||||||
@@ -2102,7 +2102,7 @@ void statusbar(const char *msg, ...)
|
|||||||
* keystroke. Otherwise, blank it after twenty-five keystrokes,
|
* keystroke. Otherwise, blank it after twenty-five keystrokes,
|
||||||
* as Pico does. */
|
* as Pico does. */
|
||||||
statusblank =
|
statusblank =
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
ISSET(QUICK_BLANK) && !ISSET(CONST_UPDATE) ? 1 :
|
ISSET(QUICK_BLANK) && !ISSET(CONST_UPDATE) ? 1 :
|
||||||
#endif
|
#endif
|
||||||
25;
|
25;
|
||||||
@@ -2216,7 +2216,7 @@ void reset_cursor(void)
|
|||||||
void edit_draw(const filestruct *fileptr, const char *converted, int
|
void edit_draw(const filestruct *fileptr, const char *converted, int
|
||||||
line, size_t start)
|
line, size_t start)
|
||||||
{
|
{
|
||||||
#if !defined(NANO_SMALL) || defined(ENABLE_COLOR)
|
#if !defined(NANO_TINY) || defined(ENABLE_COLOR)
|
||||||
size_t startpos = actual_x(fileptr->data, start);
|
size_t startpos = actual_x(fileptr->data, start);
|
||||||
/* The position in fileptr->data of the leftmost character
|
/* The position in fileptr->data of the leftmost character
|
||||||
* that displays at least partially on the window. */
|
* that displays at least partially on the window. */
|
||||||
@@ -2467,7 +2467,7 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
|
|||||||
}
|
}
|
||||||
#endif /* ENABLE_COLOR */
|
#endif /* ENABLE_COLOR */
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
/* If the mark is on, we need to display it. */
|
/* If the mark is on, we need to display it. */
|
||||||
if (openfile->mark_set && (fileptr->lineno <=
|
if (openfile->mark_set && (fileptr->lineno <=
|
||||||
openfile->mark_begin->lineno || fileptr->lineno <=
|
openfile->mark_begin->lineno || fileptr->lineno <=
|
||||||
@@ -2537,7 +2537,7 @@ void edit_draw(const filestruct *fileptr, const char *converted, int
|
|||||||
wattroff(edit, A_REVERSE);
|
wattroff(edit, A_REVERSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !NANO_SMALL */
|
#endif /* !NANO_TINY */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just update one line in the edit buffer. This is basically a wrapper
|
/* Just update one line in the edit buffer. This is basically a wrapper
|
||||||
@@ -2590,7 +2590,7 @@ void update_line(const filestruct *fileptr, size_t index)
|
|||||||
bool need_horizontal_update(size_t old_pww)
|
bool need_horizontal_update(size_t old_pww)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
openfile->mark_set ||
|
openfile->mark_set ||
|
||||||
#endif
|
#endif
|
||||||
get_page_start(old_pww) !=
|
get_page_start(old_pww) !=
|
||||||
@@ -2603,7 +2603,7 @@ bool need_horizontal_update(size_t old_pww)
|
|||||||
bool need_vertical_update(size_t old_pww)
|
bool need_vertical_update(size_t old_pww)
|
||||||
{
|
{
|
||||||
return
|
return
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
openfile->mark_set ||
|
openfile->mark_set ||
|
||||||
#endif
|
#endif
|
||||||
get_page_start(old_pww) !=
|
get_page_start(old_pww) !=
|
||||||
@@ -2735,7 +2735,7 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
|
|||||||
* between the original edittop and the current edittop, and
|
* between the original edittop and the current edittop, and
|
||||||
* then restore the original edittop. */
|
* then restore the original edittop. */
|
||||||
edit_update(
|
edit_update(
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||||
#endif
|
#endif
|
||||||
CENTER);
|
CENTER);
|
||||||
@@ -2763,12 +2763,12 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
|
|||||||
if (do_redraw)
|
if (do_redraw)
|
||||||
update_line(foo, 0);
|
update_line(foo, 0);
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
if (!openfile->mark_set)
|
if (!openfile->mark_set)
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
foo = (foo->lineno > openfile->current->lineno) ? foo->prev :
|
foo = (foo->lineno > openfile->current->lineno) ? foo->prev :
|
||||||
foo->next;
|
foo->next;
|
||||||
#endif
|
#endif
|
||||||
@@ -2791,7 +2791,7 @@ void edit_refresh(void)
|
|||||||
/* Put the top line of the edit window in range of the current
|
/* Put the top line of the edit window in range of the current
|
||||||
* line. */
|
* line. */
|
||||||
edit_update(
|
edit_update(
|
||||||
#ifndef NANO_SMALL
|
#ifndef NANO_TINY
|
||||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||||
#endif
|
#endif
|
||||||
CENTER);
|
CENTER);
|
||||||
|
|||||||
Reference in New Issue
Block a user