mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 21:01:24 +03:00
tweaks: make better use of two variables, and reshuffle two comments
This commit is contained in:
parent
f2c61c4b9a
commit
6ca8518428
18
src/nano.c
18
src/nano.c
@ -246,11 +246,12 @@ void partition_buffer(linestruct *top, size_t top_x,
|
|||||||
* to (filebot, $) again. */
|
* to (filebot, $) again. */
|
||||||
void unpartition_buffer()
|
void unpartition_buffer()
|
||||||
{
|
{
|
||||||
/* Reattach the line that was above the top of the partition,
|
/* Reattach the line that was above the top of the partition. */
|
||||||
* and restore the text that was before top_x. */
|
|
||||||
openfile->filetop->prev = foreline;
|
openfile->filetop->prev = foreline;
|
||||||
if (openfile->filetop->prev != NULL)
|
if (foreline != NULL)
|
||||||
openfile->filetop->prev->next = openfile->filetop;
|
foreline->next = openfile->filetop;
|
||||||
|
|
||||||
|
/* Restore the text that was on the first partition line before its start. */
|
||||||
openfile->filetop->data = charealloc(openfile->filetop->data,
|
openfile->filetop->data = charealloc(openfile->filetop->data,
|
||||||
strlen(antedata) + strlen(openfile->filetop->data) + 1);
|
strlen(antedata) + strlen(openfile->filetop->data) + 1);
|
||||||
charmove(openfile->filetop->data + strlen(antedata),
|
charmove(openfile->filetop->data + strlen(antedata),
|
||||||
@ -259,11 +260,12 @@ void unpartition_buffer()
|
|||||||
free(antedata);
|
free(antedata);
|
||||||
antedata = NULL;
|
antedata = NULL;
|
||||||
|
|
||||||
/* Reattach the line that was below the bottom of the partition,
|
/* Reattach the line that was below the bottom of the partition. */
|
||||||
* and restore the text that was after bot_x. */
|
|
||||||
openfile->filebot->next = aftline;
|
openfile->filebot->next = aftline;
|
||||||
if (openfile->filebot->next != NULL)
|
if (aftline != NULL)
|
||||||
openfile->filebot->next->prev = openfile->filebot;
|
aftline->prev = openfile->filebot;
|
||||||
|
|
||||||
|
/* Restore the text that was on the last partition line after its end. */
|
||||||
openfile->filebot->data = charealloc(openfile->filebot->data,
|
openfile->filebot->data = charealloc(openfile->filebot->data,
|
||||||
strlen(openfile->filebot->data) + strlen(postdata) + 1);
|
strlen(openfile->filebot->data) + strlen(postdata) + 1);
|
||||||
strcat(openfile->filebot->data, postdata);
|
strcat(openfile->filebot->data, postdata);
|
||||||
|
Loading…
Reference in New Issue
Block a user