at_edittop = (openfile->fileage == openfile->edittop);
#ifndef NANO_SMALL
if (openfile->mark_set)
- mark_inside = (openfile->mark_beginbuf->lineno >=
+ mark_inside = (openfile->mark_begin->lineno >=
openfile->fileage->lineno &&
- openfile->mark_beginbuf->lineno <=
+ openfile->mark_begin->lineno <=
openfile->filebot->lineno &&
- (openfile->mark_beginbuf != openfile->fileage ||
- openfile->mark_beginx >= top_x) &&
- (openfile->mark_beginbuf != openfile->filebot ||
- openfile->mark_beginx <= bot_x));
+ (openfile->mark_begin != openfile->fileage ||
+ openfile->mark_begin_x >= top_x) &&
+ (openfile->mark_begin != openfile->filebot ||
+ openfile->mark_begin_x <= bot_x));
#endif
/* Get the number of characters in the text, and subtract it from
openfile->edittop = openfile->fileage;
#ifndef NANO_SMALL
if (mark_inside) {
- openfile->mark_beginbuf = openfile->fileage;
- openfile->mark_beginx = top_x;
+ openfile->mark_begin = openfile->fileage;
+ openfile->mark_begin_x = top_x;
}
#endif
null_at(&openfile->current->data, openfile->current_x +
line_len - char_buf_len);
#ifndef NANO_SMALL
- if (openfile->mark_set && openfile->current_x <
- openfile->mark_beginx && openfile->mark_beginbuf ==
- openfile->current)
- openfile->mark_beginx -= char_buf_len;
+ if (openfile->mark_set && openfile->mark_begin ==
+ openfile->current && openfile->current_x <
+ openfile->mark_begin_x)
+ openfile->mark_begin_x -= char_buf_len;
#endif
openfile->totsize--;
} else if (openfile->current != openfile->filebot &&
strcpy(openfile->current->data + openfile->current_x,
foo->data);
#ifndef NANO_SMALL
- if (openfile->mark_set && openfile->mark_beginbuf ==
+ if (openfile->mark_set && openfile->mark_begin ==
openfile->current->next) {
- openfile->mark_beginx += openfile->current_x;
- openfile->mark_beginbuf = openfile->current;
+ openfile->mark_begin = openfile->current;
+ openfile->mark_begin_x += openfile->current_x;
}
#endif
if (openfile->filebot == foo)
null_at(&openfile->current->data, openfile->current_x);
#ifndef NANO_SMALL
if (openfile->mark_set && openfile->current ==
- openfile->mark_beginbuf && openfile->current_x <
- openfile->mark_beginx) {
- openfile->mark_beginbuf = newnode;
- openfile->mark_beginx += extra - openfile->current_x;
+ openfile->mark_begin && openfile->current_x <
+ openfile->mark_begin_x) {
+ openfile->mark_begin = newnode;
+ openfile->mark_begin_x += extra - openfile->current_x;
}
#endif
openfile->current_x = extra;
void do_mark(void)
{
- openfile->mark_set = openfile->mark_set ? FALSE : TRUE;
+ openfile->mark_set = !openfile->mark_set;
if (openfile->mark_set) {
statusbar(_("Mark Set"));
- openfile->mark_beginbuf = openfile->current;
- openfile->mark_beginx = openfile->current_x;
+ openfile->mark_begin = openfile->current;
+ openfile->mark_begin_x = openfile->current_x;
} else {
statusbar(_("Mark UNset"));
- openfile->mark_beginbuf = NULL;
- openfile->mark_beginx = 0;
+ openfile->mark_begin = NULL;
+ openfile->mark_begin_x = 0;
edit_refresh();
}
}
/* If the mark was on this line after the wrap point, we move it
* down. If it was on the next line and we wrapped onto that line,
* we move it right. */
- if (openfile->mark_set && openfile->mark_beginbuf == line &&
- openfile->mark_beginx > wrap_loc) {
- openfile->mark_beginbuf = line->next;
- openfile->mark_beginx -= wrap_loc - indent_len + 1;
- } else if (wrapping && openfile->mark_beginbuf == line->next)
- openfile->mark_beginx += after_break_len;
+ if (openfile->mark_set) {
+ if (openfile->mark_begin == line && openfile->mark_begin_x >
+ wrap_loc) {
+ openfile->mark_begin = line->next;
+ openfile->mark_begin_x -= wrap_loc - indent_len + 1;
+ } else if (wrapping && openfile->mark_begin == line->next)
+ openfile->mark_begin_x += after_break_len;
+ }
#endif
return TRUE;
bool added_magicline = FALSE;
/* Whether we added a magicline after filebot. */
bool right_side_up = FALSE;
- /* TRUE if (mark_beginbuf, mark_beginx) is the top of the mark,
+ /* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
filestruct *top, *bot;
size_t top_x, bot_x;
if (openfile->fileage == openfile->filebot)
bot_x += top_x;
if (right_side_up) {
- openfile->mark_beginx = top_x;
+ openfile->mark_begin_x = top_x;
current_x_save = bot_x;
} else {
current_x_save = top_x;
- openfile->mark_beginx = bot_x;
+ openfile->mark_begin_x = bot_x;
}
/* Unpartition the filestruct so that it contains all the text
bool added_magicline = FALSE;
/* Whether we added a magicline after filebot. */
bool right_side_up = FALSE;
- /* TRUE if (mark_beginbuf, mark_beginx) is the top of the mark,
+ /* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
filestruct *top, *bot;
size_t top_x, bot_x;
- ssize_t mbb_lineno_save = 0;
+ ssize_t mb_lineno_save = 0;
/* We're going to close the current file, and open the output of
- * the alternate spell command. The line that mark_beginbuf
- * points to will be freed, so we save the line number and
- * restore afterwards. */
+ * the alternate spell command. The line that mark_begin points
+ * to will be freed, so we save the line number and restore it
+ * afterwards. */
size_t totsize_save = openfile->totsize;
/* Our saved value of totsize, used when we spell-check a marked
* selection. */
if (old_mark_set) {
/* If the mark is on, save the number of the line it starts on,
* and then turn the mark off. */
- mbb_lineno_save = openfile->mark_beginbuf->lineno;
+ mb_lineno_save = openfile->mark_begin->lineno;
openfile->mark_set = FALSE;
}
#endif
if (openfile->fileage == openfile->filebot)
bot_x += top_x;
if (right_side_up) {
- openfile->mark_beginx = top_x;
+ openfile->mark_begin_x = top_x;
current_x_save = bot_x;
} else {
current_x_save = top_x;
- openfile->mark_beginx = bot_x;
+ openfile->mark_begin_x = bot_x;
}
/* Unpartition the filestruct so that it contains all the text
totsize_save += openfile->totsize;
openfile->totsize = totsize_save;
- /* Assign mark_beginbuf to the line where the mark began
- * before. */
- do_gotopos(mbb_lineno_save, openfile->mark_beginx,
+ /* Assign mark_begin to the line where the mark began before. */
+ do_gotopos(mb_lineno_save, openfile->mark_begin_x,
current_y_save, 0);
- openfile->mark_beginbuf = openfile->current;
+ openfile->mark_begin = openfile->current;
- /* Assign mark_beginx to the location in mark_beginbuf where the
+ /* Assign mark_begin_x to the location in mark_begin where the
* mark began before, adjusted for any shortening of the
* line. */
- openfile->mark_beginx = openfile->current_x;
+ openfile->mark_begin_x = openfile->current_x;
/* Turn the mark back on. */
openfile->mark_set = TRUE;
#ifndef NANO_SMALL
/* Keep track of the change in the current line. */
- if (openfile->mark_set && openfile->mark_beginbuf ==
- paragraph && openfile->mark_beginx >= end -
+ if (openfile->mark_set && openfile->mark_begin ==
+ paragraph && openfile->mark_begin_x >= end -
paragraph->data)
mark_shift += end_len;
#endif
#ifndef NANO_SMALL
/* Keep track of the change in the current line. */
- if (openfile->mark_set && openfile->mark_beginbuf ==
- paragraph && openfile->mark_beginx >= end -
+ if (openfile->mark_set && openfile->mark_begin ==
+ paragraph && openfile->mark_begin_x >= end -
paragraph->data)
mark_shift += end_len;
#endif
#ifndef NANO_SMALL
/* Adjust the mark coordinates to compensate for the change in
* the current line. */
- if (openfile->mark_set && openfile->mark_beginbuf ==
- paragraph) {
- openfile->mark_beginx -= mark_shift;
- if (openfile->mark_beginx > new_end - new_paragraph_data)
- openfile->mark_beginx = new_end - new_paragraph_data;
+ if (openfile->mark_set && openfile->mark_begin == paragraph) {
+ openfile->mark_begin_x -= mark_shift;
+ if (openfile->mark_begin_x > new_end - new_paragraph_data)
+ openfile->mark_begin_x = new_end - new_paragraph_data;
}
#endif
} else
ssize_t current_lineno_save = openfile->current->lineno;
#ifndef NANO_SMALL
bool old_mark_set = openfile->mark_set;
- ssize_t mbb_lineno_save = 0;
- size_t mark_beginx_save = 0;
+ ssize_t mb_lineno_save = 0;
+ size_t mark_begin_x_save = 0;
if (old_mark_set) {
- mbb_lineno_save = openfile->mark_beginbuf->lineno;
- mark_beginx_save = openfile->mark_beginx;
+ mb_lineno_save = openfile->mark_begin->lineno;
+ mark_begin_x_save = openfile->mark_begin_x;
}
#endif
copy_from_filestruct(jusbuffer, jusbottom);
/* Move upward from the last line of the paragraph to the first
- * line, putting first_line, edittop, current, and mark_beginbuf at
- * the same lines in the copied paragraph that they had in the
- * original paragraph. */
+ * line, putting first_line, edittop, current, and mark_begin at the
+ * same lines in the copied paragraph that they had in the original
+ * paragraph. */
top = openfile->current->prev;
for (i = par_len; i > 0; i--) {
if (top->lineno == fl_lineno_save)
if (top->lineno == current_lineno_save)
openfile->current = top;
#ifndef NANO_SMALL
- if (old_mark_set && top->lineno == mbb_lineno_save) {
- openfile->mark_beginbuf = top;
- openfile->mark_beginx = mark_beginx_save;
+ if (old_mark_set && top->lineno == mb_lineno_save) {
+ openfile->mark_begin = top;
+ openfile->mark_begin_x = mark_begin_x_save;
}
#endif
top = top->prev;
filestruct *edittop_save = openfile->edittop;
filestruct *current_save = openfile->current;
#ifndef NANO_SMALL
- filestruct *mark_beginbuf_save = openfile->mark_beginbuf;
- size_t mark_beginx_save = openfile->mark_beginx;
+ filestruct *mark_begin_save = openfile->mark_begin;
+ size_t mark_begin_x_save = openfile->mark_begin_x;
#endif
int kbinput;
bool meta_key, func_key, s_or_t, ran_func, finished;
#ifndef NANO_SMALL
/* Adjust the mark coordinates to compensate for the change
* in the next line. */
- if (openfile->mark_set && openfile->mark_beginbuf ==
+ if (openfile->mark_set && openfile->mark_begin ==
next_line) {
- openfile->mark_beginbuf = openfile->current;
- openfile->mark_beginx += line_len - indent_len;
+ openfile->mark_begin = openfile->current;
+ openfile->mark_begin_x += line_len - indent_len;
}
#endif
#ifndef NANO_SMALL
/* Adjust the mark coordinates to compensate for the change
* in the current line. */
- if (openfile->mark_set && openfile->mark_beginbuf ==
- openfile->current && openfile->mark_beginx >
+ if (openfile->mark_set && openfile->mark_begin ==
+ openfile->current && openfile->mark_begin_x >
break_pos) {
- openfile->mark_beginbuf = openfile->current->next;
- openfile->mark_beginx -= break_pos - indent_len;
+ openfile->mark_begin = openfile->current->next;
+ openfile->mark_begin_x -= break_pos - indent_len;
}
#endif
openfile->totlines = openfile->filebot->lineno;
#ifndef NANO_SMALL
if (openfile->mark_set) {
- openfile->mark_beginbuf = mark_beginbuf_save;
- openfile->mark_beginx = mark_beginx_save;
+ openfile->mark_begin = mark_begin_save;
+ openfile->mark_begin_x = mark_begin_x_save;
}
#endif
openfile->modified = modified_save;
#ifndef NANO_SMALL
/* Note that current_x has not yet been incremented. */
if (openfile->mark_set && openfile->current ==
- openfile->mark_beginbuf && openfile->current_x <
- openfile->mark_beginx)
- openfile->mark_beginx += char_buf_len;
+ openfile->mark_begin && openfile->current_x <
+ openfile->mark_begin_x)
+ openfile->mark_begin_x += char_buf_len;
#endif
do_right(FALSE);
/* Look for needle, starting at (current, current_x). If no_sameline is
* TRUE, skip over begin when looking for needle. begin is the line
- * where we first started searching, at column beginx. If
+ * where we first started searching, at column begin_x. If
* can_display_wrap is TRUE, we put messages on the statusbar, wrap
* around the file boundaries. The return value specifies whether we
* found anything. If we did, set needle_len to the length of the
* string we found if it isn't NULL. */
bool findnextstr(bool can_display_wrap, bool wholeword, bool
- no_sameline, const filestruct *begin, size_t beginx, const char
+ no_sameline, const filestruct *begin, size_t begin_x, const char
*needle, size_t *needle_len)
{
filestruct *fileptr = openfile->current;
/* Ensure we haven't wrapped around again! */
if (search_last_line &&
#ifndef NANO_SMALL
- ((!ISSET(BACKWARDS_SEARCH) && current_x_find > beginx) ||
- (ISSET(BACKWARDS_SEARCH) && current_x_find < beginx))
+ ((!ISSET(BACKWARDS_SEARCH) && current_x_find > begin_x) ||
+ (ISSET(BACKWARDS_SEARCH) && current_x_find < begin_x))
#else
- current_x_find > beginx
+ current_x_find > begin_x
#endif
) {
if (can_display_wrap)
filestruct *edittop_save = openfile->edittop, *top, *bot;
size_t top_x, bot_x;
bool right_side_up = FALSE;
- /* TRUE if (mark_beginbuf, mark_beginx) is the top of the mark,
+ /* TRUE if (mark_begin, mark_begin_x) is the top of the mark,
* FALSE if (current, current_x) is. */
if (old_mark_set) {
strlen(openfile->current->data);
#ifndef NANO_SMALL
- /* If the mark was on and (mark_beginbuf, mark_begin_x) was
- * the top of it, don't change mark_beginx. */
+ /* If the mark was on and (mark_begin, mark_begin_x) was the
+ * top of it, don't change mark_begin_x. */
if (!old_mark_set || !right_side_up) {
- /* Keep mark_beginx in sync with the text changes. */
- if (openfile->current == openfile->mark_beginbuf &&
- openfile->mark_beginx > openfile->current_x) {
- if (openfile->mark_beginx < openfile->current_x +
+ /* Keep mark_begin_x in sync with the text changes. */
+ if (openfile->current == openfile->mark_begin &&
+ openfile->mark_begin_x > openfile->current_x) {
+ if (openfile->mark_begin_x < openfile->current_x +
match_len)
- openfile->mark_beginx = openfile->current_x;
+ openfile->mark_begin_x = openfile->current_x;
else
- openfile->mark_beginx += length_change;
+ openfile->mark_begin_x += length_change;
}
}
{
int i;
filestruct *edittop_save, *begin;
- size_t beginx, pww_save;
+ size_t begin_x, pww_save;
ssize_t numreplaced;
if (ISSET(VIEW_MODE)) {
/* Save where we are. */
edittop_save = openfile->edittop;
begin = openfile->current;
- beginx = openfile->current_x;
+ begin_x = openfile->current_x;
pww_save = openfile->placewewant;
- numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE,
+ numreplaced = do_replace_loop(last_search, begin, &begin_x, FALSE,
NULL);
/* Restore where we were. */
openfile->edittop = edittop_save;
openfile->current = begin;
- openfile->current_x = beginx;
+ openfile->current_x = begin_x;
openfile->placewewant = pww_save;
renumber(openfile->fileage);