[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH] files: report an unwritable file in a separate mess
From: |
Benno Schulenberg |
Subject: |
[Nano-devel] [PATCH] files: report an unwritable file in a separate message |
Date: |
Sun, 29 May 2016 14:53:55 +0200 |
That is: don't mix the number of lines read with a warning about the
file being unwritable -- the former is just convenience information,
the latter is a must-see.
This fixes https://savannah.gnu.org/bugs/?48047.
---
src/files.c | 32 +++++---------------------------
1 file changed, 5 insertions(+), 27 deletions(-)
diff --git a/src/files.c b/src/files.c
index c76ac90..6fe4fcb 100644
--- a/src/files.c
+++ b/src/files.c
@@ -904,52 +904,30 @@ void read_file(FILE *f, int fd, const char *filename,
bool undoable, bool checkw
if (undoable)
update_undo(INSERT);
- if (format == 3) {
- if (writable)
+ if (!writable)
+ statusline(ALERT, "File '%s' is unwritable", filename);
+ else if (format == 3) {
statusline(HUSH,
+ /* TRANSLATORS: Keep the next four messages at most 76 characters.
*/
P_("Read %lu line (Converted from DOS and Mac format)",
"Read %lu lines (Converted from DOS and Mac format)",
(unsigned long)num_lines), (unsigned long)num_lines);
- else
- /* TRANSLATORS: Keep the next handful of messages at most 76
characters long. */
- statusline(ALERT,
- P_("Read %lu line (Converted from DOS and Mac format - NO write
permission)",
- "Read %lu lines (Converted from DOS and Mac format - NO write
permission)",
- (unsigned long)num_lines), (unsigned long)num_lines);
} else if (format == 2) {
openfile->fmt = MAC_FILE;
- if (writable)
statusline(HUSH,
P_("Read %lu line (Converted from Mac format)",
"Read %lu lines (Converted from Mac format)",
(unsigned long)num_lines), (unsigned long)num_lines);
- else
- statusline(ALERT,
- P_("Read %lu line (Converted from Mac format - Warning: No
write permission)",
- "Read %lu lines (Converted from Mac format - Warning: No write
permission)",
- (unsigned long)num_lines), (unsigned long)num_lines);
} else if (format == 1) {
openfile->fmt = DOS_FILE;
- if (writable)
statusline(HUSH,
P_("Read %lu line (Converted from DOS format)",
"Read %lu lines (Converted from DOS format)",
(unsigned long)num_lines), (unsigned long)num_lines);
- else
- statusline(ALERT,
- P_("Read %lu line (Converted from DOS format - Warning: No
write permission)",
- "Read %lu lines (Converted from DOS format - Warning: No write
permission)",
- (unsigned long)num_lines), (unsigned long)num_lines);
} else
-#endif
- if (writable)
+#endif /* !NANO_TINY */
statusline(HUSH, P_("Read %lu line", "Read %lu lines",
(unsigned long)num_lines), (unsigned long)num_lines);
- else
- statusline(ALERT,
- P_("Read %lu line (Warning: No write permission)",
- "Read %lu lines (Warning: No write permission)",
- (unsigned long)num_lines), (unsigned long)num_lines);
if (num_lines < editwinrows)
focusing = FALSE;
--
2.8.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Nano-devel] [PATCH] files: report an unwritable file in a separate message,
Benno Schulenberg <=