/* 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; } }
/* Move text from the current filestruct into the cutbuffer. */ void do_cut_text_void(void) { #ifndef NANO_TINY add_undo(CUT); #endif do_cut_text(FALSE, FALSE); #ifndef NANO_TINY update_undo(CUT); #endif }
/* Move text from the current linestruct into the cutbuffer. */ void do_cut_text_void(void) { #ifndef NANO_TINY add_undo(CUT); #endif do_cut_text( #ifndef NANO_TINY FALSE, FALSE, FALSE #endif ); }
/* 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); }
/* Cut from the current cursor position to the end of the file. */ void do_cut_till_eof(void) { add_undo(CUT_EOF); do_cut_text(FALSE, TRUE, FALSE); }
/* Move text from the current filestruct into the cutbuffer. */ void do_cut_text_void(void) { add_undo(CUT); do_cut_text(FALSE, FALSE, FALSE); }