commit 22a01cad9e7746cf93a9367aec5819e539ea0969
parent 8585bf2dd402dcae4fe1179ed0f100844a295a3a
Author: Benno Schulenberg <bensberg@justemail.net>
Date: Sat, 6 Feb 2016 12:12:08 +0000
Rewrapping some lines and removing some useless comments.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5614 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
Diffstat:
4 files changed, 22 insertions(+), 40 deletions(-)
diff --git a/ChangeLog b/ChangeLog
@@ -9,6 +9,8 @@
always the same, and that are global variables anyway.
* src/prompt.c (update_bar_if_needed): Rename this for more contrast.
* src/prompt.c (do_statusbar_backspace): Avoid updating the bar twice.
+ * src/cut.c, src/files.c, src/prompt.c: Rewrap some lines and remove
+ some useless comments.
2016-02-05 Benno Schulenberg <bensberg@justemail.net>
* doc/texinfo/nano.texi: Condense the descriptions of command-key
diff --git a/src/cut.c b/src/cut.c
@@ -66,7 +66,7 @@ void cut_marked(void)
size_t top_x, bot_x;
mark_order((const filestruct **)&top, &top_x,
- (const filestruct **)&bot, &bot_x, NULL);
+ (const filestruct **)&bot, &bot_x, NULL);
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
openfile->placewewant = xplustabs();
@@ -105,9 +105,9 @@ void cut_to_eol(void)
* file into the cutbuffer. */
void cut_to_eof(void)
{
- move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
- openfile->current_x, openfile->filebot,
- strlen(openfile->filebot->data));
+ move_to_filestruct(&cutbuffer, &cutbottom,
+ openfile->current, openfile->current_x,
+ openfile->filebot, strlen(openfile->filebot->data));
}
#endif /* !NANO_TINY */
@@ -125,8 +125,7 @@ void do_cut_text(
{
#ifndef NANO_TINY
filestruct *cb_save = NULL;
- /* The current end of the cutbuffer, before we add text to
- * it. */
+ /* The current end of the cutbuffer, before we add text to it. */
size_t cb_save_len = 0;
/* The length of the string at the current end of the cutbuffer,
* before we add text to it. */
@@ -160,24 +159,20 @@ void do_cut_text(
}
#endif
- /* Set keep_cutbuffer to TRUE, so that the text we're going to move
- * into the cutbuffer will be added to the text already in the
- * cutbuffer instead of replacing it. */
+ /* Ensure that the text we're going to move into the cutbuffer will
+ * be added to the text already there, instead of replacing it. */
keep_cutbuffer = TRUE;
#ifndef NANO_TINY
if (cut_till_eof) {
- /* If cut_till_eof is TRUE, move all text up to the end of the
- * file into the cutbuffer. */
+ /* Move all text up to the end of the file into the cutbuffer. */
cut_to_eof();
} else if (openfile->mark_set) {
- /* If the mark is on, move the marked text to the cutbuffer, and
- * turn the mark off. */
+ /* Move the marked text to the cutbuffer, and turn the mark off. */
cut_marked();
openfile->mark_set = FALSE;
} else if (ISSET(CUT_TO_END))
- /* If the CUT_TO_END flag is set, move all text up to the end of
- * the line into the cutbuffer. */
+ /* Move all text up to the end of the line into the cutbuffer. */
cut_to_eol();
else
#endif
@@ -207,15 +202,10 @@ void do_cut_text(
* disturbing the text. */
if (!old_no_newlines)
UNSET(NO_NEWLINES);
- }
-
- /* Leave the text in the cutbuffer, and mark the file as
- * modified. */
- if (!copy_text)
+ } else
#endif /* !NANO_TINY */
set_modified();
- /* Update the screen. */
edit_refresh_needed = TRUE;
#ifndef DISABLE_COLOR
@@ -294,7 +284,6 @@ void do_uncut_text(void)
/* Mark the file as modified. */
set_modified();
- /* Update the screen. */
edit_refresh_needed = TRUE;
#ifndef DISABLE_COLOR
diff --git a/src/files.c b/src/files.c
@@ -1523,7 +1523,6 @@ char *check_writable_directory(const char *path)
{
char *full_path = get_full_path(path);
- /* If get_full_path() fails, return NULL. */
if (full_path == NULL)
return NULL;
@@ -1534,7 +1533,6 @@ char *check_writable_directory(const char *path)
return NULL;
}
- /* Otherwise, return the full path. */
return full_path;
}
diff --git a/src/prompt.c b/src/prompt.c
@@ -231,8 +231,7 @@ int do_statusbar_mouse(void)
int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE);
/* We can click on the statusbar window text to move the cursor. */
- if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x,
- FALSE)) {
+ if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE)) {
size_t start_col;
assert(prompt != NULL);
@@ -303,9 +302,8 @@ void do_statusbar_output(char *output, size_t output_len, bool
assert(statusbar_x <= answer_len);
- charmove(answer + statusbar_x + char_buf_len,
- answer + statusbar_x, answer_len - statusbar_x +
- char_buf_len);
+ charmove(answer + statusbar_x + char_buf_len, answer + statusbar_x,
+ answer_len - statusbar_x + char_buf_len);
strncpy(answer + statusbar_x, char_buf, char_buf_len);
answer_len += char_buf_len;
@@ -366,15 +364,13 @@ void do_statusbar_delete(void)
statusbar_pww = statusbar_xplustabs();
if (answer[statusbar_x] != '\0') {
- int char_buf_len = parse_mbchar(answer + statusbar_x, NULL,
- NULL);
+ int char_buf_len = parse_mbchar(answer + statusbar_x, NULL, NULL);
size_t line_len = strlen(answer + statusbar_x);
assert(statusbar_x < strlen(answer));
- charmove(answer + statusbar_x, answer + statusbar_x +
- char_buf_len, strlen(answer) - statusbar_x -
- char_buf_len + 1);
+ charmove(answer + statusbar_x, answer + statusbar_x + char_buf_len,
+ strlen(answer) - statusbar_x - char_buf_len + 1);
null_at(&answer, statusbar_x + line_len - char_buf_len);
@@ -478,7 +474,6 @@ void do_statusbar_verbatim_input(bool *got_enter)
free(output);
}
-
/* Return the placewewant associated with statusbar_x, i.e. the
* zero-based column position of the cursor. The value will be no
* smaller than statusbar_x. */
@@ -539,6 +534,7 @@ void update_the_statusbar(void)
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
+
statusbar_pww = statusbar_xplustabs();
reset_statusbar_cursor();
wnoutrefresh(bottomwin);
@@ -604,8 +600,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
update_the_statusbar();
- /* Refresh the edit window and the statusbar before getting
- * input. */
+ /* Refresh edit window and statusbar before getting input. */
wnoutrefresh(edit);
wnoutrefresh(bottomwin);
@@ -730,11 +725,9 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
}
#ifndef DISABLE_HISTORIES
- /* Set the current position in the history list to the bottom,
- * and free magichistory if we need to. */
+ /* Set the current position in the history list to the bottom. */
if (history_list != NULL) {
history_reset(*history_list);
-
free(magichistory);
}
#endif