mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-26 06:39:43 +03:00
feedback: upon first switch to a buffer, show its error message (if any)
When opening multiple files and some of them had an error, only the first message was shown and the others were lost -- indicated only by three dots. Improve upon this by storing the first error message for each buffer and showing this message when the buffer is first switched to. Requested-by: Mike Frysinger <vapier@gentoo.org>
This commit is contained in:
parent
e8db390d6f
commit
ede64d7ea0
@ -567,6 +567,8 @@ typedef struct openfilestruct {
|
||||
/* The syntax that applies to this file, if any. */
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
char *errormessage;
|
||||
/* The ALERT message (if any) that occurred when opening the file. */
|
||||
struct openfilestruct *next;
|
||||
/* The next open file, if any. */
|
||||
struct openfilestruct *prev;
|
||||
|
@ -92,6 +92,8 @@ void make_new_buffer(void)
|
||||
|
||||
openfile->statinfo = NULL;
|
||||
openfile->lock_filename = NULL;
|
||||
|
||||
openfile->errormessage = NULL;
|
||||
#endif
|
||||
#ifdef ENABLE_COLOR
|
||||
openfile->syntax = NULL;
|
||||
@ -558,6 +560,11 @@ void redecorate_after_switch(void)
|
||||
/* Prevent a possible Shift selection from getting cancelled. */
|
||||
shift_held = TRUE;
|
||||
|
||||
if (openfile->errormessage) {
|
||||
statusline(ALERT, openfile->errormessage);
|
||||
free(openfile->errormessage);
|
||||
openfile->errormessage = NULL;
|
||||
} else
|
||||
/* Indicate on the status bar where we switched to. */
|
||||
mention_name_and_linecount();
|
||||
}
|
||||
@ -595,6 +602,7 @@ void close_buffer(void)
|
||||
/* Free the undo stack. */
|
||||
discard_until(NULL);
|
||||
#endif
|
||||
free(orphan->errormessage);
|
||||
|
||||
openfile = orphan->prev;
|
||||
free(orphan);
|
||||
|
@ -2229,6 +2229,12 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
vsnprintf(compound, MAXCHARLEN * COLS + 1, msg, ap);
|
||||
va_end(ap);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (!we_are_running && importance == ALERT &&
|
||||
!openfile->errormessage && openfile->next != openfile)
|
||||
openfile->errormessage = copy_of(compound);
|
||||
#endif
|
||||
|
||||
/* If there are multiple alert messages, add trailing dots to the first. */
|
||||
if (lastmessage == ALERT) {
|
||||
if (start_col > 4) {
|
||||
|
Loading…
Reference in New Issue
Block a user