mirror of
https://github.com/vim/vim.git
synced 2025-09-23 03:43:49 -04:00
updated for version 7.1-058
This commit is contained in:
148
src/popupmnu.c
148
src/popupmnu.c
@@ -75,7 +75,6 @@ redo:
|
|||||||
|
|
||||||
row = curwin->w_cline_row + W_WINROW(curwin);
|
row = curwin->w_cline_row + W_WINROW(curwin);
|
||||||
height = curwin->w_cline_height;
|
height = curwin->w_cline_height;
|
||||||
col = curwin->w_wcol + W_WINCOL(curwin) - curwin->w_leftcol;
|
|
||||||
|
|
||||||
if (firstwin->w_p_pvw)
|
if (firstwin->w_p_pvw)
|
||||||
top_clear = firstwin->w_height;
|
top_clear = firstwin->w_height;
|
||||||
@@ -167,6 +166,15 @@ redo:
|
|||||||
pum_base_width = max_width;
|
pum_base_width = max_width;
|
||||||
pum_kind_width = kind_width;
|
pum_kind_width = kind_width;
|
||||||
|
|
||||||
|
/* Calculate column */
|
||||||
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
|
col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol -
|
||||||
|
curwin->w_leftcol - 1;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
col = W_WINCOL(curwin) + curwin->w_wcol - curwin->w_leftcol;
|
||||||
|
|
||||||
/* if there are more items than room we need a scrollbar */
|
/* if there are more items than room we need a scrollbar */
|
||||||
if (pum_height < size)
|
if (pum_height < size)
|
||||||
{
|
{
|
||||||
@@ -179,11 +187,23 @@ redo:
|
|||||||
if (def_width < max_width)
|
if (def_width < max_width)
|
||||||
def_width = max_width;
|
def_width = max_width;
|
||||||
|
|
||||||
if (col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
|
if (((col < Columns - PUM_DEF_WIDTH || col < Columns - max_width)
|
||||||
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
&& !curwin->w_p_rl)
|
||||||
|
|| (curwin->w_p_rl && (col > PUM_DEF_WIDTH || col > max_width)
|
||||||
|
#endif
|
||||||
|
))
|
||||||
{
|
{
|
||||||
/* align pum column with "col" */
|
/* align pum column with "col" */
|
||||||
pum_col = col;
|
pum_col = col;
|
||||||
pum_width = Columns - pum_col - pum_scrollbar;
|
|
||||||
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
|
pum_width = pum_col - pum_scrollbar + 1;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
pum_width = Columns - pum_col - pum_scrollbar;
|
||||||
|
|
||||||
if (pum_width > max_width + kind_width + extra_width + 1
|
if (pum_width > max_width + kind_width + extra_width + 1
|
||||||
&& pum_width > PUM_DEF_WIDTH)
|
&& pum_width > PUM_DEF_WIDTH)
|
||||||
{
|
{
|
||||||
@@ -195,14 +215,24 @@ redo:
|
|||||||
else if (Columns < def_width)
|
else if (Columns < def_width)
|
||||||
{
|
{
|
||||||
/* not enough room, will use what we have */
|
/* not enough room, will use what we have */
|
||||||
pum_col = 0;
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
|
pum_col = Columns - 1;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
pum_col = 0;
|
||||||
pum_width = Columns - 1;
|
pum_width = Columns - 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (max_width > PUM_DEF_WIDTH)
|
if (max_width > PUM_DEF_WIDTH)
|
||||||
max_width = PUM_DEF_WIDTH; /* truncate */
|
max_width = PUM_DEF_WIDTH; /* truncate */
|
||||||
pum_col = Columns - max_width;
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
|
pum_col = max_width - 1;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
pum_col = Columns - max_width;
|
||||||
pum_width = max_width - pum_scrollbar;
|
pum_width = max_width - pum_scrollbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,8 +285,16 @@ pum_redraw()
|
|||||||
attr = (idx == pum_selected) ? attr_select : attr_norm;
|
attr = (idx == pum_selected) ? attr_select : attr_norm;
|
||||||
|
|
||||||
/* prepend a space if there is room */
|
/* prepend a space if there is room */
|
||||||
if (pum_col > 0)
|
#ifdef FEAT_RIGHTLEFT
|
||||||
screen_putchar(' ', row, pum_col - 1, attr);
|
if (curwin->w_p_rl)
|
||||||
|
{
|
||||||
|
if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1)
|
||||||
|
screen_putchar(' ', row, pum_col + 1, attr);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
if (pum_col > 0)
|
||||||
|
screen_putchar(' ', row, pum_col - 1, attr);
|
||||||
|
|
||||||
/* Display each entry, use two spaces for a Tab.
|
/* Display each entry, use two spaces for a Tab.
|
||||||
* Do this 3 times: For the main text, kind and extra info */
|
* Do this 3 times: For the main text, kind and extra info */
|
||||||
@@ -282,26 +320,67 @@ pum_redraw()
|
|||||||
{
|
{
|
||||||
/* Display the text that fits or comes before a Tab.
|
/* Display the text that fits or comes before a Tab.
|
||||||
* First convert it to printable characters. */
|
* First convert it to printable characters. */
|
||||||
char_u *st;
|
char_u *st;
|
||||||
int saved = *p;
|
int saved = *p;
|
||||||
|
|
||||||
*p = NUL;
|
*p = NUL;
|
||||||
st = transstr(s);
|
st = transstr(s);
|
||||||
*p = saved;
|
*p = saved;
|
||||||
if (st != NULL)
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
{
|
{
|
||||||
screen_puts_len(st, (int)STRLEN(st), row, col,
|
if (st != NULL)
|
||||||
attr);
|
{
|
||||||
vim_free(st);
|
char_u *rt = reverse_text(st);
|
||||||
|
char_u *rt_saved = rt;
|
||||||
|
int len, j;
|
||||||
|
|
||||||
|
if (rt != NULL)
|
||||||
|
{
|
||||||
|
len = STRLEN(rt);
|
||||||
|
if (len > pum_width)
|
||||||
|
{
|
||||||
|
for (j = pum_width; j < len; ++j)
|
||||||
|
mb_ptr_adv(rt);
|
||||||
|
len = pum_width;
|
||||||
|
}
|
||||||
|
screen_puts_len(rt, len, row,
|
||||||
|
col - len + 1, attr);
|
||||||
|
vim_free(rt_saved);
|
||||||
|
}
|
||||||
|
vim_free(st);
|
||||||
|
}
|
||||||
|
col -= width;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
if (st != NULL)
|
||||||
|
{
|
||||||
|
screen_puts_len(st, (int)STRLEN(st), row, col,
|
||||||
|
attr);
|
||||||
|
vim_free(st);
|
||||||
|
}
|
||||||
|
col += width;
|
||||||
}
|
}
|
||||||
col += width;
|
|
||||||
|
|
||||||
if (*p != TAB)
|
if (*p != TAB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Display two spaces for a Tab. */
|
/* Display two spaces for a Tab. */
|
||||||
screen_puts_len((char_u *)" ", 2, row, col, attr);
|
#ifdef FEAT_RIGHTLEFT
|
||||||
col += 2;
|
if (curwin->w_p_rl)
|
||||||
|
{
|
||||||
|
screen_puts_len((char_u *)" ", 2, row, col - 1,
|
||||||
|
attr);
|
||||||
|
col -= 2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
screen_puts_len((char_u *)" ", 2, row, col, attr);
|
||||||
|
col += 2;
|
||||||
|
}
|
||||||
totwidth += 2;
|
totwidth += 2;
|
||||||
s = NULL; /* start text at next char */
|
s = NULL; /* start text at next char */
|
||||||
width = 0;
|
width = 0;
|
||||||
@@ -322,17 +401,44 @@ pum_redraw()
|
|||||||
&& pum_array[idx].pum_extra == NULL)
|
&& pum_array[idx].pum_extra == NULL)
|
||||||
|| pum_base_width + n >= pum_width)
|
|| pum_base_width + n >= pum_width)
|
||||||
break;
|
break;
|
||||||
screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
|
{
|
||||||
|
screen_fill(row, row + 1, pum_col - pum_base_width - n + 1,
|
||||||
|
col + 1, ' ', ' ', attr);
|
||||||
|
col = pum_col - pum_base_width - n + 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
screen_fill(row, row + 1, col, pum_col + pum_base_width + n,
|
||||||
' ', ' ', attr);
|
' ', ' ', attr);
|
||||||
col = pum_col + pum_base_width + n;
|
col = pum_col + pum_base_width + n;
|
||||||
|
}
|
||||||
totwidth = pum_base_width + n;
|
totwidth = pum_base_width + n;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ', attr);
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
|
screen_fill(row, row + 1, pum_col - pum_width + 1, col + 1, ' ',
|
||||||
|
' ', attr);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
screen_fill(row, row + 1, col, pum_col + pum_width, ' ', ' ',
|
||||||
|
attr);
|
||||||
if (pum_scrollbar > 0)
|
if (pum_scrollbar > 0)
|
||||||
screen_putchar(' ', row, pum_col + pum_width,
|
{
|
||||||
i >= thumb_pos && i < thumb_pos + thumb_heigth
|
#ifdef FEAT_RIGHTLEFT
|
||||||
|
if (curwin->w_p_rl)
|
||||||
|
screen_putchar(' ', row, pum_col - pum_width,
|
||||||
|
i >= thumb_pos && i < thumb_pos + thumb_heigth
|
||||||
? attr_thumb : attr_scroll);
|
? attr_thumb : attr_scroll);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
screen_putchar(' ', row, pum_col + pum_width,
|
||||||
|
i >= thumb_pos && i < thumb_pos + thumb_heigth
|
||||||
|
? attr_thumb : attr_scroll);
|
||||||
|
}
|
||||||
|
|
||||||
++row;
|
++row;
|
||||||
}
|
}
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
/* search.c */
|
/* search.c */
|
||||||
int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch));
|
int search_regcomp __ARGS((char_u *pat, int pat_save, int pat_use, int options, regmmatch_T *regmatch));
|
||||||
char_u *get_search_pat __ARGS((void));
|
char_u *get_search_pat __ARGS((void));
|
||||||
|
char_u *reverse_text __ARGS((char_u *s));
|
||||||
void save_search_patterns __ARGS((void));
|
void save_search_patterns __ARGS((void));
|
||||||
void restore_search_patterns __ARGS((void));
|
void restore_search_patterns __ARGS((void));
|
||||||
void free_search_patterns __ARGS((void));
|
void free_search_patterns __ARGS((void));
|
||||||
|
@@ -101,7 +101,6 @@ static int saved_no_hlsearch = 0;
|
|||||||
static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */
|
static char_u *mr_pattern = NULL; /* pattern used by search_regcomp() */
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
static int mr_pattern_alloced = FALSE; /* mr_pattern was allocated */
|
static int mr_pattern_alloced = FALSE; /* mr_pattern was allocated */
|
||||||
static char_u *reverse_text __ARGS((char_u *s));
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef FEAT_FIND_ID
|
#ifdef FEAT_FIND_ID
|
||||||
@@ -228,12 +227,12 @@ get_search_pat()
|
|||||||
return mr_pattern;
|
return mr_pattern;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#if defined(FEAT_RIGHTLEFT) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
* Reverse text into allocated memory.
|
* Reverse text into allocated memory.
|
||||||
* Returns the allocated string, NULL when out of memory.
|
* Returns the allocated string, NULL when out of memory.
|
||||||
*/
|
*/
|
||||||
static char_u *
|
char_u *
|
||||||
reverse_text(s)
|
reverse_text(s)
|
||||||
char_u *s;
|
char_u *s;
|
||||||
{
|
{
|
||||||
@@ -1898,7 +1897,7 @@ findmatchlimit(oap, initc, flags, maxtravel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
/* This is just guessing: when 'rightleft' is set, search for a maching
|
/* This is just guessing: when 'rightleft' is set, search for a matching
|
||||||
* paren/brace in the other direction. */
|
* paren/brace in the other direction. */
|
||||||
if (curwin->w_p_rl && vim_strchr((char_u *)"()[]{}<>", initc) != NULL)
|
if (curwin->w_p_rl && vim_strchr((char_u *)"()[]{}<>", initc) != NULL)
|
||||||
backwards = !backwards;
|
backwards = !backwards;
|
||||||
|
@@ -666,6 +666,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
58,
|
||||||
/**/
|
/**/
|
||||||
57,
|
57,
|
||||||
/**/
|
/**/
|
||||||
|
Reference in New Issue
Block a user