Example #1
0
/* Move text from the current filestruct into the cutbuffer, and copy it
 * back into the filestruct afterward.  If the mark is set or the cursor
 * was moved, blow away previous contents of the cutbuffer. */
void do_copy_text(void)
{
    static struct filestruct *next_contiguous_line = NULL;
    bool mark_set = openfile->mark_set;

    /* Remember the current view port and cursor position. */
    ssize_t is_edittop_lineno = openfile->edittop->lineno;
    ssize_t is_current_lineno = openfile->current->lineno;
    size_t is_current_x = openfile->current_x;

    if (mark_set || openfile->current != next_contiguous_line)
	cutbuffer_reset();

    do_cut_text(TRUE, FALSE);

    /* If the mark was set, blow away the cutbuffer on the next copy. */
    next_contiguous_line = (mark_set ? NULL : openfile->current);

    if (mark_set) {
	/* Restore the view port and cursor position. */
	openfile->edittop = fsfromline(is_edittop_lineno);
	openfile->current = fsfromline(is_current_lineno);
	openfile->current_x = is_current_x;
    }
}
Example #2
0
File: cut.c Project: ris21/yoda
/* Move text from the current linestruct into the cutbuffer, and copy it
 * back into the linestruct afterward.  If the mark is set or the cursor
 * was moved, blow away previous contents of the cutbuffer. */
void do_copy_text(void)
{
    static struct linestruct *next_contiguous_line = NULL;
    bool mark_set = openfile->mark_set;

    if (mark_set || openfile->current != next_contiguous_line)
	cutbuffer_reset();

    do_cut_text(TRUE, FALSE, FALSE);

    /* If the mark was set, blow away the cutbuffer on the next copy. */
    next_contiguous_line = (mark_set ? NULL : openfile->current);
}