tweaks: rename a type, to make more sense

master
Benno Schulenberg 2019-03-21 17:08:52 +01:00
parent 04cfe5a258
commit aac4fc46e9
15 changed files with 258 additions and 258 deletions

View File

@ -287,7 +287,7 @@ void color_update(void)
/* Determine whether the matches of multiline regexes are still the same,
* and if not, schedule a screen refresh, so things will be repainted. */
void check_the_multis(filestruct *line)
void check_the_multis(linestruct *line)
{
const colortype *ink;
bool astart, anend;
@ -332,7 +332,7 @@ void check_the_multis(filestruct *line)
}
/* Allocate (for one line) the cache space for multiline color regexes. */
void alloc_multidata_if_needed(filestruct *fileptr)
void alloc_multidata_if_needed(linestruct *fileptr)
{
int i;
@ -350,7 +350,7 @@ void precalc_multicolorinfo(void)
{
const colortype *ink;
regmatch_t startmatch, endmatch;
filestruct *line, *tailline;
linestruct *line, *tailline;
if (openfile->colorstrings == NULL || ISSET(NO_COLOR_SYNTAX))
return;

View File

@ -63,7 +63,7 @@ void do_deletion(undo_type action)
#endif
/* Otherwise, when not at end of buffer, join this line with the next. */
} else if (openfile->current != openfile->filebot) {
filestruct *joining = openfile->current->next;
linestruct *joining = openfile->current->next;
/* If there is a magic line, and we're before it: don't eat it. */
if (joining == openfile->filebot && openfile->current_x != 0 &&
@ -146,12 +146,12 @@ void do_backspace(void)
void chop_word(bool forward)
{
/* Remember the current cursor position. */
filestruct *is_current = openfile->current;
linestruct *is_current = openfile->current;
size_t is_current_x = openfile->current_x;
/* Remember where the cutbuffer is and then make it seem blank. */
filestruct *is_cutbuffer = cutbuffer;
filestruct *is_cutbottom = cutbottom;
linestruct *is_cutbuffer = cutbuffer;
linestruct *is_cutbottom = cutbottom;
cutbuffer = NULL;
cutbottom = NULL;
@ -227,11 +227,11 @@ void cut_line(void)
/* Move all marked text from the current buffer into the cutbuffer. */
void cut_marked(bool *right_side_up)
{
filestruct *top, *bot;
linestruct *top, *bot;
size_t top_x, bot_x;
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, right_side_up);
mark_order((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, right_side_up);
extract_buffer(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
openfile->placewewant = xplustabs();
@ -274,7 +274,7 @@ void cut_to_eof(void)
void do_cut_text(bool copy_text, bool marked, bool cut_till_eof, bool append)
{
#ifndef NANO_TINY
filestruct *cb_save = NULL;
linestruct *cb_save = NULL;
/* The current end of the cutbuffer, before we add text to it. */
size_t cb_save_len = 0;
/* The length of the string at the current end of the cutbuffer,
@ -398,7 +398,7 @@ void do_cut_text_void(void)
* was moved, blow away previous contents of the cutbuffer. */
void do_copy_text(void)
{
static filestruct *next_contiguous_line = NULL;
static linestruct *next_contiguous_line = NULL;
bool mark_is_set = (openfile->mark != NULL);
/* Remember the current viewport and cursor position. */
@ -443,8 +443,8 @@ void do_cut_till_eof(void)
void zap_text(void)
{
/* Remember the current cutbuffer so it can be restored after the zap. */
filestruct *was_cutbuffer = cutbuffer;
filestruct *was_cutbottom = cutbottom;
linestruct *was_cutbuffer = cutbuffer;
linestruct *was_cutbottom = cutbottom;
if (!is_cuttable(ISSET(CUT_FROM_CURSOR) && openfile->mark == NULL))
return;

View File

@ -512,7 +512,7 @@ void replace_buffer(const char *filename)
{
FILE *f;
int descriptor;
filestruct *was_cutbuffer = cutbuffer;
linestruct *was_cutbuffer = cutbuffer;
/* Open the file quietly. */
descriptor = open_file(filename, FALSE, TRUE, &f);
@ -558,7 +558,7 @@ void replace_marked_buffer(const char *filename)
FILE *f;
int descriptor;
bool using_magicline = ISSET(FINAL_NEWLINE);
filestruct *was_cutbuffer = cutbuffer;
linestruct *was_cutbuffer = cutbuffer;
descriptor = open_file(filename, FALSE, TRUE, &f);
@ -772,9 +772,9 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
/* The buffer in which we assemble each line of the file. */
size_t bufx = MAX_BUF_SIZE;
/* The allocated size of the line buffer; increased as needed. */
filestruct *topline;
linestruct *topline;
/* The top of the new buffer where we store the read file. */
filestruct *bottomline;
linestruct *bottomline;
/* The bottom of the new buffer. */
int input_int;
/* The current value we read from the file, whether an input
@ -1593,7 +1593,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
/* Instead of returning in this function, you should always
* set retval and then goto cleanup_and_exit. */
size_t lineswritten = 0;
const filestruct *fileptr = openfile->fileage;
const linestruct *fileptr = openfile->fileage;
int fd;
/* The file descriptor we use. */
mode_t original_umask = 0;
@ -1999,7 +1999,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
/* If the syntax changed, discard and recompute the multidata. */
if (strcmp(oldname, newname) != 0) {
filestruct *line = openfile->fileage;
linestruct *line = openfile->fileage;
while (line != NULL) {
free(line->multidata);
@ -2044,12 +2044,12 @@ bool write_marked_file(const char *name, FILE *f_open, bool tmp,
{
bool retval;
bool added_magicline = FALSE;
filestruct *top, *bot;
linestruct *top, *bot;
size_t top_x, bot_x;
/* Partition the buffer so that it contains only the marked text. */
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
mark_order((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, NULL);
filepart = partition_filestruct(top, top_x, bot, bot_x);
/* If we are using a magic line, and the last line of the partition

View File

@ -52,7 +52,7 @@ bool suppress_cursorpos = FALSE;
message_type lastmessage = HUSH;
/* Messages of type HUSH should not overwrite type MILD nor ALERT. */
filestruct *pletion_line = NULL;
linestruct *pletion_line = NULL;
/* The line where the last completion was found, if any. */
bool inhelp = FALSE;
@ -116,9 +116,9 @@ ssize_t stripe_column = 0;
/* The column at which a vertical bar will be drawn. */
#endif
filestruct *cutbuffer = NULL;
linestruct *cutbuffer = NULL;
/* The buffer where we store cut text. */
filestruct *cutbottom = NULL;
linestruct *cutbottom = NULL;
/* The last line in the cutbuffer. */
bool keep_cutbuffer = FALSE;
/* Whether to add to the cutbuffer instead of clearing it first. */
@ -203,23 +203,23 @@ subnfunc *tailfunc;
subnfunc *exitfunc;
/* A pointer to the special Exit/Close item. */
filestruct *search_history = NULL;
linestruct *search_history = NULL;
/* The current item in the list of strings that were searched for. */
filestruct *execute_history = NULL;
linestruct *execute_history = NULL;
/* The current item in the list of commands that were run with ^R ^X. */
filestruct *replace_history = NULL;
linestruct *replace_history = NULL;
/* The current item in the list of replace strings. */
#ifdef ENABLE_HISTORIES
filestruct *searchtop = NULL;
linestruct *searchtop = NULL;
/* The oldest item in the list of search strings. */
filestruct *searchbot = NULL;
linestruct *searchbot = NULL;
/* The newest item in the list of search strings. */
filestruct *replacetop = NULL;
filestruct *replacebot = NULL;
linestruct *replacetop = NULL;
linestruct *replacebot = NULL;
filestruct *executetop = NULL;
filestruct *executebot = NULL;
linestruct *executetop = NULL;
linestruct *executebot = NULL;
#endif
regex_t search_regexp;

View File

@ -110,7 +110,7 @@ void do_help(void)
/* The current answer when the user invokes help at the prompt. */
unsigned stash[sizeof(flags) / sizeof(flags[0])];
/* A storage place for the current flag settings. */
filestruct *line;
linestruct *line;
int length;
FILE *fp;

View File

@ -64,7 +64,7 @@ void history_init(void)
}
/* Set the current position in the given history list to the bottom. */
void history_reset(const filestruct *list)
void history_reset(const linestruct *list)
{
if (list == search_history)
search_history = searchbot;
@ -77,14 +77,14 @@ void history_reset(const filestruct *list)
/* Return from the history list that starts at start and ends at end
* the first node that contains the first len characters of the given
* text, or NULL if there is no such node. */
filestruct *find_history(const filestruct *start, const filestruct *end,
linestruct *find_history(const linestruct *start, const linestruct *end,
const char *text, size_t len)
{
const filestruct *item;
const linestruct *item;
for (item = start; item != end->prev && item != NULL; item = item->prev) {
if (strncmp(item->data, text, len) == 0)
return (filestruct *)item;
return (linestruct *)item;
}
return NULL;
@ -92,9 +92,9 @@ filestruct *find_history(const filestruct *start, const filestruct *end,
/* Update a history list (the one in which item is the current position)
* with a fresh string text. That is: add text, or move it to the end. */
void update_history(filestruct **item, const char *text)
void update_history(linestruct **item, const char *text)
{
filestruct **htop = NULL, **hbot = NULL, *thesame;
linestruct **htop = NULL, **hbot = NULL, *thesame;
if (*item == search_history) {
htop = &searchtop;
@ -112,7 +112,7 @@ void update_history(filestruct **item, const char *text)
/* If an identical string was found, delete that item. */
if (thesame != NULL) {
filestruct *after = thesame->next;
linestruct *after = thesame->next;
/* If the string is at the head of the list, move the head. */
if (thesame == *htop)
@ -125,7 +125,7 @@ void update_history(filestruct **item, const char *text)
/* If the history is full, delete the oldest item (the one at the
* head of the list), to make room for a new item at the end. */
if ((*hbot)->lineno == MAX_SEARCH_HISTORY + 1) {
filestruct *oldest = *htop;
linestruct *oldest = *htop;
*htop = (*htop)->next;
unlink_node(oldest);
@ -147,7 +147,7 @@ void update_history(filestruct **item, const char *text)
/* Move h to the string in the history list just before it, and return
* that string. If there isn't one, don't move h and return NULL. */
char *get_history_older(filestruct **h)
char *get_history_older(linestruct **h)
{
if ((*h)->prev == NULL)
return NULL;
@ -159,7 +159,7 @@ char *get_history_older(filestruct **h)
/* Move h to the string in the history list just after it, and return
* that string. If there isn't one, don't move h and return NULL. */
char *get_history_newer(filestruct **h)
char *get_history_newer(linestruct **h)
{
if ((*h)->next == NULL)
return NULL;
@ -182,10 +182,10 @@ void get_history_newer_void(void)
* looking at only the first len characters of s, and return that
* string. If there isn't one, or if len is 0, don't move h and return
* s. */
char *get_history_completion(filestruct **h, char *s, size_t len)
char *get_history_completion(linestruct **h, char *s, size_t len)
{
if (len > 0) {
filestruct *htop = NULL, *hbot = NULL, *p;
linestruct *htop = NULL, *hbot = NULL, *p;
if (*h == search_history) {
htop = searchtop;
@ -315,7 +315,7 @@ void load_history(void)
/* Load the three history lists -- first search, then replace,
* then execute -- from oldest entry to newest. Between two
* lists there is an empty line. */
filestruct **history = &search_history;
linestruct **history = &search_history;
char *line = NULL;
size_t buf_len = 0;
ssize_t read;
@ -344,9 +344,9 @@ void load_history(void)
/* Write the lines of a history list, starting at head, from oldest to newest,
* to the given file. Return TRUE if writing succeeded, and FALSE otherwise. */
bool write_list(const filestruct *head, FILE *hisfile)
bool write_list(const linestruct *head, FILE *hisfile)
{
const filestruct *item;
const linestruct *item;
for (item = head; item != NULL; item = item->next) {
size_t length = strlen(item->data);

View File

@ -68,7 +68,7 @@ void get_edge_and_target(size_t *leftedge, size_t *target_column)
* chunk that starts at the given leftedge. If the target column has landed
* on a tab, prevent the cursor from falling back a row when moving forward,
* or from skipping a row when moving backward, by incrementing the index. */
size_t proper_x(filestruct *line, size_t *leftedge, bool forward,
size_t proper_x(linestruct *line, size_t *leftedge, bool forward,
size_t column, bool *shifted)
{
size_t index = actual_x(line->data, column);
@ -171,7 +171,7 @@ void do_page_down(void)
#ifdef ENABLE_JUSTIFY
/* Move to the first beginning of a paragraph before the current line. */
void do_para_begin(filestruct **line)
void do_para_begin(linestruct **line)
{
if ((*line)->prev != NULL)
*line = (*line)->prev;
@ -181,7 +181,7 @@ void do_para_begin(filestruct **line)
}
/* Move down to the last line of the first found paragraph. */
void do_para_end(filestruct **line)
void do_para_end(linestruct **line)
{
while ((*line)->next != NULL && !inpar(*line))
*line = (*line)->next;
@ -194,7 +194,7 @@ void do_para_end(filestruct **line)
/* Move up to first start of a paragraph before the current line. */
void do_para_begin_void(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
do_para_begin(&openfile->current);
openfile->current_x = 0;
@ -205,7 +205,7 @@ void do_para_begin_void(void)
/* Move down to just after the first found end of a paragraph. */
void do_para_end_void(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
do_para_end(&openfile->current);
@ -224,7 +224,7 @@ void do_para_end_void(void)
/* Move to the preceding block of text. */
void do_prev_block(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
bool is_text = FALSE, seen_text = FALSE;
/* Skip backward until first blank line after some nonblank line(s). */
@ -246,7 +246,7 @@ void do_prev_block(void)
/* Move to the next block of text. */
void do_next_block(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
bool is_white = white_string(openfile->current->data);
bool seen_white = is_white;
@ -357,7 +357,7 @@ bool do_next_word(bool after_ends, bool allow_punct)
* word if the WORD_BOUNDS flag is set, and update the screen afterwards. */
void do_prev_word_void(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
do_prev_word(ISSET(WORD_BOUNDS));
@ -369,7 +369,7 @@ void do_prev_word_void(void)
* punctuation as part of a word. Update the screen afterwards. */
void do_next_word_void(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
do_next_word(ISSET(AFTER_ENDS), ISSET(WORD_BOUNDS));
@ -381,7 +381,7 @@ void do_next_word_void(void)
* of the full line when already at the start of a chunk. */
void do_home(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
size_t was_column = xplustabs();
bool moved_off_chunk = TRUE;
#ifndef NANO_TINY
@ -441,7 +441,7 @@ void do_home(void)
* end of the full line. */
void do_end(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
size_t was_column = xplustabs();
size_t line_len = strlen(openfile->current->data);
bool moved_off_chunk = TRUE;
@ -490,7 +490,7 @@ void do_end(void)
/* Move the cursor to the preceding line or chunk. */
void do_up(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
size_t leftedge, target_column;
get_edge_and_target(&leftedge, &target_column);
@ -513,7 +513,7 @@ void do_up(void)
/* Move the cursor to next line or chunk. */
void do_down(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
size_t leftedge, target_column;
get_edge_and_target(&leftedge, &target_column);
@ -567,7 +567,7 @@ void do_scroll_down(void)
/* Move left one character. */
void do_left(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
if (openfile->current_x > 0)
openfile->current_x = move_mbleft(openfile->current->data,
@ -583,7 +583,7 @@ void do_left(void)
/* Move right one character. */
void do_right(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
if (openfile->current->data[openfile->current_x] != '\0')
openfile->current_x = move_mbright(openfile->current->data,

View File

@ -66,9 +66,9 @@ static bool input_was_aborted = FALSE;
/* Whether reading from standard input was aborted via ^C. */
/* Create a new linestruct node. Note that we do not set prevnode->next. */
filestruct *make_new_node(filestruct *prevnode)
linestruct *make_new_node(linestruct *prevnode)
{
filestruct *newnode = nmalloc(sizeof(filestruct));
linestruct *newnode = nmalloc(sizeof(linestruct));
newnode->data = NULL;
newnode->prev = prevnode;
@ -83,9 +83,9 @@ filestruct *make_new_node(filestruct *prevnode)
}
/* Make a copy of a linestruct node. */
filestruct *copy_node(const filestruct *src)
linestruct *copy_node(const linestruct *src)
{
filestruct *dst = nmalloc(sizeof(filestruct));
linestruct *dst = nmalloc(sizeof(linestruct));
dst->data = mallocstrcpy(NULL, src->data);
dst->next = src->next;
@ -100,7 +100,7 @@ filestruct *copy_node(const filestruct *src)
}
/* Splice a new node into an existing linked list of linestructs. */
void splice_node(filestruct *afterthis, filestruct *newnode)
void splice_node(linestruct *afterthis, linestruct *newnode)
{
newnode->next = afterthis->next;
newnode->prev = afterthis;
@ -114,7 +114,7 @@ void splice_node(filestruct *afterthis, filestruct *newnode)
}
/* Disconnect a node from a linked list of linestructs and delete it. */
void unlink_node(filestruct *fileptr)
void unlink_node(linestruct *fileptr)
{
if (fileptr->prev != NULL)
fileptr->prev->next = fileptr->next;
@ -129,7 +129,7 @@ void unlink_node(filestruct *fileptr)
}
/* Free the data structures in the given node. */
void delete_node(filestruct *fileptr)
void delete_node(linestruct *fileptr)
{
free(fileptr->data);
#ifdef ENABLE_COLOR
@ -139,9 +139,9 @@ void delete_node(filestruct *fileptr)
}
/* Duplicate an entire linked list of linestructs. */
filestruct *copy_filestruct(const filestruct *src)
linestruct *copy_filestruct(const linestruct *src)
{
filestruct *head, *copy;
linestruct *head, *copy;
copy = copy_node(src);
copy->prev = NULL;
@ -162,7 +162,7 @@ filestruct *copy_filestruct(const filestruct *src)
}
/* Free an entire linked list of linestructs. */
void free_filestruct(filestruct *src)
void free_filestruct(linestruct *src)
{
if (src == NULL)
return;
@ -176,7 +176,7 @@ void free_filestruct(filestruct *src)
}
/* Renumber the lines in a buffer, starting with the given line. */
void renumber(filestruct *line)
void renumber(linestruct *line)
{
ssize_t number;
@ -197,8 +197,8 @@ void renumber(filestruct *line)
/* Partition the current buffer so that it appears to begin at (top, top_x)
* and appears to end at (bot, bot_x). */
partition *partition_filestruct(filestruct *top, size_t top_x,
filestruct *bot, size_t bot_x)
partition *partition_filestruct(linestruct *top, size_t top_x,
linestruct *bot, size_t bot_x)
{
partition *p = nmalloc(sizeof(partition));
@ -283,10 +283,10 @@ void unpartition_filestruct(partition **p)
* current buffer to a new buffer beginning with file_top and ending
* with file_bot. If no text is between (top, top_x) and (bot, bot_x),
* don't do anything. */
void extract_buffer(filestruct **file_top, filestruct **file_bot,
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x)
void extract_buffer(linestruct **file_top, linestruct **file_bot,
linestruct *top, size_t top_x, linestruct *bot, size_t bot_x)
{
filestruct *top_save;
linestruct *top_save;
bool edittop_inside;
#ifndef NANO_TINY
bool mark_inside = FALSE;
@ -329,7 +329,7 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
/* Renumber, starting with file_top. */
renumber(*file_top);
} else {
filestruct *file_bot_save = *file_bot;
linestruct *file_bot_save = *file_bot;
/* Otherwise, tack the text in top onto the text at the end of
* file_bot. */
@ -395,9 +395,9 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
/* Meld the given buffer into the current file buffer
* at the current cursor position. */
void ingraft_buffer(filestruct *somebuffer)
void ingraft_buffer(linestruct *somebuffer)
{
filestruct *top_save;
linestruct *top_save;
size_t current_x_save = openfile->current_x;
bool edittop_inside;
#ifndef NANO_TINY
@ -408,11 +408,11 @@ void ingraft_buffer(filestruct *somebuffer)
/* Keep track of whether the mark begins inside the partition and
* will need adjustment. */
if (openfile->mark) {
filestruct *top, *bot;
linestruct *top, *bot;
size_t top_x, bot_x;
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
mark_order((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, &right_side_up);
single_line = (top == bot);
}
@ -491,9 +491,9 @@ void ingraft_buffer(filestruct *somebuffer)
}
/* Meld a copy of the given buffer into the current file buffer. */
void copy_from_buffer(filestruct *somebuffer)
void copy_from_buffer(linestruct *somebuffer)
{
filestruct *the_copy = copy_filestruct(somebuffer);
linestruct *the_copy = copy_filestruct(somebuffer);
ingraft_buffer(the_copy);
}
@ -1592,7 +1592,7 @@ int do_mouse(void)
/* If the click was in the edit window, put the cursor in that spot. */
if (wmouse_trafo(edit, &click_row, &click_col, FALSE)) {
filestruct *current_save = openfile->current;
linestruct *current_save = openfile->current;
ssize_t row_count = click_row - openfile->current_y;
size_t leftedge;
#ifndef NANO_TINY
@ -1776,10 +1776,10 @@ void do_input(void)
#endif
{
#ifdef ENABLE_WRAPPING
filestruct *was_next = openfile->current->next;
linestruct *was_next = openfile->current->next;
#endif
#ifndef NANO_TINY
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
size_t was_x = openfile->current_x;
/* If Shifted movement occurs, set the mark. */

View File

@ -270,32 +270,32 @@ typedef struct lintstruct {
#endif /* ENABLE_COLOR */
/* More structure types. */
typedef struct filestruct {
typedef struct linestruct {
char *data;
/* The text of this line. */
ssize_t lineno;
/* The number of this line. */
struct filestruct *next;
struct linestruct *next;
/* Next node. */
struct filestruct *prev;
struct linestruct *prev;
/* Previous node. */
#ifdef ENABLE_COLOR
short *multidata;
/* Array of which multi-line regexes apply to this line. */
#endif
} filestruct;
} linestruct;
typedef struct partition {
filestruct *fileage;
linestruct *fileage;
/* The top line of this portion of the file. */
filestruct *top_prev;
linestruct *top_prev;
/* The line before the top line of this portion of the file. */
char *top_data;
/* The text before the beginning of the top line of this portion
* of the file. */
filestruct *filebot;
linestruct *filebot;
/* The bottom line of this portion of the file. */
filestruct *bot_next;
linestruct *bot_next;
/* The line after the bottom line of this portion of the
* file. */
char *bot_data;
@ -332,9 +332,9 @@ typedef struct undo {
/* Undo info specific to groups of lines. */
/* Cut-specific stuff we need. */
filestruct *cutbuffer;
linestruct *cutbuffer;
/* Copy of the cutbuffer. */
filestruct *cutbottom;
linestruct *cutbottom;
/* Copy of cutbottom. */
ssize_t mark_begin_lineno;
/* Mostly the line number of the current line; sometimes something else. */
@ -360,13 +360,13 @@ typedef struct poshiststruct {
typedef struct openfilestruct {
char *filename;
/* The file's name. */
filestruct *fileage;
linestruct *fileage;
/* The file's first line. */
filestruct *filebot;
linestruct *filebot;
/* The file's last line. */
filestruct *edittop;
linestruct *edittop;
/* The current top of the edit window for this file. */
filestruct *current;
linestruct *current;
/* The current line for this file. */
size_t totsize;
/* The file's total number of characters. */
@ -384,7 +384,7 @@ typedef struct openfilestruct {
struct stat *current_stat;
/* The file's current stat information. */
#ifndef NANO_TINY
filestruct *mark;
linestruct *mark;
/* The line in the file where the mark is set; NULL if not set. */
size_t mark_x;
/* The mark's x position in the above line. */

View File

@ -438,7 +438,7 @@ void add_or_remove_pipe_symbol_from_answer(void)
/* Get a string of input at the statusbar prompt. */
functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
bool allow_files, bool *listed, filestruct **history_list,
bool allow_files, bool *listed, linestruct **history_list,
void (*refresh_func)(void))
{
int kbinput = ERR;
@ -584,7 +584,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
* can be tab completed. The curranswer parameter is the default answer
* for when simply Enter is typed. */
int do_prompt(bool allow_tabs, bool allow_files,
int menu, const char *curranswer, filestruct **history_list,
int menu, const char *curranswer, linestruct **history_list,
void (*refresh_func)(void), const char *msg, ...)
{
va_list ap;

View File

@ -44,7 +44,7 @@ extern bool suppress_cursorpos;
extern message_type lastmessage;
extern filestruct *pletion_line;
extern linestruct *pletion_line;
extern bool inhelp;
extern char *title;
@ -92,8 +92,8 @@ extern int margin;
extern ssize_t stripe_column;
#endif
extern filestruct *cutbuffer;
extern filestruct *cutbottom;
extern linestruct *cutbuffer;
extern linestruct *cutbottom;
extern bool keep_cutbuffer;
extern partition *filepart;
@ -147,16 +147,16 @@ extern sc *sclist;
extern subnfunc *allfuncs;
extern subnfunc *exitfunc;
extern filestruct *search_history;
extern filestruct *replace_history;
extern filestruct *execute_history;
extern linestruct *search_history;
extern linestruct *replace_history;
extern linestruct *execute_history;
#ifdef ENABLE_HISTORIES
extern filestruct *searchtop;
extern filestruct *searchbot;
extern filestruct *replacetop;
extern filestruct *replacebot;
extern filestruct *executetop;
extern filestruct *executebot;
extern linestruct *searchtop;
extern linestruct *searchbot;
extern linestruct *replacetop;
extern linestruct *replacebot;
extern linestruct *executetop;
extern linestruct *executebot;
#endif
extern regex_t search_regexp;
@ -239,8 +239,8 @@ bool is_valid_unicode(wchar_t wc);
void set_colorpairs(void);
void color_init(void);
void color_update(void);
void check_the_multis(filestruct *line);
void alloc_multidata_if_needed(filestruct *fileptr);
void check_the_multis(linestruct *line);
void alloc_multidata_if_needed(linestruct *fileptr);
void precalc_multicolorinfo(void);
#endif
@ -343,14 +343,14 @@ void do_help_void(void);
/* Most functions in history.c. */
#ifdef ENABLE_HISTORIES
void history_init(void);
void history_reset(const filestruct *h);
void update_history(filestruct **h, const char *s);
char *get_history_older(filestruct **h);
char *get_history_newer(filestruct **h);
void history_reset(const linestruct *h);
void update_history(linestruct **h, const char *s);
char *get_history_older(linestruct **h);
char *get_history_newer(linestruct **h);
void get_history_older_void(void);
void get_history_newer_void(void);
#ifdef ENABLE_TABCOMP
char *get_history_completion(filestruct **h, char *s, size_t len);
char *get_history_completion(linestruct **h, char *s, size_t len);
#endif
bool have_statedir(void);
void load_history(void);
@ -366,8 +366,8 @@ void to_last_line(void);
void do_page_up(void);
void do_page_down(void);
#ifdef ENABLE_JUSTIFY
void do_para_begin(filestruct **line);
void do_para_end(filestruct **line);
void do_para_begin(linestruct **line);
void do_para_end(linestruct **line);
void do_para_begin_void(void);
void do_para_end_void(void);
#endif
@ -389,20 +389,20 @@ void do_left(void);
void do_right(void);
/* Most functions in nano.c. */
filestruct *make_new_node(filestruct *prevnode);
void splice_node(filestruct *afterthis, filestruct *newnode);
void unlink_node(filestruct *fileptr);
void delete_node(filestruct *fileptr);
filestruct *copy_filestruct(const filestruct *src);
void free_filestruct(filestruct *src);
void renumber(filestruct *line);
partition *partition_filestruct(filestruct *top, size_t top_x,
filestruct *bot, size_t bot_x);
linestruct *make_new_node(linestruct *prevnode);
void splice_node(linestruct *afterthis, linestruct *newnode);
void unlink_node(linestruct *fileptr);
void delete_node(linestruct *fileptr);
linestruct *copy_filestruct(const linestruct *src);
void free_filestruct(linestruct *src);
void renumber(linestruct *line);
partition *partition_filestruct(linestruct *top, size_t top_x,
linestruct *bot, size_t bot_x);
void unpartition_filestruct(partition **p);
void extract_buffer(filestruct **file_top, filestruct **file_bot,
filestruct *top, size_t top_x, filestruct *bot, size_t bot_x);
void ingraft_buffer(filestruct *somebuffer);
void copy_from_buffer(filestruct *somebuffer);
void extract_buffer(linestruct **file_top, linestruct **file_bot,
linestruct *top, size_t top_x, linestruct *bot, size_t bot_x);
void ingraft_buffer(linestruct *somebuffer);
void copy_from_buffer(linestruct *somebuffer);
#ifdef ENABLE_MULTIBUFFER
void unlink_opennode(openfilestruct *fileptr);
void delete_opennode(openfilestruct *fileptr);
@ -459,7 +459,7 @@ size_t get_statusbar_page_start(size_t start_col, size_t column);
void put_cursor_at_end_of_answer(void);
void add_or_remove_pipe_symbol_from_answer(void);
int do_prompt(bool allow_tabs, bool allow_files,
int menu, const char *curranswer, filestruct **history_list,
int menu, const char *curranswer, linestruct **history_list,
void (*refresh_func)(void), const char *msg, ...);
int do_yesno_prompt(bool all, const char *msg);
@ -475,7 +475,7 @@ void do_rcfiles(void);
/* Most functions in search.c. */
void tidy_up_after_search(void);
int findnextstr(const char *needle, bool whole_word_only, int modus,
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
size_t *match_len, bool skipone, const linestruct *begin, size_t begin_x);
void do_search(void);
void do_search_forward(void);
void do_search_backward(void);
@ -484,7 +484,7 @@ void do_findnext(void);
void not_found_msg(const char *str);
void go_looking(void);
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
const filestruct *real_current, size_t *real_current_x);
const linestruct *real_current, size_t *real_current_x);
void do_replace(void);
void ask_for_replacement(void);
void goto_line_posx(ssize_t line, size_t pos_x);
@ -521,7 +521,7 @@ void update_undo(undo_type action);
#endif /* !NANO_TINY */
#ifdef ENABLE_WRAPPING
void wrap_reset(void);
bool do_wrap(filestruct *line);
bool do_wrap(linestruct *line);
#endif
#if defined(ENABLE_HELP) || defined(ENABLED_WRAPORJUSTIFY)
ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
@ -530,8 +530,8 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl);
size_t indent_length(const char *line);
#endif
#ifdef ENABLE_JUSTIFY
bool begpar(const filestruct *const foo, int depth);
bool inpar(const filestruct *const foo);
bool begpar(const linestruct *const foo, int depth);
bool inpar(const linestruct *const foo);
void do_justify(bool full_justify);
void do_justify_void(void);
void do_full_justify(void);
@ -584,13 +584,13 @@ void new_magicline(void);
void remove_magicline(void);
#endif
#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_range(const filestruct **top, const filestruct **bot);
void mark_order(const linestruct **top, size_t *top_x,
const linestruct **bot, size_t *bot_x, bool *right_side_up);
void get_range(const linestruct **top, const linestruct **bot);
#endif
size_t get_totsize(const filestruct *begin, const filestruct *end);
size_t get_totsize(const linestruct *begin, const linestruct *end);
#ifndef NANO_TINY
filestruct *fsfromline(ssize_t lineno);
linestruct *fsfromline(ssize_t lineno);
#endif
/* Most functions in winio.c. */
@ -629,28 +629,28 @@ void statusline(message_type importance, const char *msg, ...);
void bottombars(int menu);
void post_one_key(const char *keystroke, const char *tag, int width);
void place_the_cursor(void);
void edit_draw(filestruct *fileptr, const char *converted,
void edit_draw(linestruct *fileptr, const char *converted,
int line, size_t from_col);
int update_line(filestruct *fileptr, size_t index);
int update_line(linestruct *fileptr, size_t index);
#ifndef NANO_TINY
int update_softwrapped_line(filestruct *fileptr);
int update_softwrapped_line(linestruct *fileptr);
#endif
bool line_needs_update(const size_t old_column, const size_t new_column);
int go_back_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
int go_back_chunks(int nrows, linestruct **line, size_t *leftedge);
int go_forward_chunks(int nrows, linestruct **line, size_t *leftedge);
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
void edit_scroll(bool direction);
#ifndef NANO_TINY
size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
bool *end_of_line);
size_t get_chunk_and_edge(size_t column, filestruct *line, size_t *leftedge);
size_t chunk_for(size_t column, filestruct *line);
size_t leftedge_for(size_t column, filestruct *line);
size_t number_of_chunks_in(filestruct *line);
size_t get_chunk_and_edge(size_t column, linestruct *line, size_t *leftedge);
size_t chunk_for(size_t column, linestruct *line);
size_t leftedge_for(size_t column, linestruct *line);
size_t number_of_chunks_in(linestruct *line);
void ensure_firstcolumn_is_aligned(void);
#endif
size_t actual_last_column(size_t leftedge, size_t column);
void edit_redraw(filestruct *old_current, update_type manner);
void edit_redraw(linestruct *old_current, update_type manner);
void edit_refresh(void);
void adjust_viewport(update_type location);
void total_redraw(void);

View File

@ -178,13 +178,13 @@ void search_init(bool replacing, bool keep_the_answer)
* found something, 0 when nothing, and -2 on cancel. When match_len is
* not NULL, set it to the length of the found string, if any. */
int findnextstr(const char *needle, bool whole_word_only, int modus,
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x)
size_t *match_len, bool skipone, const linestruct *begin, size_t begin_x)
{
size_t found_len = strlen(needle);
/* The length of a match -- will be recomputed for a regex. */
int feedback = 0;
/* When bigger than zero, show and wipe the "Searching..." message. */
filestruct *line = openfile->current;
linestruct *line = openfile->current;
/* The line that we will search through now. */
const char *from = line->data + openfile->current_x;
/* The point in the line from where we start searching. */
@ -400,7 +400,7 @@ void not_found_msg(const char *str)
* the string occurs only once. */
void go_looking(void)
{
filestruct *was_current = openfile->current;
linestruct *was_current = openfile->current;
size_t was_current_x = openfile->current_x;
#ifdef DEBUG
clock_t start = clock();
@ -512,7 +512,7 @@ char *replace_line(const char *needle)
* is replaced by a shorter word. Return -1 if needle isn't found, -2 if
* the seeking is aborted, else the number of replacements performed. */
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
const filestruct *real_current, size_t *real_current_x)
const linestruct *real_current, size_t *real_current_x)
{
ssize_t numreplaced = -1;
size_t match_len;
@ -520,8 +520,8 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
bool skipone = ISSET(BACKWARDS_SEARCH);
int modus = REPLACING;
#ifndef NANO_TINY
filestruct *was_mark = openfile->mark;
filestruct *top, *bot;
linestruct *was_mark = openfile->mark;
linestruct *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
@ -529,8 +529,8 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
/* If the mark is on, frame the region, and turn the mark off. */
if (openfile->mark) {
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
mark_order((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, &right_side_up);
openfile->mark = NULL;
modus = INREGION;
@ -701,7 +701,7 @@ void do_replace(void)
/* Ask the user what the already given search string should be replaced with. */
void ask_for_replacement(void)
{
filestruct *edittop_save, *begin;
linestruct *edittop_save, *begin;
size_t firstcolumn_save, begin_x;
ssize_t numreplaced;
int i = do_prompt(FALSE, FALSE, MREPLACEWITH, NULL, &replace_history,
@ -833,7 +833,7 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
filestruct *currentline = openfile->current;
linestruct *currentline = openfile->current;
size_t leftedge = leftedge_for(xplustabs(), openfile->current);
rows_from_tail = (editwinrows / 2) - go_forward_chunks(
@ -868,7 +868,7 @@ void do_gotolinecolumn_void(void)
* we found a match, and FALSE otherwise. */
bool find_bracket_match(bool reverse, const char *bracket_set)
{
filestruct *fileptr = openfile->current;
linestruct *fileptr = openfile->current;
const char *rev_start = NULL, *found = NULL;
assert(mbstrlen(bracket_set) == 2);
@ -922,7 +922,7 @@ bool find_bracket_match(bool reverse, const char *bracket_set)
* there is one. */
void do_find_bracket(void)
{
filestruct *current_save;
linestruct *current_save;
size_t current_x_save;
const char *ch;
/* The location in matchbrackets of the bracket at the current

View File

@ -98,7 +98,7 @@ void do_tab(void)
#ifndef NANO_TINY
/* Add an indent to the given line. */
void indent_a_line(filestruct *line, char *indentation)
void indent_a_line(linestruct *line, char *indentation)
{
size_t length = strlen(line->data);
size_t indent_len = strlen(indentation);
@ -129,10 +129,10 @@ void indent_a_line(filestruct *line, char *indentation)
void do_indent(void)
{
char *indentation;
filestruct *top, *bot, *line;
linestruct *top, *bot, *line;
/* Use either all the marked lines or just the current line. */
get_range((const filestruct **)&top, (const filestruct **)&bot);
get_range((const linestruct **)&top, (const linestruct **)&bot);
/* Skip any leading empty lines. */
while (top != bot->next && top->data[0] == '\0')
@ -192,7 +192,7 @@ size_t length_of_white(const char *text)
}
/* Adjust the positions of mark and cursor when they are on the given line. */
void compensate_leftward(filestruct *line, size_t leftshift)
void compensate_leftward(linestruct *line, size_t leftshift)
{
if (line == openfile->mark) {
if (openfile->mark_x < leftshift)
@ -211,7 +211,7 @@ void compensate_leftward(filestruct *line, size_t leftshift)
}
/* Remove an indent from the given line. */
void unindent_a_line(filestruct *line, size_t indent_len)
void unindent_a_line(linestruct *line, size_t indent_len)
{
size_t length = strlen(line->data);
@ -232,10 +232,10 @@ void unindent_a_line(filestruct *line, size_t indent_len)
* The removed indent can be a mixture of spaces plus at most one tab. */
void do_unindent(void)
{
filestruct *top, *bot, *line;
linestruct *top, *bot, *line;
/* Use either all the marked lines or just the current line. */
get_range((const filestruct **)&top, (const filestruct **)&bot);
get_range((const linestruct **)&top, (const linestruct **)&bot);
/* Skip any leading lines that cannot be unindented. */
while (top != bot->next && length_of_white(top->data) == 0)
@ -270,7 +270,7 @@ void do_unindent(void)
void handle_indent_action(undo *u, bool undoing, bool add_indent)
{
undo_group *group = u->grouping;
filestruct *line = fsfromline(group->top_line);
linestruct *line = fsfromline(group->top_line);
if (group->next != NULL)
statusline(ALERT, "Multiple groups -- please report a bug");
@ -312,7 +312,7 @@ bool white_string(const char *s)
/* Test whether the given line can be uncommented, or add or remove a comment,
* depending on action. Return TRUE if the line is uncommentable, or when
* anything was added or removed; FALSE otherwise. */
bool comment_line(undo_type action, filestruct *line, const char *comment_seq)
bool comment_line(undo_type action, linestruct *line, const char *comment_seq)
{
size_t comment_seq_len = strlen(comment_seq);
const char *post_seq = strchr(comment_seq, '|');
@ -376,7 +376,7 @@ void do_comment(void)
{
const char *comment_seq = GENERAL_COMMENT_CHARACTER;
undo_type action = UNCOMMENT;
filestruct *top, *bot, *line;
linestruct *top, *bot, *line;
bool empty, all_empty = TRUE;
#ifdef ENABLE_COLOR
@ -390,7 +390,7 @@ void do_comment(void)
#endif
/* Determine which lines to work on. */
get_range((const filestruct **)&top, (const filestruct **)&bot);
get_range((const linestruct **)&top, (const linestruct **)&bot);
/* If only the magic line is selected, don't do anything. */
if (top == bot && bot == openfile->filebot && ISSET(FINAL_NEWLINE)) {
@ -441,7 +441,7 @@ void handle_comment_action(undo *u, bool undoing, bool add_comment)
goto_line_posx(u->lineno, u->begin);
while (group) {
filestruct *f = fsfromline(group->top_line);
linestruct *f = fsfromline(group->top_line);
while (f && f->lineno <= group->bottom_line) {
comment_line(undoing ^ add_comment ?
@ -491,7 +491,7 @@ void undo_cut(undo *u)
/* Redo a cut, or undo an uncut. */
void redo_cut(undo *u)
{
filestruct *oldcutbuffer = cutbuffer, *oldcutbottom = cutbottom;
linestruct *oldcutbuffer = cutbuffer, *oldcutbottom = cutbottom;
goto_line_posx(u->lineno, u->begin);
@ -516,8 +516,8 @@ void redo_cut(undo *u)
void do_undo(void)
{
undo *u = openfile->current_undo;
filestruct *f = NULL, *t = NULL;
filestruct *oldcutbuffer, *oldcutbottom;
linestruct *f = NULL, *t = NULL;
linestruct *oldcutbuffer, *oldcutbottom;
char *data, *undidmsg = NULL;
size_t from_x, to_x;
@ -694,7 +694,7 @@ void do_undo(void)
/* Redo the last thing(s) we undid. */
void do_redo(void)
{
filestruct *f = NULL, *shoveline;
linestruct *f = NULL, *shoveline;
char *data, *redidmsg = NULL;
undo *u = openfile->undotop;
@ -866,10 +866,10 @@ void do_redo(void)
/* Break the current line at the cursor position. */
void do_enter(void)
{
filestruct *newnode = make_new_node(openfile->current);
linestruct *newnode = make_new_node(openfile->current);
size_t extra = 0;
#ifndef NANO_TINY
filestruct *sampleline = openfile->current;
linestruct *sampleline = openfile->current;
bool allblanks = FALSE;
if (ISSET(AUTOINDENT)) {
@ -946,7 +946,7 @@ RETSIGTYPE cancel_the_command(int signal)
}
/* Send the text that starts at the given line to file descriptor fd. */
void send_data(const filestruct *line, int fd)
void send_data(const linestruct *line, int fd)
{
FILE *tube = fdopen(fd, "w");
@ -1021,7 +1021,7 @@ bool execute_command(const char *command)
/* If the command starts with "|", pipe buffer or region to the command. */
if (should_pipe) {
filestruct *was_cutbuffer = cutbuffer;
linestruct *was_cutbuffer = cutbuffer;
cutbuffer = NULL;
#ifdef ENABLE_MULTIBUFFER
@ -1431,7 +1431,7 @@ void wrap_reset(void)
}
/* Try wrapping the given line. Return TRUE if wrapped, FALSE otherwise. */
bool do_wrap(filestruct *line)
bool do_wrap(linestruct *line)
{
size_t line_len = strlen(line->data);
/* The length of the line we wrap. */
@ -1443,7 +1443,7 @@ bool do_wrap(filestruct *line)
/* The length of the remainder. */
size_t old_x = openfile->current_x;
filestruct *old_line = openfile->current;
linestruct *old_line = openfile->current;
/* There are three steps. First, we decide where to wrap. Then, we
* create the new wrap line. Finally, we clean up. */
@ -1669,7 +1669,7 @@ size_t indent_length(const char *line)
* but keep two spaces (if there are two) after any closing punctuation,
* and remove all blanks from the end of the line. Leave the first skip
* number of characters untreated. */
void squeeze(filestruct *line, size_t skip)
void squeeze(linestruct *line, size_t skip)
{
char *end, *new_end, *newdata;
size_t shift = 0;
@ -1789,7 +1789,7 @@ size_t quote_length(const char *line)
#define RECURSION_LIMIT 222
/* Return TRUE when the given line is the beginning of a paragraph (BOP). */
bool begpar(const filestruct *const line, int depth)
bool begpar(const linestruct *const line, int depth)
{
size_t quote_len, indent_len, prev_dent_len;
@ -1832,7 +1832,7 @@ bool begpar(const filestruct *const line, int depth)
/* Return TRUE when the given line is part of a paragraph: when it
* contains something more than quoting and leading whitespace. */
bool inpar(const filestruct *const line)
bool inpar(const linestruct *const line)
{
size_t quote_len = quote_length(line->data);
size_t indent_len = indent_length(line->data + quote_len);
@ -1844,9 +1844,9 @@ bool inpar(const filestruct *const line)
* Return TRUE if we found a paragraph, and FALSE otherwise. Furthermore,
* return in firstline the first line of the paragraph,
* and in *parlen the length of the paragraph. */
bool find_paragraph(filestruct **firstline, size_t *const parlen)
bool find_paragraph(linestruct **firstline, size_t *const parlen)
{
filestruct *line = *firstline;
linestruct *line = *firstline;
/* The line of the current paragraph we're searching in. */
/* When not currently in a paragraph, move forward to a line that is. */
@ -1871,10 +1871,10 @@ bool find_paragraph(filestruct **firstline, size_t *const parlen)
/* Tack all the lines of the paragraph (that starts at *line, and consists of
* par_len lines) together, skipping
* the quoting and indentation on all lines after the first. */
void concat_paragraph(filestruct **line, size_t par_len)
void concat_paragraph(linestruct **line, size_t par_len)
{
while (par_len > 1) {
filestruct *next_line = (*line)->next;
linestruct *next_line = (*line)->next;
size_t line_len = strlen((*line)->data);
size_t next_line_len = strlen(next_line->data);
size_t next_quote_len = quote_length(next_line->data);
@ -1900,7 +1900,7 @@ void concat_paragraph(filestruct **line, size_t par_len)
/* Rewrap the given line (that starts with the given lead string which is of
* the given length), into lines that fit within the target width (wrap_at). */
void rewrap_paragraph(filestruct **line, char *lead_string, size_t lead_len)
void rewrap_paragraph(linestruct **line, char *lead_string, size_t lead_len)
{
ssize_t break_pos;
/* The x-coordinate where the current line is to be broken. */
@ -1947,9 +1947,9 @@ void rewrap_paragraph(filestruct **line, char *lead_string, size_t lead_len)
/* Justify the lines of the given paragraph (that starts at *line, and consists
* of par_len lines) so they all fit within the target width (wrap_at) and have
* their whitespace normalized. */
void justify_paragraph(filestruct **line, size_t par_len)
void justify_paragraph(linestruct **line, size_t par_len)
{
filestruct *sampleline;
linestruct *sampleline;
/* The line from which the indentation is copied. */
size_t quote_len;
/* Length of the quote part. */
@ -1985,19 +1985,19 @@ void do_justify(bool full_justify)
{
size_t par_len;
/* The number of lines in the original paragraph. */
filestruct *first_par_line;
linestruct *first_par_line;
/* The first line of the paragraph. */
filestruct *last_par_line;
linestruct *last_par_line;
/* The line after the last line of the paragraph. */
size_t top_x;
/* The top x-coordinate of the paragraph we justify. */
size_t bot_x;
/* The bottom x-coordinate of the paragraph we justify. */
filestruct *was_cutbuffer = cutbuffer;
linestruct *was_cutbuffer = cutbuffer;
/* The old cutbuffer, so we can justify in the current cutbuffer. */
filestruct *was_cutbottom = cutbottom;
linestruct *was_cutbottom = cutbottom;
/* The old cutbottom, so we can justify in the current cutbuffer. */
filestruct *jusline;
linestruct *jusline;
/* The line that we're justifying in the current cutbuffer. */
#ifndef NANO_TINY
@ -2058,8 +2058,8 @@ void do_justify(bool full_justify)
if (openfile->mark) {
size_t quote_len;
mark_order((const filestruct **)&first_par_line, &top_x,
(const filestruct **)&last_par_line, &bot_x,
mark_order((const linestruct **)&first_par_line, &top_x,
(const linestruct **)&last_par_line, &bot_x,
&right_side_up);
/* Save the coordinates of the mark. */
@ -2142,7 +2142,7 @@ void do_justify(bool full_justify)
size_t line_len = strlen(cutbuffer->data), indent_len;
size_t needed_top_extra = (top_x < lead_len ? top_x : lead_len);
size_t needed_bot_extra = (bot_x < lead_len ? lead_len - bot_x : 0);
filestruct *line;
linestruct *line;
/* If the marked region starts in the middle of a line, and this line
* has a leading part, prepend any missing portion of this leading part
@ -2322,8 +2322,8 @@ bool fix_spello(const char *word)
char *save_search;
size_t firstcolumn_save = openfile->firstcolumn;
size_t current_x_save = openfile->current_x;
filestruct *edittop_save = openfile->edittop;
filestruct *current_save = openfile->current;
linestruct *edittop_save = openfile->edittop;
linestruct *current_save = openfile->current;
/* Save where we are. */
bool proceed = FALSE;
/* The return value of this function. */
@ -2333,7 +2333,7 @@ bool fix_spello(const char *word)
bool right_side_up = FALSE;
/* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
filestruct *top, *bot;
linestruct *top, *bot;
size_t top_x, bot_x;
#endif
@ -2344,8 +2344,8 @@ bool fix_spello(const char *word)
#ifndef NANO_TINY
/* If the mark is on, start at the beginning of the marked region. */
if (openfile->mark) {
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
mark_order((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, &right_side_up);
/* If the region is marked normally, swap the end points, so that
* (current, current_x) (where searching starts) is at the top. */
if (right_side_up) {
@ -2376,7 +2376,7 @@ bool fix_spello(const char *word)
light_from_col = xplustabs();
light_to_col = light_from_col + strlenpt(word);
#ifndef NANO_TINY
filestruct *saved_mark = openfile->mark;
linestruct *saved_mark = openfile->mark;
openfile->mark = NULL;
#endif
edit_refresh();
@ -2672,13 +2672,13 @@ const char *do_alt_speller(char *tempfile_name)
#ifndef NANO_TINY
/* Replace the marked text (or entire text) with the corrected text. */
if (openfile->mark) {
filestruct *top, *bot;
linestruct *top, *bot;
size_t top_x, bot_x;
bool right_side_up;
ssize_t was_mark_lineno = openfile->mark->lineno;
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, &right_side_up);
mark_order((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, &right_side_up);
replace_marked_buffer(tempfile_name);
@ -3126,16 +3126,16 @@ void do_wordlinechar_count(void)
ssize_t nlines = 0;
size_t current_x_save = openfile->current_x;
size_t pww_save = openfile->placewewant;
filestruct *current_save = openfile->current;
filestruct *was_mark = openfile->mark;
filestruct *top, *bot;
linestruct *current_save = openfile->current;
linestruct *was_mark = openfile->mark;
linestruct *top, *bot;
size_t top_x, bot_x;
/* If the mark is on, partition the buffer so that it
* contains only the marked text, and turn the mark off. */
if (was_mark) {
mark_order((const filestruct **)&top, &top_x,
(const filestruct **)&bot, &bot_x, NULL);
mark_order((const linestruct **)&top, &top_x,
(const linestruct **)&bot, &bot_x, NULL);
filepart = partition_filestruct(top, top_x, bot, bot_x);
openfile->mark = NULL;
}

View File

@ -465,8 +465,8 @@ void remove_magicline(void)
/* Set (top, top_x) and (bot, bot_x) to the start and end "coordinates" of
* the marked region. If right_side_up isn't NULL, set it to TRUE when the
* mark is at the top of the marked region, and to FALSE otherwise. */
void mark_order(const filestruct **top, size_t *top_x,
const filestruct **bot, size_t *bot_x, bool *right_side_up)
void mark_order(const linestruct **top, size_t *top_x,
const linestruct **bot, size_t *bot_x, bool *right_side_up)
{
if ((openfile->current->lineno == openfile->mark->lineno &&
openfile->current_x > openfile->mark_x) ||
@ -490,7 +490,7 @@ void mark_order(const filestruct **top, size_t *top_x,
/* Get the set of lines to work on -- either just the current line, or the
* first to last lines of the marked region. When the cursor (or mark) is
* at the start of the last line of the region, exclude that line. */
void get_range(const filestruct **top, const filestruct **bot)
void get_range(const linestruct **top, const linestruct **bot)
{
if (!openfile->mark) {
*top = openfile->current;
@ -508,9 +508,9 @@ void get_range(const filestruct **top, const filestruct **bot)
}
/* Given a line number, return a pointer to the corresponding struct. */
filestruct *fsfromline(ssize_t lineno)
linestruct *fsfromline(ssize_t lineno)
{
filestruct *f = openfile->current;
linestruct *f = openfile->current;
if (lineno <= openfile->current->lineno)
while (f->lineno != lineno && f->prev != NULL)
@ -529,9 +529,9 @@ filestruct *fsfromline(ssize_t lineno)
#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)
size_t get_totsize(const linestruct *begin, const linestruct *end)
{
const filestruct *line;
const linestruct *line;
size_t totsize = 0;
/* Sum the number of characters (plus a newline) in each line. */

View File

@ -2360,7 +2360,7 @@ void place_the_cursor(void)
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
filestruct *line = openfile->edittop;
linestruct *line = openfile->edittop;
size_t leftedge;
row -= chunk_for(openfile->firstcolumn, openfile->edittop);
@ -2395,7 +2395,7 @@ void place_the_cursor(void)
* character of this page. That is, the first character of converted
* corresponds to character number actual_x(fileptr->data, from_col) of the
* line. */
void edit_draw(filestruct *fileptr, const char *converted,
void edit_draw(linestruct *fileptr, const char *converted,
int row, size_t from_col)
{
#if !defined(NANO_TINY) || defined(ENABLE_COLOR)
@ -2456,9 +2456,9 @@ void edit_draw(filestruct *fileptr, const char *converted,
/* The place in converted from where painting starts. */
regmatch_t match;
/* The match positions of a single-line regex. */
const filestruct *start_line = fileptr->prev;
const linestruct *start_line = fileptr->prev;
/* The first line before fileptr that matches 'start'. */
const filestruct *end_line = fileptr;
const linestruct *end_line = fileptr;
/* The line that matches 'end'. */
regmatch_t startmatch, endmatch;
/* The match positions of the start and end regexes. */
@ -2721,7 +2721,7 @@ void edit_draw(filestruct *fileptr, const char *converted,
fileptr->lineno <= openfile->current->lineno) &&
(fileptr->lineno >= openfile->mark->lineno ||
fileptr->lineno >= openfile->current->lineno)) {
const filestruct *top, *bot;
const linestruct *top, *bot;
/* The lines where the marked region begins and ends. */
size_t top_x, bot_x;
/* The x positions where the marked region begins and ends. */
@ -2770,7 +2770,7 @@ void edit_draw(filestruct *fileptr, const char *converted,
* line will be passed to update_softwrapped_line(). Likely values of
* index are current_x or zero. Return the number of additional rows
* consumed (when softwrapping). */
int update_line(filestruct *fileptr, size_t index)
int update_line(linestruct *fileptr, size_t index)
{
int row = 0;
/* The row in the edit window we will be updating. */
@ -2830,11 +2830,11 @@ int update_line(filestruct *fileptr, size_t index)
/* Redraw all the chunks of the given line (as far as they fit onscreen),
* unless it's edittop, which will be displayed from column firstcolumn.
* Return the number of additional rows consumed. */
int update_softwrapped_line(filestruct *fileptr)
int update_softwrapped_line(linestruct *fileptr)
{
int row = 0;
/* The row in the edit window we will write to. */
filestruct *line = openfile->edittop;
linestruct *line = openfile->edittop;
/* An iterator needed to find the relevant row. */
int starting_row;
/* The first row in the edit window that gets updated. */
@ -2913,7 +2913,7 @@ bool line_needs_update(const size_t old_column, const size_t new_column)
* given column (leftedge). After moving, leftedge will be set to the
* starting column of the current chunk. Return the number of chunks we
* couldn't move up, which will be zero if we completely succeeded. */
int go_back_chunks(int nrows, filestruct **line, size_t *leftedge)
int go_back_chunks(int nrows, linestruct **line, size_t *leftedge)
{
int i;
@ -2950,7 +2950,7 @@ int go_back_chunks(int nrows, filestruct **line, size_t *leftedge)
* given column (leftedge). After moving, leftedge will be set to the
* starting column of the current chunk. Return the number of chunks we
* couldn't move down, which will be zero if we completely succeeded. */
int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge)
int go_forward_chunks(int nrows, linestruct **line, size_t *leftedge)
{
int i;
@ -2993,7 +2993,7 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
{
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
filestruct *line = openfile->current;
linestruct *line = openfile->current;
size_t leftedge = leftedge_for(xplustabs(), openfile->current);
int rows_left = go_back_chunks(editwinrows - 1, &line, &leftedge);
@ -3008,7 +3008,7 @@ bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge)
* draw the relevant content on the resultant blank row. */
void edit_scroll(bool direction)
{
filestruct *line;
linestruct *line;
size_t leftedge;
int remainder = 0, nrows = 1;
@ -3125,7 +3125,7 @@ size_t get_softwrap_breakpoint(const char *text, size_t leftedge,
/* Get the row of the softwrapped chunk of the given line that column is on,
* relative to the first row (zero-based), and return it. If leftedge isn't
* NULL, return the leftmost column of the chunk in it. */
size_t get_chunk_and_edge(size_t column, filestruct *line, size_t *leftedge)
size_t get_chunk_and_edge(size_t column, linestruct *line, size_t *leftedge)
{
size_t current_chunk = 0, start_col = 0, end_col;
bool end_of_line = FALSE;
@ -3147,7 +3147,7 @@ size_t get_chunk_and_edge(size_t column, filestruct *line, size_t *leftedge)
/* Return the row of the softwrapped chunk of the given line that column is on,
* relative to the first row (zero-based). */
size_t chunk_for(size_t column, filestruct *line)
size_t chunk_for(size_t column, linestruct *line)
{
if (ISSET(SOFTWRAP))
return get_chunk_and_edge(column, line, NULL);
@ -3157,7 +3157,7 @@ size_t chunk_for(size_t column, filestruct *line)
/* Return the leftmost column of the softwrapped chunk of the given line that
* column is on. */
size_t leftedge_for(size_t column, filestruct *line)
size_t leftedge_for(size_t column, linestruct *line)
{
size_t leftedge;
@ -3171,7 +3171,7 @@ size_t leftedge_for(size_t column, filestruct *line)
/* Return the row of the last softwrapped chunk of the given line, relative to
* the first row (zero-based). */
size_t number_of_chunks_in(filestruct *line)
size_t number_of_chunks_in(linestruct *line)
{
return chunk_for((size_t)-1, line);
}
@ -3237,7 +3237,7 @@ bool current_is_below_screen(void)
{
#ifndef NANO_TINY
if (ISSET(SOFTWRAP)) {
filestruct *line = openfile->edittop;
linestruct *line = openfile->edittop;
size_t leftedge = openfile->firstcolumn;
/* If current[current_x] is more than a screen's worth of lines after
@ -3262,7 +3262,7 @@ bool current_is_offscreen(void)
/* Update any lines between old_current and current that need to be
* updated. Use this if we've moved without changing any text. */
void edit_redraw(filestruct *old_current, update_type manner)
void edit_redraw(linestruct *old_current, update_type manner)
{
size_t was_pww = openfile->placewewant;
@ -3278,7 +3278,7 @@ void edit_redraw(filestruct *old_current, update_type manner)
#ifndef NANO_TINY
/* If the mark is on, update all lines between old_current and current. */
if (openfile->mark) {
filestruct *line = old_current;
linestruct *line = old_current;
while (line != openfile->current) {
update_line(line, 0);
@ -3305,7 +3305,7 @@ void edit_redraw(filestruct *old_current, update_type manner)
* if we've moved and changed text. */
void edit_refresh(void)
{
filestruct *line;
linestruct *line;
int row = 0;
#ifdef ENABLE_COLOR