2014-05-10 Chris Allegretta <chrisa@asty.org>

* src/rcfile.c (parse_color_names): Redefine false and true to
          their appropriate macro names so --with-slang works (slangv2 anyway).
        * src/text.c (do_linter): Care about whether user cancelled the file
          save (cancel the operation) versus justy said no (continue but don't
          save the file).  Also doupdate() after statusbar message that
          linter is being invoked and blank the shortcuts to draw the eye.
          Also allow user to cancel at the "open in a new buffer" prompt.
          New function lint_cleanup().  Fixes Savannah bug 42203.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4855 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2014-05-11 03:09:00 +00:00
parent a225841753
commit 61523be8d2
3 changed files with 41 additions and 10 deletions

View File

@ -1,3 +1,13 @@
2014-05-10 Chris Allegretta <chrisa@asty.org>
* src/rcfile.c (parse_color_names): Redefine false and true to
their appropriate macro names so --with-slang works (slangv2 anyway).
* src/text.c (do_linter): Care about whether user cancelled the file
save (cancel the operation) versus justy said no (continue but don't
save the file). Also doupdate() after statusbar message that
linter is being invoked and blank the shortcuts to draw the eye.
Also allow user to cancel at the "open in a new buffer" prompt.
New function lint_cleanup(). Fixes Savannah bug 42203.
2014-05-10 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Make syntax highlighting into a separate
section, and add the still missing section on rebinding keys.

View File

@ -846,7 +846,7 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
bool no_fgcolor = FALSE;
if (combostr == NULL)
return false;
return FALSE;
if (strchr(combostr, ',') != NULL) {
char *bgcolorname;
@ -860,7 +860,7 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
}
if (strncasecmp(bgcolorname, "bright", 6) == 0) {
rcfile_error(N_("Background color \"%s\" cannot be bright"), bgcolorname);
return false;
return FALSE;
}
*bg = color_to_short(bgcolorname, bright);
} else
@ -871,11 +871,11 @@ bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright)
/* Don't try to parse screwed-up foreground colors. */
if (*fg == -1)
return false;
return FALSE;
} else
*fg = -1;
return true;
return TRUE;
}
/* Parse the header-line regex that may influence the choice of syntax. */

View File

@ -2980,6 +2980,14 @@ void do_spell(void)
#endif /* !DISABLE_SPELLER */
#ifndef DISABLE_COLOR
/* Cleanup things to do after leaving the linter */
void lint_cleanup(void)
{
currmenu = MMAIN;
display_main_list();
}
/* Run linter. Based on alt-speller code. Return NULL for normal
* termination, and the error string otherwise. */
void do_linter(void)
@ -3010,9 +3018,13 @@ void do_linter(void)
if (openfile->modified) {
int i = do_yesno_prompt(FALSE,
_("Save modified buffer before linting?"));
if (i == 1) {
if (i == -1) {
statusbar(_("Cancelled"));
lint_cleanup();
return;
} else if (i == 1) {
if (do_writeout(FALSE) != TRUE) {
lint_cleanup();
return;
}
}
@ -3022,10 +3034,13 @@ void do_linter(void)
/* Create pipe up front. */
if (pipe(lint_fd) == -1) {
statusbar(_("Could not create pipe"));
lint_cleanup();
return;
}
blank_bottombars();
statusbar(_("Invoking linter, please wait"));
doupdate();
/* Set up an argument list to pass execvp(). */
if (lintargs == NULL) {
@ -3070,6 +3085,7 @@ void do_linter(void)
if (pid_lint < 0) {
close(lint_fd[0]);
statusbar(_("Could not fork"));
lint_cleanup();
return;
}
@ -3077,6 +3093,7 @@ void do_linter(void)
if ((pipe_buff_size = fpathconf(lint_fd[0], _PC_PIPE_BUF)) < 1) {
close(lint_fd[0]);
statusbar(_("Could not get size of pipe buffer"));
lint_cleanup();
return;
}
@ -3179,6 +3196,7 @@ void do_linter(void)
if (parsesuccess == 0) {
statusbar(_("Got 0 parsable lines from command: %s"), openfile->syntax->linter);
lint_cleanup();
return;
}
@ -3215,7 +3233,10 @@ void do_linter(void)
curlint->filename);
i = do_yesno_prompt(FALSE, msg);
free(msg);
if (i == 1) {
if (i == -1) {
statusbar(_("Cancelled"));
goto free_lints_and_return;
} else if (i == 1) {
SET(MULTIBUFFER);
open_buffer(curlint->filename, FALSE);
} else {
@ -3268,14 +3289,14 @@ void do_linter(void)
}
}
}
blank_statusbar();
free_lints_and_return:
for (tmplint = lints; tmplint != NULL; tmplint = tmplint->next) {
free(tmplint->msg);
free(tmplint->filename);
free(tmplint);
}
blank_statusbar();
currmenu = MMAIN;
display_main_list();
lint_cleanup();
}
#endif /* !DISABLE_COLOR */