Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
e1538e6d
Commit
e1538e6d
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: reshuffle a statement to a better place and condense some comments
parent
1c46551c
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cut.c
+9
-21
src/cut.c
with
9 additions
and
21 deletions
+9
-21
src/cut.c
View file @
e1538e6d
...
...
@@ -129,35 +129,28 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
assert
(
openfile
->
current
!=
NULL
&&
openfile
->
current
->
data
!=
NULL
);
/*
Empty the cutbuffer when
a chain of cuts
i
s broken. */
/*
If
a chain of cuts
wa
s broken
, empty the cutbuffer
. */
if
(
!
keep_cutbuffer
)
{
free_filestruct
(
cutbuffer
);
cutbuffer
=
NULL
;
#ifdef DEBUG
fprintf
(
stderr
,
"Blew away cutbuffer =)
\n
"
);
#endif
/* Indicate that future cuts should add to the cutbuffer. */
keep_cutbuffer
=
TRUE
;
}
#ifndef NANO_TINY
if
(
copy_text
)
{
/* If the cutbuffer isn't empty, remember where it currently ends. */
if
(
cutbuffer
!=
NULL
)
{
/* If the cutbuffer isn't empty, save where it currently
* ends. This is where we'll add the new text. */
cb_save
=
cutbottom
;
cb_save_len
=
strlen
(
cutbottom
->
data
);
}
/* Set NO_NEWLINES to TRUE, so that we don't disturb the last
* line of the file when moving text to the cutbuffer. */
/* Don't add a magicline when moving text to the cutbuffer. */
SET
(
NO_NEWLINES
);
}
#endif
/* Ensure that the text we're going to move into the cutbuffer will
* be added to the text already there, instead of replacing it. */
keep_cutbuffer
=
TRUE
;
#ifndef NANO_TINY
if
(
cut_till_eof
)
{
/* Move all text up to the end of the file into the cutbuffer. */
cut_to_eof
();
...
...
@@ -175,10 +168,9 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
#ifndef NANO_TINY
if
(
copy_text
)
{
/* Copy the text in the cutbuffer, starting at its saved end if
* there is one, back into the filestruct. This effectively
* uncuts the text we just cut without marking the file as
* modified. */
/* Copy the text that is in the cutbuffer (starting at its saved end,
* if there is one) back into the current buffer. This effectively
* uncuts the text we just cut. */
if
(
cutbuffer
!=
NULL
)
{
if
(
cb_save
!=
NULL
)
{
cb_save
->
data
+=
cb_save_len
;
...
...
@@ -187,13 +179,9 @@ void do_cut_text(bool copy_text, bool cut_till_eof)
}
else
copy_from_filestruct
(
cutbuffer
);
/* Set the current place we want to where the text from the
* cutbuffer ends. */
openfile
->
placewewant
=
xplustabs
();
}
/* Set NO_NEWLINES back to what it was before, since we're done
* disturbing the text. */
/* Restore the magicline behavior now that we're done fiddling. */
if
(
!
old_no_newlines
)
UNSET
(
NO_NEWLINES
);
}
else
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help