To: vim-dev@vim.org Subject: Patch 6.0.228 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.228 Problem: After putting text in Visual mode the '] mark is not at the end of the put text. Undo doesn't work properly when putting a word into a Visual selection that spans more than one line. Solution: Correct the '] mark for the deleting the Visually selected text. #ifdef code that depends on FEAT_VISUAL properly. Also fix that "d" crossing line boundary puts '[ just before deleted text. Fix undo by saving all deleted lines at once. Files: src/ex_docmd.c, src/globals.h, src/normal.c, src/ops.c, src/structs.h, src/vim.h *** ../vim60.227/src/ex_docmd.c Sun Feb 17 13:55:07 2002 --- src/ex_docmd.c Sun Feb 17 20:22:06 2002 *************** *** 6276,6282 **** eap->forceit = TRUE; } curwin->w_cursor.lnum = eap->line2; ! do_put(eap->regname, eap->forceit ? BACKWARD : FORWARD, -1L, 0); } /* --- 6276,6282 ---- eap->forceit = TRUE; } curwin->w_cursor.lnum = eap->line2; ! do_put(eap->regname, eap->forceit ? BACKWARD : FORWARD, 1L, PUT_LINE); } /* *** ../vim60.227/src/globals.h Sun Feb 3 12:42:13 2002 --- src/globals.h Sun Feb 17 16:23:37 2002 *************** *** 446,451 **** --- 447,453 ---- EXTERN int redo_VIsual_busy INIT(= FALSE); /* TRUE when redoing Visual */ + EXTERN int did_visual_put INIT(= FALSE); /* TRUE after Visual mode "p" */ #endif #ifdef FEAT_MOUSE *** ../vim60.227/src/normal.c Sat Feb 16 22:55:56 2002 --- src/normal.c Sun Feb 17 21:04:42 2002 *************** *** 1130,1135 **** --- 1130,1138 ---- normal_end: msg_nowait = FALSE; + #ifdef FEAT_VISUAL + did_visual_put = FALSE; + #endif /* Reset finish_op, in case it was set */ #ifdef CURSOR_SHAPE *************** *** 1888,1894 **** --- 1891,1899 ---- { curwin->w_cursor = old_cursor; } + #ifdef FEAT_VISUAL oap->block_mode = FALSE; + #endif oap->regname = 0; oap->motion_force = NUL; } *************** *** 7180,7185 **** --- 7185,7191 ---- /* * Handle an operator command. + * The actual work is done by do_pending_operator(). */ static void nv_operator(cap) *************** *** 7842,7852 **** --- 7848,7862 ---- colnr_T left, right; #endif int dir; + int flags = 0; if (cap->oap->op_type != OP_NOP) clearopbeep(cap->oap); else { + dir = (cap->cmdchar == 'P' + || (cap->cmdchar == 'g' && cap->nchar == 'P')) + ? BACKWARD : FORWARD; #ifdef FEAT_VISUAL if (VIsual_active) { *************** *** 7866,7881 **** if (VIsual_mode == 'v' && *p_sel == 'e') dir = BACKWARD; else dir = FORWARD; } - else #endif - dir = (cap->cmdchar == 'P' - || (cap->cmdchar == 'g' && cap->nchar == 'P')) - ? BACKWARD : FORWARD; prep_redo_cmd(cap); ! do_put(cap->oap->regname, dir, ! cap->count1, cap->cmdchar == 'g' ? PUT_CURSEND : 0); #ifdef FEAT_VISUAL if (VIsual_active) --- 7876,7896 ---- if (VIsual_mode == 'v' && *p_sel == 'e') dir = BACKWARD; else + { + if (dir == BACKWARD) + flags |= PUT_LINE_BACKWARD; dir = FORWARD; + } + /* When deleting a linewise Visual area, must put the register as + * lines to avoid it being deleted. */ + if (VIsual_mode == 'V') + flags |= PUT_LINE; } #endif prep_redo_cmd(cap); ! if (cap->cmdchar == 'g') ! flags |= PUT_CURSEND; ! do_put(cap->oap->regname, dir, cap->count1, flags); #ifdef FEAT_VISUAL if (VIsual_active) *************** *** 7886,7891 **** --- 7901,7907 ---- cap->oap->regname = NUL; curwin->w_cursor = curpos; nv_operator(cap); + did_visual_put = TRUE; /* tell op_delete() to correct '] mark */ } #endif } *** ../vim60.227/src/ops.c Tue Feb 12 12:14:36 2002 --- src/ops.c Sun Feb 17 21:07:29 2002 *************** *** 50,56 **** --- 50,58 ---- char_u **y_array; /* pointer to array of line pointers */ linenr_T y_size; /* number of lines in y_array */ char_u y_type; /* MLINE, MCHAR or MBLOCK */ + #ifdef FEAT_VISUAL colnr_T y_width; /* only set if y_type == MBLOCK */ + #endif } y_regs[NUM_REGISTERS]; static struct yankreg *y_current; /* ptr to current yankreg */ *************** *** 99,108 **** --- 101,113 ---- #endif static void free_yank __ARGS((long)); static void free_yank_all __ARGS((void)); + static int yank_copy_line __ARGS((struct block_def *bd, long y_idx)); #ifdef FEAT_CLIPBOARD static void copy_yank_reg __ARGS((struct yankreg *reg)); #endif + #ifdef FEAT_VISUAL static void block_prep __ARGS((oparg_T *oap, struct block_def *, linenr_T, int)); + #endif #if defined(FEAT_CLIPBOARD) || defined(FEAT_EVAL) static void str_to_reg __ARGS((struct yankreg *y_ptr, int type, char_u *str, long len)); #endif *************** *** 213,227 **** { long i; int first_char; - int block_col = 0; char_u *s; if (u_save((linenr_T)(oap->start.lnum - 1), (linenr_T)(oap->end.lnum + 1)) == FAIL) return; if (oap->block_mode) block_col = curwin->w_cursor.col; for (i = oap->line_count; --i >= 0; ) { --- 218,236 ---- { long i; int first_char; char_u *s; + #ifdef FEAT_VISUAL + int block_col = 0; + #endif if (u_save((linenr_T)(oap->start.lnum - 1), (linenr_T)(oap->end.lnum + 1)) == FAIL) return; + #ifdef FEAT_VISUAL if (oap->block_mode) block_col = curwin->w_cursor.col; + #endif for (i = oap->line_count; --i >= 0; ) { *************** *** 246,257 **** changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); if (oap->block_mode) { curwin->w_cursor.lnum = oap->start.lnum; curwin->w_cursor.col = block_col; } ! else if (curs_top) /* put cursor on first line, for ">>" */ { curwin->w_cursor.lnum = oap->start.lnum; beginline(BL_SOL | BL_FIX); /* shift_line() may have set cursor.col */ --- 255,269 ---- changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); + #ifdef FEAT_VISUAL if (oap->block_mode) { curwin->w_cursor.lnum = oap->start.lnum; curwin->w_cursor.col = block_col; } ! else ! #endif ! if (curs_top) /* put cursor on first line, for ">>" */ { curwin->w_cursor.lnum = oap->start.lnum; beginline(BL_SOL | BL_FIX); /* shift_line() may have set cursor.col */ *************** *** 1402,1411 **** int n; linenr_T lnum; char_u *ptr; char_u *newp, *oldp; linenr_T old_lcount = curbuf->b_ml.ml_line_count; int did_yank = FALSE; - struct block_def bd; if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to do */ return OK; --- 1414,1425 ---- int n; linenr_T lnum; char_u *ptr; + #ifdef FEAT_VISUAL char_u *newp, *oldp; + struct block_def bd; + #endif linenr_T old_lcount = curbuf->b_ml.ml_line_count; int did_yank = FALSE; if (curbuf->b_ml.ml_flags & ML_EMPTY) /* nothing to do */ return OK; *************** *** 1538,1543 **** --- 1552,1558 ---- } } + #ifdef FEAT_VISUAL /* * block mode delete */ *************** *** 1584,1590 **** oap->end.lnum + 1, 0L); oap->line_count = 0; /* no lines deleted */ } ! else if (oap->motion_type == MLINE) { if (oap->op_type == OP_CHANGE) { --- 1599,1607 ---- oap->end.lnum + 1, 0L); oap->line_count = 0; /* no lines deleted */ } ! else ! #endif ! if (oap->motion_type == MLINE) { if (oap->op_type == OP_CHANGE) { *************** *** 1623,1631 **** } else { - if (u_save_cursor() == FAIL) /* save first line for undo */ - return FAIL; - #ifdef FEAT_VIRTUALEDIT if (virtual_active()) { --- 1640,1645 ---- *************** *** 1634,1639 **** --- 1648,1655 ---- /* For virtualedit: break the tabs that are partly included. */ if (gchar_pos(&oap->start) == '\t') { + if (u_save_cursor() == FAIL) /* save first line for undo */ + return FAIL; if (oap->line_count == 1) endcol = getviscol2(oap->end.col, oap->end.coladd); coladvance_force(getviscol2(oap->start.col, oap->start.coladd)); *************** *** 1649,1654 **** --- 1665,1675 ---- if (gchar_pos(&oap->end) == '\t') { + /* save last line for undo if it's not also the first line */ + if (oap->end.lnum != curwin->w_cursor.lnum + && u_save((linenr_T)(oap->end.lnum - 1), + (linenr_T)(oap->end.lnum + 1)) == FAIL) + return FAIL; curwin->w_cursor = oap->end; coladvance_force(getviscol2(oap->end.col, oap->end.coladd)); oap->end = curwin->w_cursor; *************** *** 1659,1664 **** --- 1680,1688 ---- if (oap->line_count == 1) /* delete characters within one line */ { + if (u_save_cursor() == FAIL) /* save line for undo */ + return FAIL; + /* if 'cpoptions' contains '$', display '$' at end of change */ if ( vim_strchr(p_cpo, CPO_DOLLAR) != NULL && oap->op_type == OP_CHANGE *************** *** 1697,1717 **** } else /* delete characters between lines */ { truncate_line(TRUE); /* delete from cursor to end of line */ ! oap->start = curwin->w_cursor; /* remember curwin->w_cursor */ ++curwin->w_cursor.lnum; ! /* includes save for undo */ ! del_lines((long)(oap->line_count - 2), TRUE); - if (u_save_cursor() == FAIL) /* save last line for undo */ - return FAIL; - u_clearline(); /* "U" not possible now */ /* delete from start of line until op_end */ curwin->w_cursor.col = 0; (void)del_bytes((long)(oap->end.col + 1 - !oap->inclusive), restart_edit == NUL && !virtual_active()); ! curwin->w_cursor = oap->start; /* restore curwin->w_cursor */ (void)do_join(FALSE); } --- 1721,1744 ---- } else /* delete characters between lines */ { + pos_T curpos; + + /* save deleted and changed lines for undo */ + if (u_save((linenr_T)(curwin->w_cursor.lnum - 1), + (linenr_T)(curwin->w_cursor.lnum + oap->line_count)) == FAIL) + return FAIL; + truncate_line(TRUE); /* delete from cursor to end of line */ ! curpos = curwin->w_cursor; /* remember curwin->w_cursor */ ++curwin->w_cursor.lnum; ! del_lines((long)(oap->line_count - 2), FALSE); /* delete from start of line until op_end */ curwin->w_cursor.col = 0; (void)del_bytes((long)(oap->end.col + 1 - !oap->inclusive), restart_edit == NUL && !virtual_active()); ! curwin->w_cursor = curpos; /* restore curwin->w_cursor */ (void)do_join(FALSE); } *************** *** 1719,1735 **** msgmore(curbuf->b_ml.ml_line_count - old_lcount); /* * Set "'[" and "']" marks. */ ! curbuf->b_op_start = oap->start; ! if (oap->block_mode) { ! curbuf->b_op_end.lnum = oap->end.lnum; ! curbuf->b_op_end.col = oap->start.col; } else ! curbuf->b_op_end = oap->start; return OK; } --- 1746,1793 ---- msgmore(curbuf->b_ml.ml_line_count - old_lcount); + #ifdef FEAT_VISUAL /* * Set "'[" and "']" marks. */ ! if (did_visual_put) { ! /* "p" in Visual mode: The '] mark is at the end of the inserted text, ! * correct it for the deleted text. */ ! if (oap->block_mode) ! { ! if (curbuf->b_op_end.lnum <= oap->end.lnum) ! curbuf->b_op_end.col -= bd.textlen ! - bd.startspaces - bd.endspaces; ! } ! else if (oap->motion_type == MLINE) ! curbuf->b_op_end.lnum -= oap->line_count; ! else ! { ! if (curbuf->b_op_end.lnum == curbuf->b_op_start.lnum) ! { ! if (oap->line_count == 1) ! curbuf->b_op_end.col -= oap->end.col - oap->start.col + 1; ! else ! curbuf->b_op_end.col -= oap->end.col - 1; ! } ! curbuf->b_op_end.lnum -= oap->line_count - 1; ! } } else ! #endif ! { ! #ifdef FEAT_VISUAL ! if (oap->block_mode) ! { ! curbuf->b_op_end.lnum = oap->end.lnum; ! curbuf->b_op_end.col = oap->start.col; ! } ! else ! #endif ! curbuf->b_op_end = oap->start; ! } ! curbuf->b_op_start = oap->start; return OK; } *************** *** 1952,1958 **** --- 2010,2018 ---- oparg_T *oap; { pos_T pos; + #ifdef FEAT_VISUAL struct block_def bd; + #endif int did_change = 0; if (u_save((linenr_T)(oap->start.lnum - 1), *************** *** 1960,1965 **** --- 2020,2026 ---- return; pos = oap->start; + #ifdef FEAT_VISUAL if (oap->block_mode) /* Visual block mode */ { for (; pos.lnum <= oap->end.lnum; ++pos.lnum) *************** *** 1977,1982 **** --- 2038,2044 ---- changed_lines(oap->start.lnum, 0, oap->end.lnum + 1, 0L); } else /* not block mode */ + #endif { if (oap->motion_type == MLINE) { *************** *** 2470,2476 **** --- 2532,2540 ---- y_current->y_size = yanklines; y_current->y_type = yanktype; /* set the yank register type */ + #ifdef FEAT_VISUAL y_current->y_width = 0; + #endif y_current->y_array = (char_u **)lalloc_clear((long_u)(sizeof(char_u *) * yanklines), TRUE); *************** *** 2483,2488 **** --- 2547,2553 ---- y_idx = 0; lnum = oap->start.lnum; + #ifdef FEAT_VISUAL if (oap->block_mode) { /* Visual block mode */ *************** *** 2492,2522 **** if (curwin->w_curswant == MAXCOL && y_current->y_width > 0) y_current->y_width--; } for ( ; lnum <= yankendlnum; lnum++, y_idx++) { switch (y_current->y_type) { case MBLOCK: block_prep(oap, &bd, lnum, FALSE); ! copyline: ! if ((pnew = alloc(bd.startspaces + bd.endspaces ! + bd.textlen + 1)) == NULL) ! { ! fail: /* free the allocated lines */ ! free_yank(y_idx + 1); ! y_current = curr; ! return FAIL; ! } ! y_current->y_array[y_idx] = pnew; ! copy_spaces(pnew, (size_t)bd.startspaces); ! pnew += bd.startspaces; ! mch_memmove(pnew, bd.textstart, (size_t)bd.textlen); ! pnew += bd.textlen; ! copy_spaces(pnew, (size_t)bd.endspaces); ! pnew += bd.endspaces; ! *pnew = NUL; break; case MLINE: if ((y_current->y_array[y_idx] = --- 2557,2575 ---- if (curwin->w_curswant == MAXCOL && y_current->y_width > 0) y_current->y_width--; } + #endif for ( ; lnum <= yankendlnum; lnum++, y_idx++) { switch (y_current->y_type) { + #ifdef FEAT_VISUAL case MBLOCK: block_prep(oap, &bd, lnum, FALSE); ! if (yank_copy_line(&bd, y_idx) == FAIL) ! goto fail; break; + #endif case MLINE: if ((y_current->y_array[y_idx] = *************** *** 2595,2601 **** bd.textlen = endcol - startcol + oap->inclusive; } bd.textstart = p + startcol; ! goto copyline; } /* NOTREACHED */ } --- 2648,2656 ---- bd.textlen = endcol - startcol + oap->inclusive; } bd.textstart = p + startcol; ! if (yank_copy_line(&bd, y_idx) == FAIL) ! goto fail; ! break; } /* NOTREACHED */ } *************** *** 2623,2630 **** + STRLEN(y_current->y_array[0]) + 1), TRUE); if (pnew == NULL) { ! y_idx = y_current->y_size - 1; ! goto fail; } STRCPY(pnew, curr->y_array[--j]); STRCAT(pnew, y_current->y_array[0]); --- 2678,2685 ---- + STRLEN(y_current->y_array[0]) + 1), TRUE); if (pnew == NULL) { ! y_idx = y_current->y_size - 1; ! goto fail; } STRCPY(pnew, curr->y_array[--j]); STRCAT(pnew, y_current->y_array[0]); *************** *** 2643,2649 **** } if (mess) /* Display message about yank? */ { ! if (yanktype == MCHAR && !oap->block_mode && yanklines == 1) yanklines = 0; /* Some versions of Vi use ">=" here, some don't... */ if (yanklines > p_report) --- 2698,2708 ---- } if (mess) /* Display message about yank? */ { ! if (yanktype == MCHAR ! #ifdef FEAT_VISUAL ! && !oap->block_mode ! #endif ! && yanklines == 1) yanklines = 0; /* Some versions of Vi use ">=" here, some don't... */ if (yanklines > p_report) *************** *** 2660,2667 **** /* * Set "'[" and "']" marks. */ ! curbuf->b_op_start = oap->start; ! curbuf->b_op_end = oap->end; #ifdef FEAT_CLIPBOARD /* --- 2719,2731 ---- /* * Set "'[" and "']" marks. */ ! #ifdef FEAT_VISUAL ! if (!did_visual_put) ! #endif ! { ! curbuf->b_op_start = oap->start; ! curbuf->b_op_end = oap->end; ! } #ifdef FEAT_CLIPBOARD /* *************** *** 2702,2707 **** --- 2766,2797 ---- #endif return OK; + + fail: /* free the allocated lines */ + free_yank(y_idx + 1); + y_current = curr; + return FAIL; + } + + static int + yank_copy_line(bd, y_idx) + struct block_def *bd; + long y_idx; + { + char_u *pnew; + + if ((pnew = alloc(bd->startspaces + bd->endspaces + bd->textlen + 1)) + == NULL) + return FAIL; + y_current->y_array[y_idx] = pnew; + copy_spaces(pnew, (size_t)bd->startspaces); + pnew += bd->startspaces; + mch_memmove(pnew, bd->textstart, (size_t)bd->textlen); + pnew += bd->textlen; + copy_spaces(pnew, (size_t)bd->endspaces); + pnew += bd->endspaces; + *pnew = NUL; + return OK; } #ifdef FEAT_CLIPBOARD *************** *** 2736,2744 **** /* * put contents of register "regname" into the text - * For ":put" command count == -1. * flags: PUT_FIXINDENT make indent look nice * PUT_CURSEND leave cursor after end of new text */ void do_put(regname, dir, count, flags) --- 2826,2834 ---- /* * put contents of register "regname" into the text * flags: PUT_FIXINDENT make indent look nice * PUT_CURSEND leave cursor after end of new text + * PUT_LINE force linewise put (":put") */ void do_put(regname, dir, count, flags) *************** *** 2750,2769 **** char_u *ptr; char_u *newp, *oldp; int yanklen; - int oldlen; int totlen = 0; /* init for gcc */ linenr_T lnum; colnr_T col; long i; /* index in y_array[] */ int y_type; long y_size; long y_width = 0; - char_u **y_array = NULL; - long nr_lines = 0; colnr_T vcol; int delcount; int incr = 0; long j; pos_T new_cursor; int indent; int orig_indent = 0; /* init for gcc */ --- 2840,2862 ---- char_u *ptr; char_u *newp, *oldp; int yanklen; int totlen = 0; /* init for gcc */ linenr_T lnum; colnr_T col; long i; /* index in y_array[] */ int y_type; long y_size; + #ifdef FEAT_VISUAL + int oldlen; long y_width = 0; colnr_T vcol; int delcount; int incr = 0; long j; + struct block_def bd; + #endif + char_u **y_array = NULL; + long nr_lines = 0; pos_T new_cursor; int indent; int orig_indent = 0; /* init for gcc */ *************** *** 2771,2777 **** int first_indent = TRUE; int lendiff = 0; pos_T old_pos; - struct block_def bd; char_u *insert_string = NULL; int allocated = FALSE; long cnt; --- 2864,2869 ---- *************** *** 2879,2894 **** get_yank_register(regname, FALSE); y_type = y_current->y_type; y_width = y_current->y_width; y_size = y_current->y_size; y_array = y_current->y_array; } ! if (count == -1) /* :put command */ ! { y_type = MLINE; - count = 1; - } if (y_size == 0 || y_array == NULL) { --- 2971,2987 ---- get_yank_register(regname, FALSE); y_type = y_current->y_type; + #ifdef FEAT_VISUAL y_width = y_current->y_width; + #endif y_size = y_current->y_size; y_array = y_current->y_array; } ! if ((flags & PUT_LINE_BACKWARD) && y_type == MLINE) ! dir = BACKWARD; ! if (flags & PUT_LINE) /* :put command */ y_type = MLINE; if (y_size == 0 || y_array == NULL) { *************** *** 2897,2902 **** --- 2990,2996 ---- goto end; } + #ifdef FEAT_VISUAL if (y_type == MBLOCK) { lnum = curwin->w_cursor.lnum + y_size + 1; *************** *** 2905,2911 **** if (u_save(curwin->w_cursor.lnum - 1, lnum) == FAIL) goto end; } ! else if (y_type == MLINE) { lnum = curwin->w_cursor.lnum; #ifdef FEAT_FOLDING --- 2999,3007 ---- if (u_save(curwin->w_cursor.lnum - 1, lnum) == FAIL) goto end; } ! else ! #endif ! if (y_type == MLINE) { lnum = curwin->w_cursor.lnum; #ifdef FEAT_FOLDING *************** *** 2954,2959 **** --- 3050,3056 ---- lnum = curwin->w_cursor.lnum; col = curwin->w_cursor.col; + #ifdef FEAT_VISUAL /* * Block mode */ *************** *** 3126,3131 **** --- 3223,3229 ---- curwin->w_cursor.lnum = lnum; } else + #endif { /* * Character or Line mode *************** *** 4093,4098 **** --- 4215,4221 ---- } #endif + #ifdef FEAT_VISUAL /* * prepare a few things for block mode yank/delete/tilde * *************** *** 4255,4260 **** --- 4378,4384 ---- bdp->textcol = (colnr_T) (pstart - line); bdp->textstart = pstart; } + #endif /* FEAT_VISUAL */ #ifdef FEAT_RIGHTLEFT static void reverse_line __ARGS((char_u *s)); *************** *** 4596,4608 **** --- 4720,4738 ---- str = skipwhite(str); if (STRNCMP(str, "CHAR", 4) == 0) y_current->y_type = MCHAR; + #ifdef FEAT_VISUAL else if (STRNCMP(str, "BLOCK", 5) == 0) y_current->y_type = MBLOCK; + #endif else y_current->y_type = MLINE; /* get the block width; if it's missing we get a zero, which is OK */ str = skipwhite(skiptowhite(str)); + #ifdef FEAT_VISUAL y_current->y_width = getdigits(&str); + #else + (void)getdigits(&str); + #endif } while (!(eof = viminfo_readline(virp)) *************** *** 4679,4687 **** --- 4809,4819 ---- case MCHAR: type = (char_u *)"CHAR"; break; + #ifdef FEAT_VISUAL case MBLOCK: type = (char_u *)"BLOCK"; break; + #endif default: sprintf((char *)IObuff, _("Unknown register type %d"), y_regs[i].y_type); *************** *** 4692,4698 **** if (y_previous == &y_regs[i]) fprintf(fp, "\""); c = get_register_name(i); ! fprintf(fp, "\"%c\t%s\t%d\n", c, type, y_regs[i].y_width); num_lines = y_regs[i].y_size; /* If max_num_lines < 0, then we save ALL the lines in the register */ --- 4824,4836 ---- if (y_previous == &y_regs[i]) fprintf(fp, "\""); c = get_register_name(i); ! fprintf(fp, "\"%c\t%s\t%d\n", c, type, ! #ifdef FEAT_VISUAL ! (int)y_regs[i].y_width ! #else ! 0 ! #endif ! ); num_lines = y_regs[i].y_size; /* If max_num_lines < 0, then we save ALL the lines in the register */ *************** *** 4803,4808 **** --- 4941,4947 ---- #endif colnr_T old_curswant; int old_set_curswant; + pos_T old_op_start, old_op_end; oparg_T oa; cmdarg_T ca; *************** *** 4818,4823 **** --- 4957,4964 ---- old_cursor = curwin->w_cursor; old_curswant = curwin->w_curswant; old_set_curswant = curwin->w_set_curswant; + old_op_start = curbuf->b_op_start; + old_op_end = curbuf->b_op_end; #ifdef FEAT_VISUAL old_visual = VIsual; old_visual_mode = VIsual_mode; *************** *** 4836,4841 **** --- 4977,4984 ---- curwin->w_cursor = old_cursor; curwin->w_curswant = old_curswant; curwin->w_set_curswant = old_set_curswant; + curbuf->b_op_start = old_op_start; + curbuf->b_op_end = old_op_end; #ifdef FEAT_VISUAL VIsual = old_visual; VIsual_mode = old_visual_mode; *************** *** 5204,5210 **** --- 5347,5355 ---- } y_ptr->y_type = type; y_ptr->y_size = lnum; + # ifdef FEAT_VISUAL y_ptr->y_width = 0; + # endif } #endif /* FEAT_CLIPBOARD || FEAT_EVAL || PROTO */ *************** *** 5320,5326 **** if (VIsual_mode == Ctrl_V) { oparg.is_VIsual = 1; ! oparg.block_mode = 1; oparg.op_type = OP_NOP; getvcols(curwin, &min_pos, &max_pos, &oparg.start_vcol, &oparg.end_vcol); --- 5465,5471 ---- if (VIsual_mode == Ctrl_V) { oparg.is_VIsual = 1; ! oparg.block_mode = TRUE; oparg.op_type = OP_NOP; getvcols(curwin, &min_pos, &max_pos, &oparg.start_vcol, &oparg.end_vcol); *** ../vim60.227/src/structs.h Thu Jan 17 16:30:27 2002 --- src/structs.h Sun Feb 17 16:22:11 2002 *************** *** 1428,1435 **** do_change()) */ #ifdef FEAT_VISUAL int is_VIsual; /* operator on Visual area */ - #endif int block_mode; /* current operator is Visual block mode */ colnr_T start_vcol; /* start col for block mode operator */ colnr_T end_vcol; /* end col for block mode operator */ } oparg_T; --- 1428,1435 ---- do_change()) */ #ifdef FEAT_VISUAL int is_VIsual; /* operator on Visual area */ int block_mode; /* current operator is Visual block mode */ + #endif colnr_T start_vcol; /* start col for block mode operator */ colnr_T end_vcol; /* end col for block mode operator */ } oparg_T; *** ../vim60.227/src/vim.h Mon Feb 4 17:08:29 2002 --- src/vim.h Sun Feb 17 21:05:10 2002 *************** *** 816,821 **** --- 816,823 ---- /* flags for do_put() */ #define PUT_FIXINDENT 1 /* make indent look nice */ #define PUT_CURSEND 2 /* leave cursor after end of new text */ + #define PUT_LINE 4 /* put register as lines */ + #define PUT_LINE_BACKWARD 8 /* put linewise register backwards */ /* flags for set_indent() */ #define SIN_CHANGED 1 /* call changed_bytes() when line changed */ *** ../vim60.227/src/version.c Sun Feb 17 15:39:58 2002 --- src/version.c Sun Feb 17 22:11:06 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 228, /**/ -- INSPECTOR END OF FILM: Move along. There's nothing to see! Keep moving! [Suddenly he notices the cameras.] INSPECTOR END OF FILM: (to Camera) All right, put that away sonny. [He walks over to it and puts his hand over the lens.] "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///