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
9fa95a36
Commit
9fa95a36
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: put some prototypes in the proper order, and move a bit of code
parent
d6cc2c40
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
+9
-9
src/proto.h
src/text.c
+1
-1
src/text.c
src/utils.c
+19
-21
src/utils.c
with
29 additions
and
31 deletions
+29
-31
src/proto.h
View file @
9fa95a36
...
...
@@ -588,18 +588,25 @@ void do_tab(void);
void
do_indent
(
ssize_t
cols
);
void
do_indent_void
(
void
);
void
do_unindent
(
void
);
void
do_undo
(
void
);
void
do_redo
(
void
);
#endif
bool
white_string
(
const
char
*
s
);
#ifdef ENABLE_COMMENT
void
do_comment
(
void
);
bool
comment_line
(
undo_type
action
,
filestruct
*
f
,
const
char
*
comment_seq
);
#endif
void
do_undo
(
void
);
void
do_redo
(
void
);
void
do_enter
(
void
);
#ifndef NANO_TINY
RETSIGTYPE
cancel_command
(
int
signal
);
bool
execute_command
(
const
char
*
command
);
void
discard_until
(
const
undo
*
thisitem
,
openfilestruct
*
thefile
);
void
add_undo
(
undo_type
action
);
#ifndef DISABLE_COMMENT
void
update_comment_undo
(
ssize_t
lineno
);
#endif
void
update_undo
(
undo_type
action
);
#endif
/* !NANO_TINY */
#ifndef DISABLE_WRAPPING
void
wrap_reset
(
void
);
bool
do_wrap
(
filestruct
*
line
);
...
...
@@ -688,13 +695,6 @@ void new_magicline(void);
void
remove_magicline
(
void
);
void
mark_order
(
const
filestruct
**
top
,
size_t
*
top_x
,
const
filestruct
**
bot
,
size_t
*
bot_x
,
bool
*
right_side_up
);
void
discard_until
(
const
undo
*
thisitem
,
openfilestruct
*
thefile
);
void
add_undo
(
undo_type
action
);
void
update_undo
(
undo_type
action
);
#ifndef DISABLE_COMMENT
void
update_comment_undo
(
ssize_t
lineno
);
bool
comment_line
(
undo_type
action
,
filestruct
*
f
,
const
char
*
comment_seq
);
#endif
#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 @
9fa95a36
...
...
@@ -981,7 +981,7 @@ void do_redo(void)
#endif
/* !NANO_TINY */
/* Break the current line at the cursor position. */
void
do_enter
()
void
do_enter
(
void
)
{
filestruct
*
newnode
=
make_new_node
(
openfile
->
current
);
size_t
extra
=
0
;
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
9fa95a36
...
...
@@ -597,27 +597,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
*
right_side_up
=
FALSE
;
}
}
#endif
/* !NANO_TINY */
/* Count the number of characters from begin to end, and return it. */
size_t
get_totsize
(
const
filestruct
*
begin
,
const
filestruct
*
end
)
{
const
filestruct
*
line
;
size_t
totsize
=
0
;
/* Sum the number of characters (plus a newline) in each line. */
for
(
line
=
begin
;
line
!=
end
->
next
;
line
=
line
->
next
)
totsize
+=
mbstrlen
(
line
->
data
)
+
1
;
/* The last line of a file doesn't have a newline -- otherwise it
* wouldn't be the last line -- so subtract 1 when at EOF. */
if
(
line
==
NULL
)
totsize
--
;
return
totsize
;
}
#ifndef NANO_TINY
/* Given a line number, return a pointer to the corresponding struct. */
filestruct
*
fsfromline
(
ssize_t
lineno
)
{
...
...
@@ -638,7 +618,25 @@ filestruct *fsfromline(ssize_t lineno)
return
f
;
}
#endif
#endif
/* !NANO_TINY */
/* Count the number of characters from begin to end, and return it. */
size_t
get_totsize
(
const
filestruct
*
begin
,
const
filestruct
*
end
)
{
const
filestruct
*
line
;
size_t
totsize
=
0
;
/* Sum the number of characters (plus a newline) in each line. */
for
(
line
=
begin
;
line
!=
end
->
next
;
line
=
line
->
next
)
totsize
+=
mbstrlen
(
line
->
data
)
+
1
;
/* The last line of a file doesn't have a newline -- otherwise it
* wouldn't be the last line -- so subtract 1 when at EOF. */
if
(
line
==
NULL
)
totsize
--
;
return
totsize
;
}
#ifdef DEBUG
/* Dump the filestruct inptr to stderr. */
...
...
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