tweaks: put some prototypes in the proper order, and move a bit of code
Этот коммит содержится в:
родитель
d6cc2c40fe
Коммит
9fa95a3680
18
src/proto.h
18
src/proto.h
@ -588,18 +588,25 @@ void do_tab(void);
|
|||||||
void do_indent(ssize_t cols);
|
void do_indent(ssize_t cols);
|
||||||
void do_indent_void(void);
|
void do_indent_void(void);
|
||||||
void do_unindent(void);
|
void do_unindent(void);
|
||||||
void do_undo(void);
|
|
||||||
void do_redo(void);
|
|
||||||
#endif
|
#endif
|
||||||
bool white_string(const char *s);
|
bool white_string(const char *s);
|
||||||
#ifdef ENABLE_COMMENT
|
#ifdef ENABLE_COMMENT
|
||||||
void do_comment(void);
|
void do_comment(void);
|
||||||
|
bool comment_line(undo_type action, filestruct *f, const char *comment_seq);
|
||||||
#endif
|
#endif
|
||||||
|
void do_undo(void);
|
||||||
|
void do_redo(void);
|
||||||
void do_enter(void);
|
void do_enter(void);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
RETSIGTYPE cancel_command(int signal);
|
RETSIGTYPE cancel_command(int signal);
|
||||||
bool execute_command(const char *command);
|
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
|
#endif
|
||||||
|
void update_undo(undo_type action);
|
||||||
|
#endif /* !NANO_TINY */
|
||||||
#ifndef DISABLE_WRAPPING
|
#ifndef DISABLE_WRAPPING
|
||||||
void wrap_reset(void);
|
void wrap_reset(void);
|
||||||
bool do_wrap(filestruct *line);
|
bool do_wrap(filestruct *line);
|
||||||
@ -688,13 +695,6 @@ void new_magicline(void);
|
|||||||
void remove_magicline(void);
|
void remove_magicline(void);
|
||||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||||
**bot, size_t *bot_x, bool *right_side_up);
|
**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
|
#endif
|
||||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
|
@ -981,7 +981,7 @@ void do_redo(void)
|
|||||||
#endif /* !NANO_TINY */
|
#endif /* !NANO_TINY */
|
||||||
|
|
||||||
/* Break the current line at the cursor position. */
|
/* Break the current line at the cursor position. */
|
||||||
void do_enter()
|
void do_enter(void)
|
||||||
{
|
{
|
||||||
filestruct *newnode = make_new_node(openfile->current);
|
filestruct *newnode = make_new_node(openfile->current);
|
||||||
size_t extra = 0;
|
size_t extra = 0;
|
||||||
|
40
src/utils.c
40
src/utils.c
@ -597,27 +597,7 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
|||||||
*right_side_up = FALSE;
|
*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. */
|
/* Given a line number, return a pointer to the corresponding struct. */
|
||||||
filestruct *fsfromline(ssize_t lineno)
|
filestruct *fsfromline(ssize_t lineno)
|
||||||
{
|
{
|
||||||
@ -638,7 +618,25 @@ filestruct *fsfromline(ssize_t lineno)
|
|||||||
|
|
||||||
return f;
|
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
|
#ifdef DEBUG
|
||||||
/* Dump the filestruct inptr to stderr. */
|
/* Dump the filestruct inptr to stderr. */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user