Skip to content
GitLab
Menu
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
3264d0c5
Commit
3264d0c5
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: move a variable that doesn't need to be global
parent
d9148e7b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/global.c
+0
-7
src/global.c
src/proto.h
+0
-3
src/proto.h
src/text.c
+13
-14
src/text.c
with
13 additions
and
24 deletions
+13
-24
src/global.c
View file @
3264d0c5
...
...
@@ -90,10 +90,6 @@ filestruct *cutbuffer = NULL;
/* The buffer where we store cut text. */
filestruct
*
cutbottom
=
NULL
;
/* The last line in the cutbuffer. */
#ifndef DISABLE_JUSTIFY
filestruct
*
jusbuffer
=
NULL
;
/* The buffer where we store unjustified text. */
#endif
partition
*
filepart
=
NULL
;
/* The "partition" where we store a portion of the current file. */
openfilestruct
*
openfile
=
NULL
;
...
...
@@ -1691,9 +1687,6 @@ void thanks_for_all_the_fish(void)
free
(
alt_speller
);
#endif
free_filestruct
(
cutbuffer
);
#ifndef DISABLE_JUSTIFY
free_filestruct
(
jusbuffer
);
#endif
/* Free the memory associated with each open file buffer. */
while
(
openfile
!=
openfile
->
next
)
{
openfile
=
openfile
->
next
;
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
3264d0c5
...
...
@@ -73,9 +73,6 @@ extern int maxrows;
extern
filestruct
*
cutbuffer
;
extern
filestruct
*
cutbottom
;
#ifndef DISABLE_JUSTIFY
extern
filestruct
*
jusbuffer
;
#endif
extern
partition
*
filepart
;
extern
openfilestruct
*
openfile
;
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
3264d0c5
...
...
@@ -42,8 +42,10 @@ static bool prepend_wrap = FALSE;
/* Should we prepend wrapped text to the next line? */
#endif
#ifndef DISABLE_JUSTIFY
static
filestruct
*
jusbuffer
=
NULL
;
/* The buffer where we store unjustified text. */
static
filestruct
*
jusbottom
=
NULL
;
/*
P
ointer to the end of the
justify buffer
. */
/*
A p
ointer to the end of the
buffer with unjustified text
. */
#endif
#ifndef NANO_TINY
...
...
@@ -2513,8 +2515,8 @@ void do_justify(bool full_justify)
||
func
==
do_undo
#endif
)
{
/*
Splice the justify buffer back into the file, but only if we
*
actually
justified
something.
*/
/*
If we actually justified something, then splice the preserved
*
un
justified
text back into the file,
*/
if
(
first_par_line
!=
NULL
)
{
/* Partition the filestruct so that it contains only the
* text of the justified paragraph. */
...
...
@@ -2522,24 +2524,19 @@ void do_justify(bool full_justify)
last_par_line
,
filebot_inpar
?
strlen
(
last_par_line
->
data
)
:
0
);
/*
Remove the text of
the justified paragraph, and
*
replace it with the text in the justify buffer
. */
/*
Throw away
the justified paragraph, and
replace it with
*
the preserved unjustified text
. */
free_filestruct
(
openfile
->
fileage
);
openfile
->
fileage
=
jusbuffer
;
openfile
->
filebot
=
jusbottom
;
/* Unpartition the filestruct so that it contains all the
* text again. Note that the justified paragraph has been
* replaced with the unjustified paragraph. */
/* Unpartition the filestruct, to contain the entire text again. */
unpartition_filestruct
(
&
filepart
);
/* Renumber, from the beginning of the unjustified part. */
renumber
(
jusbuffer
);
/* Mark the justify buffer as empty, as it's been swallowed. */
jusbuffer
=
NULL
;
/* Restore the justify we just did (ungrateful user!). */
/* Restore the old position, the size, and the mark. */
openfile
->
edittop
=
edittop_save
;
openfile
->
current
=
current_save
;
openfile
->
current_x
=
current_x_save
;
...
...
@@ -2569,11 +2566,13 @@ void do_justify(bool full_justify)
discard_until
(
NULL
,
openfile
);
openfile
->
current_undo
=
NULL
;
#endif
/* Blow away the
text in the justify buffer
. */
/* Blow away the
unjustified text
. */
free_filestruct
(
jusbuffer
);
jusbuffer
=
NULL
;
}
/* Mark the buffer for unjustified text as empty. */
jusbuffer
=
NULL
;
blank_statusbar
();
/* Display the shortcut list with UnCut. */
...
...
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