tweaks: normalize the indentation after the previous change
Also rewrap two lines, reshuffle three, and improve three comments.master
parent
b3faf353c9
commit
3c4a4b04ce
23
src/nano.c
23
src/nano.c
|
@ -1669,14 +1669,10 @@ void inject(char *burst, size_t count)
|
||||||
memmove(openfile->current->data + openfile->current_x + count,
|
memmove(openfile->current->data + openfile->current_x + count,
|
||||||
openfile->current->data + openfile->current_x,
|
openfile->current->data + openfile->current_x,
|
||||||
current_len - openfile->current_x + 1);
|
current_len - openfile->current_x + 1);
|
||||||
strncpy(openfile->current->data + openfile->current_x,
|
strncpy(openfile->current->data + openfile->current_x, burst, count);
|
||||||
burst, count);
|
|
||||||
|
|
||||||
openfile->totsize += mbstrlen(burst);
|
|
||||||
set_modified();
|
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Note that current_x has not yet been incremented. */
|
/* When the mark is to the right of the cursor, compensate its position. */
|
||||||
if (openfile->current == openfile->mark &&
|
if (openfile->current == openfile->mark &&
|
||||||
openfile->current_x < openfile->mark_x)
|
openfile->current_x < openfile->mark_x)
|
||||||
openfile->mark_x += count;
|
openfile->mark_x += count;
|
||||||
|
@ -1684,28 +1680,29 @@ void inject(char *burst, size_t count)
|
||||||
/* When the cursor is on the top row and not on the first chunk
|
/* When the cursor is on the top row and not on the first chunk
|
||||||
* of a line, adding text there might change the preceding chunk
|
* of a line, adding text there might change the preceding chunk
|
||||||
* and thus require an adjustment of firstcolumn. */
|
* and thus require an adjustment of firstcolumn. */
|
||||||
if (openfile->current == openfile->edittop &&
|
if (openfile->current == openfile->edittop && openfile->firstcolumn > 0) {
|
||||||
openfile->firstcolumn > 0) {
|
|
||||||
ensure_firstcolumn_is_aligned();
|
ensure_firstcolumn_is_aligned();
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/* If text was added to the magic line, create a new magic line. */
|
||||||
openfile->current_x += count;
|
|
||||||
|
|
||||||
/* If we've added text to the magic line, create a new magic line. */
|
|
||||||
if (openfile->filebot == openfile->current && !ISSET(NO_NEWLINES)) {
|
if (openfile->filebot == openfile->current && !ISSET(NO_NEWLINES)) {
|
||||||
new_magicline();
|
new_magicline();
|
||||||
if (margin > 0)
|
if (margin > 0)
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
openfile->current_x += count;
|
||||||
|
|
||||||
|
openfile->totsize += mbstrlen(burst);
|
||||||
|
set_modified();
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
update_undo(ADD);
|
update_undo(ADD);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_WRAPPING
|
#ifdef ENABLE_WRAPPING
|
||||||
/* If text gets wrapped, the edit window needs a refresh. */
|
/* Wrap the line when needed, and if so, schedule a refresh. */
|
||||||
if (ISSET(BREAK_LONG_LINES) && do_wrap())
|
if (ISSET(BREAK_LONG_LINES) && do_wrap())
|
||||||
refresh_needed = TRUE;
|
refresh_needed = TRUE;
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue