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
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();
* 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 */
{
#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. */
}
#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
* 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
/* Mark the file as modified. */
set_modified();
- /* Update the screen. */
edit_refresh_needed = TRUE;
#ifndef DISABLE_COLOR
{
char *full_path = get_full_path(path);
- /* If get_full_path() fails, return NULL. */
if (full_path == NULL)
return NULL;
return NULL;
}
- /* Otherwise, return the full path. */
return full_path;
}
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);
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;
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);
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. */
wattroff(bottomwin, A_BOLD);
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
+
statusbar_pww = statusbar_xplustabs();
reset_statusbar_cursor();
wnoutrefresh(bottomwin);
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);
}
#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