CVS code -
- General:
- Translation updates (see po/ChangeLog for details).
+ - Updated nano.1, nano.1.html, and nano.texi to fix an
+ inaccuracy in the description of -Q/--quotestr. (DLR)
+ - Set REG_EXTENDED in all regcomp() calls. (DLR)
+ - Minor cosmetic code cleanups. (DLR)
- configure.ac:
- Added pt_BR to ALL_LINGUAS (Jordi).
- files.c:
+ open_file()
+ - String change: "File "x" is a directory" -> ""x" is a
+ directory". (Jordi)
+ open_prevfile_void(), open_nextfile_void()
+ - Return the return values of open_prevfile() and
+ open_nextfile(), respectively, instead of (incorrectly)
+ calling them and returning 0. (DLR)
real_dir_from_tilde()
- Rework to use getpwent() exclusively and end reliance on
$HOME. Adapted from equivalent code in do_rcfile(). (DLR)
- Most likely fixed the check marked with FIXME, so that tab
completion works properly when we're trying to tab-complete a
username and the string already contains data. (DLR)
+- move.c:
+ page_up()
+ - Fix bug where current is moved up two lines when the up arrow
+ is pressed on the top line of the edit window; this causes a
+ segfault is the top line in the edit window is the second
+ line of the file, as the line current ends up on doesn't
+ exist. (Jeff Defouw)
+ do_down()
+ - Fix bug where, if the last line in the edit window is the
+ line before the magicline, and smooth scrolling is turned
+ off, pressing the down arrow on that last line centers the
+ cursor without updating the edit window. (Jeff DeFouw)
- nano.c:
do_next_word(), do_prev_word()
- If we're on the last/first line of the file, don't center the
- Rework to only call edit_refresh() unconditionally if
ENABLE_COLOR is defined; if it isn't, and we're not deleting
the end of the line, only call update_line(). (DLR)
+ do_wrap()
+ - Make sure wrapping is done properly when the number of
+ characters on the line is exactly one over the limit. (David
+ Benbennick)
+ do_alt_speller()
+ - Readd DLR's fix to preserve marking when using the alternate
+ spell checker; it was accidentally dropped. (David
+ Benbennick)
+ do_justify()
+ - Fix cosmetic problems caused when justifying on the
+ magicline. (David Benbennick)
+- nano.h:
+ - Change search toggles for case sensitive searching and regexp
+ searching to M-C and M-R, respectively. (DLR; suggested by
+ Chris)
+- TODO:
+ - Add entry in the 1.4 section for Pico's paragraph searching
+ ability (at the search prompt, ^W goes to the paragraph's
+ beginning, and ^O goes to the paragraph's end). (DLR)
GNU nano 1.1.10 - 07/25/2002
- General:
For version 1.4:
- UTF-8 support.
+- Support for Pico's paragraph searching ability.
- Undo/Redo key?
Old requests:
for (tmpsyntax = syntaxes; tmpsyntax != NULL; tmpsyntax = tmpsyntax->next) {
exttype *e;
for (e = tmpsyntax->extensions; e != NULL; e = e->next) {
- regcomp(&syntaxfile_regexp, e->val, 0);
+ regcomp(&syntaxfile_regexp, e->val, REG_EXTENDED);
/* Set colorstrings if we matched the extension regex */
- if (!regexec(&syntaxfile_regexp, filename, 1, synfilematches, 0))
- colorstrings = tmpsyntax->color;
+ if (!regexec(&syntaxfile_regexp, filename, 1, synfilematches, 0))
+ colorstrings = tmpsyntax->color;
regfree(&syntaxfile_regexp);
}
#define _(string) (string)
#endif
-/* statics for here */
#ifndef NANO_SMALL
static int fileformat = 0; /* 0 = *nix, 1 = DOS, 2 = Mac */
#endif
if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
S_ISBLK(fileinfo.st_mode)) {
if (S_ISDIR(fileinfo.st_mode))
- statusbar(_("File \"%s\" is a directory"), filename);
+ statusbar(_("\"%s\" is a directory"), filename);
else
/* Don't open character or block files. Sorry, /dev/sndstat! */
statusbar(_("File \"%s\" is a device file"), filename);
/* This function is used by the shortcut list. */
int open_prevfile_void(void)
{
- open_prevfile(0);
- return 0;
+ return open_prevfile(0);
}
/*
/* This function is used by the shortcut list. */
int open_nextfile_void(void)
{
- open_nextfile(0);
- return 0;
+ return open_nextfile(0);
}
/*
}
/* Initialize a struct *without* our lovely braces =( */
-static void sc_init_one(shortcut **shortcutage, int key,
- const char *desc,
+void sc_init_one(shortcut **shortcutage, int key, const char *desc,
#ifndef DISABLE_HELP
- const char *help,
+ const char *help,
#endif
- int alt, int misc1, int misc2, int view,
- int (*func) (void))
+ int alt, int misc1, int misc2, int view, int (*func) (void))
{
shortcut *s;
#ifndef NANO_SMALL
/* Create one new toggle structure, at the end of the toggles
* linked list. */
-static void toggle_init_one(int val, const char *desc, int flag)
+void toggle_init_one(int val, const char *desc, int flag)
{
toggle *u;
#ifdef DEBUG
/* Deallocate all of the toggles. */
-static void free_toggles(void)
+void free_toggles(void)
{
while (toggles != NULL) {
toggle *pt = toggles; /* Think "previous toggle" */
}
#endif
-static void toggle_init(void)
+void toggle_init(void)
{
char *toggle_const_msg, *toggle_autoindent_msg, *toggle_suspend_msg,
*toggle_nohelp_msg, *toggle_picomode_msg, *toggle_mouse_msg,
#endif /* !NANO_SMALL */
/* Deallocate the given shortcut. */
-static void free_shortcutage(shortcut **shortcutage)
+void free_shortcutage(shortcut **shortcutage)
{
assert(shortcutage != NULL);
while (*shortcutage != NULL) {
line and don't center it. */
if (edittop != fileage)
center_cursor();
- else {
- current = current->prev;
+ else
reset_cursor();
- }
}
} else
current_y = 0;
} else
#endif
{
- edit_update(editbot->next, CENTER);
- /* sets edittop so editbot->next is centered */
+ /* Set edittop so editbot->next (or else editbot) is
+ * centered, and set current_y = editwinrows / 2. */
+ edit_update(editbot->next != NULL ? editbot->next : editbot, CENTER);
center_cursor();
- /* sets current_y = editwinrows / 2 */
}
} else {
update_line(current->prev, 0);
.\" Public License for copying conditions. There is NO warranty.
.\"
.\" $Id$
-.TH NANO 1 "July 14, 2002"
+.TH NANO 1 "July 30, 2002"
.\" Please adjust this date whenever revising the manpage.
.\"
.SH NAME
Disable automatic conversion of files from DOS/Mac format.
.TP
.B \-Q \fI[str]\fP (\-\-quotestr=\fI[str]\fP)
-Set the quoting string for justifying. The default is "> ".
+Set the quoting string for justifying. The default is
+"^([ \\t]*[|>:}#])+" if regular expression support is available, or
+"> " otherwise.
.TP
.B \-R (\-\-regexp)
Enable regular expression matching for search strings, as well as
<HTML><HEAD><TITLE>Manpage of NANO</TITLE>
</HEAD><BODY>
<H1>NANO</H1>
-Section: User Commands (1)<BR>Updated: July 14, 2002<BR><A HREF="#index">Index</A>
+Section: User Commands (1)<BR>Updated: July 30, 2002<BR><A HREF="#index">Index</A>
<A HREF="http://localhost/cgi-bin/man/man2html">Return to Main Contents</A><HR>
<DT><B>-Q </B><I>[str]</I> (--quotestr=<I>[str]</I>)
<DD>
-Set the quoting string for justifying. The default is "> ".
+Set the quoting string for justifying. The default is
+"^([ \t]*[|>:}#])+" if regular expression support is available, or
+"> " otherwise.
<DT><B>-R (--regexp)</B>
<DD>
This document was created by
<A HREF="http://localhost/cgi-bin/man/man2html">man2html</A>,
using the manual pages.<BR>
-Time: 00:51:19 GMT, July 14, 2002
+Time: 21:12:05 GMT, July 30, 2002
</BODY>
</HTML>
#endif
#ifndef DISABLE_WRAPJUSTIFY
-/* Former global, now static */
static int fill = 0; /* Fill - where to wrap lines, basically */
#endif
static sigjmp_buf jmpbuf; /* Used to return to mainloop after SIGWINCH */
/* What we do when we're all set to exit */
-static RETSIGTYPE finish(int sigage)
+RETSIGTYPE finish(int sigage)
{
keypad(edit, TRUE);
keypad(bottomwin, TRUE);
/* Die with an error message that the screen was too small if, well, the
* screen is too small. */
-static void die_too_small(void)
+void die_too_small(void)
{
die(_("Window size is too small for nano...\n"));
}
/* Initialize global variables - no better way for now. If
* save_cutbuffer is nonzero, don't set cutbuffer to NULL. */
-static void global_init(int save_cutbuffer)
+void global_init(int save_cutbuffer)
{
current_x = 0;
current_y = 0;
/* Print one usage string to the screen, removes lots of duplicate
* strings to translate and takes out the parts that shouldn't be
* translatable (the flag names). */
-static void print1opt(const char *shortflag, const char *longflag,
+void print1opt(const char *shortflag, const char *longflag,
const char *desc)
{
printf(" %s\t", shortflag);
printf("%s\n", desc);
}
-static void usage(void)
+void usage(void)
{
#ifdef HAVE_GETOPT_LONG
printf(_("Usage: nano [+LINE] [GNU long option] [option] [file]\n\n"));
exit(0);
}
-static void version(void)
+void version(void)
{
printf(_(" GNU nano version %s (compiled %s, %s)\n"),
VERSION, __TIME__, __DATE__);
int wrap_loc = -1; /* index of inptr->data where we wrap */
int word_back = -1;
#ifndef NANO_SMALL
- char *indentation = NULL; /* indentation to prepend to the new line */
+ const char *indentation = NULL;
+ /* indentation to prepend to the new line */
int indent_len = 0; /* strlen(indentation) */
#endif
- char *after_break; /* text after the wrap point */
+ const char *after_break; /* text after the wrap point */
int after_break_len; /* strlen(after_break) */
int wrapping = 0; /* do we prepend to the next line? */
- char *wrap_line = NULL; /* the next line, minus indentation */
+ const char *wrap_line = NULL;
+ /* the next line, minus indentation */
int wrap_line_len = 0; /* strlen(wrap_line) */
char *newline = NULL; /* the line we create */
int new_line_len = 0; /* eventual length of newline */
/* There are three steps. First, we decide where to wrap. Then, we
* create the new wrap line. Finally, we clean up. */
- /* Is it necessary to do anything? */
- if (strlenpt(inptr->data) <= fill)
- return 0;
-
/* Step 1, finding where to wrap. We are going to replace a white-space
* character with a new-line. In this step, we set wrap_loc as the
* location of this replacement.
* Note that the initial indentation does not count as a legal wrap
* point if we are going to auto-indent!
*
- * Note that the code below could be optimised, by not calling strlenpt
- * so often, and by not calling isspace(inptr->data[i+1]) and then in
- * the next loop calling isspace(inptr->data[i]). Oh well, fixing the
- * first point would entail expanding the definition of strnlenpt, which
- * I won't do since it will probably change soon. Fixing the second
- * point would entail nested loops. */
+ * Note that the code below could be optimised, by not calling strnlenpt()
+ * so often. */
#ifndef NANO_SMALL
if (ISSET(AUTOINDENT))
i = indent_length(inptr->data);
#endif
- for(; i < len; i++) {
+ wrap_line = inptr->data + i;
+ for(; i < len; i++, wrap_line++) {
/* record where the last word ended */
- if (!isspace((int)inptr->data[i]))
+ if (*wrap_line != ' ' && *wrap_line != '\t')
word_back = i;
/* if we have found a "legal wrap point" and the current word
* extends too far, then we stop */
- if (wrap_loc != -1 && strnlenpt(inptr->data,word_back) > fill)
+ if (wrap_loc != -1 && strnlenpt(inptr->data, word_back + 1) > fill)
break;
/* we record the latest "legal wrap point" */
- if (i != (current_x - 1) && isspace((int)inptr->data[i]) &&
- (i == (len - 1) || !isspace((int)inptr->data[i + 1]))) {
+ if (i != current_x - 1 && word_back != i &&
+ wrap_line[1] != ' ' && wrap_line[1] != '\t')
wrap_loc = i;
- }
}
- if (wrap_loc < 0 || wrap_loc == len - 1 || i == len)
+ if (wrap_loc < 0 || i == len)
return 0;
/* Step 2, making the new wrap line. It will consist of indentation +
}
#endif
strcat(newline, after_break);
- after_break = NULL;
/* We end the old line at wrap_loc. Note this eats the space. */
null_at(&inptr->data, wrap_loc);
if (wrapping) {
}
#ifndef DISABLE_SPELLER
-static int do_int_spell_fix(const char *word)
+int do_int_spell_fix(const char *word)
{
char *save_search;
char *save_replace;
{
int alt_spell_status, lineno_cur = current->lineno;
int x_cur = current_x, y_cur = current_y, pww_cur = placewewant;
-#ifndef NANO_SMALL
- int mark_set;
-#endif
pid_t pid_spell;
char *ptr;
static int arglen = 3;
- static char **spellargs = (char **) NULL;
-
+ static char **spellargs = (char **)NULL;
#ifndef NANO_SMALL
- mark_set = ISSET(MARK_ISSET);
- UNSET(MARK_ISSET);
+ int mark_set = ISSET(MARK_ISSET);
+ int mbb_lineno_cur = 0;
+ /* We're going to close the current file, and open the output of
+ the alternate spell command. The line that mark_beginbuf
+ points to will be freed, so we save the line number and restore
+ afterwards. */
+
+ if (mark_set) {
+ mbb_lineno_cur = mark_beginbuf->lineno;
+ UNSET(MARK_ISSET);
+ }
#endif
endwin();
open_file(file_name, 0, 1);
#ifndef NANO_SMALL
- if (mark_set)
+ if (mark_set) {
+ do_gotopos(mbb_lineno_cur, mark_beginx, y_cur, 0);
+ mark_beginbuf = current;
+ mark_beginx = current_x;
+ /* In case the line got shorter, assign mark_beginx. */
SET(MARK_ISSET);
+ }
#endif
/* go back to the old position, mark the file as modified, and make
}
/* Restore the suspend handler when we come back into the prog */
-static RETSIGTYPE do_cont(int signal)
+RETSIGTYPE do_cont(int signal)
{
/* Now we just update the screen instead of having to reenable the
SIGTSTP handler. */
* justify_format will not look at the first skip characters of line.
* skip should be at most strlen(line->data). The skip+1st character must
* not be whitespace. */
-static int justify_format(int changes_allowed, filestruct *line,
- size_t skip) {
+int justify_format(int changes_allowed, filestruct *line, size_t skip)
+{
char *back, *front;
/* These four asserts are assumptions about the input data. */
* Note that if !HAVE_REGEX_H then we match concatenated copies of
* quotestr. */
#ifdef HAVE_REGEX_H
-static size_t quote_length(const char *line, const regex_t *qreg) {
+size_t quote_length(const char *line, const regex_t *qreg)
+{
regmatch_t matches;
int rc = regexec(qreg, line, 1, &matches, 0);
return matches.rm_eo;
}
#else /* !HAVE_REGEX_H */
-static size_t quote_length(const char *line) {
+size_t quote_length(const char *line)
+{
size_t qdepth = 0;
size_t qlen = strlen(quotestr);
/* a_line and b_line are lines of text. The quotation part of a_line is
* the first a_quote characters. Check that the quotation part of
* b_line is the same. */
-static int quotes_match(const char *a_line, size_t a_quote,
- IFREG(const char *b_line, const regex_t *qreg)) {
+int quotes_match(const char *a_line, size_t a_quote,
+ IFREG(const char *b_line, const regex_t *qreg))
+{
/* Here is the assumption about a_quote: */
assert(a_quote == quote_length(IFREG(a_line, qreg)));
return a_quote == quote_length(IFREG(b_line, qreg)) &&
/* We assume a_line and b_line have no quote part. Then, we return whether
* b_line could follow a_line in a paragraph. */
-static size_t indents_match(const char *a_line, size_t a_indent,
- const char *b_line, size_t b_indent) {
+size_t indents_match(const char *a_line, size_t a_indent,
+ const char *b_line, size_t b_indent)
+{
assert(a_indent == indent_length(a_line));
assert(b_indent == indent_length(b_line));
* buffer. We assume there are enough lines after first_line. We leave
* copies of the lines in place, too. We return the new copy of
* first_line. */
-static filestruct *backup_lines(filestruct *first_line, size_t par_len,
- size_t quote_len) {
+filestruct *backup_lines(filestruct *first_line, size_t par_len,
+ size_t quote_len)
+{
/* We put the original lines, not copies, into the cut buffer, just
* out of a misguided sense of consistency, so if you un-cut, you
* get the actual same paragraph back, not a copy. */
* no such space, and force is not 0, then we find the first space.
* Anyway, we then take the last space in that group of spaces. The
* terminating '\0' counts as a space. */
-static int break_line(const char *line, int goal, int force) {
+int break_line(const char *line, int goal, int force)
+{
/* Note that we use int instead of size_t, since goal is at most COLS,
* the screen width, which will always be reasonably small. */
int space_loc = -1;
#endif /* !DISABLE_JUSTIFY */
/* This function justifies the current paragraph. */
-int do_justify(void) {
+int do_justify(void)
+{
#ifdef DISABLE_JUSTIFY
nano_disabled_msg();
return 1;
quote_len = quote_length(IFREG(current->data, &qreg));
indent_len = indent_length(current->data + quote_len);
+ current_x = 0;
if (current->data[quote_len + indent_len] != '\0') {
/* This line is part of a paragraph. So we must search back to
* the first line of this paragraph. */
/* indentation length of the previous line */
size_t temp_id_len =
indent_length(current->prev->data + quote_len);
+
if (!indents_match(current->prev->data + quote_len,
temp_id_len, current->data + quote_len,
indent_len) ||
break;
indent_len = temp_id_len;
current = current->prev;
+ current_y--;
}
}
} else {
* to a non "blank" line. */
do {
/* There is no next paragraph, so nothing to justify. */
- if (current->next == NULL)
+ if (current->next == NULL) {
+ placewewant = 0;
+ if (current_y > editwinrows - 4)
+ edit_update(current, CENTER);
+ else
+ edit_refresh();
return 0;
+ }
current = current->next;
+ current_y++;
quote_len = quote_length(IFREG(current->data, &qreg));
indent_len = indent_length(current->data + quote_len);
} while (current->data[quote_len + indent_len] == '\0');
/* The line is too long. Try to wrap it to the next. */
break_pos = break_line(current->data + indent_len,
fill - strnlenpt(current->data, indent_len),
- 1);
+ 1);
if (break_pos == -1 || break_pos + indent_len == line_len)
/* We can't break the line, or don't need to, so just go
* on to the next. */
current = current->next;
}
} else
-continue_loc:
+ continue_loc:
current = current->next;
}
/* We are now done justifying the paragraph. There are cleanup things to
* fileage, set current_x. Also, edit_refresh() needs the line
* numbers to be right, so we renumber(). */
last_par_line = current->prev;
- if (first_mod_line != NULL && first_mod_line->prev == NULL)
- fileage = first_mod_line;
- current_x = 0;
- if (first_mod_line != NULL)
+ if (first_mod_line != NULL) {
+ if (first_mod_line->prev == NULL)
+ fileage = first_mod_line;
renumber(first_mod_line);
+ }
if (current_y > editwinrows - 4)
edit_update(current, CENTER);
#endif
}
-
#ifndef DISABLE_HELP
/* This function allocates help_text, and stores the help string in it.
* help_text should be NULL initially. */
#endif
#ifndef NANO_SMALL
-static void do_toggle(const toggle *which)
+void do_toggle(const toggle *which)
{
int enabled;
#define TOGGLE_PICOMODE_KEY NANO_ALT_P
#define TOGGLE_MOUSE_KEY NANO_ALT_M
#define TOGGLE_CUTTOEND_KEY NANO_ALT_K
-#define TOGGLE_REGEXP_KEY NANO_ALT_E
+#define TOGGLE_REGEXP_KEY NANO_ALT_R
#define TOGGLE_WRAP_KEY NANO_ALT_W
#define TOGGLE_BACKWARDS_KEY NANO_ALT_B
-#define TOGGLE_CASE_KEY NANO_ALT_A
+#define TOGGLE_CASE_KEY NANO_ALT_C
#define TOGGLE_LOAD_KEY NANO_ALT_F
#define TOGGLE_DOS_KEY NANO_ALT_D
#define TOGGLE_MAC_KEY NANO_ALT_O
@smallbook
@set EDITION 0.1
@set VERSION 1.1.10
-@set UPDATED 14 Jul 2002
+@set UPDATED 30 Jul 2002
@dircategory Editors
@direntry
Do not convert files from DOS/Mac format.
@item -Q [str], --quotestr [str]
+Set the quoting string for justifying. The default is
+"^([ \t]*[|>:@}#])+" if regular expression support is available, or
+"> " otherwise.
+
Set the quoting string for justifying. The default is "> ".
@item -R, --regexp
#define _(string) (string)
#endif
-/* Static stuff for the nanorc file */
static rcoption rcopts[] = {
#ifndef NANO_SMALL
{"autoindent", AUTOINDENT},
/* We have an error in some part of the rcfile; put it on stderr and
make the user hit return to continue starting up nano. */
-static void rcfile_error(const char *msg, ...)
+void rcfile_error(const char *msg, ...)
{
va_list ap;
}
/* Just print the error (one of many, perhaps) but don't abort, yet. */
-static void rcfile_msg(const char *msg, ...)
+void rcfile_msg(const char *msg, ...)
{
va_list ap;
}
/* Parse the next word from the string. Returns NULL if we hit EOL. */
-static char *parse_next_word(char *ptr)
+char *parse_next_word(char *ptr)
{
while (*ptr != ' ' && *ptr != '\t' && *ptr != '\n' && *ptr != '\0')
ptr++;
* next word starts with a ", we say it ends with the last " of the line.
* Otherwise, the word is interpreted as usual. That is so the arguments
* can contain "s too. */
-static char *parse_argument(char *ptr) {
+char *parse_argument(char *ptr)
+{
const char *ptr_bak = ptr;
char *last_quote = NULL;
#ifdef ENABLE_COLOR
-static char *parse_next_regex(char *ptr)
+char *parse_next_regex(char *ptr)
{
while ((*ptr != '"' || (*(ptr + 1) != ' ' && *(ptr + 1) != '\n'))
&& *ptr != '\n' && *ptr != '\0')
return ptr;
}
-static int colortoint(const char *colorname, int *bright)
+int colortoint(const char *colorname, int *bright)
{
int mcolor = 0;
return mcolor;
}
-static void parse_syntax(char *ptr)
+void parse_syntax(char *ptr)
{
syntaxtype *tmpsyntax = NULL;
const char *fileregptr = NULL, *nameptr = NULL;
}
/* Parse the color stuff into the colorstrings array */
-static void parse_colors(char *ptr)
+void parse_colors(char *ptr)
{
int fg, bg, bright = 0;
int expectend = 0; /* Do we expect an end= line? */
#endif /* ENABLE_COLOR */
/* Parse the RC file, once it has been opened successfully */
-static void parse_rcfile(FILE *rcstream)
+void parse_rcfile(FILE *rcstream)
{
char *buf, *ptr, *keyword, *option;
int set = 0, i, j;
#ifdef HAVE_REGEX_H
void regexp_init(const char *regexp)
{
- regcomp(&search_regexp, regexp, ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE);
+ regcomp(&search_regexp, regexp, (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE) | REG_EXTENDED);
SET(REGEXP_COMPILED);
}
replacing = 1 if we call from do_replace, 0 if called from do_search func.
*/
-static int search_init(int replacing)
+int search_init(int replacing)
{
int i = 0;
char *buf;
int i = 1;
if (n < 0)
- n = 0 - n;
+ n = -n;
while (n > 10) {
n /= 10;
/* None of this is needed if we're using NANO_SMALL! */
#ifndef NANO_SMALL
-static const char *revstrstr(const char *haystack, const char *needle,
+const char *revstrstr(const char *haystack, const char *needle,
const char *rev_start)
{
for(; rev_start >= haystack ; rev_start--) {
return NULL;
}
-static const char *revstristr(const char *haystack, const char *needle,
+const char *revstristr(const char *haystack, const char *needle,
const char *rev_start)
{
for (; rev_start >= haystack; rev_start--) {
#define _(string) (string)
#endif
-/* winio.c statics */
static int statblank = 0; /* Number of keystrokes left after
we call statusbar(), before we
actually blank the statusbar */
-/* Local Function Prototypes for only winio.c */
-static int get_page_start(int column);
-
-/* Window I/O */
-
int do_first_line(void)
{
current = fileage;
return strnlenpt(buf, -1);
}
-/* Resets current_y, based on the position of current, and puts the
- * cursor at (current_y, current_x). */
-void reset_cursor(void)
-{
- const filestruct *ptr = edittop;
- size_t x;
-
- /* Yuck. This condition can be true after open_file when opening the
- * first file. */
- if (edittop == NULL)
- return;
-
- current_y = 0;
-
- while (ptr != current && ptr != editbot && ptr->next != NULL) {
- ptr = ptr->next;
- current_y++;
- }
-
- x = xplustabs();
- wmove(edit, current_y, x - get_page_start(x));
-}
-
void blank_bottombars(void)
{
if (!no_help()) {
*
* Note that we must turn on A_REVERSE here, since do_help turns it
* off! */
-static void nanoget_repaint(const char *buf, const char *inputbuf,
- int x)
+void nanoget_repaint(const char *buf, const char *inputbuf, int x)
{
int len = strlen(buf) + 2;
int wid = COLS - len;
/* Get the input from the kb; this should only be called from
* statusq(). */
-static int nanogetstr(int allowtabs, const char *buf, const char *def,
+int nanogetstr(int allowtabs, const char *buf, const char *def,
const shortcut *s
#ifndef DISABLE_TABCOMP
, int *list
* keystroke is e.g. "^G" and desc is e.g. "Get Help".
* We are careful to write exactly len characters, even if len is
* very small and keystroke and desc are long. */
-static void onekey(const char *keystroke, const char *desc, int len)
+void onekey(const char *keystroke, const char *desc, int len)
{
wattron(bottomwin, A_REVERSE);
waddnstr(bottomwin, keystroke, len);
}
}
-static void clear_bottomwin(void)
+void clear_bottomwin(void)
{
if (ISSET(NO_HELP))
return;
return get_page_start_virtual(page) + COLS - 1;
}
-static int get_page_start(int column)
+int get_page_start(int column)
{
assert(COLS > 9);
return column < COLS - 1 ? 0 : column - 7 - (column - 8) % (COLS - 9);
}
+/* Resets current_y, based on the position of current, and puts the
+ * cursor at (current_y, current_x). */
+void reset_cursor(void)
+{
+ const filestruct *ptr = edittop;
+ size_t x;
+
+ /* Yuck. This condition can be true after open_file when opening the
+ * first file. */
+ if (edittop == NULL)
+ return;
+
+ current_y = 0;
+
+ while (ptr != current && ptr != editbot && ptr->next != NULL) {
+ ptr = ptr->next;
+ current_y++;
+ }
+
+ x = xplustabs();
+ wmove(edit, current_y, x - get_page_start(x));
+}
#ifndef NANO_SMALL
/* This takes care of the case where there is a mark that covers only */
/* First, highlight all single-line regexes */
k = start;
- regcomp(&color_regexp, tmpcolor->start, 0);
+ regcomp(&color_regexp, tmpcolor->start, REG_EXTENDED);
while (!regexec(&color_regexp, &fileptr->data[k], 1,
colormatches, 0)) {
s = fileptr;
while (s != NULL) {
- regcomp(&color_regexp, tmpcolor->start, 0);
+ regcomp(&color_regexp, tmpcolor->start, REG_EXTENDED);
if (!regexec
(&color_regexp, s->data, 1, colormatches, 0)) {
regfree(&color_regexp);
e = s;
while (e != NULL && e != fileptr) {
- regcomp(&color_regexp, tmpcolor->end, 0);
+ regcomp(&color_regexp, tmpcolor->end, REG_EXTENDED);
if (!regexec
(&color_regexp, e->data, 1, colormatches, 0)) {
regfree(&color_regexp);
continue; /* There's an end before us */
else { /* Keep looking for an end */
while (e != NULL) {
- regcomp(&color_regexp, tmpcolor->end, 0);
+ regcomp(&color_regexp, tmpcolor->end, REG_EXTENDED);
if (!regexec
(&color_regexp, e->data, 1, colormatches,
0)) {
ematch = colormatches[0].rm_eo;
while (e != NULL) {
- regcomp(&color_regexp, tmpcolor->end, 0);
+ regcomp(&color_regexp, tmpcolor->end, REG_EXTENDED);
if (!regexec
(&color_regexp, e->data, 1,
colormatches, 0)) {