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
25b1114e
Commit
25b1114e
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: elide two parameters from the get_region() function
parent
4b8a3875
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/proto.h
+1
-2
src/proto.h
src/text.c
+3
-9
src/text.c
src/utils.c
+5
-4
src/utils.c
with
9 additions
and
15 deletions
+9
-15
src/proto.h
View file @
25b1114e
...
...
@@ -609,8 +609,7 @@ void remove_magicline(void);
#ifndef NANO_TINY
void
mark_order
(
const
filestruct
**
top
,
size_t
*
top_x
,
const
filestruct
**
bot
,
size_t
*
bot_x
,
bool
*
right_side_up
);
void
get_region
(
const
filestruct
**
top
,
size_t
*
top_x
,
const
filestruct
**
bot
,
size_t
*
bot_x
);
void
get_region
(
const
filestruct
**
top
,
const
filestruct
**
bot
);
#endif
size_t
get_totsize
(
const
filestruct
*
begin
,
const
filestruct
*
end
);
#ifndef NANO_TINY
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
25b1114e
...
...
@@ -296,12 +296,10 @@ void do_indent(void)
char
*
indentation
=
charalloc
(
tabsize
+
1
);
/* The whitespace added to each line in order to indent it. */
filestruct
*
top
,
*
bot
,
*
line
;
size_t
top_x
,
bot_x
;
/* Use either all the marked lines or just the current line. */
if
(
openfile
->
mark
)
get_region
((
const
filestruct
**
)
&
top
,
&
top_x
,
(
const
filestruct
**
)
&
bot
,
&
bot_x
);
get_region
((
const
filestruct
**
)
&
top
,
(
const
filestruct
**
)
&
bot
);
else
{
top
=
openfile
->
current
;
bot
=
top
;
...
...
@@ -401,12 +399,10 @@ void unindent_a_line(filestruct *line, size_t indent_len)
void
do_unindent
(
void
)
{
filestruct
*
top
,
*
bot
,
*
line
;
size_t
top_x
,
bot_x
;
/* Use either all the marked lines or just the current line. */
if
(
openfile
->
mark
)
get_region
((
const
filestruct
**
)
&
top
,
&
top_x
,
(
const
filestruct
**
)
&
bot
,
&
bot_x
);
get_region
((
const
filestruct
**
)
&
top
,
(
const
filestruct
**
)
&
bot
);
else
{
top
=
openfile
->
current
;
bot
=
top
;
...
...
@@ -494,7 +490,6 @@ void do_comment(void)
const
char
*
comment_seq
=
GENERAL_COMMENT_CHARACTER
;
undo_type
action
=
UNCOMMENT
;
filestruct
*
top
,
*
bot
,
*
line
;
size_t
top_x
,
bot_x
;
bool
empty
,
all_empty
=
TRUE
;
#ifdef ENABLE_COLOR
...
...
@@ -509,8 +504,7 @@ void do_comment(void)
/* Determine which lines to work on. */
if
(
openfile
->
mark
)
get_region
((
const
filestruct
**
)
&
top
,
&
top_x
,
(
const
filestruct
**
)
&
bot
,
&
bot_x
);
get_region
((
const
filestruct
**
)
&
top
,
(
const
filestruct
**
)
&
bot
);
else
{
top
=
openfile
->
current
;
bot
=
top
;
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
25b1114e
...
...
@@ -534,12 +534,13 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
/* Get the start and end points of the marked region, but
* push the end point back if it's at the start of a line. */
void
get_region
(
const
filestruct
**
top
,
size_t
*
top_x
,
const
filestruct
**
bot
,
size_t
*
bot_x
)
void
get_region
(
const
filestruct
**
top
,
const
filestruct
**
bot
)
{
mark_order
(
top
,
top_x
,
bot
,
bot_x
,
NULL
)
;
size_t
top_x
,
bot_x
;
if
(
*
bot_x
==
0
)
mark_order
(
top
,
&
top_x
,
bot
,
&
bot_x
,
NULL
);
if
(
bot_x
==
0
)
*
bot
=
(
*
bot
)
->
prev
;
}
...
...
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