From a338798559fb0f1b63bae2f8e2115507295f152e Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 3 May 2015 13:56:51 +0000 Subject: [PATCH] Adjusting a few comments and line wrappings. git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5222 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- ChangeLog | 1 + src/browser.c | 25 ++++++++---------------- src/nano.c | 53 +++++++++++++++++++++------------------------------ 3 files changed, 31 insertions(+), 48 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5d486685..cfe5075e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,7 @@ 2015-05-03 Benno Schulenberg * src/browser.c (browser_refresh): Display an ellipsis only when the filename is longer than the available space, not when it still fits. + * src/browser.c, src/nano.c: Adjust a few comments and line wrappings. 2015-04-28 Benno Schulenberg * src/color.c (color_update): Match the file regex of a syntax against diff --git a/src/browser.c b/src/browser.c index b366edf9..2a5e764d 100644 --- a/src/browser.c +++ b/src/browser.c @@ -543,14 +543,10 @@ void browser_refresh(void) { static int uimax_digits = -1; size_t i; - int col = 0; - /* The maximum number of columns that the filenames will take - * up. */ - int line = 0; - /* The maximum number of lines that the filenames will take - * up. */ + int line = 0, col = 0; + /* The current line and column while the list is getting displayed. */ char *foo; - /* The file information that we'll display. */ + /* The additional information that we'll display about a file. */ if (uimax_digits == -1) uimax_digits = digits(UINT_MAX); @@ -585,15 +581,13 @@ void browser_refresh(void) * "(dir)", or the file size, plus three columns for the * ellipsis. */ - /* Start highlighting the currently selected file or - * directory. */ + /* Start highlighting the currently selected file or directory. */ if (i == selected) wattron(edit, hilite_attribute); blank_line(edit, line, col, longest); - /* If dots is TRUE, we will display something like - * "...ename". */ + /* If dots is TRUE, we will display something like "...ename". */ if (dots) mvwaddstr(edit, line, col, "..."); mvwaddstr(edit, line, dots ? col + 3 : col, disp); @@ -613,14 +607,12 @@ void browser_refresh(void) /* If the file is a symlink that points to a directory, * display it as a directory. */ else - /* TRANSLATORS: Try to keep this at most 7 - * characters. */ + /* TRANSLATORS: Try to keep this at most 7 characters. */ foo = mallocstrcpy(NULL, _("(dir)")); } else if (S_ISDIR(st.st_mode)) { /* If the file is a directory, display it as such. */ if (strcmp(filetail, "..") == 0) { - /* TRANSLATORS: Try to keep this at most 12 - * characters. */ + /* TRANSLATORS: Try to keep this at most 12 characters. */ foo = mallocstrcpy(NULL, _("(parent dir)")); foomaxlen = 12; } else @@ -660,8 +652,7 @@ void browser_refresh(void) mvwaddstr(edit, line, col - foolen, foo); - /* Finish highlighting the currently selected file or - * directory. */ + /* Finish highlighting the currently selected file or directory. */ if (i == selected) wattroff(edit, hilite_attribute); diff --git a/src/nano.c b/src/nano.c index 8291cf3d..137f33c4 100644 --- a/src/nano.c +++ b/src/nano.c @@ -556,7 +556,8 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode, /* Unlink a node from the rest of the openfilestruct, and delete it. */ void unlink_opennode(openfilestruct *fileptr) { - assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && fileptr != fileptr->prev && fileptr != fileptr->next); + assert(fileptr != NULL && fileptr->prev != NULL && fileptr->next != NULL && + fileptr != fileptr->prev && fileptr != fileptr->next); fileptr->prev->next = fileptr->next; fileptr->next->prev = fileptr->prev; @@ -851,27 +852,23 @@ void usage(void) print_opt(_("-C "), _("--backupdir="), N_("Directory for saving unique backup files")); #endif - print_opt("-D", "--boldtext", - N_("Use bold instead of reverse video text")); + print_opt("-D", "--boldtext", N_("Use bold instead of reverse video text")); #ifndef NANO_TINY - print_opt("-E", "--tabstospaces", - N_("Convert typed tabs to spaces")); + print_opt("-E", "--tabstospaces", N_("Convert typed tabs to spaces")); #endif #ifndef DISABLE_MULTIBUFFER print_opt("-F", "--multibuffer", N_("Read a file into a new buffer by default")); #endif #ifndef NANO_TINY - print_opt("-G", "--locking", - N_("Use (vim-style) lock files")); + print_opt("-G", "--locking", N_("Use (vim-style) lock files")); #endif #ifndef DISABLE_HISTORIES print_opt("-H", "--historylog", N_("Log & read search/replace string history")); #endif #ifndef DISABLE_NANORC - print_opt("-I", "--ignorercfiles", - N_("Don't look at nanorc files")); + print_opt("-I", "--ignorercfiles", N_("Don't look at nanorc files")); #endif print_opt("-K", "--rebindkeypad", N_("Fix numeric keypad key confusion problem")); @@ -883,25 +880,21 @@ void usage(void) #endif print_opt("-O", "--morespace", N_("Use one more line for editing")); #ifndef DISABLE_HISTORIES - print_opt("-P", "--poslog", - N_("Log & read location of cursor position")); + print_opt("-P", "--poslog", N_("Log & read location of cursor position")); #endif #ifndef DISABLE_JUSTIFY - print_opt(_("-Q "), _("--quotestr="), - N_("Quoting string")); + print_opt(_("-Q "), _("--quotestr="), N_("Quoting string")); #endif print_opt("-R", "--restricted", N_("Restricted mode")); #ifndef NANO_TINY - print_opt("-S", "--smooth", - N_("Scroll by line instead of half-screen")); + print_opt("-S", "--smooth", N_("Scroll by line instead of half-screen")); #endif print_opt(_("-T <#cols>"), _("--tabsize=<#cols>"), N_("Set width of a tab to #cols columns")); #ifndef NANO_TINY print_opt("-U", "--quickblank", N_("Do quick statusbar blanking")); #endif - print_opt("-V", "--version", - N_("Print version information and exit")); + print_opt("-V", "--version", N_("Print version information and exit")); #ifndef NANO_TINY print_opt("-W", "--wordbounds", N_("Detect word boundaries more accurately")); @@ -915,12 +908,10 @@ void usage(void) N_("Fix Backspace/Delete confusion problem")); print_opt("-h", "--help", N_("Show this help text")); #ifndef NANO_TINY - print_opt("-i", "--autoindent", - N_("Automatically indent new lines")); + print_opt("-i", "--autoindent", N_("Automatically indent new lines")); print_opt("-k", "--cut", N_("Cut from cursor to end of line")); #endif - print_opt("-l", "--nofollow", - N_("Don't follow symbolic links, overwrite")); + print_opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite")); #ifndef DISABLE_MOUSE print_opt("-m", "--mouse", N_("Enable the use of the mouse")); #endif @@ -929,8 +920,7 @@ void usage(void) print_opt(_("-o "), _("--operatingdir="), N_("Set operating directory")); #endif - print_opt("-p", "--preserve", - N_("Preserve XON (^Q) and XOFF (^S) keys")); + print_opt("-p", "--preserve", N_("Preserve XON (^Q) and XOFF (^S) keys")); #ifndef DISABLE_NANORC print_opt("-q", "--quiet", N_("Silently ignore startup issues like rc file errors")); @@ -943,8 +933,7 @@ void usage(void) print_opt(_("-s "), _("--speller="), N_("Enable alternate speller")); #endif - print_opt("-t", "--tempfile", - N_("Auto save on exit, don't prompt")); + print_opt("-t", "--tempfile", N_("Auto save on exit, don't prompt")); print_opt("-v", "--view", N_("View mode (read-only)")); #ifndef DISABLE_WRAPPING print_opt("-w", "--nowrap", N_("Don't hard-wrap long lines")); @@ -1168,9 +1157,12 @@ void do_cancel(void) ; } -static struct sigaction pager_oldaction, pager_newaction; /* Original and temporary handlers for SIGINT. */ -static bool pager_sig_failed = FALSE; /* Did sigaction() fail without changing the signal handlers? */ -static bool pager_input_aborted = FALSE; /* Did someone invoke the pager and abort it via ^C? */ +static struct sigaction pager_oldaction, pager_newaction; + /* Original and temporary handlers for SIGINT. */ +static bool pager_sig_failed = FALSE; + /* Did sigaction() fail without changing the signal handlers? */ +static bool pager_input_aborted = FALSE; + /* Did someone invoke the pager and abort it via ^C? */ /* Things which need to be run regardless of whether * we finished the stdin pipe correctly or not. */ @@ -1238,8 +1230,7 @@ void stdin_pager(void) /* Initialize the signal handlers. */ void signal_init(void) { - /* Trap SIGINT and SIGQUIT because we want them to do useful - * things. */ + /* Trap SIGINT and SIGQUIT because we want them to do useful things. */ memset(&act, 0, sizeof(struct sigaction)); act.sa_handler = SIG_IGN; sigaction(SIGINT, &act, NULL); @@ -1314,7 +1305,7 @@ RETSIGTYPE do_suspend(int signal) kill(0, SIGSTOP); } -/* the subnfunc version */ +/* The version of above function that is bound to a key. */ void do_suspend_void(void) { if (ISSET(SUSPEND))