updated for version 7.0050
diff --git a/src/buffer.c b/src/buffer.c
index 6a6ffc6..a634062 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3008,7 +3008,7 @@
/* format: "fname + (path) (1 of 2) - VIM" */
if (curbuf->b_fname == NULL)
- STRCPY(buf, _("[No file]"));
+ STRCPY(buf, _("[No Name]"));
else
{
p = transstr(gettail(curbuf->b_fname));
diff --git a/src/edit.c b/src/edit.c
index a889736..ae00c2a 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -6270,6 +6270,10 @@
if (--*count > 0) /* repeat what was typed */
{
+ /* Vi repeats the insert without replacing characters. */
+ if (vim_strchr(p_cpo, CPO_REPLCNT) != NULL)
+ State &= ~REPLACE_FLAG;
+
(void)start_redo_ins();
if (cmdchar == 'r' || cmdchar == 'v')
stuffReadbuff(ESC_STR); /* no ESC in redo buffer */
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 899e4c8..d2e933a 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -6457,6 +6457,7 @@
ex_preserve(eap)
exarg_T *eap;
{
+ curbuf->b_flags |= BF_PRESERVED;
ml_preserve(curbuf, TRUE);
}
diff --git a/src/ex_getln.c b/src/ex_getln.c
index a7dfd9a..05c85b4 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -205,13 +205,25 @@
* set some variables for redrawcmd()
*/
ccline.cmdfirstc = (firstc == '@' ? 0 : firstc);
- ccline.cmdindent = indent;
- alloc_cmdbuff(exmode_active ? 250 : 0); /* alloc initial ccline.cmdbuff */
+ ccline.cmdindent = (firstc > 0 ? indent : 0);
+
+ /* alloc initial ccline.cmdbuff */
+ alloc_cmdbuff(exmode_active ? 250 : indent + 1);
if (ccline.cmdbuff == NULL)
return NULL; /* out of memory */
ccline.cmdlen = ccline.cmdpos = 0;
ccline.cmdbuff[0] = NUL;
+ /* autoindent for :insert and :append */
+ if (firstc <= 0)
+ {
+ copy_spaces(ccline.cmdbuff, indent);
+ ccline.cmdbuff[indent] = NUL;
+ ccline.cmdpos = indent;
+ ccline.cmdspos = indent;
+ ccline.cmdlen = indent;
+ }
+
ExpandInit(&xpc);
#ifdef FEAT_RIGHTLEFT
@@ -1878,7 +1890,7 @@
garray_T line_ga;
int len;
int off = 0;
- char_u *p;
+ char_u *pend;
int finished = FALSE;
#if defined(FEAT_GUI) || defined(NO_COOKED_INPUT)
int startcol = 0;
@@ -1897,6 +1909,7 @@
msg_putchar('\n');
if (c == ':')
{
+ /* indent that is only displayed, not in the line itself */
msg_putchar(':');
while (indent-- > 0)
msg_putchar(' ');
@@ -1907,6 +1920,25 @@
ga_init2(&line_ga, 1, 30);
+ /* autoindent for :insert and :append is in the line itself */
+ if (c <= 0)
+ {
+#if defined(FEAT_GUI) || defined(NO_COOKED_INPUT)
+ vcol = indent;
+#endif
+ while (indent >= 8)
+ {
+ ga_append(&line_ga, TAB);
+ msg_puts((char_u *)" ");
+ indent -= 8;
+ }
+ while (indent-- > 0)
+ {
+ ga_append(&line_ga, ' ');
+ msg_putchar(' ');
+ }
+ }
+
/*
* Get the line, one character at a time.
*/
@@ -1915,14 +1947,14 @@
{
if (ga_grow(&line_ga, 40) == FAIL)
break;
- p = (char_u *)line_ga.ga_data + line_ga.ga_len;
+ pend = (char_u *)line_ga.ga_data + line_ga.ga_len;
/* Get one character (inchar gets a third of maxlen characters!) */
- len = inchar(p + off, 3, -1L, 0);
+ len = inchar(pend + off, 3, -1L, 0);
if (len < 0)
continue; /* end of input script reached */
/* for a special character, we need at least three characters */
- if ((*p == K_SPECIAL || *p == CSI) && off + len < 3)
+ if ((*pend == K_SPECIAL || *pend == CSI) && off + len < 3)
{
off += len;
continue;
@@ -1947,7 +1979,7 @@
while (len > 0)
{
- c1 = *p++;
+ c1 = *pend++;
--len;
if ((c1 == K_SPECIAL
# if !defined(NO_COOKED_INPUT) || defined(FEAT_GUI)
@@ -1955,8 +1987,8 @@
# endif
) && len >= 2)
{
- c1 = TO_SPECIAL(p[0], p[1]);
- p += 2;
+ c1 = TO_SPECIAL(pend[0], pend[1]);
+ pend += 2;
len -= 2;
}
@@ -2006,6 +2038,46 @@
continue;
}
+ if (c1 == Ctrl_T)
+ c1 = TAB; /* very simplistic... */
+
+ if (c1 == Ctrl_D)
+ {
+ char_u *p;
+
+ /* Delete one shiftwidth. */
+ p = (char_u *)line_ga.ga_data;
+ p[line_ga.ga_len] = NUL;
+ indent = get_indent_str(p, 8);
+ --indent;
+ indent -= indent % 8;
+ while (get_indent_str(p, 8) > indent)
+ {
+ char_u *s = skipwhite(p);
+
+ mch_memmove(s - 1, s, line_ga.ga_len - (s - p) + 1);
+ --line_ga.ga_len;
+ }
+ msg_col = startcol;
+ for (vcol = 0; *p != NUL; ++p)
+ {
+ if (*p == TAB)
+ {
+ do
+ {
+ msg_putchar(' ');
+ } while (++vcol % 8);
+ }
+ else
+ {
+ msg_outtrans_len(p, 1);
+ vcol += char2cells(*p);
+ }
+ }
+ msg_clr_eos();
+ continue;
+ }
+
if (c1 == Ctrl_V)
{
escaped = TRUE;
@@ -2046,13 +2118,13 @@
line_ga.ga_len += len;
}
#endif
- p = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
- if (line_ga.ga_len && p[-1] == '\n')
+ pend = (char_u *)(line_ga.ga_data) + line_ga.ga_len;
+ if (line_ga.ga_len && pend[-1] == '\n')
{
finished = TRUE;
--line_ga.ga_len;
- --p;
- *p = NUL;
+ --pend;
+ *pend = NUL;
}
}
diff --git a/src/fileio.c b/src/fileio.c
index ea7c924..9dd1d49 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -433,7 +433,7 @@
* Only set/reset b_p_ro when BF_CHECK_RO is set.
*/
check_readonly = (newfile && (curbuf->b_flags & BF_CHECK_RO));
- if (check_readonly && !readonlymode) /* default: set file not readonly */
+ if (check_readonly && !readonlymode)
curbuf->b_p_ro = FALSE;
if (newfile && !read_stdin && !read_buffer)
@@ -3499,8 +3499,8 @@
#endif
/* When using ":w!" and writing to the current file, readonly makes no
- * sense, reset it */
- if (forceit && overwriting)
+ * sense, reset it, unless 'Z' appears in 'cpoptions'. */
+ if (forceit && overwriting && vim_strchr(p_cpo, CPO_KEEPRO) == NULL)
{
buf->b_p_ro = FALSE;
#ifdef FEAT_TITLE
diff --git a/src/main.aap b/src/main.aap
index 9356dd9..ddaa5c8 100644
--- a/src/main.aap
+++ b/src/main.aap
@@ -114,6 +114,7 @@
MOTIF
GUI_SRC = gui.c gui_motif.c gui_x11.c pty.c gui_beval.c
+ gui_xmdlg.c gui_xmebw.c
GUI_OBJ =
GUI_DEFS = -DFEAT_GUI_MOTIF $NARROW_PROTO
GUI_IPATH = $GUI_INC_LOC
diff --git a/src/main.c b/src/main.c
index 3b888f2..351225c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -826,8 +826,9 @@
/* "-w {scriptout}" write to script */
if (vim_isdigit(((char_u *)argv[0])[argv_idx]))
{
- argv_idx = -1;
- break; /* not implemented, ignored */
+ i = get_number_arg((char_u *)argv[0], &argv_idx, 10);
+ set_option_value((char_u *)"window", (long)i, NULL, 0);
+ break;
}
want_argument = TRUE;
break;
@@ -848,7 +849,17 @@
restricted = TRUE;
break;
- case 'c': /* "-c {command}" execute command */
+ case 'c': /* "-c{command}" or "-c {command}" execute
+ command */
+ if (argv[0][argv_idx] != NUL)
+ {
+ if (n_commands >= MAX_ARG_CMDS)
+ mainerr(ME_EXTRA_CMD, NULL);
+ commands[n_commands++] = (char_u *)argv[0] + argv_idx;
+ argv_idx = -1;
+ break;
+ }
+ /*FALLTRHOUGH*/
case 'S': /* "-S {file}" execute Vim script */
case 'i': /* "-i {viminfo}" use for viminfo */
#ifndef FEAT_DIFF
@@ -990,7 +1001,17 @@
#endif
break;
- case 'w': /* "-w {scriptout}" append to script file */
+ case 'w': /* "-w {nr}" 'window' value */
+ /* "-w {scriptout}" append to script file */
+ if (vim_isdigit(*((char_u *)argv[0])))
+ {
+ argv_idx = 0;
+ i = get_number_arg((char_u *)argv[0], &argv_idx, 10);
+ set_option_value((char_u *)"window", (long)i, NULL, 0);
+ argv_idx = -1;
+ break;
+ }
+ /*FALLTRHOUGH*/
case 'W': /* "-W {scriptout}" overwrite script file */
if (scriptout != NULL)
goto scripterror;
diff --git a/src/misc1.c b/src/misc1.c
index 4d7cf60..658c30e 100644
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -23,7 +23,6 @@
#if defined(USE_EXE_NAME) && defined(MACOS_X)
static char_u *remove_tail_with_ext __ARGS((char_u *p, char_u *pend, char_u *ext));
#endif
-static int get_indent_str __ARGS((char_u *ptr, int ts));
static int copy_indent __ARGS((int size, char_u *src));
/*
@@ -63,7 +62,7 @@
* count the size (in window cells) of the indent in line "ptr", with
* 'tabstop' at "ts"
*/
- static int
+ int
get_indent_str(ptr, ts)
char_u *ptr;
int ts;
@@ -79,7 +78,7 @@
else
break;
}
- return (count);
+ return count;
}
/*
diff --git a/src/move.c b/src/move.c
index f3d7825..ac59320 100644
--- a/src/move.c
+++ b/src/move.c
@@ -2332,9 +2332,20 @@
#endif
if (dir == FORWARD)
{
- /* at end of file */
- if (curwin->w_botline > curbuf->b_ml.ml_line_count)
+ if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1)
{
+ /* Vi compatible scrolling */
+ if (p_window <= 2)
+ ++curwin->w_topline;
+ else
+ curwin->w_topline += p_window - 2;
+ if (curwin->w_topline > curbuf->b_ml.ml_line_count)
+ curwin->w_topline = curbuf->b_ml.ml_line_count;
+ curwin->w_cursor.lnum = curwin->w_topline;
+ }
+ else if (curwin->w_botline > curbuf->b_ml.ml_line_count)
+ {
+ /* at end of file */
curwin->w_topline = curbuf->b_ml.ml_line_count;
#ifdef FEAT_DIFF
curwin->w_topfill = 0;
@@ -2371,6 +2382,21 @@
continue;
}
#endif
+ if (firstwin == lastwin && p_window > 0 && p_window < Rows - 1)
+ {
+ /* Vi compatible scrolling (sort of) */
+ if (p_window <= 2)
+ --curwin->w_topline;
+ else
+ curwin->w_topline -= p_window - 2;
+ if (curwin->w_topline < 1)
+ curwin->w_topline = 1;
+ curwin->w_cursor.lnum = curwin->w_topline + p_window - 1;
+ if (curwin->w_cursor.lnum > curbuf->b_ml.ml_line_count)
+ curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count;
+ continue;
+ }
+
/* Find the line at the top of the window that is going to be the
* line at the bottom of the window. Make sure this results in
* the same line as before doing CTRL-F. */
diff --git a/src/normal.c b/src/normal.c
index 16f65be..f13b45e 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -1379,6 +1379,7 @@
#ifdef FEAT_VISUAL
&& (!VIsual_active || oap->motion_force)
#endif
+ && cap->cmdchar != 'D'
#ifdef FEAT_FOLDING
&& oap->op_type != OP_FOLD
&& oap->op_type != OP_FOLDOPEN
@@ -6701,9 +6702,24 @@
if (!checkclearopq(cap->oap))
{
- if (cap->count0)
- stuffnumReadbuff(cap->count0);
- stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
+ /* In Vi "2D" doesn't delete the next line. Can't translate it
+ * either, because "2." should also not use the count. */
+ if (cap->cmdchar == 'D' && vim_strchr(p_cpo, CPO_HASH) != NULL)
+ {
+ cap->oap->start = curwin->w_cursor;
+ cap->oap->op_type = OP_DELETE;
+ cap->count1 = 1;
+ nv_dollar(cap);
+ finish_op = TRUE;
+ ResetRedobuff();
+ AppendCharToRedobuff('D');
+ }
+ else
+ {
+ if (cap->count0)
+ stuffnumReadbuff(cap->count0);
+ stuffReadbuff(ar[(int)(vim_strchr(str, cap->cmdchar) - str)]);
+ }
}
cap->opcount = 0;
}
@@ -7599,6 +7615,9 @@
#endif
0, 0))
{
+ /* When '#' is in 'cpoptions' ignore the count. */
+ if (vim_strchr(p_cpo, CPO_HASH) != NULL)
+ cap->count1 = 1;
invoke_edit(cap, FALSE, cap->cmdchar, TRUE);
}
}
@@ -8156,7 +8175,10 @@
break;
case 'I': /* "I"nsert before the first non-blank */
- beginline(BL_WHITE);
+ if (vim_strchr(p_cpo, CPO_INSEND) == NULL)
+ beginline(BL_WHITE);
+ else
+ beginline(BL_WHITE|BL_FIX);
break;
case 'a': /* "a"ppend is like "i"nsert on the next character. */
diff --git a/src/ops.c b/src/ops.c
index 8541c31..7c426d1 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -2838,9 +2838,9 @@
if (yanktype == MLINE) /* MLINE overrides MCHAR and MBLOCK */
curr->y_type = MLINE;
- /* concatenate the last line of the old block with the first line of
- * the new block */
- if (curr->y_type == MCHAR)
+ /* Concatenate the last line of the old block with the first line of
+ * the new block, unless being Vi compatible. */
+ if (curr->y_type == MCHAR && vim_strchr(p_cpo, CPO_REGAPPEND) == NULL)
{
pnew = lalloc((long_u)(STRLEN(curr->y_array[curr->y_size - 1])
+ STRLEN(y_current->y_array[0]) + 1), TRUE);
@@ -3897,6 +3897,8 @@
long count;
int insert_space;
{
+ colnr_T col = MAXCOL;
+
if (u_save((linenr_T)(curwin->w_cursor.lnum - 1),
(linenr_T)(curwin->w_cursor.lnum + count)) == FAIL)
return;
@@ -3909,8 +3911,14 @@
beep_flush();
break;
}
+ if (col == MAXCOL && vim_strchr(p_cpo, CPO_JOINCOL) != NULL)
+ col = curwin->w_cursor.col;
}
+ /* Vi compatible: use the column of the first join */
+ if (col != MAXCOL && vim_strchr(p_cpo, CPO_JOINCOL) != NULL)
+ curwin->w_cursor.col = col;
+
#if 0
/*
* Need to update the screen if the line where the cursor is became too
diff --git a/src/option.c b/src/option.c
index ffeaf86..205b21c 100644
--- a/src/option.c
+++ b/src/option.c
@@ -665,7 +665,7 @@
{(char_u *)FALSE, (char_u *)0L}},
{"cpoptions", "cpo", P_STRING|P_VIM|P_RALL|P_FLAGLIST,
(char_u *)&p_cpo, PV_NONE,
- {(char_u *)CPO_ALL, (char_u *)CPO_DEFAULT}},
+ {(char_u *)CPO_VI, (char_u *)CPO_VIM}},
{"cscopepathcomp", "cspc", P_NUM|P_VI_DEF|P_VIM,
#ifdef FEAT_CSCOPE
(char_u *)&p_cspc, PV_NONE,
@@ -2340,7 +2340,7 @@
#endif
},
{"window", "wi", P_NUM|P_VI_DEF,
- (char_u *)NULL, PV_NONE,
+ (char_u *)&p_window, PV_NONE,
{(char_u *)0L, (char_u *)0L}},
{"winheight", "wh", P_NUM|P_VI_DEF,
#ifdef FEAT_WINDOWS
@@ -2591,6 +2591,10 @@
/* Be Vi compatible by default */
p_cp = TRUE;
+ /* Use POSIX compatibility when $VIM_POSIX is set. */
+ if (mch_getenv((char_u *)"VIM_POSIX") != NULL)
+ set_string_default("cpo", (char_u *)CPO_ALL);
+
/*
* Find default value for 'shell' option.
* Don't use it if it is empty.
@@ -3082,31 +3086,39 @@
void
set_init_2()
{
+ int idx;
+
/*
* 'scroll' defaults to half the window height. Note that this default is
* wrong when the window height changes.
*/
- options[findoption((char_u *)"scroll")].def_val[VI_DEFAULT]
- = (char_u *)((long_u)Rows >> 1);
+ set_number_default("scroll", (long_u)Rows >> 1);
comp_col();
+ /*
+ * 'window' is only for backwards compatibility with Vi.
+ * Default is Rows - 1.
+ */
+ idx = findoption((char_u *)"wi");
+ if (!(options[idx].flags & P_WAS_SET))
+ p_window = Rows - 1;
+ set_number_default("window", Rows - 1);
+
#if !((defined(MSDOS) || defined(OS2) || defined(WIN3264)) && !defined(FEAT_GUI))
{
- int idx4;
-
/*
* If 'background' wasn't set by the user, try guessing the value,
* depending on the terminal name. Only need to check for terminals
* with a dark background, that can handle color. Only "linux"
* console at the moment.
*/
- idx4 = findoption((char_u *)"bg");
- if (!(options[idx4].flags & P_WAS_SET) && STRCMP(T_NAME, "linux") == 0)
+ idx = findoption((char_u *)"bg");
+ if (!(options[idx].flags & P_WAS_SET) && STRCMP(T_NAME, "linux") == 0)
{
- set_string_option_direct(NULL, idx4, (char_u *)"dark", OPT_FREE);
+ set_string_option_direct(NULL, idx, (char_u *)"dark", OPT_FREE);
/* don't mark it as set, when starting the GUI it may be changed
* again */
- options[idx4].flags &= ~P_WAS_SET;
+ options[idx].flags &= ~P_WAS_SET;
}
}
#endif
@@ -6872,6 +6884,14 @@
#endif
}
+ else if (pp == &p_window)
+ {
+ if (p_window < 1)
+ p_window = 1;
+ else if (p_window >= Rows)
+ p_window = Rows - 1;
+ }
+
else if (pp == &curbuf->b_p_imsearch)
{
if (curbuf->b_p_imsearch < -1 || curbuf->b_p_imsearch > B_IMODE_LAST)
@@ -7011,6 +7031,8 @@
if (cmdline_row > Rows - p_ch && Rows > p_ch)
cmdline_row = Rows - p_ch;
}
+ if (p_window >= Rows)
+ p_window = Rows - 1;
}
if (curbuf->b_p_sts < 0)
diff --git a/src/option.h b/src/option.h
index 9be2c49..674eb4e 100644
--- a/src/option.h
+++ b/src/option.h
@@ -132,6 +132,7 @@
#define CPO_FNAMER 'f' /* set file name for ":r file" */
#define CPO_FNAMEW 'F' /* set file name for ":w file" */
#define CPO_GOTO1 'g' /* goto line 1 for ":edit" */
+#define CPO_INSEND 'H' /* "I" inserts before last blank in line */
#define CPO_INTMOD 'i' /* interrupt a read makes buffer modified */
#define CPO_INDENT 'I' /* remove auto-indent more often */
#define CPO_JOINSP 'j' /* only use two spaces for join after '.' */
@@ -146,6 +147,7 @@
#define CPO_LINEOFF 'o'
#define CPO_OVERNEW 'O' /* silently overwrite new file */
#define CPO_LISP 'p' /* 'lisp' indenting */
+#define CPO_JOINCOL 'q' /* with "3J" use column after first join */
#define CPO_REDO 'r'
#define CPO_REMMARK 'R' /* remove marks when filtering */
#define CPO_BUFOPT 's'
@@ -156,7 +158,9 @@
#define CPO_CW 'w' /* "cw" only changes one blank */
#define CPO_FWRITE 'W' /* "w!" doesn't overwrite readonly files */
#define CPO_ESC 'x'
+#define CPO_REPLCNT 'X' /* "R" with a count only delets chars once */
#define CPO_YANK 'y'
+#define CPO_KEEPRO 'Z' /* don't reset 'readonly' on ":w!" */
#define CPO_DOLLAR '$'
#define CPO_FILTER '!'
#define CPO_MATCH '%'
@@ -164,8 +168,16 @@
#define CPO_PLUS '+' /* ":write file" resets 'modified' */
#define CPO_MINUS '-' /* "9-" fails at and before line 9 */
#define CPO_SPECI '<' /* don't recognize <> in mappings */
-#define CPO_DEFAULT "aABceFs"
-#define CPO_ALL "aAbBcCdDeEfFgiIjJkKlLmMnoOprRsStuvwWxy$!%*-+<"
+#define CPO_REGAPPEND '>' /* insert NL when appending to a register */
+/* POSIX flags */
+#define CPO_HASH '#' /* "D", "o" and "O" do not use a count */
+#define CPO_PARA '{' /* "{" is also a paragraph boundary */
+#define CPO_TSIZE '|' /* $LINES and $COLUMNS overrule term size */
+#define CPO_PRESERVE '&' /* keep swap file after :preserve */
+/* default values for Vim, Vi and POSIX */
+#define CPO_VIM "aABceFs"
+#define CPO_VI "aAbBcCdDeEfFgHiIjJkKlLmMnoOpqrRsStuvwWxXyZ$!%*-+<>"
+#define CPO_ALL "aAbBcCdDeEfFgHiIjJkKlLmMnoOpqrRsStuvwWxXyZ$!%*-+<>#{|&"
/* characters for p_ww option: */
#define WW_ALL "bshl<>[],~"
@@ -789,6 +801,7 @@
#ifdef FEAT_CMDL_COMPL
EXTERN char_u *p_wop; /* 'wildoptions' */
#endif
+EXTERN long p_window; /* 'window' */
#if defined(FEAT_GUI_MSWIN) || defined(FEAT_GUI_MOTIF) || defined(LINT) \
|| defined (FEAT_GUI_GTK) || defined(FEAT_GUI_PHOTON) || defined(FEAT_GUI_KDE)
#define FEAT_WAK
diff --git a/src/os_unix.c b/src/os_unix.c
index c09638f..d89636d 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3222,9 +3222,10 @@
/*
* 2. get size from environment
- * When being POSIX compliant this overrules the ioctl() values!
+ * When being POSIX compliant ('|' flag in 'cpoptions') this overrules
+ * the ioctl() values!
*/
- if (columns == 0 || rows == 0 || getenv("VIM_POSIX") != NULL)
+ if (columns == 0 || rows == 0 || vim_strchr(p_cpo, CPO_TSIZE) != NULL)
{
if ((p = (char_u *)getenv("LINES")))
rows = atoi((char *)p);
diff --git a/src/proto/misc1.pro b/src/proto/misc1.pro
index 2fb74d3..5a42c13 100644
--- a/src/proto/misc1.pro
+++ b/src/proto/misc1.pro
@@ -2,6 +2,7 @@
int get_indent __ARGS((void));
int get_indent_lnum __ARGS((linenr_T lnum));
int get_indent_buf __ARGS((buf_T *buf, linenr_T lnum));
+int get_indent_str __ARGS((char_u *ptr, int ts));
int set_indent __ARGS((int size, int flags));
int get_number_indent __ARGS((linenr_T lnum));
int open_line __ARGS((int dir, int flags, int old_indent));
diff --git a/src/search.c b/src/search.c
index 2bcdf24..8520282 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2493,11 +2493,12 @@
}
/*
- * findpar(dir, count, what) - Find the next paragraph in direction 'dir'
+ * Find the next paragraph or section in direction 'dir'.
* Paragraphs are currently supposed to be separated by empty lines.
- * Return TRUE if the next paragraph was found.
+ * If 'what' is NUL we go to the next paragraph.
* If 'what' is '{' or '}' we go to the next section.
* If 'both' is TRUE also stop at '}'.
+ * Return TRUE if the next paragraph or section was found.
*/
int
findpar(oap, dir, count, what, both)
@@ -2510,6 +2511,7 @@
linenr_T curr;
int did_skip; /* TRUE after separating lines have been skipped */
int first; /* TRUE on first line */
+ int posix = (vim_strchr(p_cpo, CPO_PARA) != NULL);
#ifdef FEAT_FOLDING
linenr_T fold_first; /* first line of a closed fold */
linenr_T fold_last; /* last line of a closed fold */
@@ -2537,7 +2539,11 @@
}
#endif
- if (!first && did_skip && startPS(curr, what, both))
+ /* POSIX has it's own ideas of what a paragraph boundary is and it
+ * doesn't match historical Vi: It also stops at a "{" in the
+ * first column and at an empty line. */
+ if (!first && did_skip && (startPS(curr, what, both)
+ || (posix && what == NUL && *ml_get(curr) == '{')))
break;
#ifdef FEAT_FOLDING
diff --git a/src/structs.h b/src/structs.h
index 8a81611..92a8428 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1021,6 +1021,8 @@
listwatch_T *lv_watch; /* first watcher, NULL if none */
int lv_idx; /* cached index of an item */
listitem_T *lv_idx_item; /* when not NULL item at index "lv_idx" */
+ int lv_copyID; /* ID used by deepcopy() */
+ list_T *lv_copylist; /* copied list used by deepcopy() */
char lv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
};
@@ -1050,6 +1052,8 @@
{
int dv_refcount; /* reference count */
hashtab_T dv_hashtab; /* hashtab that refers to the items */
+ int dv_copyID; /* ID used by deepcopy() */
+ dict_T *dv_copydict; /* copied dict used by deepcopy() */
char dv_lock; /* zero, VAR_LOCKED, VAR_FIXED */
};
diff --git a/src/term.c b/src/term.c
index a471c1e..386b05c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -2991,6 +2991,9 @@
ui_new_shellsize();
if (old_Rows != Rows)
{
+ /* if 'window' uses the whole screen, keep it using that */
+ if (p_window == old_Rows - 1)
+ p_window = Rows - 1;
old_Rows = Rows;
shell_new_rows(); /* update window sizes */
}
@@ -3234,6 +3237,8 @@
* echoed.
* Only do this after termcap mode has been started, otherwise the codes for
* the cursor keys may be wrong.
+ * On Unix only do it when both output and input are a tty (avoid writing
+ * request to terminal while reading from a file).
* The result is caught in check_termcode().
*/
static void
@@ -3244,6 +3249,7 @@
&& termcap_active
#ifdef UNIX
&& isatty(1)
+ && isatty(read_cmd_fd)
#endif
&& *T_CRV != NUL)
{
diff --git a/src/testdir/test16.in b/src/testdir/test16.in
index 7fc0d50..aa00517 100644
--- a/src/testdir/test16.in
+++ b/src/testdir/test16.in
@@ -1,7 +1,11 @@
Tests for resetting "secure" flag after GUI has started.
+For KDE set a font, empty 'guifont' may cause a hang.
STARTTEST
:set exrc secure
+:if has("gui_kde")
+: set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
+:endif
:gui -f
:.,$w! test.out
:qa!
diff --git a/src/testdir/test55.in b/src/testdir/test55.in
index 89fbaae..46a857b 100644
--- a/src/testdir/test55.in
+++ b/src/testdir/test55.in
@@ -149,15 +149,20 @@
:endfunc
:$put =d.func(string(remove(d, 'func')))
:"
-:" Nasty: deepcopy() dict that refers to itself (fails)
+:" Nasty: deepcopy() dict that refers to itself (fails when noref used)
:let d = {1:1, 2:2}
:let l = [4, d, 6]
:let d[3] = l
+:let dc = deepcopy(d)
:try
-: let x = deepcopy(d)
+: let dc = deepcopy(d, 1)
:catch
: $put =v:exception[:14]
:endtry
+:let l2 = [0, l, l, 3]
+:let l[1] = l2
+:let l3 = deepcopy(l2)
+:$put ='same list: ' . (l3[1] is l3[2])
:"
:" Locked variables
:for depth in range(5)
@@ -253,6 +258,14 @@
: $put ='caught ' . v:exception
:endtry
:"
+:" reverse() and sort()
+:let l = ['-0', 'A11', 2, 'xaaa', 4, 'foo', 'foo6', [0, 1, 2], 'x8']
+:$put =string(reverse(l))
+:$put =string(reverse(reverse(l)))
+:$put =string(sort(l))
+:$put =string(reverse(sort(l)))
+:$put =string(sort(reverse(sort(l))))
+:"
:endfun
:call Test(1, 2, [3, 4], {5: 6}) " This may take a while
:"
diff --git a/src/testdir/test55.ok b/src/testdir/test55.ok
index 922fdfc..559cafa 100644
--- a/src/testdir/test55.ok
+++ b/src/testdir/test55.ok
@@ -30,6 +30,7 @@
g:dict.func-4
a:function('3')
Vim(let):E698:
+same list: 1
depth is 0
0000-000
ppppppp
@@ -70,3 +71,8 @@
caught a:000[2]
caught a:000[3]
[1, 2, [3, 9, 5, 6], {'a': 12, '5': 8}]
+['x8', [0, 1, 2], 'foo6', 'foo', 4, 'xaaa', 2, 'A11', '-0']
+['x8', [0, 1, 2], 'foo6', 'foo', 4, 'xaaa', 2, 'A11', '-0']
+['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 2, 4, [0, 1, 2]]
+[[0, 1, 2], 4, 2, 'xaaa', 'x8', 'foo6', 'foo', 'A11', '-0']
+['-0', 'A11', 'foo', 'foo6', 'x8', 'xaaa', 2, 4, [0, 1, 2]]
diff --git a/src/version.h b/src/version.h
index 6dfc7d5..1925a60 100644
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 7)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 7, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 12)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Feb 12, compiled "
diff --git a/src/vim.h b/src/vim.h
index 9ffaf9f..6d2b249 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -604,6 +604,7 @@
#define BF_NEW_W 0x20 /* Warned for BF_NEW and file created */
#define BF_READERR 0x40 /* got errors while reading the file */
#define BF_DUMMY 0x80 /* dummy buffer, only used internally */
+#define BF_PRESERVED 0x100 /* ":preserve" was used */
/* Mask to check for flags that prevent normal writing */
#define BF_WRITE_MASK (BF_NOTEDITED + BF_NEW + BF_READERR)