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
Этот коммит содержится в:
родитель
023db6aa77
Коммит
ebe3425f9f
@ -100,6 +100,7 @@ CVS code -
|
||||
- Don't install the localized versions of the manpages if
|
||||
nano is built with --disable-nls. Changes to Makefile.am and
|
||||
doc/man/Makefile.am. (Mike Frysinger)
|
||||
- Rename the NANO_SMALL #define to NANO_TINY. (DLR)
|
||||
- chars.c:
|
||||
mbwidth()
|
||||
- If wcwidth() returns -1 for the character passed in, treat the
|
||||
|
@ -87,7 +87,7 @@ fi])
|
||||
AC_ARG_ENABLE(tiny,
|
||||
[ --enable-tiny Disable features for the sake of size],
|
||||
[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_HELP, 1, [Define this to disable the help menu.])
|
||||
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);
|
||||
|
||||
j = do_prompt(FALSE, gotodir_list, "",
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
_("Go To Directory"));
|
||||
|
@ -655,7 +655,7 @@ const char *mbstrcasestr(const char *haystack, const char *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
|
||||
* string in reverse, starting at rev_start. */
|
||||
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;
|
||||
}
|
||||
#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
|
||||
* the string in reverse, starting at rev_start. */
|
||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
@ -764,7 +764,7 @@ const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
#endif
|
||||
return revstrcasestr(haystack, needle, rev_start);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* This function is equivalent to strlen() for multibyte strings. */
|
||||
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;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Move all currently marked text to the cutbuffer, and set the current
|
||||
* place we want to where the text used to start. */
|
||||
void cut_marked(void)
|
||||
@ -97,7 +97,7 @@ void cut_to_eol(void)
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move text from the current filestruct into the cutbuffer. */
|
||||
void do_cut_text(void)
|
||||
@ -121,7 +121,7 @@ void do_cut_text(void)
|
||||
* cutbuffer instead of replacing it. */
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set) {
|
||||
/* If the mark is on, move the marked text to the cutbuffer and
|
||||
* turn the mark off. */
|
||||
@ -144,7 +144,7 @@ void do_cut_text(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Cut from the current cursor position to the end of the file. */
|
||||
void do_cut_till_end(void)
|
||||
{
|
||||
@ -163,7 +163,7 @@ void do_cut_till_end(void)
|
||||
dump_filestruct(cutbuffer);
|
||||
#endif
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Copy text from the cutbuffer into the current filestruct. */
|
||||
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->modified = FALSE;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set = FALSE;
|
||||
|
||||
openfile->mark_begin = NULL;
|
||||
@ -143,7 +143,7 @@ void open_buffer(const char *filename)
|
||||
* no stat, update the stat, if applicable. */
|
||||
if (rc == 0) {
|
||||
read_file(f, filename);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->current_stat == NULL) {
|
||||
openfile->current_stat =
|
||||
(struct stat *)nmalloc(sizeof(struct stat));
|
||||
@ -304,7 +304,7 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
|
||||
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,
|
||||
* strip the '\r' part from fileptr->data. */
|
||||
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;
|
||||
/* The current value we read from the file, whether an input
|
||||
* character or EOF. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
int format = 0;
|
||||
/* 0 = *nix, 1 = DOS, 2 = Mac, 3 = both DOS and Mac. */
|
||||
#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
|
||||
* conversion isn't disabled, handle it! */
|
||||
if (input == '\n') {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* 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
|
||||
* currently think it's a Mac file. */
|
||||
@ -400,7 +400,7 @@ void read_file(FILE *f, const char *filename)
|
||||
num_lines++;
|
||||
buf[0] = '\0';
|
||||
i = 0;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If it's a Mac file ('\r' without '\n'), and file conversion
|
||||
* isn't disabled, handle it! */
|
||||
} 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);
|
||||
fclose(f);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If file conversion isn't disabled and the last character in this
|
||||
* file is '\r', read it in properly as a Mac format line. */
|
||||
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? */
|
||||
if (len > 0) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If file conversion isn't disabled and the last character in
|
||||
* 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
|
||||
@ -553,7 +553,7 @@ void read_file(FILE *f, const char *filename)
|
||||
* file we inserted. */
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (format == 3)
|
||||
statusbar(
|
||||
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(
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool execute
|
||||
#else
|
||||
void
|
||||
@ -685,7 +685,7 @@ void do_insertfile(
|
||||
#endif
|
||||
|
||||
while (TRUE) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
msg =
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@ -701,16 +701,16 @@ void do_insertfile(
|
||||
N_("File to insert into new buffer [from %s] ") :
|
||||
#endif
|
||||
N_("File to insert [from %s] ");
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
i = do_prompt(TRUE,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
execute ? extcmd_list :
|
||||
#endif
|
||||
insertfile_list, ans,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
_(msg),
|
||||
@ -734,7 +734,7 @@ void do_insertfile(
|
||||
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (i == TOGGLE_MULTIBUFFER_KEY) {
|
||||
/* Don't allow toggling if we're in view mode. */
|
||||
@ -750,7 +750,7 @@ void do_insertfile(
|
||||
#ifndef DISABLE_BROWSER
|
||||
else
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
if (i == NANO_TOFILES_KEY) {
|
||||
@ -795,7 +795,7 @@ void do_insertfile(
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (execute) {
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER))
|
||||
@ -815,7 +815,7 @@ void do_insertfile(
|
||||
/* Save the file specified in answer in the current
|
||||
* buffer. */
|
||||
open_buffer(answer);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -877,7 +877,7 @@ void do_insertfile_void(void)
|
||||
else
|
||||
#endif
|
||||
do_insertfile(
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
FALSE
|
||||
#endif
|
||||
);
|
||||
@ -1156,7 +1156,7 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void init_backup_dir(void)
|
||||
{
|
||||
char *full_backup_dir;
|
||||
@ -1297,7 +1297,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
* one). */
|
||||
realexists = (stat(realname, &st) != -1);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* We backup only if the backup toggle is set, the file isn't
|
||||
* temporary, and the file already exists. Furthermore, if we
|
||||
* 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);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* 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
|
||||
@ -1532,7 +1532,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
if (fileptr->data[0] == '\0')
|
||||
lineswritten--;
|
||||
} else {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->fmt == DOS_FILE || openfile->fmt ==
|
||||
MAC_FILE) {
|
||||
if (putc('\r', f) == EOF) {
|
||||
@ -1551,7 +1551,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
fclose(f);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -1610,7 +1610,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Update current_stat to reference the file as it is now. */
|
||||
if (openfile->current_stat == NULL)
|
||||
openfile->current_stat =
|
||||
@ -1634,7 +1634,7 @@ int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
return retval;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Write a marked selection from a file out. */
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append)
|
||||
@ -1679,7 +1679,7 @@ int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
|
||||
return retval;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
int do_writeout(bool exiting)
|
||||
{
|
||||
@ -1703,14 +1703,14 @@ int do_writeout(bool exiting)
|
||||
}
|
||||
|
||||
ans = mallocstrcpy(NULL,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
(openfile->mark_set && !exiting) ? "" :
|
||||
#endif
|
||||
openfile->filename);
|
||||
|
||||
while (TRUE) {
|
||||
const char *msg;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *formatstr, *backupstr;
|
||||
|
||||
formatstr = (openfile->fmt == DOS_FILE) ?
|
||||
@ -1725,7 +1725,7 @@ int do_writeout(bool exiting)
|
||||
N_("Append Selection to File") :
|
||||
N_("Write Selection to File");
|
||||
else
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
msg = (append == PREPEND) ? N_("File Name to Prepend to") :
|
||||
(append == APPEND) ? N_("File Name to Append to") :
|
||||
N_("File Name to Write");
|
||||
@ -1735,7 +1735,7 @@ int do_writeout(bool exiting)
|
||||
* completion. */
|
||||
i = do_prompt(!ISSET(RESTRICTED) ||
|
||||
openfile->filename[0] == '\0', writefile_list, ans,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
NULL, "%s%s%s", _(msg), formatstr, backupstr
|
||||
#else
|
||||
"%s", _(msg)
|
||||
@ -1766,7 +1766,7 @@ int do_writeout(bool exiting)
|
||||
do_prompt_abort();
|
||||
} else
|
||||
#endif /* !DISABLE_BROWSER */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (i == TOGGLE_DOS_KEY) {
|
||||
openfile->fmt = (openfile->fmt == DOS_FILE) ? NIX_FILE :
|
||||
DOS_FILE;
|
||||
@ -1779,7 +1779,7 @@ int do_writeout(bool exiting)
|
||||
TOGGLE(BACKUP_FILE);
|
||||
continue;
|
||||
} else
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
if (i == NANO_PREPEND_KEY) {
|
||||
append = (append == PREPEND) ? OVERWRITE : PREPEND;
|
||||
continue;
|
||||
@ -1817,7 +1817,7 @@ int do_writeout(bool exiting)
|
||||
* bother showing the "Different Name" prompt. */
|
||||
} else if (!ISSET(RESTRICTED) &&
|
||||
openfile->filename[0] != '\0'
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
&& (exiting || !openfile->mark_set)
|
||||
#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
|
||||
* a separate file. If we're using restricted mode, this is
|
||||
* 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)
|
||||
retval = write_marked_file(answer, NULL, FALSE, append);
|
||||
else
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
retval = write_file(answer, NULL, FALSE, append, FALSE);
|
||||
|
||||
break;
|
||||
@ -2281,7 +2281,7 @@ const char *tail(const char *foo)
|
||||
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.
|
||||
* The string is dynamically allocated, and should be freed. */
|
||||
char *histfilename(void)
|
||||
@ -2399,4 +2399,4 @@ void save_history(void)
|
||||
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;
|
||||
/* 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
|
||||
the first characters of tabs and
|
||||
spaces. */
|
||||
@ -81,7 +81,7 @@ size_t quotelen; /* strlen(quotestr) */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
char *backup_dir = NULL; /* Backup directory. */
|
||||
#endif
|
||||
|
||||
@ -113,7 +113,7 @@ shortcut *help_list = NULL;
|
||||
#ifndef DISABLE_SPELLER
|
||||
shortcut *spell_list = NULL;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
shortcut *extcmd_list = NULL;
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
@ -128,11 +128,11 @@ char *syntaxstr = NULL;
|
||||
|
||||
const shortcut *currshortcut; /* Current shortcut list we're using */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
toggle *toggles = NULL;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
filestruct *search_history = NULL;
|
||||
filestruct *searchage = NULL;
|
||||
filestruct *searchbot = NULL;
|
||||
@ -209,7 +209,7 @@ void shortcut_init(bool unjustify)
|
||||
const char *first_line_msg = N_("First Line");
|
||||
const char *last_line_msg = N_("Last Line");
|
||||
const char *refresh_msg = N_("Refresh");
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *cut_till_end_msg = N_("CutTillEnd");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@ -217,14 +217,14 @@ void shortcut_init(bool unjustify)
|
||||
const char *end_of_par_msg = N_("End of Par");
|
||||
const char *fulljstify_msg = N_("FullJstify");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *case_sens_msg = N_("Case Sens");
|
||||
const char *backwards_msg = N_("Backwards");
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *regexp_msg = N_("Regexp");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *history_msg = N_("History");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *new_buffer_msg = N_("New Buffer");
|
||||
@ -261,7 +261,7 @@ void shortcut_init(bool unjustify)
|
||||
N_("Invoke the spell checker, if available");
|
||||
const char *nano_gotoline_msg = N_("Go to line and column number");
|
||||
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_whereis_next_msg = N_("Repeat last search");
|
||||
#endif
|
||||
@ -283,7 +283,7 @@ void shortcut_init(bool unjustify)
|
||||
N_("Insert a tab character at the cursor position");
|
||||
const char *nano_enter_msg =
|
||||
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_prevword_msg = N_("Move backward one word");
|
||||
const char *nano_wordcount_msg =
|
||||
@ -306,14 +306,14 @@ void shortcut_init(bool unjustify)
|
||||
N_("Switch to the next file buffer");
|
||||
#endif
|
||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_cut_till_end_msg =
|
||||
N_("Cut from the cursor position to the end of the file");
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
||||
#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");
|
||||
#endif
|
||||
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");
|
||||
const char *nano_lastline_msg =
|
||||
N_("Go to the last line of the file");
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_case_msg =
|
||||
N_("Make the current search/replace case (in)sensitive");
|
||||
const char *nano_reverse_msg =
|
||||
@ -330,25 +330,25 @@ void shortcut_init(bool unjustify)
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *nano_regexp_msg = N_("Use regular expressions");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_history_msg =
|
||||
N_("Edit the previous search/replace strings");
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *nano_tofiles_msg = N_("Go to file browser");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_dos_msg = N_("Write file out in DOS format");
|
||||
const char *nano_mac_msg = N_("Write file out in Mac format");
|
||||
#endif
|
||||
const char *nano_append_msg = N_("Append 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 =
|
||||
N_("Back up original file when saving");
|
||||
const char *nano_execute_msg = N_("Execute external command");
|
||||
#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");
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
@ -478,7 +478,7 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||
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"),
|
||||
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
|
||||
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,
|
||||
NANO_NO_KEY, NOVIEW, do_enter);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
sc_init_one(&main_list, NANO_NEXTWORD_KEY, N_("Next Word"),
|
||||
IFHELP(nano_nextword_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
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,
|
||||
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, cut_till_end_msg,
|
||||
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);
|
||||
#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"),
|
||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_find_bracket);
|
||||
@ -649,7 +649,7 @@ void shortcut_init(bool unjustify)
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end_void);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_NO_KEY, case_sens_msg,
|
||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||
@ -668,7 +668,7 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PREVLINE_KEY, history_msg,
|
||||
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,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
sc_init_one(&replace_list, NANO_NO_KEY, case_sens_msg,
|
||||
IFHELP(nano_case_msg, TOGGLE_CASE_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
@ -736,7 +736,7 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
sc_init_one(&replace_list, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
@ -766,7 +766,7 @@ void shortcut_init(bool unjustify)
|
||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
sc_init_one(&replace_list_2, NANO_PREVLINE_KEY, history_msg,
|
||||
IFHELP(nano_history_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
@ -854,7 +854,7 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If we're using restricted mode, the DOS format, Mac format,
|
||||
* append, prepend, and backup toggles are disabled. The first and
|
||||
* 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,
|
||||
NANO_NO_KEY, NOVIEW, NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Translators: try to keep this string under 16 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
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);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If we're using restricted mode, command execution is disabled.
|
||||
* It's useless since inserting files is disabled. */
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
@ -957,7 +957,7 @@ void shortcut_init(bool unjustify)
|
||||
NANO_NO_KEY, VIEW, NULL);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
free_shortcutage(&extcmd_list);
|
||||
|
||||
sc_init_one(&extcmd_list, NANO_HELP_KEY, get_help_msg,
|
||||
@ -1034,7 +1034,7 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
currshortcut = main_list;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
toggle_init();
|
||||
#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
|
||||
* list. */
|
||||
void toggle_init_one(int val, const char *desc, long flag)
|
||||
@ -1132,7 +1132,7 @@ void toggle_init(void)
|
||||
WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* This function is called just before calling exit(). Practically, the
|
||||
* 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);
|
||||
#endif
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (backup_dir != NULL)
|
||||
free(backup_dir);
|
||||
#endif
|
||||
@ -1194,14 +1194,14 @@ void thanks_for_all_the_fish(void)
|
||||
#ifndef DISABLE_SPELLER
|
||||
free_shortcutage(&spell_list);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
free_shortcutage(&extcmd_list);
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
free_shortcutage(&browser_list);
|
||||
free_shortcutage(&gotodir_list);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Free the memory associated with each toggle. */
|
||||
while (toggles != NULL) {
|
||||
toggle *t = toggles;
|
||||
@ -1252,7 +1252,7 @@ void thanks_for_all_the_fish(void)
|
||||
free(bill);
|
||||
}
|
||||
#endif /* ENABLE_COLOR */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Free the search and replace history lists. */
|
||||
if (searchage != NULL)
|
||||
free_filestruct(searchage);
|
||||
|
@ -181,7 +181,7 @@ void help_init(void)
|
||||
* compiler to handle. */
|
||||
char *ptr;
|
||||
const shortcut *s;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const toggle *t;
|
||||
#ifdef ENABLE_NANORC
|
||||
bool old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||
@ -285,7 +285,7 @@ void help_init(void)
|
||||
htx[2] = NULL;
|
||||
}
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
else if (currshortcut == extcmd_list) {
|
||||
htx[0] = N_("Execute Command Help Text\n\n "
|
||||
"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()) :
|
||||
((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.
|
||||
* Each line has "M-%c\t\t\t", which fills 24 columns, plus a space,
|
||||
* plus translated text, plus '\n'. */
|
||||
@ -469,7 +469,7 @@ void help_init(void)
|
||||
ptr += sprintf(ptr, "\n");
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* And the toggles... */
|
||||
if (currshortcut == main_list) {
|
||||
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
|
||||
* beginning of the top line of the edit window, as Pico does. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -118,12 +118,12 @@ void do_page_down(void)
|
||||
|
||||
/* 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. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -209,7 +209,7 @@ void do_para_end_void(void)
|
||||
}
|
||||
#endif /* !DISABLE_JUSTIFY */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* 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,
|
||||
* 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);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
void do_home(void)
|
||||
{
|
||||
@ -443,7 +443,7 @@ void do_home(void)
|
||||
|
||||
check_statusblank();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t current_x_save = openfile->current_x;
|
||||
|
||||
@ -458,7 +458,7 @@ void do_home(void)
|
||||
#endif
|
||||
openfile->current_x = 0;
|
||||
openfile->placewewant = 0;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -503,7 +503,7 @@ void do_up(void)
|
||||
* a page if we're not. */
|
||||
if (openfile->current_y == 0)
|
||||
edit_scroll(UP,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
@ -517,7 +517,7 @@ void do_up(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_up(void)
|
||||
{
|
||||
check_statusblank();
|
||||
@ -540,7 +540,7 @@ void do_scroll_up(void)
|
||||
/* Scroll the edit window up one line. */
|
||||
edit_scroll(UP, 1);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
void do_down(void)
|
||||
{
|
||||
@ -566,7 +566,7 @@ void do_down(void)
|
||||
* half a page if we're not. */
|
||||
if (openfile->current_y == editwinrows - 1)
|
||||
edit_scroll(DOWN,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
@ -580,7 +580,7 @@ void do_down(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_down(void)
|
||||
{
|
||||
check_statusblank();
|
||||
@ -603,7 +603,7 @@ void do_scroll_down(void)
|
||||
/* Scroll the edit window down one line. */
|
||||
edit_scroll(DOWN, 1);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
void do_left(void)
|
||||
{
|
||||
|
90
src/nano.c
90
src/nano.c
@ -45,14 +45,14 @@
|
||||
#include <getopt.h>
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
#include <setjmp.h>
|
||||
#endif
|
||||
|
||||
static struct termios oldterm; /* The user's original term settings. */
|
||||
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
|
||||
* SIGWINCH. */
|
||||
#endif
|
||||
@ -283,7 +283,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
{
|
||||
filestruct *top_save;
|
||||
bool edittop_inside;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool mark_inside = FALSE;
|
||||
#endif
|
||||
|
||||
@ -301,7 +301,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
edittop_inside = (openfile->edittop->lineno >=
|
||||
openfile->fileage->lineno && openfile->edittop->lineno <=
|
||||
openfile->filebot->lineno);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set)
|
||||
mark_inside = (openfile->mark_begin->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->data = mallocstrcpy(NULL, "");
|
||||
openfile->filebot = openfile->fileage;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (mark_inside) {
|
||||
openfile->mark_begin = openfile->fileage;
|
||||
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. */
|
||||
if (edittop_inside)
|
||||
edit_update(
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||
#endif
|
||||
CENTER);
|
||||
@ -501,7 +501,7 @@ void delete_opennode(openfilestruct *fileptr)
|
||||
|
||||
free(fileptr->filename);
|
||||
free_filestruct(fileptr->fileage);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (fileptr->current_stat != NULL)
|
||||
free(fileptr->current_stat);
|
||||
#endif
|
||||
@ -544,7 +544,7 @@ void finish(void)
|
||||
/* Restore the old terminal settings. */
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
save_history();
|
||||
#endif
|
||||
@ -726,7 +726,7 @@ void usage(void)
|
||||
print1opt("-h, -?", "--help", N_("Show this message"));
|
||||
print1opt(_("+LINE,COLUMN"), "",
|
||||
N_("Start at line LINE, column COLUMN"));
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-A", "--smarthome", N_("Enable smart home key"));
|
||||
print1opt("-B", "--backup", N_("Save backups of existing files"));
|
||||
print1opt(_("-C [dir]"), _("--backupdir=[dir]"),
|
||||
@ -738,7 +738,7 @@ void usage(void)
|
||||
print1opt("-F", "--multibuffer", N_("Enable multiple file buffers"));
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-H", "--historylog",
|
||||
N_("Log & read search/replace string history"));
|
||||
#endif
|
||||
@ -749,7 +749,7 @@ void usage(void)
|
||||
N_("Fix numeric keypad key confusion problem"));
|
||||
print1opt("-L", "--nonewlines",
|
||||
N_("Don't add newlines to the ends of files"));
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-N", "--noconvert",
|
||||
N_("Don't convert files from DOS/Mac format"));
|
||||
#endif
|
||||
@ -759,17 +759,17 @@ void usage(void)
|
||||
N_("Quoting string"));
|
||||
#endif
|
||||
print1opt("-R", "--restricted", N_("Restricted mode"));
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-S", "--smooth", N_("Smooth scrolling"));
|
||||
#endif
|
||||
print1opt(_("-T [#cols]"), _("--tabsize=[#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"));
|
||||
#endif
|
||||
print1opt("-V", "--version",
|
||||
N_("Print version information and exit"));
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-W", "--wordbounds",
|
||||
N_("Detect word boundaries more accurately"));
|
||||
#endif
|
||||
@ -780,7 +780,7 @@ void usage(void)
|
||||
print1opt("-c", "--const", N_("Constantly show cursor position"));
|
||||
print1opt("-d", "--rebinddelete",
|
||||
N_("Fix Backspace/Delete confusion problem"));
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
print1opt("-i", "--autoindent",
|
||||
N_("Automatically indent new lines"));
|
||||
print1opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||
@ -873,7 +873,7 @@ void version(void)
|
||||
#ifdef ENABLE_NANORC
|
||||
printf(" --enable-nanorc");
|
||||
#endif
|
||||
#ifdef NANO_SMALL
|
||||
#ifdef NANO_TINY
|
||||
printf(" --enable-tiny");
|
||||
#endif
|
||||
#ifdef ENABLE_UTF8
|
||||
@ -943,7 +943,7 @@ void signal_init(void)
|
||||
sigaction(SIGHUP, &act, NULL);
|
||||
sigaction(SIGTERM, &act, NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Trap SIGWINCH because we want to handle window resizes. */
|
||||
act.sa_handler = handle_sigwinch;
|
||||
sigaction(SIGWINCH, &act, NULL);
|
||||
@ -996,7 +996,7 @@ void do_suspend(int signal)
|
||||
/* Handler for SIGCONT (continue after suspend). */
|
||||
void do_cont(int signal)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Perhaps the user resized the window while we slept. Handle it,
|
||||
* and update the screen in the process. */
|
||||
handle_sigwinch(0);
|
||||
@ -1006,7 +1006,7 @@ void do_cont(int signal)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void handle_sigwinch(int s)
|
||||
{
|
||||
const char *tty = ttyname(0);
|
||||
@ -1088,9 +1088,9 @@ void allow_pending_sigwinch(bool allow)
|
||||
sigaddset(&winch, SIGWINCH);
|
||||
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)
|
||||
{
|
||||
bool enabled;
|
||||
@ -1139,7 +1139,7 @@ void do_toggle(const toggle *which)
|
||||
statusbar("%s %s", which->desc, enabled ? _("enabled") :
|
||||
_("disabled"));
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
void disable_extended_io(void)
|
||||
{
|
||||
@ -1160,7 +1160,7 @@ void disable_signals(void)
|
||||
tcsetattr(0, TCSANOW, &term);
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void enable_signals(void)
|
||||
{
|
||||
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. */
|
||||
const shortcut *s;
|
||||
bool have_shortcut;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const toggle *t;
|
||||
bool have_toggle;
|
||||
#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 ||
|
||||
input == NANO_XOFF_KEY || input == NANO_SUSPEND_KEY);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Check for a toggle in the main list. */
|
||||
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. */
|
||||
*s_or_t = (have_shortcut
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
|| have_toggle
|
||||
#endif
|
||||
);
|
||||
@ -1318,7 +1318,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
case NANO_XOFF_KEY:
|
||||
statusbar(_("XOFF ignored, mumble mumble."));
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case NANO_SUSPEND_KEY:
|
||||
if (ISSET(SUSPEND))
|
||||
do_suspend(0);
|
||||
@ -1346,7 +1346,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
break;
|
||||
}
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
else if (have_toggle) {
|
||||
/* Blow away the text in the cutbuffer, since we aren't
|
||||
* cutting text. */
|
||||
@ -1400,7 +1400,7 @@ bool do_mouse(void)
|
||||
get_page_start(xplustabs()) + mouse_x);
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Clicking where the cursor is toggles the mark, as does
|
||||
* clicking beyond the line length with the cursor at the
|
||||
* end of the line. */
|
||||
@ -1479,7 +1479,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
openfile->totsize++;
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Note that current_x has not yet been incremented. */
|
||||
if (openfile->mark_set && openfile->current ==
|
||||
openfile->mark_begin && openfile->current_x <
|
||||
@ -1581,7 +1581,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
{"nohelp", 0, NULL, 'x'},
|
||||
{"suspend", 0, NULL, 'z'},
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
{"smarthome", 0, NULL, 'A'},
|
||||
{"backup", 0, NULL, 'B'},
|
||||
{"backupdir", 1, NULL, 'C'},
|
||||
@ -1647,7 +1647,7 @@ int main(int argc, char **argv)
|
||||
case 'j':
|
||||
/* Pico compatibility flags. */
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case 'A':
|
||||
SET(SMART_HOME);
|
||||
break;
|
||||
@ -1667,7 +1667,7 @@ int main(int argc, char **argv)
|
||||
break;
|
||||
#endif
|
||||
#ifdef ENABLE_NANORC
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case 'H':
|
||||
SET(HISTORYLOG);
|
||||
break;
|
||||
@ -1682,7 +1682,7 @@ int main(int argc, char **argv)
|
||||
case 'L':
|
||||
SET(NO_NEWLINES);
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case 'N':
|
||||
SET(NO_CONVERT);
|
||||
break;
|
||||
@ -1698,7 +1698,7 @@ int main(int argc, char **argv)
|
||||
case 'R':
|
||||
SET(RESTRICTED);
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case 'S':
|
||||
SET(SMOOTH_SCROLL);
|
||||
break;
|
||||
@ -1710,7 +1710,7 @@ int main(int argc, char **argv)
|
||||
exit(1);
|
||||
}
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case 'U':
|
||||
SET(QUICK_BLANK);
|
||||
break;
|
||||
@ -1718,7 +1718,7 @@ int main(int argc, char **argv)
|
||||
case 'V':
|
||||
version();
|
||||
exit(0);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case 'W':
|
||||
SET(WORD_BOUNDS);
|
||||
break;
|
||||
@ -1734,7 +1734,7 @@ int main(int argc, char **argv)
|
||||
case 'd':
|
||||
SET(REBIND_DELETE);
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case 'i':
|
||||
SET(AUTOINDENT);
|
||||
break;
|
||||
@ -1820,7 +1820,7 @@ int main(int argc, char **argv)
|
||||
#ifndef DISABLE_WRAPJUSTIFY
|
||||
ssize_t wrap_at_cpy = wrap_at;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
char *backup_dir_cpy = backup_dir;
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@ -1835,7 +1835,7 @@ int main(int argc, char **argv)
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
operating_dir = NULL;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
backup_dir = NULL;
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@ -1857,7 +1857,7 @@ int main(int argc, char **argv)
|
||||
if (fill_used)
|
||||
wrap_at = wrap_at_cpy;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (backup_dir_cpy != NULL) {
|
||||
free(backup_dir);
|
||||
backup_dir = backup_dir_cpy;
|
||||
@ -1885,7 +1885,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
history_init();
|
||||
#ifdef ENABLE_NANORC
|
||||
if (!ISSET(NO_RCFILE) && ISSET(HISTORYLOG))
|
||||
@ -1893,7 +1893,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Set up the backup directory (unless we're using restricted mode,
|
||||
* in which case backups are disabled, since they would allow
|
||||
* reading from or writing to files not specified on the command
|
||||
@ -1955,7 +1955,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
#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 == NULL) {
|
||||
whitespace = mallocstrcpy(NULL, " ");
|
||||
@ -2071,7 +2071,7 @@ int main(int argc, char **argv)
|
||||
|
||||
display_main_list();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Return here after a SIGWINCH. */
|
||||
sigsetjmp(jmpbuf, 1);
|
||||
#endif
|
||||
|
10
src/nano.h
10
src/nano.h
@ -235,7 +235,7 @@ typedef struct openfilestruct {
|
||||
* position. */
|
||||
bool modified; /* Current file's modification
|
||||
* status. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool mark_set; /* Current file's marking status. */
|
||||
filestruct *mark_begin; /* Current file's beginning marked
|
||||
* line. */
|
||||
@ -269,7 +269,7 @@ typedef struct shortcut {
|
||||
struct shortcut *next;
|
||||
} shortcut;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
typedef struct toggle {
|
||||
int val; /* Sequence to toggle the key. Should only need
|
||||
* one. */
|
||||
@ -494,8 +494,8 @@ typedef struct rcoption {
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Toggles do not exist with NANO_SMALL. */
|
||||
#ifndef NANO_TINY
|
||||
/* Toggles do not exist with NANO_TINY. */
|
||||
#define TOGGLE_CONST_KEY NANO_ALT_C
|
||||
#define TOGGLE_AUTOINDENT_KEY NANO_ALT_I
|
||||
#define TOGGLE_SUSPEND_KEY NANO_ALT_Z
|
||||
@ -516,7 +516,7 @@ typedef struct rcoption {
|
||||
#define TOGGLE_WHITESPACE_KEY NANO_ALT_P
|
||||
#define TOGGLE_MORESPACE_KEY NANO_ALT_O
|
||||
#define TOGGLE_TABSTOSPACES_KEY NANO_ALT_Q
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#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_BACKSPACE_KEY || input == NANO_DELETE_KEY ||
|
||||
input == NANO_CUT_KEY ||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
input == NANO_NEXTWORD_KEY ||
|
||||
#endif
|
||||
(*meta_key == TRUE && (
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
input == NANO_PREVWORD_KEY ||
|
||||
#endif
|
||||
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)
|
||||
do_statusbar_cut_text();
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case NANO_NEXTWORD_KEY:
|
||||
do_statusbar_next_word(FALSE);
|
||||
break;
|
||||
@ -338,7 +338,7 @@ void do_statusbar_home(void)
|
||||
{
|
||||
size_t pww_save = statusbar_pww;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t statusbar_x_save = statusbar_x;
|
||||
|
||||
@ -353,7 +353,7 @@ void do_statusbar_home(void)
|
||||
#endif
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -432,7 +432,7 @@ void do_statusbar_cut_text(void)
|
||||
{
|
||||
assert(answer != NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(CUT_TO_END))
|
||||
null_at(&answer, statusbar_x);
|
||||
else {
|
||||
@ -440,14 +440,14 @@ void do_statusbar_cut_text(void)
|
||||
null_at(&answer, 0);
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
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
|
||||
* TRUE, treat punctuation as part of a word. Return TRUE if we started
|
||||
* 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 started_on_word;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
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
|
||||
* called from do_prompt(). */
|
||||
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const shortcut *s
|
||||
@ -728,7 +728,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
bool tabbed = FALSE;
|
||||
/* Whether we've pressed Tab. */
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
char *history = NULL;
|
||||
/* The current history string. */
|
||||
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
|
||||
* tab complete, if any. */
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
curranswer_len = strlen(answer);
|
||||
@ -785,7 +785,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
switch (kbinput) {
|
||||
case NANO_TAB_KEY:
|
||||
#ifndef DISABLE_TABCOMP
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (history_list != NULL) {
|
||||
if (last_kbinput != NANO_TAB_KEY)
|
||||
complete_len = strlen(answer);
|
||||
@ -797,7 +797,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
statusbar_x = strlen(answer);
|
||||
}
|
||||
} else
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
if (allow_tabs)
|
||||
answer = input_tab(answer, &statusbar_x, &tabbed,
|
||||
list);
|
||||
@ -806,7 +806,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
break;
|
||||
case NANO_PREVLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (history_list != NULL) {
|
||||
/* If we're scrolling up at the bottom of the
|
||||
* 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. */
|
||||
finished = FALSE;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
break;
|
||||
case NANO_NEXTLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (history_list != NULL) {
|
||||
/* Get the newer search from the history list and
|
||||
* 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);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
break;
|
||||
}
|
||||
|
||||
@ -870,14 +870,14 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
if (finished)
|
||||
break;
|
||||
|
||||
#if !defined(NANO_SMALL) && !defined(DISABLE_TABCOMP)
|
||||
#if !defined(NANO_TINY) && !defined(DISABLE_TABCOMP)
|
||||
last_kbinput = kbinput;
|
||||
#endif
|
||||
|
||||
reset_statusbar_cursor();
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Set the current position in the history list to the bottom and
|
||||
* free magichistory, if we need to. */
|
||||
if (history_list != NULL) {
|
||||
@ -909,7 +909,7 @@ int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
* interpreted. */
|
||||
int do_prompt(bool allow_tabs, const shortcut *s, const char
|
||||
*curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
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));
|
||||
|
||||
retval = get_prompt_string(allow_tabs, curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
history_list,
|
||||
#endif
|
||||
s
|
||||
|
72
src/proto.h
72
src/proto.h
@ -35,7 +35,7 @@ extern long flags;
|
||||
extern ssize_t tabsize;
|
||||
extern int currslen;
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
extern char *whitespace;
|
||||
extern int whitespace_len[2];
|
||||
#endif
|
||||
@ -53,7 +53,7 @@ extern size_t quotelen;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
extern char *backup_dir;
|
||||
#endif
|
||||
|
||||
@ -88,7 +88,7 @@ extern shortcut *main_list, *whereis_list;
|
||||
extern shortcut *replace_list, *gotoline_list;
|
||||
extern shortcut *writefile_list, *insertfile_list;
|
||||
extern shortcut *replace_list_2;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
extern shortcut *extcmd_list;
|
||||
#endif
|
||||
#ifndef DISABLE_HELP
|
||||
@ -112,11 +112,11 @@ extern regmatch_t synfilematches[1];
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
extern toggle *toggles;
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
extern filestruct *search_history;
|
||||
extern filestruct *searchage;
|
||||
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);
|
||||
#endif
|
||||
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
|
||||
char *rev_start);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *revstrcasestr(const char *haystack, const char *needle,
|
||||
const char *rev_start);
|
||||
const char *mbrevstrcasestr(const char *haystack, const char *needle,
|
||||
@ -220,12 +220,12 @@ void color_update(void);
|
||||
/* Public functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(void);
|
||||
void cut_to_eol(void);
|
||||
#endif
|
||||
void do_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_cut_till_end(void);
|
||||
#endif
|
||||
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);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool execute
|
||||
#else
|
||||
void
|
||||
@ -265,13 +265,13 @@ char *safe_tempfile(FILE **f);
|
||||
void init_operating_dir(void);
|
||||
bool check_operating_dir(const char *currpath, bool allow_tabcomp);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void init_backup_dir(void);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
append, bool nonamechange);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
int write_marked_file(const char *name, FILE *f_open, bool tmp,
|
||||
append_type append);
|
||||
#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);
|
||||
#endif
|
||||
const char *tail(const char *foo);
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, filestruct *histhead);
|
||||
@ -299,7 +299,7 @@ void save_history(void);
|
||||
|
||||
/* Public functions in global.c. */
|
||||
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(void);
|
||||
#endif
|
||||
@ -333,7 +333,7 @@ void do_para_begin_void(void);
|
||||
void do_para_end(bool allow_update);
|
||||
void do_para_end_void(void);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool do_next_word(bool allow_punct, bool allow_update);
|
||||
void do_next_word_void(void);
|
||||
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_end(void);
|
||||
void do_up(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_up(void);
|
||||
#endif
|
||||
void do_down(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_scroll_down(void);
|
||||
#endif
|
||||
void do_left(void);
|
||||
@ -399,16 +399,16 @@ void signal_init(void);
|
||||
void handle_hupterm(int signal);
|
||||
void do_suspend(int signal);
|
||||
void do_cont(int signal);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void handle_sigwinch(int s);
|
||||
void allow_pending_sigwinch(bool allow);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_toggle(const toggle *which);
|
||||
#endif
|
||||
void disable_extended_io(void);
|
||||
void disable_signals(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void enable_signals(void);
|
||||
#endif
|
||||
void disable_flow_control(void);
|
||||
@ -436,7 +436,7 @@ void do_statusbar_left(void);
|
||||
void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool do_statusbar_next_word(bool allow_punct);
|
||||
bool do_statusbar_prev_word(bool allow_punct);
|
||||
#endif
|
||||
@ -447,7 +447,7 @@ void update_statusbar_line(const char *curranswer, size_t index);
|
||||
void reset_statusbar_cursor(void);
|
||||
bool need_statusbar_horizontal_update(size_t old_pww);
|
||||
int get_prompt_string(bool allow_tabs, const char *curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
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
|
||||
*curranswer,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
filestruct **history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
@ -494,7 +494,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
*needle, size_t *needle_len);
|
||||
void findnextstr_wrap_reset(void);
|
||||
void do_search(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_research(void);
|
||||
#endif
|
||||
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
|
||||
pos_pww);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
#ifdef HAVE_REGEX_H
|
||||
void do_find_bracket(void);
|
||||
#endif
|
||||
@ -533,14 +533,14 @@ char *get_history_completion(filestruct **h, const char *s, size_t len);
|
||||
#endif
|
||||
|
||||
/* Public functions in text.c. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void);
|
||||
#endif
|
||||
void do_delete(void);
|
||||
void do_backspace(void);
|
||||
void do_tab(void);
|
||||
void do_enter(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void cancel_command(int signal);
|
||||
bool execute_command(const char *command);
|
||||
#endif
|
||||
@ -551,7 +551,7 @@ bool do_wrap(filestruct *line);
|
||||
#if !defined(DISABLE_HELP) || !defined(DISABLE_JUSTIFY) || !defined(DISABLE_WRAPPING)
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool newline);
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_JUSTIFY)
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY)
|
||||
size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@ -575,7 +575,7 @@ const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_wordlinechar_count(void);
|
||||
#endif
|
||||
void do_verbatim_input(void);
|
||||
@ -589,7 +589,7 @@ void align(char **str);
|
||||
void null_at(char **data, size_t index);
|
||||
void unsunder(char *str, size_t true_len);
|
||||
void sunder(char *str);
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
#ifndef HAVE_GETLINE
|
||||
ssize_t ngetline(char **lineptr, size_t *n, FILE *stream);
|
||||
#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 strlenpt(const char *s);
|
||||
void new_magicline(void);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void remove_magicline(void);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
@ -634,7 +634,7 @@ void dump_filestruct_reverse(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in winio.c. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
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_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
|
||||
#endif
|
||||
);
|
||||
@ -652,12 +652,12 @@ int get_escape_seq_kbinput(const int *seq, size_t seq_len, bool
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int get_byte_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
long get_unicode_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
@ -670,7 +670,7 @@ bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
||||
*meta_key, bool *func_key);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const toggle *get_toggle(int kbinput, bool meta_key);
|
||||
#endif
|
||||
void blank_line(WINDOW *win, int y, int x, int n);
|
||||
|
@ -75,7 +75,7 @@ const static rcoption rcopts[] = {
|
||||
{"tabsize", 0},
|
||||
{"tempfile", TEMP_FILE},
|
||||
{"view", VIEW_MODE},
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"backupdir", 0},
|
||||
@ -639,7 +639,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
free(option);
|
||||
} else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (strcasecmp(rcopts[i].name, "whitespace") == 0) {
|
||||
whitespace = option;
|
||||
if (mbstrlen(whitespace) != 2 ||
|
||||
@ -681,7 +681,7 @@ void parse_rcfile(FILE *rcstream)
|
||||
quotestr = option;
|
||||
else
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (strcasecmp(rcopts[i].name,
|
||||
"backupdir") == 0)
|
||||
backup_dir = option;
|
||||
|
58
src/search.c
58
src/search.c
@ -33,7 +33,7 @@
|
||||
|
||||
static bool search_last_line = FALSE;
|
||||
/* 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;
|
||||
/* Have any of the history lists changed? */
|
||||
#endif
|
||||
@ -49,7 +49,7 @@ static bool regexp_compiled = FALSE;
|
||||
int regexp_init(const char *regexp)
|
||||
{
|
||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
||||
#endif
|
||||
);
|
||||
@ -98,7 +98,7 @@ void not_found_msg(const char *str)
|
||||
void search_abort(void)
|
||||
{
|
||||
display_main_list();
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set)
|
||||
edit_refresh();
|
||||
#endif
|
||||
@ -163,12 +163,12 @@ int search_init(bool replacing, bool use_answer)
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = do_prompt(FALSE, replacing ? replace_list : whereis_list,
|
||||
backupstring,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
&search_history,
|
||||
#endif
|
||||
"%s%s%s%s%s%s", _("Search"),
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* This string is just a modifier for the search prompt; no
|
||||
* grammar is implied. */
|
||||
ISSET(CASE_SENSITIVE) ? _(" [Case Sensitive]") :
|
||||
@ -182,7 +182,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
#endif
|
||||
"",
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* This string is just a modifier for the search prompt; no
|
||||
* grammar is implied. */
|
||||
ISSET(BACKWARDS_SEARCH) ? _(" [Backwards]") :
|
||||
@ -190,7 +190,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
"",
|
||||
|
||||
replacing ?
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set ? _(" (to replace) in selection") :
|
||||
#endif
|
||||
_(" (to replace)") : "",
|
||||
@ -221,7 +221,7 @@ int search_init(bool replacing, bool use_answer)
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
case TOGGLE_CASE_KEY:
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
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
|
||||
* previous or next line. */
|
||||
rev_start =
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(BACKWARDS_SEARCH) ?
|
||||
fileptr->data + (openfile->current_x - 1) :
|
||||
#endif
|
||||
@ -329,7 +329,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = fileptr->prev;
|
||||
current_y_find--;
|
||||
@ -337,7 +337,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
#endif
|
||||
fileptr = fileptr->next;
|
||||
current_y_find++;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -346,7 +346,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
if (!can_display_wrap)
|
||||
return FALSE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
fileptr = openfile->filebot;
|
||||
current_y_find = editwinrows - 1;
|
||||
@ -354,7 +354,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
#endif
|
||||
fileptr = openfile->fileage;
|
||||
current_y_find = 0;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -367,7 +367,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
search_last_line = TRUE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
rev_start += strlen(fileptr->data);
|
||||
#endif
|
||||
@ -378,7 +378,7 @@ bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
|
||||
/* Ensure we haven't wrapped around again! */
|
||||
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))
|
||||
#else
|
||||
@ -427,7 +427,7 @@ void do_search(void)
|
||||
search_abort();
|
||||
else if (i == -2) /* 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
|
||||
* toggle. */
|
||||
do_search();
|
||||
@ -442,7 +442,7 @@ void do_search(void)
|
||||
else
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If answer is not "", add this search string to the search history
|
||||
* list. */
|
||||
if (answer[0] != '\0')
|
||||
@ -483,7 +483,7 @@ void do_search(void)
|
||||
search_abort();
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Search for the next string without prompting. */
|
||||
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. */
|
||||
bool begin_line = FALSE, bol_or_eol = FALSE;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
filestruct *edittop_save = openfile->edittop, *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
@ -769,7 +769,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
length_change = strlen(copy) -
|
||||
strlen(openfile->current->data);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark was on and (mark_begin, mark_begin_x) was the
|
||||
* top of it, don't change mark_begin_x. */
|
||||
if (!old_mark_set || !right_side_up) {
|
||||
@ -797,7 +797,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
match_len;
|
||||
*real_current_x += length_change;
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -805,7 +805,7 @@ ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
* text, so searching will resume after the replacement
|
||||
* text. Note that current_x might be set to (size_t)-1
|
||||
* here. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (!ISSET(BACKWARDS_SEARCH))
|
||||
#endif
|
||||
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 the mark was on, unpartition the filestruct so that it
|
||||
* 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
|
||||
* copy answer into last_search. */
|
||||
if (answer[0] != '\0') {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
last_search = mallocstrcpy(last_search, answer);
|
||||
@ -893,12 +893,12 @@ void do_replace(void)
|
||||
last_replace = mallocstrcpy(last_replace, "");
|
||||
|
||||
i = do_prompt(FALSE, replace_list_2, last_replace,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
&replace_history,
|
||||
#endif
|
||||
_("Replace with"));
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Add this replace string to the replace history list. i == 0
|
||||
* means that the string is not "". */
|
||||
if (i == 0)
|
||||
@ -954,7 +954,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
|
||||
/* Ask for it. */
|
||||
int i = do_prompt(FALSE, gotoline_list, use_answer ? ans : "",
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
_("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
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
#ifdef HAVE_REGEX_H
|
||||
void do_find_bracket(void)
|
||||
{
|
||||
@ -1326,4 +1326,4 @@ char *get_history_completion(filestruct **h, const char *s, size_t len)
|
||||
return (char *)s;
|
||||
}
|
||||
#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 "proto.h"
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
static pid_t pid = -1;
|
||||
/* The PID of the newly forked process in execute_command(), for
|
||||
* use with the cancel_command() signal handler. */
|
||||
@ -47,7 +47,7 @@ static filestruct *jusbottom = NULL;
|
||||
/* Pointer to the end of the justify buffer. */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void)
|
||||
{
|
||||
openfile->mark_set = !openfile->mark_set;
|
||||
@ -62,7 +62,7 @@ void do_mark(void)
|
||||
edit_refresh();
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
void do_delete(void)
|
||||
{
|
||||
@ -89,7 +89,7 @@ void do_delete(void)
|
||||
|
||||
null_at(&openfile->current->data, openfile->current_x +
|
||||
line_len - char_buf_len);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set && openfile->mark_begin ==
|
||||
openfile->current && openfile->current_x <
|
||||
openfile->mark_begin_x)
|
||||
@ -110,7 +110,7 @@ void do_delete(void)
|
||||
openfile->current_x + strlen(foo->data) + 1);
|
||||
strcpy(openfile->current->data + openfile->current_x,
|
||||
foo->data);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set && openfile->mark_begin ==
|
||||
openfile->current->next) {
|
||||
openfile->mark_begin = openfile->current;
|
||||
@ -163,7 +163,7 @@ void do_backspace(void)
|
||||
|
||||
void do_tab(void)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(TABS_TO_SPACES)) {
|
||||
char *output;
|
||||
size_t output_len = 0, new_pww = xplustabs();
|
||||
@ -184,7 +184,7 @@ void do_tab(void)
|
||||
} else {
|
||||
#endif
|
||||
do_output("\t", 1, TRUE);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -197,7 +197,7 @@ void do_enter(void)
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Do auto-indenting, like the neolithic Turbo Pascal editor. */
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
/* If we are breaking the line in the indentation, the new
|
||||
@ -212,14 +212,14 @@ void do_enter(void)
|
||||
openfile->current_x) + extra + 1);
|
||||
strcpy(&newnode->data[extra], openfile->current->data +
|
||||
openfile->current_x);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
strncpy(newnode->data, openfile->current->data, extra);
|
||||
openfile->totsize += mbstrlen(newnode->data);
|
||||
}
|
||||
#endif
|
||||
null_at(&openfile->current->data, openfile->current_x);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set && openfile->current ==
|
||||
openfile->mark_begin && openfile->current_x <
|
||||
openfile->mark_begin_x) {
|
||||
@ -245,7 +245,7 @@ void do_enter(void)
|
||||
edit_refresh();
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
void cancel_command(int signal)
|
||||
{
|
||||
if (kill(pid, SIGKILL) == -1)
|
||||
@ -332,7 +332,7 @@ bool execute_command(const char *command)
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
void wrap_reset(void)
|
||||
@ -349,7 +349,7 @@ bool do_wrap(filestruct *line)
|
||||
/* The length of the line we wrap. */
|
||||
ssize_t wrap_loc;
|
||||
/* The index of line->data where we wrap. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const char *indent_string = NULL;
|
||||
/* Indentation to prepend to the new line. */
|
||||
size_t indent_len = 0;
|
||||
@ -403,7 +403,7 @@ bool do_wrap(filestruct *line)
|
||||
if (line->data[wrap_loc] == '\0')
|
||||
return FALSE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If autoindent is turned on, and we're on the character just after
|
||||
* the indentation, we don't wrap. */
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
@ -462,7 +462,7 @@ bool do_wrap(filestruct *line)
|
||||
* the text of the next line. */
|
||||
new_line_len += after_break_len;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
if (wrapping) {
|
||||
/* 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[0] = '\0';
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
/* Copy the indentation. */
|
||||
strncpy(new_line, indent_string, indent_len);
|
||||
@ -534,14 +534,14 @@ bool do_wrap(filestruct *line)
|
||||
same_line_wrap = FALSE;
|
||||
openfile->current = openfile->current->next;
|
||||
openfile->current_x -= wrap_loc
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
- indent_len
|
||||
#endif
|
||||
;
|
||||
openfile->placewewant = xplustabs();
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* 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,
|
||||
* 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 */
|
||||
|
||||
#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
|
||||
* and the non-whitespace of the line. */
|
||||
size_t indent_length(const char *line)
|
||||
@ -664,7 +664,7 @@ size_t indent_length(const char *line)
|
||||
|
||||
return len;
|
||||
}
|
||||
#endif /* !NANO_SMALL || !DISABLE_JUSTIFY */
|
||||
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* 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;
|
||||
size_t shift = 0;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
size_t mark_shift = 0;
|
||||
#endif
|
||||
|
||||
@ -714,7 +714,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
||||
end += end_len;
|
||||
shift += end_len;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Keep track of the change in the current line. */
|
||||
if (openfile->mark_set && openfile->mark_begin ==
|
||||
paragraph && openfile->mark_begin_x >= end -
|
||||
@ -769,7 +769,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
||||
end += end_len;
|
||||
shift += end_len;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Keep track of the change in the current line. */
|
||||
if (openfile->mark_set && openfile->mark_begin ==
|
||||
paragraph && openfile->mark_begin_x >= end -
|
||||
@ -808,7 +808,7 @@ void justify_format(filestruct *paragraph, size_t skip)
|
||||
free(paragraph->data);
|
||||
paragraph->data = new_paragraph_data;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Adjust the mark coordinates to compensate for the change in
|
||||
* the current line. */
|
||||
if (openfile->mark_set && openfile->mark_begin == paragraph) {
|
||||
@ -923,7 +923,7 @@ bool begpar(const filestruct *const foo)
|
||||
/* Case 2) or 5) or 4). */
|
||||
if (foo->prev->data[quote_len + temp_id_len] == '\0' ||
|
||||
(quote_len == 0 && indent_len > 0
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
&& !ISSET(AUTOINDENT)
|
||||
#endif
|
||||
) || !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 edittop_lineno_save = openfile->edittop->lineno;
|
||||
ssize_t current_lineno_save = openfile->current->lineno;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
ssize_t mb_lineno_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;
|
||||
if (top->lineno == current_lineno_save)
|
||||
openfile->current = top;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set && top->lineno == mb_lineno_save) {
|
||||
openfile->mark_begin = top;
|
||||
openfile->mark_begin_x = mark_begin_x_save;
|
||||
@ -1134,7 +1134,7 @@ void do_justify(bool full_justify)
|
||||
size_t pww_save = openfile->placewewant;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
size_t totsize_save = openfile->totsize;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
filestruct *mark_begin_save = openfile->mark_begin;
|
||||
size_t mark_begin_x_save = openfile->mark_begin_x;
|
||||
#endif
|
||||
@ -1287,7 +1287,7 @@ void do_justify(bool full_justify)
|
||||
if (next_line == openfile->filebot)
|
||||
openfile->filebot = openfile->current;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Adjust the mark coordinates to compensate for the change
|
||||
* in the next line. */
|
||||
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
|
||||
* indentation is treated as part of the line. */
|
||||
if (quote_len == 0
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
&& !ISSET(AUTOINDENT)
|
||||
#endif
|
||||
)
|
||||
@ -1365,7 +1365,7 @@ void do_justify(bool full_justify)
|
||||
par_len++;
|
||||
openfile->totsize += indent_len + 1;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Adjust the mark coordinates to compensate for the change
|
||||
* in the current line. */
|
||||
if (openfile->mark_set && openfile->mark_begin ==
|
||||
@ -1474,7 +1474,7 @@ void do_justify(bool full_justify)
|
||||
openfile->placewewant = pww_save;
|
||||
openfile->current_y = current_y_save;
|
||||
openfile->totsize = totsize_save;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set) {
|
||||
openfile->mark_begin = mark_begin_save;
|
||||
openfile->mark_begin_x = mark_begin_x_save;
|
||||
@ -1529,13 +1529,13 @@ bool do_int_spell_fix(const char *word)
|
||||
bool canceled = FALSE;
|
||||
/* The return value. */
|
||||
bool case_sens_set = ISSET(CASE_SENSITIVE);
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool backwards_search_set = ISSET(BACKWARDS_SEARCH);
|
||||
#endif
|
||||
#ifdef HAVE_REGEX_H
|
||||
bool regexp_set = ISSET(USE_REGEXP);
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
bool added_magicline = FALSE;
|
||||
/* 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. */
|
||||
SET(CASE_SENSITIVE);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Make sure spell-check goes forward only. */
|
||||
UNSET(BACKWARDS_SEARCH);
|
||||
#endif
|
||||
@ -1567,7 +1567,7 @@ bool do_int_spell_fix(const char *word)
|
||||
last_search = mallocstrcpy(NULL, word);
|
||||
last_replace = mallocstrcpy(NULL, word);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
/* If the mark is on, partition the filestruct so that it
|
||||
* 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. */
|
||||
canceled = (do_prompt(FALSE, spell_list, word,
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
NULL,
|
||||
#endif
|
||||
_("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 the mark was on, the NO_NEWLINES flag isn't set, and we
|
||||
* added a magicline, remove it now. */
|
||||
@ -1667,7 +1667,7 @@ bool do_int_spell_fix(const char *word)
|
||||
if (!case_sens_set)
|
||||
UNSET(CASE_SENSITIVE);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Restore search/replace direction. */
|
||||
if (backwards_search_set)
|
||||
SET(BACKWARDS_SEARCH);
|
||||
@ -1876,7 +1876,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
char *ptr;
|
||||
static int arglen = 3;
|
||||
static char **spellargs = NULL;
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
bool old_mark_set = openfile->mark_set;
|
||||
bool added_magicline = FALSE;
|
||||
/* Whether we added a magicline after filebot. */
|
||||
@ -1932,7 +1932,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
if (pid_spell < 0)
|
||||
return _("Could not fork");
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Don't handle a pending SIGWINCH until the alternate spell checker
|
||||
* is finished and we've loaded the spell-checked file back in. */
|
||||
allow_pending_sigwinch(FALSE);
|
||||
@ -1959,7 +1959,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
char *altspell_error;
|
||||
char *invoke_error = _("Error invoking \"%s\"");
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Turn the mark back on if it was on before. */
|
||||
openfile->mark_set = old_mark_set;
|
||||
#endif
|
||||
@ -1971,7 +1971,7 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
return altspell_error;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
/* If the mark is on, partition the filestruct so that it
|
||||
* 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. */
|
||||
replace_buffer(tempfile_name);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (old_mark_set) {
|
||||
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);
|
||||
set_modified();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Handle a pending SIGWINCH again. */
|
||||
allow_pending_sigwinch(TRUE);
|
||||
#endif
|
||||
@ -2068,7 +2068,7 @@ void do_spell(void)
|
||||
return;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->mark_set)
|
||||
i = write_marked_file(temp, temp_file, TRUE, OVERWRITE);
|
||||
else
|
||||
@ -2102,7 +2102,7 @@ void do_spell(void)
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Our own version of "wc". Note that its character counts are in
|
||||
* multibyte characters instead of single-byte characters. */
|
||||
void do_wordlinechar_count(void)
|
||||
@ -2167,7 +2167,7 @@ void do_wordlinechar_count(void)
|
||||
_("In Selection: ") : "", (unsigned long)words, (long)lines,
|
||||
(unsigned long)chars);
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
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
|
||||
* 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
|
||||
/* This function is equivalent to getline(). */
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_SMALL && ENABLE_NANORC */
|
||||
#endif /* !NANO_TINY && ENABLE_NANORC */
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
@ -301,7 +301,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP)) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH)) {
|
||||
if (regexec(&search_regexp, haystack, 1, regmatches,
|
||||
0) == 0 && haystack + regmatches[0].rm_so <= start) {
|
||||
@ -319,7 +319,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
return retval;
|
||||
}
|
||||
} else
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
if (regexec(&search_regexp, start, 10, regmatches,
|
||||
(start > haystack) ? REG_NOTBOL : 0) == 0) {
|
||||
const char *retval = start + regmatches[0].rm_so;
|
||||
@ -330,17 +330,17 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
return NULL;
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
#if !defined(NANO_SMALL) || !defined(DISABLE_SPELLER)
|
||||
#if !defined(NANO_TINY) || !defined(DISABLE_SPELLER)
|
||||
if (ISSET(CASE_SENSITIVE)) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(BACKWARDS_SEARCH))
|
||||
return revstrstr(haystack, needle, start);
|
||||
else
|
||||
#endif
|
||||
return strstr(start, needle);
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER || !NANO_SMALL */
|
||||
#ifndef NANO_SMALL
|
||||
#endif /* !DISABLE_SPELLER || !NANO_TINY */
|
||||
#ifndef NANO_TINY
|
||||
else if (ISSET(BACKWARDS_SEARCH))
|
||||
return mbrevstrcasestr(haystack, needle, start);
|
||||
#endif
|
||||
@ -508,7 +508,7 @@ void new_magicline(void)
|
||||
openfile->totsize++;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Remove the magicline from filebot, if there is one and it isn't the
|
||||
* only line in the file. */
|
||||
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
|
||||
* be the Begin key. */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* Reset all the input routines that rely on character sequences. */
|
||||
void reset_kbinput(void)
|
||||
{
|
||||
@ -131,7 +131,7 @@ void get_key_buffer(WINDOW *win)
|
||||
return;
|
||||
|
||||
/* Read in the first character using blocking input. */
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
@ -147,7 +147,7 @@ void get_key_buffer(WINDOW *win)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
|
||||
@ -162,7 +162,7 @@ void get_key_buffer(WINDOW *win)
|
||||
nodelay(win, TRUE);
|
||||
|
||||
while (TRUE) {
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
@ -181,7 +181,7 @@ void get_key_buffer(WINDOW *win)
|
||||
sizeof(int));
|
||||
key_buffer[key_buffer_len - 1] = input;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
}
|
||||
@ -204,7 +204,7 @@ size_t get_key_buffer_len(void)
|
||||
* keystroke buffer. */
|
||||
void unget_input(int *input, size_t input_len)
|
||||
{
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#endif
|
||||
@ -263,7 +263,7 @@ int *get_input(WINDOW *win, size_t input_len)
|
||||
{
|
||||
int *input;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
allow_pending_sigwinch(TRUE);
|
||||
allow_pending_sigwinch(FALSE);
|
||||
#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
|
||||
* we get a recognized value or sequence. */
|
||||
while ((kbinput = parse_kbinput(win, meta_key, func_key
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, FALSE
|
||||
#endif
|
||||
)) == 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
|
||||
* a function key. Assume nodelay(win) is FALSE. */
|
||||
int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
)
|
||||
@ -347,7 +347,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||
static int escapes = 0, byte_digits = 0;
|
||||
int *kbinput, retval = ERR;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (reset) {
|
||||
escapes = 0;
|
||||
byte_digits = 0;
|
||||
@ -379,9 +379,9 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||
escapes = 0;
|
||||
}
|
||||
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
|
||||
* 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. */
|
||||
case KEY_RESIZE:
|
||||
break;
|
||||
@ -548,7 +548,7 @@ int parse_kbinput(WINDOW *win, bool *meta_key, bool *func_key
|
||||
|
||||
byte_digits++;
|
||||
byte = get_byte_kbinput(*kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, FALSE
|
||||
#endif
|
||||
);
|
||||
@ -1149,7 +1149,7 @@ int get_escape_seq_abcd(int kbinput)
|
||||
/* Translate a byte sequence: turn a three-digit decimal number from
|
||||
* 000 to 255 into its corresponding byte value. */
|
||||
int get_byte_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
)
|
||||
@ -1157,7 +1157,7 @@ int get_byte_kbinput(int kbinput
|
||||
static int byte_digits = 0, byte = 0;
|
||||
int retval = ERR;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (reset) {
|
||||
byte_digits = 0;
|
||||
byte = 0;
|
||||
@ -1233,7 +1233,7 @@ int get_byte_kbinput(int kbinput
|
||||
* from 000000 to 10FFFF (case-insensitive) into its corresponding
|
||||
* multibyte value. */
|
||||
long get_unicode_kbinput(int kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, bool reset
|
||||
#endif
|
||||
)
|
||||
@ -1242,7 +1242,7 @@ long get_unicode_kbinput(int kbinput
|
||||
static long uni = 0;
|
||||
long retval = ERR;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (reset) {
|
||||
uni_digits = 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. */
|
||||
uni = get_unicode_kbinput(*kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, FALSE
|
||||
#endif
|
||||
);
|
||||
@ -1469,7 +1469,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
||||
while ((kbinput = get_input(win, 1)) == NULL);
|
||||
|
||||
uni = get_unicode_kbinput(*kbinput
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
, FALSE
|
||||
#endif
|
||||
);
|
||||
@ -1639,7 +1639,7 @@ const shortcut *get_shortcut(const shortcut *s_list, int *kbinput, bool
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
const toggle *get_toggle(int kbinput, bool meta_key)
|
||||
{
|
||||
const toggle *t = toggles;
|
||||
@ -1658,7 +1658,7 @@ const toggle *get_toggle(int kbinput, bool meta_key)
|
||||
|
||||
return t;
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Move to (x, y) in win, and display a line of n spaces with the
|
||||
* 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_mb == '\t') {
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
if (ISSET(WHITESPACE_DISPLAY)) {
|
||||
int i;
|
||||
|
||||
@ -1830,7 +1830,7 @@ char *display_string(const char *buf, size_t start_col, size_t len, bool
|
||||
free(ctrl_buf_mb);
|
||||
/* If buf contains a space character, interpret it. */
|
||||
} else if (*buf_mb == ' ') {
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
if (ISSET(WHITESPACE_DISPLAY)) {
|
||||
int i;
|
||||
|
||||
@ -2049,7 +2049,7 @@ void statusbar(const char *msg, ...)
|
||||
va_list ap;
|
||||
char *bar, *foo;
|
||||
size_t start_x, foo_len;
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
bool old_whitespace;
|
||||
#endif
|
||||
|
||||
@ -2066,7 +2066,7 @@ void statusbar(const char *msg, ...)
|
||||
/* Blank out the line. */
|
||||
blank_statusbar();
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
#if !defined(NANO_TINY) && defined(ENABLE_NANORC)
|
||||
old_whitespace = ISSET(WHITESPACE_DISPLAY);
|
||||
UNSET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
@ -2074,7 +2074,7 @@ void statusbar(const char *msg, ...)
|
||||
vsnprintf(bar, mb_cur_max() * (COLS - 3), msg, ap);
|
||||
va_end(ap);
|
||||
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)
|
||||
SET(WHITESPACE_DISPLAY);
|
||||
#endif
|
||||
@ -2102,7 +2102,7 @@ void statusbar(const char *msg, ...)
|
||||
* keystroke. Otherwise, blank it after twenty-five keystrokes,
|
||||
* as Pico does. */
|
||||
statusblank =
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(QUICK_BLANK) && !ISSET(CONST_UPDATE) ? 1 :
|
||||
#endif
|
||||
25;
|
||||
@ -2216,7 +2216,7 @@ void reset_cursor(void)
|
||||
void edit_draw(const filestruct *fileptr, const char *converted, int
|
||||
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);
|
||||
/* The position in fileptr->data of the leftmost character
|
||||
* 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 */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark is on, we need to display it. */
|
||||
if (openfile->mark_set && (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);
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif /* !NANO_TINY */
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
return
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set ||
|
||||
#endif
|
||||
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)
|
||||
{
|
||||
return
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set ||
|
||||
#endif
|
||||
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
|
||||
* then restore the original edittop. */
|
||||
edit_update(
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||
#endif
|
||||
CENTER);
|
||||
@ -2763,12 +2763,12 @@ void edit_redraw(const filestruct *old_current, size_t old_pww)
|
||||
if (do_redraw)
|
||||
update_line(foo, 0);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
if (!openfile->mark_set)
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
foo = (foo->lineno > openfile->current->lineno) ? foo->prev :
|
||||
foo->next;
|
||||
#endif
|
||||
@ -2791,7 +2791,7 @@ void edit_refresh(void)
|
||||
/* Put the top line of the edit window in range of the current
|
||||
* line. */
|
||||
edit_update(
|
||||
#ifndef NANO_SMALL
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||
#endif
|
||||
CENTER);
|
||||
|
Загрузка…
Ссылка в новой задаче
Block a user