+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.
bool no_fgcolor = FALSE;
if (combostr == NULL)
- return false;
+ return FALSE;
if (strchr(combostr, ',') != NULL) {
char *bgcolorname;
}
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
/* 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. */
#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)
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;
}
}
/* 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) {
if (pid_lint < 0) {
close(lint_fd[0]);
statusbar(_("Could not fork"));
+ lint_cleanup();
return;
}
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;
}
if (parsesuccess == 0) {
statusbar(_("Got 0 parsable lines from command: %s"), openfile->syntax->linter);
+ lint_cleanup();
return;
}
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 {
}
}
}
+ 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 */