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