Compare commits

...

3 Commits

Author SHA1 Message Date
Bram Moolenaar
219b87038a updated for version 7.0-155 2006-11-01 14:32:36 +00:00
Bram Moolenaar
74c596b5a8 updated for version 7.0-154 2006-11-01 11:44:31 +00:00
Bram Moolenaar
0cae847008 updated for version 7.0-153 2006-10-30 21:32:28 +00:00
7 changed files with 129 additions and 26 deletions

View File

@@ -1,4 +1,4 @@
*eval.txt* For Vim version 7.0. Last change: 2006 Sep 22
*eval.txt* For Vim version 7.0. Last change: 2006 Nov 01
VIM REFERENCE MANUAL by Bram Moolenaar
@@ -1374,6 +1374,21 @@ v:lnum Line number for the 'foldexpr' |fold-expr| and 'indentexpr'
'guitabtooltip'. Only valid while one of these expressions is
being evaluated. Read-only when in the |sandbox|.
*v:mouse_win* *mouse_win-variable*
v:mouse_win Window number for a mouse click obtained with |getchar()|.
First window has number 1, like with |winnr()|. The value is
zero when there was no mouse button click.
*v:mouse_lnum* *mouse_lnum-variable*
v:mouse_lnum Line number for a mouse click obtained with |getchar()|.
This is the text line number, not the screen line number. The
value is zero when there was no mouse button click.
*v:mouse_col* *mouse_col-variable*
v:mouse_col Column number for a mouse click obtained with |getchar()|.
This is the screen column number, like with |virtcol()|. The
value is zero when there was no mouse button click.
*v:prevcount* *prevcount-variable*
v:prevcount The count given for the last but one Normal mode command.
This is the v:count value of the previous command. Useful if
@@ -2702,6 +2717,17 @@ getchar([expr]) *getchar()*
one-byte character it is the character itself as a number.
Use nr2char() to convert it to a String.
When the user clicks a mouse button, the mouse event will be
returned. The position can then be found in |v:mouse_col|,
|v:mouse_lnum| and |v:mouse_win|. This example positions the
mouse as it would normally happen: >
let c = getchar()
if c == "\<LeftMouse>" && v:mouse_win > 0
exe v:mouse_win . "wincmd w"
exe v:mouse_lnum
exe "normal " . v:mouse_col . "|"
endif
<
There is no prompt, you will somehow have to make clear to the
user that a character has to be typed.
There is no mapping for the character.

View File

@@ -343,6 +343,9 @@ static struct vimvar
{VV_NAME("swapchoice", VAR_STRING), 0},
{VV_NAME("swapcommand", VAR_STRING), VV_RO},
{VV_NAME("char", VAR_STRING), VV_RO},
{VV_NAME("mouse_win", VAR_NUMBER), 0},
{VV_NAME("mouse_lnum", VAR_NUMBER), 0},
{VV_NAME("mouse_col", VAR_NUMBER), 0},
};
/* shorthand */
@@ -9855,6 +9858,10 @@ f_getchar(argvars, rettv)
--no_mapping;
--allow_keys;
vimvars[VV_MOUSE_WIN].vv_nr = 0;
vimvars[VV_MOUSE_LNUM].vv_nr = 0;
vimvars[VV_MOUSE_COL].vv_nr = 0;
rettv->vval.v_number = n;
if (IS_SPECIAL(n) || mod_mask != 0)
{
@@ -9883,6 +9890,53 @@ f_getchar(argvars, rettv)
temp[i++] = NUL;
rettv->v_type = VAR_STRING;
rettv->vval.v_string = vim_strsave(temp);
#ifdef FEAT_MOUSE
if (n == K_LEFTMOUSE
|| n == K_LEFTMOUSE_NM
|| n == K_LEFTDRAG
|| n == K_LEFTRELEASE
|| n == K_LEFTRELEASE_NM
|| n == K_MIDDLEMOUSE
|| n == K_MIDDLEDRAG
|| n == K_MIDDLERELEASE
|| n == K_RIGHTMOUSE
|| n == K_RIGHTDRAG
|| n == K_RIGHTRELEASE
|| n == K_X1MOUSE
|| n == K_X1DRAG
|| n == K_X1RELEASE
|| n == K_X2MOUSE
|| n == K_X2DRAG
|| n == K_X2RELEASE
|| n == K_MOUSEDOWN
|| n == K_MOUSEUP)
{
int row = mouse_row;
int col = mouse_col;
win_T *win;
linenr_T lnum;
# ifdef FEAT_WINDOWS
win_T *wp;
# endif
int n = 1;
if (row >= 0 && col >= 0)
{
/* Find the window at the mouse coordinates and compute the
* text position. */
win = mouse_find_win(&row, &col);
(void)mouse_comp_pos(win, &row, &col, &lnum);
# ifdef FEAT_WINDOWS
for (wp = firstwin; wp != win; wp = wp->w_next)
++n;
# endif
vimvars[VV_MOUSE_WIN].vv_nr = n;
vimvars[VV_MOUSE_LNUM].vv_nr = lnum;
vimvars[VV_MOUSE_COL].vv_nr = col + 1;
}
}
#endif
}
}

View File

@@ -2971,7 +2971,11 @@ foldlevelIndent(flp)
else
flp->lvl = get_indent_buf(buf, lnum) / buf->b_p_sw;
if (flp->lvl > flp->wp->w_p_fdn)
{
flp->lvl = flp->wp->w_p_fdn;
if (flp->lvl < 0)
flp->lvl = 0;
}
}
/* foldlevelDiff() {{{2 */

View File

@@ -1100,38 +1100,44 @@ cs_find_common(opt, pat, forceit, verbose, use_ll)
if (qfpos != NULL && *qfpos != '0' && totmatches > 0)
{
/* fill error list */
FILE *f;
char_u *tmp = vim_tempname('c');
FILE *f;
char_u *tmp = vim_tempname('c');
qf_info_T *qi = NULL;
win_T *wp = NULL;
f = mch_fopen((char *)tmp, "w");
cs_file_results(f, nummatches);
fclose(f);
if (use_ll) /* Use location list */
wp = curwin;
/* '-' starts a new error list */
if (qf_init(wp, tmp, (char_u *)"%f%*\\t%l%*\\t%m", *qfpos == '-') > 0)
if (f == NULL)
EMSG2(_(e_notopen), tmp);
else
{
# ifdef FEAT_WINDOWS
if (postponed_split != 0)
cs_file_results(f, nummatches);
fclose(f);
if (use_ll) /* Use location list */
wp = curwin;
/* '-' starts a new error list */
if (qf_init(wp, tmp, (char_u *)"%f%*\\t%l%*\\t%m",
*qfpos == '-') > 0)
{
win_split(postponed_split > 0 ? postponed_split : 0,
# ifdef FEAT_WINDOWS
if (postponed_split != 0)
{
win_split(postponed_split > 0 ? postponed_split : 0,
postponed_split_flags);
# ifdef FEAT_SCROLLBIND
curwin->w_p_scb = FALSE;
curwin->w_p_scb = FALSE;
# endif
postponed_split = 0;
}
postponed_split = 0;
}
# endif
if (use_ll)
/*
* In the location list window, use the displayed location
* list. Otherwise, use the location list for the window.
*/
qi = (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL) ?
wp->w_llist_ref : wp->w_llist;
qf_jump(qi, 0, 0, forceit);
if (use_ll)
/*
* In the location list window, use the displayed location
* list. Otherwise, use the location list for the window.
*/
qi = (bt_quickfix(wp->w_buffer) && wp->w_llist_ref != NULL)
? wp->w_llist_ref : wp->w_llist;
qf_jump(qi, 0, 0, forceit);
}
}
mch_remove(tmp);
vim_free(tmp);
@@ -1723,7 +1729,7 @@ cs_file_results(f, nummatches_a)
continue;
context = (char *)alloc((unsigned)strlen(cntx)+5);
if (context==NULL)
if (context == NULL)
continue;
if (strcmp(cntx, "<global>")==0)
@@ -1731,7 +1737,7 @@ cs_file_results(f, nummatches_a)
else
sprintf(context, "<<%s>>", cntx);
if (search==NULL)
if (search == NULL)
fprintf(f, "%s\t%s\t%s\n", fullname, slno, context);
else
fprintf(f, "%s\t%s\t%s %s\n", fullname, slno, context, search);

View File

@@ -6072,7 +6072,11 @@ syn_get_foldlevel(wp, lnum)
++level;
}
if (level > wp->w_p_fdn)
{
level = wp->w_p_fdn;
if (level < 0)
level = 0;
}
return level;
}
#endif

View File

@@ -666,6 +666,12 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
155,
/**/
154,
/**/
153,
/**/
152,
/**/

View File

@@ -1669,7 +1669,10 @@ int vim_memcmp __ARGS((void *, void *, size_t));
#define VV_SWAPCHOICE 46
#define VV_SWAPCOMMAND 47
#define VV_CHAR 48
#define VV_LEN 49 /* number of v: vars */
#define VV_MOUSE_WIN 49
#define VV_MOUSE_LNUM 50
#define VV_MOUSE_COL 51
#define VV_LEN 52 /* number of v: vars */
#ifdef FEAT_CLIPBOARD