1. ZyX_I
  2. vim

Commits

ZyX_I  committed 262f483 Merge

Merge

  • Participants
  • Parent commits fdde3db, 953a467
  • Branches default

Comments (0)

Files changed (19)

File .hgtags

View file
 4d1753f3e85c7fb6d9cde1a8aa9ded8d11cdcd01 v7-3-742
 67e3b2753a6ef97a94084b85f87873c309fea3d6 v7-3-743
 26c8b3b49f743ca163a63463da08cc3822322bc2 v7-3-744
+aab4b29520e79134e33f2c641f1d960de2dcdc1e v7-3-745
+4934eb2e22dc0bc03fd5d4f95706a69a1ddffb94 v7-3-746
+cd59ba19985a3b3bd66dffdcf59b00427f844818 v7-3-747
+56bb88c68f985365b0545a0370be59fcd97a4178 v7-3-748
+3e22fe67fa6935d1156738a34e50bffdf62006c9 v7-3-749

File runtime/doc/eval.txt

View file
 resolve( {filename})		String	get filename a shortcut points to
 reverse( {list})		List	reverse {list} in-place
 round( {expr})			Float	round off {expr}
+screencol()			Number	current cursor column
+screenrow()			Number	current cursor row
 search( {pattern} [, {flags} [, {stopline} [, {timeout}]]])
 				Number	search for {pattern}
 searchdecl( {name} [, {global} [, {thisblock}]])

File src/eval.c

View file
 #ifdef FEAT_FLOAT
 static void f_round __ARGS((typval_T *argvars, typval_T *rettv));
 #endif
+static void f_screencol __ARGS((typval_T *argvars, typval_T *rettv));
+static void f_screenrow __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_search __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_searchdecl __ARGS((typval_T *argvars, typval_T *rettv));
 static void f_searchpair __ARGS((typval_T *argvars, typval_T *rettv));
 #ifdef FEAT_FLOAT
     {"round",		1, 1, f_round},
 #endif
+    {"screencol",	0, 0, f_screencol},
+    {"screenrow",	0, 0, f_screenrow},
     {"search",		1, 4, f_search},
     {"searchdecl",	1, 3, f_searchdecl},
     {"searchpair",	3, 7, f_searchpair},
 #endif
 
 /*
+ * "screencol()" function
+ *
+ * First column is 1 to be consistent with virtcol().
+ */
+    static void
+f_screencol(argvars, rettv)
+    typval_T	*argvars UNUSED;
+    typval_T	*rettv;
+{
+    rettv->vval.v_number = screen_screencol() + 1;
+}
+
+/*
+ * "screenrow()" function
+ */
+    static void
+f_screenrow(argvars, rettv)
+    typval_T	*argvars UNUSED;
+    typval_T	*rettv;
+{
+    rettv->vval.v_number = screen_screenrow() + 1;
+}
+
+/*
  * "search()" function
  */
     static void
 		action = *act;
 	}
 
-	if (l != NULL && set_errorlist(wp, l, action, NULL) == OK)
+	if (l != NULL && set_errorlist(wp, l, action,
+	       (char_u *)(wp == NULL ? "setqflist()" : "setloclist()")) == OK)
 	    rettv->vval.v_number = 0;
     }
 #endif

File src/if_py_both.h

View file
     if (!PyArg_ParseTuple(args, "s", &expr))
 	return NULL;
 
-    return PyLong_FromLong(mb_string2cells((char_u *)expr, (int)STRLEN(expr)));
+    return PyLong_FromLong(
+#ifdef FEAT_MBYTE
+	    mb_string2cells((char_u *)expr, (int)STRLEN(expr))
+#else
+	    STRLEN(expr)
+#endif
+	    );
 }
 
 /*

File src/option.c

View file
 }
 
 /*
+ * Reset the flag indicating option "name" was set.
+ */
+    void
+reset_option_was_set(name)
+    char_u	*name;
+{
+    int idx = findoption(name);
+
+    if (idx >= 0)
+	options[idx].flags &= ~P_WAS_SET;
+}
+
+/*
  * compatible_set() - Called when 'compatible' has been set or unset.
  *
  * When 'compatible' set: Set all relevant options (those that have the P_VIM)

File src/proto/option.pro

View file
 void vimrc_found __ARGS((char_u *fname, char_u *envname));
 void change_compatible __ARGS((int on));
 int option_was_set __ARGS((char_u *name));
+void reset_option_was_set __ARGS((char_u *name));
 int can_bs __ARGS((int what));
 void save_file_ff __ARGS((buf_T *buf));
 int file_ff_differs __ARGS((buf_T *buf, int ignore_empty));

File src/proto/screen.pro

View file
 int messaging __ARGS((void));
 void showruler __ARGS((int always));
 int number_width __ARGS((win_T *wp));
+int screen_screencol __ARGS((void));
+int screen_screenrow __ARGS((void));
 /* vim: set ft=c : */

File src/quickfix.c

View file
     int		idx;
 {
     qfline_T	*qfp;
+    int		stop = FALSE;
 
     while (qi->qf_lists[idx].qf_count)
     {
 	qfp = qi->qf_lists[idx].qf_start->qf_next;
-	if (qi->qf_lists[idx].qf_title != NULL)
+	if (qi->qf_lists[idx].qf_title != NULL && !stop)
 	{
 	    vim_free(qi->qf_lists[idx].qf_start->qf_text);
+	    stop = (qi->qf_lists[idx].qf_start == qfp);
 	    vim_free(qi->qf_lists[idx].qf_start->qf_pattern);
 	    vim_free(qi->qf_lists[idx].qf_start);
+	    if (stop)
+		/* Somehow qf_count may have an incorrect value, set it to 1
+		 * to avoid crashing when it's wrong.
+		 * TODO: Avoid qf_count being incorrect. */
+		qi->qf_lists[idx].qf_count = 1;
 	}
 	qi->qf_lists[idx].qf_start = qfp;
 	--qi->qf_lists[idx].qf_count;

File src/screen.c

View file
 		{
 		    /* tab amount depends on current column */
 		    n_extra = (int)wp->w_buffer->b_p_ts
-				   - VCOL_HLC % (int)wp->w_buffer->b_p_ts - 1;
+					- vcol % (int)wp->w_buffer->b_p_ts - 1;
+#ifdef FEAT_CONCEAL
+		    /* Tab alignment should be identical regardless of
+		     * 'conceallevel' value. So tab compensates of all
+		     * previous concealed characters, and thus resets vcol_off
+		     * and boguscols accumulated so far in the line. Note that
+		     * the tab can be longer than 'tabstop' when there
+		     * are concealed characters. */
+		    n_extra += vcol_off;
+		    vcol -= vcol_off;
+		    vcol_off = 0;
+		    col -= boguscols;
+		    boguscols = 0;
+#endif
 #ifdef FEAT_MBYTE
 		    mb_utf8 = FALSE;	/* don't draw as UTF-8 */
 #endif
     return n;
 }
 #endif
+
+/*
+ * Return the current cursor column. This is the actual position on the
+ * screen. First column is 0.
+ */
+    int
+screen_screencol()
+{
+    return screen_cur_col;
+}
+
+/*
+ * Return the current cursor row. This is the actual position on the screen.
+ * First row is 0.
+ */
+    int
+screen_screenrow()
+{
+    return screen_cur_row;
+}

File src/term.c

View file
 	}
 #  endif
 	if (p != NULL)
+	{
 	    set_option_value((char_u *)"ttym", 0L, p, 0);
+	    /* Reset the WAS_SET flag, 'ttymouse' can be set to "sgr" or
+	     * "xterm2" in check_termcode(). */
+	    reset_option_was_set((char_u *)"ttym");
+	}
 	if (p == NULL
 #   ifdef FEAT_GUI
 		|| gui.in_use

File src/testdir/Make_amiga.mak

View file
 		test66.out test67.out test68.out test69.out test70.out \
 		test71.out test72.out test73.out test74.out test75.out \
 		test76.out test77.out test78.out test79.out test80.out \
-		test81.out test82.out test83.out test84.out
+		test81.out test82.out test83.out test84.out test88.out
 
 .SUFFIXES: .in .out
 
 test82.out: test82.in
 test83.out: test83.in
 test84.out: test84.in
+test88.out: test88.in

File src/testdir/Make_dos.mak

View file
 		test68.out test69.out test71.out test72.out test73.out \
 		test74.out test75.out test76.out test77.out test78.out \
 		test79.out test80.out test81.out test82.out test83.out \
-		test84.out test85.out test86.out test87.out
+		test84.out test85.out test86.out test87.out test88.out
 
 SCRIPTS32 =	test50.out test70.out
 

File src/testdir/Make_ming.mak

View file
 		test68.out test69.out test71.out test72.out test73.out \
 		test74.out test75.out test76.out test77.out test78.out \
 		test79.out test80.out test81.out test82.out test83.out \
-		test84.out test85.out test86.out test87.out
+		test84.out test85.out test86.out test87.out test88.out
 
 SCRIPTS32 =	test50.out test70.out
 

File src/testdir/Make_os2.mak

View file
 		test66.out test67.out test68.out test69.out test70.out \
 		test71.out test72.out test73.out test74.out test75.out \
 		test76.out test77.out test78.out test79.out test80.out \
-		test81.out test82.out test83.out test84.out
+		test81.out test82.out test83.out test84.out test88.out
 
 .SUFFIXES: .in .out
 

File src/testdir/Make_vms.mms

View file
 # Authors:	Zoltan Arpadffy, <arpadffy@polarhome.com>
 #		Sandor Kopanyi,  <sandor.kopanyi@mailbox.hu>
 #
-# Last change:  2012 Oct 06
+# Last change:  2012 Dec 05
 #
 # This has been tested on VMS 6.2 to 8.3 on DEC Alpha, VAX and IA64.
 # Edit the lines in the Configuration section below to select.
 	 test66.out test67.out test68.out test69.out \
 	 test71.out test72.out test74.out test75.out test76.out \
 	 test77.out test78.out test79.out test80.out test81.out \
-	 test82.out test83.out test84.out
+	 test82.out test83.out test84.out test88.out
 
 # Known problems:
 # Test 30: a problem around mac format - unknown reason

File src/testdir/Makefile

View file
 
 SCRIPTS = test1.out test2.out test3.out test4.out test5.out test6.out \
 		test7.out test8.out test9.out test10.out test11.out \
-		test12.out  test13.out test14.out test15.out test17.out \
+		test12.out test13.out test14.out test15.out test17.out \
 		test18.out test19.out test20.out test21.out test22.out \
 		test23.out test24.out test25.out test26.out test27.out \
 		test28.out test29.out test30.out test31.out test32.out \
 		test69.out test70.out test71.out test72.out test73.out \
 		test74.out test75.out test76.out test77.out test78.out \
 		test79.out test80.out test81.out test82.out test83.out \
-		test84.out test85.out test86.out test87.out
+		test84.out test85.out test86.out test87.out test88.out
 
 SCRIPTS_GUI = test16.out
 

File src/testdir/test88.in

View file
+vim: set ft=vim
+
+Tests for correct display (cursor column position) with +conceal and
+tabulators.
+
+STARTTEST
+:so small.vim
+:if !has('conceal')
+   e! test.ok
+   wq! test.out
+:endif
+:" Conceal settings.
+:set conceallevel=2
+:set concealcursor=nc
+:syntax match test /|/ conceal
+:" Save current cursor position. Only works in <expr> mode, can't be used
+:" with :normal because it moves the cursor to the command line. Thanks to ZyX
+:" <zyx.vim@gmail.com> for the idea to use an <expr> mapping.
+:let positions = []
+:nnoremap <expr> GG ":let positions += ['".screenrow().":".screencol()."']\n"
+:" Start test.
+/^start:
+:normal ztj
+GGk
+:" We should end up in the same column when running these commands on the two
+:" lines.
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j
+GGk
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j0j
+GGk
+:" Same for next test block.
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j
+GGk
+:normal ft
+GGk
+:normal $
+GGk
+:normal 0j0j
+GGk
+:" And check W with multiple tabs and conceals in a line.
+:normal W
+GGk
+:normal W
+GGk
+:normal W
+GGk
+:normal $
+GGk
+:normal 0j
+GGk
+:normal W
+GGk
+:normal W
+GGk
+:normal W
+GGk
+:normal $
+GGk
+:" Display result.
+:call append('$', 'end:')
+:call append('$', positions)
+:/^end/,$wq! test.out
+ENDTEST
+
+start:
+.concealed.     text
+|concealed|	text
+
+	.concealed.	text
+	|concealed|	text
+
+.a.	.b.	.c.	.d.
+|a|	|b|	|c|	|d|

File src/testdir/test88.ok

View file
+end:
+2:1
+2:17
+2:20
+3:1
+3:17
+3:20
+5:8
+5:25
+5:28
+6:8
+6:25
+6:28
+8:1
+8:9
+8:17
+8:25
+8:27
+9:1
+9:9
+9:17
+9:25
+9:26

File src/version.c

View file
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    749,
+/**/
+    748,
+/**/
+    747,
+/**/
+    746,
+/**/
+    745,
+/**/
     744,
 /**/
     743,