forked from aniani/vim
patch 8.1.2394: using old C style comments
Problem: Using old C style comments. Solution: Use // comments where appropriate.
This commit is contained in:
182
src/popupmenu.c
182
src/popupmenu.c
@@ -12,22 +12,22 @@
|
|||||||
*/
|
*/
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
|
|
||||||
static pumitem_T *pum_array = NULL; /* items of displayed pum */
|
static pumitem_T *pum_array = NULL; // items of displayed pum
|
||||||
static int pum_size; /* nr of items in "pum_array" */
|
static int pum_size; // nr of items in "pum_array"
|
||||||
static int pum_selected; /* index of selected item or -1 */
|
static int pum_selected; // index of selected item or -1
|
||||||
static int pum_first = 0; /* index of top item */
|
static int pum_first = 0; // index of top item
|
||||||
|
|
||||||
static int call_update_screen = FALSE;
|
static int call_update_screen = FALSE;
|
||||||
|
|
||||||
static int pum_height; /* nr of displayed pum items */
|
static int pum_height; // nr of displayed pum items
|
||||||
static int pum_width; /* width of displayed pum items */
|
static int pum_width; // width of displayed pum items
|
||||||
static int pum_base_width; /* width of pum items base */
|
static int pum_base_width; // width of pum items base
|
||||||
static int pum_kind_width; /* width of pum items kind column */
|
static int pum_kind_width; // width of pum items kind column
|
||||||
static int pum_extra_width; /* width of extra stuff */
|
static int pum_extra_width; // width of extra stuff
|
||||||
static int pum_scrollbar; /* TRUE when scrollbar present */
|
static int pum_scrollbar; // TRUE when scrollbar present
|
||||||
|
|
||||||
static int pum_row; /* top row of pum */
|
static int pum_row; // top row of pum
|
||||||
static int pum_col; /* left column of pum */
|
static int pum_col; // left column of pum
|
||||||
|
|
||||||
static win_T *pum_window = NULL;
|
static win_T *pum_window = NULL;
|
||||||
static int pum_win_row;
|
static int pum_win_row;
|
||||||
@@ -49,7 +49,7 @@ pum_compute_size(void)
|
|||||||
int i;
|
int i;
|
||||||
int w;
|
int w;
|
||||||
|
|
||||||
/* Compute the width of the widest match and the widest extra. */
|
// Compute the width of the widest match and the widest extra.
|
||||||
pum_base_width = 0;
|
pum_base_width = 0;
|
||||||
pum_kind_width = 0;
|
pum_kind_width = 0;
|
||||||
pum_extra_width = 0;
|
pum_extra_width = 0;
|
||||||
@@ -83,8 +83,8 @@ pum_compute_size(void)
|
|||||||
pum_display(
|
pum_display(
|
||||||
pumitem_T *array,
|
pumitem_T *array,
|
||||||
int size,
|
int size,
|
||||||
int selected) /* index of initially selected item, none if
|
int selected) // index of initially selected item, none if
|
||||||
out of range */
|
// out of range
|
||||||
{
|
{
|
||||||
int def_width;
|
int def_width;
|
||||||
int max_width;
|
int max_width;
|
||||||
@@ -103,8 +103,8 @@ pum_display(
|
|||||||
above_row = 0;
|
above_row = 0;
|
||||||
below_row = cmdline_row;
|
below_row = cmdline_row;
|
||||||
|
|
||||||
/* Pretend the pum is already there to avoid that must_redraw is set
|
// Pretend the pum is already there to avoid that must_redraw is set
|
||||||
* when 'cuc' is on. */
|
// when 'cuc' is on.
|
||||||
pum_array = (pumitem_T *)1;
|
pum_array = (pumitem_T *)1;
|
||||||
validate_cursor_col();
|
validate_cursor_col();
|
||||||
pum_array = NULL;
|
pum_array = NULL;
|
||||||
@@ -141,14 +141,14 @@ pum_display(
|
|||||||
if (p_ph > 0 && pum_height > p_ph)
|
if (p_ph > 0 && pum_height > p_ph)
|
||||||
pum_height = p_ph;
|
pum_height = p_ph;
|
||||||
|
|
||||||
/* Put the pum below "pum_win_row" if possible. If there are few lines
|
// Put the pum below "pum_win_row" if possible. If there are few lines
|
||||||
* decide on where there is more room. */
|
// decide on where there is more room.
|
||||||
if (pum_win_row + 2 >= below_row - pum_height
|
if (pum_win_row + 2 >= below_row - pum_height
|
||||||
&& pum_win_row - above_row > (below_row - above_row) / 2)
|
&& pum_win_row - above_row > (below_row - above_row) / 2)
|
||||||
{
|
{
|
||||||
/* pum above "pum_win_row" */
|
// pum above "pum_win_row"
|
||||||
|
|
||||||
/* Leave two lines of context if possible */
|
// Leave two lines of context if possible
|
||||||
if (curwin->w_wrow - curwin->w_cline_row >= 2)
|
if (curwin->w_wrow - curwin->w_cline_row >= 2)
|
||||||
context_lines = 2;
|
context_lines = 2;
|
||||||
else
|
else
|
||||||
@@ -172,9 +172,9 @@ pum_display(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* pum below "pum_win_row" */
|
// pum below "pum_win_row"
|
||||||
|
|
||||||
/* Leave two lines of context if possible */
|
// Leave two lines of context if possible
|
||||||
if (curwin->w_cline_row
|
if (curwin->w_cline_row
|
||||||
+ curwin->w_cline_height - curwin->w_wrow >= 3)
|
+ curwin->w_cline_height - curwin->w_wrow >= 3)
|
||||||
context_lines = 3;
|
context_lines = 3;
|
||||||
@@ -191,7 +191,7 @@ pum_display(
|
|||||||
pum_height = p_ph;
|
pum_height = p_ph;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* don't display when we only have room for one line */
|
// don't display when we only have room for one line
|
||||||
if (pum_height < 1 || (pum_height == 1 && size > 1))
|
if (pum_height < 1 || (pum_height == 1 && size > 1))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ pum_display(
|
|||||||
pum_compute_size();
|
pum_compute_size();
|
||||||
max_width = pum_base_width;
|
max_width = pum_base_width;
|
||||||
|
|
||||||
/* Calculate column */
|
// Calculate column
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (curwin->w_p_rl)
|
if (curwin->w_p_rl)
|
||||||
cursor_col = curwin->w_wincol + curwin->w_width
|
cursor_col = curwin->w_wincol + curwin->w_width
|
||||||
@@ -218,7 +218,7 @@ pum_display(
|
|||||||
#endif
|
#endif
|
||||||
cursor_col = curwin->w_wincol + curwin->w_wcol;
|
cursor_col = curwin->w_wincol + curwin->w_wcol;
|
||||||
|
|
||||||
/* 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)
|
||||||
{
|
{
|
||||||
pum_scrollbar = 1;
|
pum_scrollbar = 1;
|
||||||
@@ -239,10 +239,10 @@ pum_display(
|
|||||||
#endif
|
#endif
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
/* align pum with "cursor_col" */
|
// align pum with "cursor_col"
|
||||||
pum_col = cursor_col;
|
pum_col = cursor_col;
|
||||||
|
|
||||||
/* start with the maximum space available */
|
// start with the maximum space available
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (curwin->w_p_rl)
|
if (curwin->w_p_rl)
|
||||||
pum_width = pum_col - pum_scrollbar + 1;
|
pum_width = pum_col - pum_scrollbar + 1;
|
||||||
@@ -253,8 +253,8 @@ pum_display(
|
|||||||
if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
|
if (pum_width > max_width + pum_kind_width + pum_extra_width + 1
|
||||||
&& pum_width > p_pw)
|
&& pum_width > p_pw)
|
||||||
{
|
{
|
||||||
/* the width is more than needed for the items, make it
|
// the width is more than needed for the items, make it
|
||||||
* narrower */
|
// narrower
|
||||||
pum_width = max_width + pum_kind_width + pum_extra_width + 1;
|
pum_width = max_width + pum_kind_width + pum_extra_width + 1;
|
||||||
if (pum_width < p_pw)
|
if (pum_width < p_pw)
|
||||||
pum_width = p_pw;
|
pum_width = p_pw;
|
||||||
@@ -267,7 +267,7 @@ pum_display(
|
|||||||
#endif
|
#endif
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
/* align pum edge with "cursor_col" */
|
// align pum edge with "cursor_col"
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (curwin->w_p_rl
|
if (curwin->w_p_rl
|
||||||
&& W_ENDCOL(curwin) < max_width + pum_scrollbar + 1)
|
&& W_ENDCOL(curwin) < max_width + pum_scrollbar + 1)
|
||||||
@@ -282,7 +282,7 @@ pum_display(
|
|||||||
if (curwin->w_wincol > Columns - max_width - pum_scrollbar
|
if (curwin->w_wincol > Columns - max_width - pum_scrollbar
|
||||||
&& max_width <= p_pw)
|
&& max_width <= p_pw)
|
||||||
{
|
{
|
||||||
/* use full width to end of the screen */
|
// use full width to end of the screen
|
||||||
pum_col = Columns - max_width - pum_scrollbar;
|
pum_col = Columns - max_width - pum_scrollbar;
|
||||||
if (pum_col < 0)
|
if (pum_col < 0)
|
||||||
pum_col = 0;
|
pum_col = 0;
|
||||||
@@ -326,7 +326,7 @@ pum_display(
|
|||||||
}
|
}
|
||||||
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
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (curwin->w_p_rl)
|
if (curwin->w_p_rl)
|
||||||
pum_col = Columns - 1;
|
pum_col = Columns - 1;
|
||||||
@@ -338,7 +338,7 @@ pum_display(
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (max_width > p_pw)
|
if (max_width > p_pw)
|
||||||
max_width = p_pw; /* truncate */
|
max_width = p_pw; // truncate
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (curwin->w_p_rl)
|
if (curwin->w_p_rl)
|
||||||
pum_col = max_width - 1;
|
pum_col = max_width - 1;
|
||||||
@@ -348,9 +348,9 @@ pum_display(
|
|||||||
pum_width = max_width - pum_scrollbar;
|
pum_width = max_width - pum_scrollbar;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set selected item and redraw. If the window size changed need to
|
// Set selected item and redraw. If the window size changed need to
|
||||||
* redo the positioning. Limit this to two times, when there is not
|
// redo the positioning. Limit this to two times, when there is not
|
||||||
* much room the window size will keep changing. */
|
// much room the window size will keep changing.
|
||||||
} while (pum_set_selected(selected, redo_count) && ++redo_count <= 2);
|
} while (pum_set_selected(selected, redo_count) && ++redo_count <= 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -440,7 +440,7 @@ pum_redraw(void)
|
|||||||
idx = i + pum_first;
|
idx = i + pum_first;
|
||||||
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
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (curwin->w_p_rl)
|
if (curwin->w_p_rl)
|
||||||
{
|
{
|
||||||
@@ -452,8 +452,8 @@ pum_redraw(void)
|
|||||||
if (pum_col > 0)
|
if (pum_col > 0)
|
||||||
screen_putchar(' ', row, pum_col - 1, attr);
|
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
|
||||||
col = pum_col;
|
col = pum_col;
|
||||||
totwidth = 0;
|
totwidth = 0;
|
||||||
for (round = 1; round <= 3; ++round)
|
for (round = 1; round <= 3; ++round)
|
||||||
@@ -474,8 +474,8 @@ pum_redraw(void)
|
|||||||
w = ptr2cells(p);
|
w = ptr2cells(p);
|
||||||
if (*p == NUL || *p == TAB || totwidth + w > pum_width)
|
if (*p == NUL || *p == TAB || totwidth + w > pum_width)
|
||||||
{
|
{
|
||||||
/* 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;
|
||||||
|
|
||||||
@@ -508,11 +508,11 @@ pum_redraw(void)
|
|||||||
|
|
||||||
if (size < pum_width)
|
if (size < pum_width)
|
||||||
{
|
{
|
||||||
/* Most left character requires
|
// Most left character requires
|
||||||
* 2-cells but only 1 cell is
|
// 2-cells but only 1 cell is
|
||||||
* available on screen. Put a
|
// available on screen. Put a
|
||||||
* '<' on the left of the pum
|
// '<' on the left of the pum
|
||||||
* item */
|
// item
|
||||||
*(--rt) = '<';
|
*(--rt) = '<';
|
||||||
size++;
|
size++;
|
||||||
}
|
}
|
||||||
@@ -540,7 +540,7 @@ pum_redraw(void)
|
|||||||
if (*p != TAB)
|
if (*p != TAB)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Display two spaces for a Tab. */
|
// Display two spaces for a Tab.
|
||||||
#ifdef FEAT_RIGHTLEFT
|
#ifdef FEAT_RIGHTLEFT
|
||||||
if (curwin->w_p_rl)
|
if (curwin->w_p_rl)
|
||||||
{
|
{
|
||||||
@@ -555,7 +555,7 @@ pum_redraw(void)
|
|||||||
col += 2;
|
col += 2;
|
||||||
}
|
}
|
||||||
totwidth += 2;
|
totwidth += 2;
|
||||||
s = NULL; /* start text at next char */
|
s = NULL; // start text at next char
|
||||||
width = 0;
|
width = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -567,7 +567,7 @@ pum_redraw(void)
|
|||||||
else
|
else
|
||||||
n = 1;
|
n = 1;
|
||||||
|
|
||||||
/* Stop when there is nothing more to display. */
|
// Stop when there is nothing more to display.
|
||||||
if (round == 3
|
if (round == 3
|
||||||
|| (round == 2 && pum_array[idx].pum_extra == NULL)
|
|| (round == 2 && pum_array[idx].pum_extra == NULL)
|
||||||
|| (round == 1 && pum_array[idx].pum_kind == NULL
|
|| (round == 1 && pum_array[idx].pum_kind == NULL
|
||||||
@@ -693,8 +693,8 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
{
|
{
|
||||||
if (pum_first > pum_selected - 4)
|
if (pum_first > pum_selected - 4)
|
||||||
{
|
{
|
||||||
/* scroll down; when we did a jump it's probably a PageUp then
|
// scroll down; when we did a jump it's probably a PageUp then
|
||||||
* scroll a whole page */
|
// scroll a whole page
|
||||||
if (pum_first > pum_selected - 2)
|
if (pum_first > pum_selected - 2)
|
||||||
{
|
{
|
||||||
pum_first -= pum_height - 2;
|
pum_first -= pum_height - 2;
|
||||||
@@ -708,8 +708,8 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
}
|
}
|
||||||
else if (pum_first < pum_selected - pum_height + 5)
|
else if (pum_first < pum_selected - pum_height + 5)
|
||||||
{
|
{
|
||||||
/* scroll up; when we did a jump it's probably a PageDown then
|
// scroll up; when we did a jump it's probably a PageDown then
|
||||||
* scroll a whole page */
|
// scroll a whole page
|
||||||
if (pum_first < pum_selected - pum_height + 1 + 2)
|
if (pum_first < pum_selected - pum_height + 1 + 2)
|
||||||
{
|
{
|
||||||
pum_first += pum_height - 2;
|
pum_first += pum_height - 2;
|
||||||
@@ -720,21 +720,21 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
pum_first = pum_selected - pum_height + 1;
|
pum_first = pum_selected - pum_height + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Give a few lines of context when possible. */
|
// Give a few lines of context when possible.
|
||||||
if (context > 3)
|
if (context > 3)
|
||||||
context = 3;
|
context = 3;
|
||||||
if (pum_height > 2)
|
if (pum_height > 2)
|
||||||
{
|
{
|
||||||
if (pum_first > pum_selected - context)
|
if (pum_first > pum_selected - context)
|
||||||
{
|
{
|
||||||
/* scroll down */
|
// scroll down
|
||||||
pum_first = pum_selected - context;
|
pum_first = pum_selected - context;
|
||||||
if (pum_first < 0)
|
if (pum_first < 0)
|
||||||
pum_first = 0;
|
pum_first = 0;
|
||||||
}
|
}
|
||||||
else if (pum_first < pum_selected + context - pum_height + 1)
|
else if (pum_first < pum_selected + context - pum_height + 1)
|
||||||
{
|
{
|
||||||
/* scroll up */
|
// scroll up
|
||||||
pum_first = pum_selected + context - pum_height + 1;
|
pum_first = pum_selected + context - pum_height + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -845,8 +845,8 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
// delete the empty last line
|
// delete the empty last line
|
||||||
ml_delete(curbuf->b_ml.ml_line_count, FALSE);
|
ml_delete(curbuf->b_ml.ml_line_count, FALSE);
|
||||||
|
|
||||||
/* Increase the height of the preview window to show the
|
// Increase the height of the preview window to show the
|
||||||
* text, but no more than 'previewheight' lines. */
|
// text, but no more than 'previewheight' lines.
|
||||||
if (repeat == 0 && use_popup == USEPOPUP_NONE)
|
if (repeat == 0 && use_popup == USEPOPUP_NONE)
|
||||||
{
|
{
|
||||||
if (lnum > p_pvh)
|
if (lnum > p_pvh)
|
||||||
@@ -886,20 +886,20 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
if (curtab != curtab_save && valid_tabpage(curtab_save))
|
if (curtab != curtab_save && valid_tabpage(curtab_save))
|
||||||
goto_tabpage_tp(curtab_save, FALSE, FALSE);
|
goto_tabpage_tp(curtab_save, FALSE, FALSE);
|
||||||
|
|
||||||
/* When the first completion is done and the preview
|
// When the first completion is done and the preview
|
||||||
* window is not resized, skip the preview window's
|
// window is not resized, skip the preview window's
|
||||||
* status line redrawing. */
|
// status line redrawing.
|
||||||
if (ins_compl_active() && !resized)
|
if (ins_compl_active() && !resized)
|
||||||
curwin->w_redr_status = FALSE;
|
curwin->w_redr_status = FALSE;
|
||||||
|
|
||||||
/* Return cursor to where we were */
|
// Return cursor to where we were
|
||||||
validate_cursor();
|
validate_cursor();
|
||||||
redraw_later(SOME_VALID);
|
redraw_later(SOME_VALID);
|
||||||
|
|
||||||
/* When the preview window was resized we need to
|
// When the preview window was resized we need to
|
||||||
* update the view on the buffer. Only go back to
|
// update the view on the buffer. Only go back to
|
||||||
* the window when needed, otherwise it will always be
|
// the window when needed, otherwise it will always be
|
||||||
* redraw. */
|
// redraw.
|
||||||
if (resized && win_valid(curwin_save))
|
if (resized && win_valid(curwin_save))
|
||||||
{
|
{
|
||||||
++no_u_sync;
|
++no_u_sync;
|
||||||
@@ -908,8 +908,8 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
update_topline();
|
update_topline();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update the screen before drawing the popup menu.
|
// Update the screen before drawing the popup menu.
|
||||||
* Enable updating the status lines. */
|
// Enable updating the status lines.
|
||||||
pum_do_redraw = TRUE;
|
pum_do_redraw = TRUE;
|
||||||
update_screen(0);
|
update_screen(0);
|
||||||
pum_do_redraw = FALSE;
|
pum_do_redraw = FALSE;
|
||||||
@@ -928,8 +928,8 @@ pum_set_selected(int n, int repeat UNUSED)
|
|||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/* May need to update the screen again when there are
|
// May need to update the screen again when there are
|
||||||
* autocommands involved. */
|
// autocommands involved.
|
||||||
pum_do_redraw = TRUE;
|
pum_do_redraw = TRUE;
|
||||||
update_screen(0);
|
update_screen(0);
|
||||||
pum_do_redraw = FALSE;
|
pum_do_redraw = FALSE;
|
||||||
@@ -1064,14 +1064,14 @@ pum_position_at_mouse(int min_width)
|
|||||||
{
|
{
|
||||||
if (Rows - mouse_row > pum_size)
|
if (Rows - mouse_row > pum_size)
|
||||||
{
|
{
|
||||||
/* Enough space below the mouse row. */
|
// Enough space below the mouse row.
|
||||||
pum_row = mouse_row + 1;
|
pum_row = mouse_row + 1;
|
||||||
if (pum_height > Rows - pum_row)
|
if (pum_height > Rows - pum_row)
|
||||||
pum_height = Rows - pum_row;
|
pum_height = Rows - pum_row;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Show above the mouse row, reduce height if it does not fit. */
|
// Show above the mouse row, reduce height if it does not fit.
|
||||||
pum_row = mouse_row - pum_size;
|
pum_row = mouse_row - pum_size;
|
||||||
if (pum_row < 0)
|
if (pum_row < 0)
|
||||||
{
|
{
|
||||||
@@ -1081,10 +1081,10 @@ pum_position_at_mouse(int min_width)
|
|||||||
}
|
}
|
||||||
if (Columns - mouse_col >= pum_base_width
|
if (Columns - mouse_col >= pum_base_width
|
||||||
|| Columns - mouse_col > min_width)
|
|| Columns - mouse_col > min_width)
|
||||||
/* Enough space to show at mouse column. */
|
// Enough space to show at mouse column.
|
||||||
pum_col = mouse_col;
|
pum_col = mouse_col;
|
||||||
else
|
else
|
||||||
/* Not enough space, right align with window. */
|
// Not enough space, right align with window.
|
||||||
pum_col = Columns - (pum_base_width > min_width
|
pum_col = Columns - (pum_base_width > min_width
|
||||||
? min_width : pum_base_width);
|
? min_width : pum_base_width);
|
||||||
|
|
||||||
@@ -1158,7 +1158,7 @@ split_message(char_u *mesg, pumitem_T **array)
|
|||||||
{
|
{
|
||||||
if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}')
|
if ((*p == ',' && p[1] == ' ') || *p == '{' || *p == '}')
|
||||||
{
|
{
|
||||||
/* Looks like a good point to break. */
|
// Looks like a good point to break.
|
||||||
if (*p == '{')
|
if (*p == '{')
|
||||||
++indent;
|
++indent;
|
||||||
else if (*p == '}' && indent > 0)
|
else if (*p == '}' && indent > 0)
|
||||||
@@ -1181,22 +1181,22 @@ split_message(char_u *mesg, pumitem_T **array)
|
|||||||
|
|
||||||
height = 2 + ga.ga_len;
|
height = 2 + ga.ga_len;
|
||||||
|
|
||||||
/* If there are long items and the height is below the limit: split lines */
|
// If there are long items and the height is below the limit: split lines
|
||||||
if (long_item_count > 0 && height + long_item_count <= max_height)
|
if (long_item_count > 0 && height + long_item_count <= max_height)
|
||||||
{
|
{
|
||||||
split_long_items = TRUE;
|
split_long_items = TRUE;
|
||||||
height += long_item_count;
|
height += long_item_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Limit to half the window height, it has to fit above or below the mouse
|
// Limit to half the window height, it has to fit above or below the mouse
|
||||||
* position. */
|
// position.
|
||||||
if (height > max_height)
|
if (height > max_height)
|
||||||
height = max_height;
|
height = max_height;
|
||||||
*array = ALLOC_CLEAR_MULT(pumitem_T, height);
|
*array = ALLOC_CLEAR_MULT(pumitem_T, height);
|
||||||
if (*array == NULL)
|
if (*array == NULL)
|
||||||
goto failed;
|
goto failed;
|
||||||
|
|
||||||
/* Add an empty line above and below, looks better. */
|
// Add an empty line above and below, looks better.
|
||||||
(*array)->pum_text = vim_strsave((char_u *)"");
|
(*array)->pum_text = vim_strsave((char_u *)"");
|
||||||
(*array + height - 1)->pum_text = vim_strsave((char_u *)"");
|
(*array + height - 1)->pum_text = vim_strsave((char_u *)"");
|
||||||
|
|
||||||
@@ -1246,7 +1246,7 @@ split_message(char_u *mesg, pumitem_T **array)
|
|||||||
|
|
||||||
vim_strncpy(p + ind, item->start + skip, copylen);
|
vim_strncpy(p + ind, item->start + skip, copylen);
|
||||||
(*array)[line].pum_text = p;
|
(*array)[line].pum_text = p;
|
||||||
item->indent = 0; /* wrapped line has no indent */
|
item->indent = 0; // wrapped line has no indent
|
||||||
++line;
|
++line;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1415,7 +1415,7 @@ pum_show_popupmenu(vimmenu_T *menu)
|
|||||||
pum_selected = -1;
|
pum_selected = -1;
|
||||||
pum_first = 0;
|
pum_first = 0;
|
||||||
# ifdef FEAT_BEVAL_TERM
|
# ifdef FEAT_BEVAL_TERM
|
||||||
p_bevalterm = TRUE; /* track mouse movement */
|
p_bevalterm = TRUE; // track mouse movement
|
||||||
mch_setmouse(TRUE);
|
mch_setmouse(TRUE);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@@ -1435,13 +1435,13 @@ pum_show_popupmenu(vimmenu_T *menu)
|
|||||||
break;
|
break;
|
||||||
else if (c == CAR || c == NL)
|
else if (c == CAR || c == NL)
|
||||||
{
|
{
|
||||||
/* enter: select current item, if any, and close */
|
// enter: select current item, if any, and close
|
||||||
pum_execute_menu(menu, mode);
|
pum_execute_menu(menu, mode);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
|
else if (c == 'k' || c == K_UP || c == K_MOUSEUP)
|
||||||
{
|
{
|
||||||
/* cursor up: select previous item */
|
// cursor up: select previous item
|
||||||
while (pum_selected > 0)
|
while (pum_selected > 0)
|
||||||
{
|
{
|
||||||
--pum_selected;
|
--pum_selected;
|
||||||
@@ -1451,7 +1451,7 @@ pum_show_popupmenu(vimmenu_T *menu)
|
|||||||
}
|
}
|
||||||
else if (c == 'j' || c == K_DOWN || c == K_MOUSEDOWN)
|
else if (c == 'j' || c == K_DOWN || c == K_MOUSEDOWN)
|
||||||
{
|
{
|
||||||
/* cursor down: select next item */
|
// cursor down: select next item
|
||||||
while (pum_selected < pum_size - 1)
|
while (pum_selected < pum_size - 1)
|
||||||
{
|
{
|
||||||
++pum_selected;
|
++pum_selected;
|
||||||
@@ -1461,19 +1461,19 @@ pum_show_popupmenu(vimmenu_T *menu)
|
|||||||
}
|
}
|
||||||
else if (c == K_RIGHTMOUSE)
|
else if (c == K_RIGHTMOUSE)
|
||||||
{
|
{
|
||||||
/* Right mouse down: reposition the menu. */
|
// Right mouse down: reposition the menu.
|
||||||
vungetc(c);
|
vungetc(c);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else if (c == K_LEFTDRAG || c == K_RIGHTDRAG || c == K_MOUSEMOVE)
|
else if (c == K_LEFTDRAG || c == K_RIGHTDRAG || c == K_MOUSEMOVE)
|
||||||
{
|
{
|
||||||
/* mouse moved: select item in the mouse row */
|
// mouse moved: select item in the mouse row
|
||||||
pum_select_mouse_pos();
|
pum_select_mouse_pos();
|
||||||
}
|
}
|
||||||
else if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_RIGHTRELEASE)
|
else if (c == K_LEFTMOUSE || c == K_LEFTMOUSE_NM || c == K_RIGHTRELEASE)
|
||||||
{
|
{
|
||||||
/* left mouse click: select clicked item, if any, and close;
|
// left mouse click: select clicked item, if any, and close;
|
||||||
* right mouse release: select clicked item, close if any */
|
// right mouse release: select clicked item, close if any
|
||||||
pum_select_mouse_pos();
|
pum_select_mouse_pos();
|
||||||
if (pum_selected >= 0)
|
if (pum_selected >= 0)
|
||||||
{
|
{
|
||||||
@@ -1500,8 +1500,8 @@ pum_make_popup(char_u *path_name, int use_mouse_pos)
|
|||||||
|
|
||||||
if (!use_mouse_pos)
|
if (!use_mouse_pos)
|
||||||
{
|
{
|
||||||
/* Hack: set mouse position at the cursor so that the menu pops up
|
// Hack: set mouse position at the cursor so that the menu pops up
|
||||||
* around there. */
|
// around there.
|
||||||
mouse_row = curwin->w_winrow + curwin->w_wrow;
|
mouse_row = curwin->w_winrow + curwin->w_wrow;
|
||||||
mouse_col = curwin->w_wincol + curwin->w_wcol;
|
mouse_col = curwin->w_wincol + curwin->w_wcol;
|
||||||
}
|
}
|
||||||
|
|||||||
66
src/pty.c
66
src/pty.c
@@ -20,26 +20,25 @@
|
|||||||
* copyright notice below.
|
* copyright notice below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Copyright (c) 1993
|
// Copyright (c) 1993
|
||||||
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
|
// Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
|
||||||
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
|
// Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
|
||||||
* Copyright (c) 1987 Oliver Laumann
|
// Copyright (c) 1987 Oliver Laumann
|
||||||
*
|
//
|
||||||
* This program is free software; you can redistribute it and/or modify
|
// This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
// it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation; either version 2, or (at your option)
|
// the Free Software Foundation; either version 2, or (at your option)
|
||||||
* any later version.
|
// any later version.
|
||||||
*
|
//
|
||||||
* This program is distributed in the hope that it will be useful,
|
// This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
// GNU General Public License for more details.
|
||||||
*
|
//
|
||||||
* You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
* along with this program (see the file COPYING); if not, write to the
|
// along with this program (see the file COPYING); if not, write to the
|
||||||
* Free Software Foundation, Inc.,
|
// Free Software Foundation, Inc.,
|
||||||
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||||
*/
|
|
||||||
|
|
||||||
#include "vim.h"
|
#include "vim.h"
|
||||||
|
|
||||||
@@ -124,7 +123,7 @@
|
|||||||
# define PTYRANGE1 "0123456789abcdef"
|
# define PTYRANGE1 "0123456789abcdef"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* SVR4 pseudo ttys don't seem to work with SCO-5 */
|
// SVR4 pseudo ttys don't seem to work with SCO-5
|
||||||
#ifdef M_UNIX
|
#ifdef M_UNIX
|
||||||
# undef HAVE_SVR4_PTYS
|
# undef HAVE_SVR4_PTYS
|
||||||
#endif
|
#endif
|
||||||
@@ -240,7 +239,7 @@ mch_openpty(char **ttyn)
|
|||||||
{
|
{
|
||||||
char *m, *s;
|
char *m, *s;
|
||||||
int f;
|
int f;
|
||||||
/* used for opening a new pty-pair: */
|
// used for opening a new pty-pair:
|
||||||
static char PtyName[32];
|
static char PtyName[32];
|
||||||
static char TtyName[32];
|
static char TtyName[32];
|
||||||
|
|
||||||
@@ -289,7 +288,7 @@ mch_openpty(char **ttyn)
|
|||||||
{
|
{
|
||||||
int f;
|
int f;
|
||||||
stat_T buf;
|
stat_T buf;
|
||||||
/* used for opening a new pty-pair: */
|
// used for opening a new pty-pair:
|
||||||
static char TtyName[32];
|
static char TtyName[32];
|
||||||
|
|
||||||
if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_NONBLOCK | O_EXTRA, 0)) < 0)
|
if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_NONBLOCK | O_EXTRA, 0)) < 0)
|
||||||
@@ -309,8 +308,8 @@ mch_openpty(char **ttyn)
|
|||||||
#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) \
|
#if defined(HAVE_SVR4_PTYS) && !defined(PTY_DONE) && !defined(hpux) \
|
||||||
&& !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6))
|
&& !(defined(MACOS_X) && !defined(MAC_OS_X_VERSION_10_6))
|
||||||
|
|
||||||
/* NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
|
// NOTE: Even though HPUX can have /dev/ptmx, the code below doesn't work!
|
||||||
* Same for Mac OS X Leopard (10.5). */
|
// Same for Mac OS X Leopard (10.5).
|
||||||
#define PTY_DONE
|
#define PTY_DONE
|
||||||
int
|
int
|
||||||
mch_openpty(char **ttyn)
|
mch_openpty(char **ttyn)
|
||||||
@@ -318,7 +317,7 @@ mch_openpty(char **ttyn)
|
|||||||
int f;
|
int f;
|
||||||
char *m;
|
char *m;
|
||||||
RETSIGTYPE (*sigcld) SIGPROTOARG;
|
RETSIGTYPE (*sigcld) SIGPROTOARG;
|
||||||
/* used for opening a new pty-pair: */
|
// used for opening a new pty-pair:
|
||||||
static char TtyName[32];
|
static char TtyName[32];
|
||||||
|
|
||||||
if ((f = open("/dev/ptmx", O_RDWR | O_NOCTTY | O_EXTRA, 0)) == -1)
|
if ((f = open("/dev/ptmx", O_RDWR | O_NOCTTY | O_EXTRA, 0)) == -1)
|
||||||
@@ -354,10 +353,10 @@ static int aixhack = -1;
|
|||||||
mch_openpty(char **ttyn)
|
mch_openpty(char **ttyn)
|
||||||
{
|
{
|
||||||
int f;
|
int f;
|
||||||
/* used for opening a new pty-pair: */
|
// used for opening a new pty-pair:
|
||||||
static char TtyName[32];
|
static char TtyName[32];
|
||||||
|
|
||||||
/* a dumb looking loop replaced by mycrofts code: */
|
// a dumb looking loop replaced by mycrofts code:
|
||||||
if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0)
|
if ((f = open("/dev/ptc", O_RDWR | O_NOCTTY | O_EXTRA)) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
vim_strncpy((char_u *)TtyName, (char_u *)ttyname(f), sizeof(TtyName) - 1);
|
vim_strncpy((char_u *)TtyName, (char_u *)ttyname(f), sizeof(TtyName) - 1);
|
||||||
@@ -401,7 +400,7 @@ mch_openpty(char **ttyn)
|
|||||||
{
|
{
|
||||||
char *p, *q, *l, *d;
|
char *p, *q, *l, *d;
|
||||||
int f;
|
int f;
|
||||||
/* used for opening a new pty-pair: */
|
// used for opening a new pty-pair:
|
||||||
static char PtyName[32];
|
static char PtyName[32];
|
||||||
static char TtyName[32];
|
static char TtyName[32];
|
||||||
|
|
||||||
@@ -425,13 +424,12 @@ mch_openpty(char **ttyn)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
#if defined(SUN_SYSTEM) && defined(TIOCGPGRP) && !defined(SUNOS3)
|
#if defined(SUN_SYSTEM) && defined(TIOCGPGRP) && !defined(SUNOS3)
|
||||||
/* Hack to ensure that the slave side of the pty is
|
// Hack to ensure that the slave side of the pty is
|
||||||
* unused. May not work in anything other than SunOS4.1
|
// unused. May not work in anything other than SunOS4.1
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
int pgrp;
|
int pgrp;
|
||||||
|
|
||||||
/* tcgetpgrp does not work (uses TIOCGETPGRP)! */
|
// tcgetpgrp does not work (uses TIOCGETPGRP)!
|
||||||
if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO)
|
if (ioctl(f, TIOCGPGRP, (char *)&pgrp) != -1 || errno != EIO)
|
||||||
{
|
{
|
||||||
close(f);
|
close(f);
|
||||||
@@ -474,4 +472,4 @@ mch_isatty(int fd)
|
|||||||
return isatty(fd);
|
return isatty(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FEAT_GUI || FEAT_JOB_CHANNEL */
|
#endif // FEAT_GUI || FEAT_JOB_CHANNEL
|
||||||
|
|||||||
@@ -7880,7 +7880,7 @@ ex_helpgrep(exarg_T *eap)
|
|||||||
curwin->w_llist = qi;
|
curwin->w_llist = qi;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* FEAT_QUICKFIX */
|
#endif // FEAT_QUICKFIX
|
||||||
|
|
||||||
#if defined(FEAT_EVAL) || defined(PROTO)
|
#if defined(FEAT_EVAL) || defined(PROTO)
|
||||||
# ifdef FEAT_QUICKFIX
|
# ifdef FEAT_QUICKFIX
|
||||||
|
|||||||
504
src/regexp.c
504
src/regexp.c
File diff suppressed because it is too large
Load Diff
1431
src/regexp_nfa.c
1431
src/regexp_nfa.c
File diff suppressed because it is too large
Load Diff
575
src/screen.c
575
src/screen.c
File diff suppressed because it is too large
Load Diff
972
src/search.c
972
src/search.c
File diff suppressed because it is too large
Load Diff
14
src/sha256.c
14
src/sha256.c
@@ -260,7 +260,7 @@ sha256_finish(context_sha256_T *ctx, char_u digest[32])
|
|||||||
PUT_UINT32(ctx->state[6], digest, 24);
|
PUT_UINT32(ctx->state[6], digest, 24);
|
||||||
PUT_UINT32(ctx->state[7], digest, 28);
|
PUT_UINT32(ctx->state[7], digest, 28);
|
||||||
}
|
}
|
||||||
#endif /* FEAT_CRYPT || FEAT_PERSISTENT_UNDO */
|
#endif // FEAT_CRYPT || FEAT_PERSISTENT_UNDO
|
||||||
|
|
||||||
#if defined(FEAT_CRYPT) || defined(PROTO)
|
#if defined(FEAT_CRYPT) || defined(PROTO)
|
||||||
/*
|
/*
|
||||||
@@ -301,7 +301,7 @@ sha256_key(
|
|||||||
char_u *salt,
|
char_u *salt,
|
||||||
int salt_len)
|
int salt_len)
|
||||||
{
|
{
|
||||||
/* No passwd means don't encrypt */
|
// No passwd means don't encrypt
|
||||||
if (buf == NULL || *buf == NUL)
|
if (buf == NULL || *buf == NUL)
|
||||||
return (char_u *)"";
|
return (char_u *)"";
|
||||||
|
|
||||||
@@ -370,7 +370,7 @@ sha256_self_test(void)
|
|||||||
{
|
{
|
||||||
failures++;
|
failures++;
|
||||||
output[sizeof(output) - 1] = '\0';
|
output[sizeof(output) - 1] = '\0';
|
||||||
/* printf("sha256_self_test %d failed %s\n", i, output); */
|
// printf("sha256_self_test %d failed %s\n", i, output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return failures > 0 ? FAIL : OK;
|
return failures > 0 ? FAIL : OK;
|
||||||
@@ -382,7 +382,7 @@ get_some_time(void)
|
|||||||
# ifdef HAVE_GETTIMEOFDAY
|
# ifdef HAVE_GETTIMEOFDAY
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
/* Using usec makes it less predictable. */
|
// Using usec makes it less predictable.
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
return (unsigned int)(tv.tv_sec + tv.tv_usec);
|
return (unsigned int)(tv.tv_sec + tv.tv_usec);
|
||||||
# else
|
# else
|
||||||
@@ -414,14 +414,14 @@ sha2_seed(
|
|||||||
sha256_update(&ctx, (char_u *)random_data, sizeof(random_data));
|
sha256_update(&ctx, (char_u *)random_data, sizeof(random_data));
|
||||||
sha256_finish(&ctx, sha256sum);
|
sha256_finish(&ctx, sha256sum);
|
||||||
|
|
||||||
/* put first block into header. */
|
// put first block into header.
|
||||||
for (i = 0; i < header_len; i++)
|
for (i = 0; i < header_len; i++)
|
||||||
header[i] = sha256sum[i % sizeof(sha256sum)];
|
header[i] = sha256sum[i % sizeof(sha256sum)];
|
||||||
|
|
||||||
/* put remaining block into salt. */
|
// put remaining block into salt.
|
||||||
if (salt != NULL)
|
if (salt != NULL)
|
||||||
for (i = 0; i < salt_len; i++)
|
for (i = 0; i < salt_len; i++)
|
||||||
salt[i] = sha256sum[(i + header_len) % sizeof(sha256sum)];
|
salt[i] = sha256sum[(i + header_len) % sizeof(sha256sum)];
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FEAT_CRYPT */
|
#endif // FEAT_CRYPT
|
||||||
|
|||||||
@@ -701,8 +701,8 @@ buf_signcount(buf_T *buf, linenr_T lnum)
|
|||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
# endif /* FEAT_SIGN_ICONS */
|
# endif // FEAT_SIGN_ICONS
|
||||||
# endif /* FEAT_NETBEANS_INTG */
|
# endif // FEAT_NETBEANS_INTG
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Delete signs in group 'group' in buffer "buf". If 'group' is '*', then
|
* Delete signs in group 'group' in buffer "buf". If 'group' is '*', then
|
||||||
@@ -2744,4 +2744,4 @@ f_sign_unplacelist(typval_T *argvars, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* FEAT_SIGNS */
|
#endif // FEAT_SIGNS
|
||||||
|
|||||||
@@ -742,6 +742,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 */
|
||||||
|
/**/
|
||||||
|
2394,
|
||||||
/**/
|
/**/
|
||||||
2393,
|
2393,
|
||||||
/**/
|
/**/
|
||||||
|
|||||||
Reference in New Issue
Block a user