mirror of git://git.sv.gnu.org/nano.git
tweaks: rename three variables, to follow the general scheme
Also rewrap a line, reshuffle two others, and remove two redundant comments.
This commit is contained in:
parent
42b7dea14b
commit
fdc0b0ac24
|
@ -263,8 +263,7 @@ void extract_segment(linestruct *top, size_t top_x, linestruct *bot, size_t bot_
|
|||
if (top == bot) {
|
||||
taken = make_new_node(NULL);
|
||||
taken->data = measured_copy(top->data + top_x, bot_x - top_x);
|
||||
memmove(top->data + top_x, top->data + bot_x,
|
||||
strlen(top->data + bot_x) + 1);
|
||||
memmove(top->data + top_x, top->data + bot_x, strlen(top->data + bot_x) + 1);
|
||||
last = taken;
|
||||
} else if (top_x == 0 && bot_x == 0) {
|
||||
taken = top;
|
||||
|
@ -695,15 +694,13 @@ void copy_text(void)
|
|||
/* Copy text from the cutbuffer into the current buffer. */
|
||||
void paste_text(void)
|
||||
{
|
||||
/* Remember where the paste started. */
|
||||
#ifndef NANO_TINY
|
||||
/* Remember where the paste started. */
|
||||
linestruct *was_current = openfile->current;
|
||||
bool had_anchor = was_current->has_anchor;
|
||||
#endif
|
||||
ssize_t was_lineno = openfile->current->lineno;
|
||||
/* The line number where we started the paste. */
|
||||
size_t was_leftedge = 0;
|
||||
/* The leftedge where we started the paste. */
|
||||
|
||||
if (cutbuffer == NULL) {
|
||||
statusline(AHEM, _("Cutbuffer is empty"));
|
||||
|
@ -722,7 +719,7 @@ void paste_text(void)
|
|||
copy_from_buffer(cutbuffer);
|
||||
|
||||
#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)
|
||||
line->has_anchor = FALSE;
|
||||
|
||||
|
|
|
@ -973,10 +973,10 @@ bool execute_command(const char *command)
|
|||
{
|
||||
int from_fd[2], to_fd[2];
|
||||
/* The pipes through which text will be written and read. */
|
||||
const bool should_pipe = (command[0] == '|');
|
||||
FILE *stream;
|
||||
struct sigaction oldaction, newaction = {{0}};
|
||||
/* 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,
|
||||
* 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. */
|
||||
void treat(char *tempfile_name, char *theprogram, bool spelling)
|
||||
{
|
||||
ssize_t lineno_save = openfile->current->lineno;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
ssize_t was_lineno = openfile->current->lineno;
|
||||
size_t was_pww = openfile->placewewant;
|
||||
size_t was_x = openfile->current_x;
|
||||
bool was_at_eol = (openfile->current->data[openfile->current_x] == '\0');
|
||||
struct stat fileinfo;
|
||||
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
|
||||
* length of the region's last line. */
|
||||
if (upright)
|
||||
current_x_save = openfile->current_x;
|
||||
was_x = openfile->current_x;
|
||||
else
|
||||
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. */
|
||||
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))
|
||||
openfile->current_x = strlen(openfile->current->data);
|
||||
|
||||
|
@ -2176,7 +2176,7 @@ void treat(char *tempfile_name, char *theprogram, bool spelling)
|
|||
#endif
|
||||
}
|
||||
|
||||
openfile->placewewant = pww_save;
|
||||
openfile->placewewant = was_pww;
|
||||
adjust_viewport(STATIONARY);
|
||||
|
||||
if (spelling)
|
||||
|
|
Loading…
Reference in New Issue