tweaks: rename three variables, to follow the general scheme
Also rewrap a line, reshuffle two others, and remove two redundant comments.
Этот коммит содержится в:
родитель
42b7dea14b
Коммит
fdc0b0ac24
@ -263,8 +263,7 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
|||||||
if (top == bot) {
|
if (top == bot) {
|
||||||
taken = make_new_node(NULL);
|
taken = make_new_node(NULL);
|
||||||
taken->data = measured_copy(top->data + top_x, bot_x - top_x);
|
taken->data = measured_copy(top->data + top_x, bot_x - top_x);
|
||||||
memmove(top->data + top_x, top->data + bot_x,
|
memmove(top->data + top_x, top->data + bot_x, strlen(top->data + bot_x) + 1);
|
||||||
strlen(top->data + bot_x) + 1);
|
|
||||||
last = taken;
|
last = taken;
|
||||||
} else if (top_x == 0 && bot_x == 0) {
|
} else if (top_x == 0 && bot_x == 0) {
|
||||||
taken = top;
|
taken = top;
|
||||||
@ -695,15 +694,13 @@ void copy_text(void)
|
|||||||
/* Copy text from the cutbuffer into the current buffer. */
|
/* Copy text from the cutbuffer into the current buffer. */
|
||||||
void paste_text(void)
|
void paste_text(void)
|
||||||
{
|
{
|
||||||
/* Remember where the paste started. */
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
/* Remember where the paste started. */
|
||||||
linestruct *was_current = openfile->current;
|
linestruct *was_current = openfile->current;
|
||||||
bool had_anchor = was_current->has_anchor;
|
bool had_anchor = was_current->has_anchor;
|
||||||
#endif
|
#endif
|
||||||
ssize_t was_lineno = openfile->current->lineno;
|
ssize_t was_lineno = openfile->current->lineno;
|
||||||
/* The line number where we started the paste. */
|
|
||||||
size_t was_leftedge = 0;
|
size_t was_leftedge = 0;
|
||||||
/* The leftedge where we started the paste. */
|
|
||||||
|
|
||||||
if (cutbuffer == NULL) {
|
if (cutbuffer == NULL) {
|
||||||
statusline(AHEM, _("Cutbuffer is empty"));
|
statusline(AHEM, _("Cutbuffer is empty"));
|
||||||
@ -722,7 +719,7 @@ void paste_text(void)
|
|||||||
copy_from_buffer(cutbuffer);
|
copy_from_buffer(cutbuffer);
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Wipe any anchors in the pasted text, so that they don't move around. */
|
/* Wipe any anchors in the pasted text, so that they don't proliferate. */
|
||||||
for (linestruct *line = was_current; line != openfile->current->next; line = line->next)
|
for (linestruct *line = was_current; line != openfile->current->next; line = line->next)
|
||||||
line->has_anchor = FALSE;
|
line->has_anchor = FALSE;
|
||||||
|
|
||||||
|
@ -973,10 +973,10 @@ bool execute_command(const char *command)
|
|||||||
{
|
{
|
||||||
int from_fd[2], to_fd[2];
|
int from_fd[2], to_fd[2];
|
||||||
/* The pipes through which text will be written and read. */
|
/* The pipes through which text will be written and read. */
|
||||||
const bool should_pipe = (command[0] == '|');
|
|
||||||
FILE *stream;
|
|
||||||
struct sigaction oldaction, newaction = {{0}};
|
struct sigaction oldaction, newaction = {{0}};
|
||||||
/* Original and temporary handlers for SIGINT. */
|
/* Original and temporary handlers for SIGINT. */
|
||||||
|
const bool should_pipe = (command[0] == '|');
|
||||||
|
FILE *stream;
|
||||||
|
|
||||||
/* Create a pipe to read the command's output from, and, if needed,
|
/* Create a pipe to read the command's output from, and, if needed,
|
||||||
* a pipe to feed the command's input through. */
|
* a pipe to feed the command's input through. */
|
||||||
|
12
src/text.c
12
src/text.c
@ -2061,9 +2061,9 @@ bool replace_buffer(const char *filename, undo_type action, const char *operatio
|
|||||||
/* Execute the given program, with the given temp file as last argument. */
|
/* Execute the given program, with the given temp file as last argument. */
|
||||||
void treat(char *tempfile_name, char *theprogram, bool spelling)
|
void treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||||
{
|
{
|
||||||
ssize_t lineno_save = openfile->current->lineno;
|
ssize_t was_lineno = openfile->current->lineno;
|
||||||
size_t current_x_save = openfile->current_x;
|
size_t was_pww = openfile->placewewant;
|
||||||
size_t pww_save = openfile->placewewant;
|
size_t was_x = openfile->current_x;
|
||||||
bool was_at_eol = (openfile->current->data[openfile->current_x] == '\0');
|
bool was_at_eol = (openfile->current->data[openfile->current_x] == '\0');
|
||||||
struct stat fileinfo;
|
struct stat fileinfo;
|
||||||
long timestamp_sec = 0;
|
long timestamp_sec = 0;
|
||||||
@ -2147,7 +2147,7 @@ void treat(char *tempfile_name, char *theprogram, bool spelling)
|
|||||||
/* Adjust the end point of the marked region for any change in
|
/* Adjust the end point of the marked region for any change in
|
||||||
* length of the region's last line. */
|
* length of the region's last line. */
|
||||||
if (upright)
|
if (upright)
|
||||||
current_x_save = openfile->current_x;
|
was_x = openfile->current_x;
|
||||||
else
|
else
|
||||||
openfile->mark_x = openfile->current_x;
|
openfile->mark_x = openfile->current_x;
|
||||||
|
|
||||||
@ -2165,7 +2165,7 @@ void treat(char *tempfile_name, char *theprogram, bool spelling)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Go back to the old position. */
|
/* Go back to the old position. */
|
||||||
goto_line_posx(lineno_save, current_x_save);
|
goto_line_posx(was_lineno, was_x);
|
||||||
if (was_at_eol || openfile->current_x > strlen(openfile->current->data))
|
if (was_at_eol || openfile->current_x > strlen(openfile->current->data))
|
||||||
openfile->current_x = strlen(openfile->current->data);
|
openfile->current_x = strlen(openfile->current->data);
|
||||||
|
|
||||||
@ -2176,7 +2176,7 @@ void treat(char *tempfile_name, char *theprogram, bool spelling)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
openfile->placewewant = pww_save;
|
openfile->placewewant = was_pww;
|
||||||
adjust_viewport(STATIONARY);
|
adjust_viewport(STATIONARY);
|
||||||
|
|
||||||
if (spelling)
|
if (spelling)
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user