move check_linenumbers(), dump_buffer(), and dump_buffer_reverse() from
winio.c to utils.c too git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@3076 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
305c6459e9
commit
00cc565ddd
13
ChangeLog
13
ChangeLog
|
@ -11,13 +11,14 @@ CVS code -
|
|||
nanoget_repaint(), nanogetstr(), and statusq(). (DLR)
|
||||
- Since the statusbar prompt code needs at least 4 columns in
|
||||
order to work properly, make that the minimum number of
|
||||
columns nano requires to run, and remove assertions and code
|
||||
that make use of a smaller number. Changes to window_init(),
|
||||
nanoget_repaint(), titlebar(), statusbar(), and
|
||||
get_page_start(). (DLR)
|
||||
columns that nano requires in order to run, and remove
|
||||
assertions and code that make use of a smaller number of
|
||||
columns. Changes to window_init(), nanoget_repaint(),
|
||||
titlebar(), statusbar(), and get_page_start(). (DLR)
|
||||
- Move get_page_start(), xplustabs(), actual_x(), strnlenpt(),
|
||||
and strlenpt() from winio.c to utils.c, as they're really
|
||||
utility functions. (DLR)
|
||||
strlenpt(), check_linenumbers(), dump_buffer(), and
|
||||
dump_buffer_reverse() from winio.c to utils.c, as they're
|
||||
really utility functions. (DLR)
|
||||
- Add missing stdio.h #include to winio.c. (DLR)
|
||||
- Move functions specific to the statusbar prompt to their own
|
||||
source file, adjust related variables accordingly, and rename
|
||||
|
|
14
src/proto.h
14
src/proto.h
|
@ -617,6 +617,13 @@ void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
|||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
size_t get_totsize(const filestruct *begin, const filestruct *end);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void dump_filestruct(const filestruct *inptr);
|
||||
void dump_filestruct_reverse(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in winio.c. */
|
||||
#ifndef NANO_SMALL
|
||||
|
@ -689,13 +696,6 @@ void display_main_list(void);
|
|||
void do_cursorpos(bool constant);
|
||||
void do_cursorpos_void(void);
|
||||
void do_replace_highlight(bool highlight, const char *word);
|
||||
#ifndef NDEBUG
|
||||
int check_linenumbers(const filestruct *fileptr);
|
||||
#endif
|
||||
#ifdef DEBUG
|
||||
void dump_filestruct(const filestruct *inptr);
|
||||
void dump_filestruct_reverse(void);
|
||||
#endif
|
||||
#ifdef NANO_EXTRA
|
||||
void do_credits(void);
|
||||
#endif
|
||||
|
|
46
src/utils.c
46
src/utils.c
|
@ -561,3 +561,49 @@ size_t get_totsize(const filestruct *begin, const filestruct *end)
|
|||
|
||||
return totsize;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* Return what the current line number should be, starting at edittop
|
||||
* and ending at fileptr. */
|
||||
int check_linenumbers(const filestruct *fileptr)
|
||||
{
|
||||
int check_line = 0;
|
||||
const filestruct *filetmp;
|
||||
|
||||
for (filetmp = openfile->edittop; filetmp != fileptr;
|
||||
filetmp = filetmp->next)
|
||||
check_line++;
|
||||
|
||||
return check_line;
|
||||
}
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Dump the filestruct inptr to stderr. */
|
||||
void dump_filestruct(const filestruct *inptr)
|
||||
{
|
||||
if (inptr == openfile->fileage)
|
||||
fprintf(stderr, "Dumping file buffer to stderr...\n");
|
||||
else if (inptr == cutbuffer)
|
||||
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
|
||||
else
|
||||
fprintf(stderr, "Dumping a buffer to stderr...\n");
|
||||
|
||||
while (inptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data);
|
||||
inptr = inptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump the current buffer's filestruct to stderr in reverse. */
|
||||
void dump_filestruct_reverse(void)
|
||||
{
|
||||
const filestruct *fileptr = openfile->filebot;
|
||||
|
||||
while (fileptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno,
|
||||
fileptr->data);
|
||||
fileptr = fileptr->prev;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
|
46
src/winio.c
46
src/winio.c
|
@ -3090,52 +3090,6 @@ void do_replace_highlight(bool highlight, const char *word)
|
|||
wattroff(edit, A_REVERSE);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* Return what the current line number should be, starting at edittop
|
||||
* and ending at fileptr. */
|
||||
int check_linenumbers(const filestruct *fileptr)
|
||||
{
|
||||
int check_line = 0;
|
||||
const filestruct *filetmp;
|
||||
|
||||
for (filetmp = openfile->edittop; filetmp != fileptr;
|
||||
filetmp = filetmp->next)
|
||||
check_line++;
|
||||
|
||||
return check_line;
|
||||
}
|
||||
#endif /* !NDEBUG */
|
||||
|
||||
#ifdef DEBUG
|
||||
/* Dump the filestruct inptr to stderr. */
|
||||
void dump_filestruct(const filestruct *inptr)
|
||||
{
|
||||
if (inptr == openfile->fileage)
|
||||
fprintf(stderr, "Dumping file buffer to stderr...\n");
|
||||
else if (inptr == cutbuffer)
|
||||
fprintf(stderr, "Dumping cutbuffer to stderr...\n");
|
||||
else
|
||||
fprintf(stderr, "Dumping a buffer to stderr...\n");
|
||||
|
||||
while (inptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", (long)inptr->lineno, inptr->data);
|
||||
inptr = inptr->next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Dump the current buffer's filestruct to stderr in reverse. */
|
||||
void dump_filestruct_reverse(void)
|
||||
{
|
||||
const filestruct *fileptr = openfile->filebot;
|
||||
|
||||
while (fileptr != NULL) {
|
||||
fprintf(stderr, "(%ld) %s\n", (long)fileptr->lineno,
|
||||
fileptr->data);
|
||||
fileptr = fileptr->prev;
|
||||
}
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
#define CREDIT_LEN 54
|
||||
#define XLCREDIT_LEN 8
|
||||
|
|
Loading…
Reference in New Issue