Skip to content

Commit

Permalink
Closed #11
Browse files Browse the repository at this point in the history
  • Loading branch information
h-east committed Feb 13, 2016
1 parent fe338c7 commit e66c1a9
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 33 deletions.
22 changes: 11 additions & 11 deletions src/clpum.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ static int clpum_col; /* left column of pum */

static int clpum_do_redraw = FALSE; /* do redraw anyway */

static int clpum_set_selected __ARGS((int n, int repeat));
static int clpum_set_selected(int n, int repeat);

#define CLPUM_DEF_HEIGHT 10
#define CLPUM_DEF_WIDTH 15
Expand All @@ -42,12 +42,12 @@ static int clpum_set_selected __ARGS((int n, int repeat));
* The menu appears above the screen line "row" or at "row" + "height" - 1.
*/
void
clpum_display(array, size, selected, disp_col)
pumitem_T *array;
int size;
int selected; /* index of initially selected item, none if
clpum_display(
pumitem_T *array,
int size,
int selected, /* index of initially selected item, none if
out of range */
int disp_col;
int disp_col)
{
int w;
int def_width;
Expand Down Expand Up @@ -184,7 +184,7 @@ clpum_display(array, size, selected, disp_col)
* Redraw the popup menu, using "clpum_first" and "clpum_selected".
*/
void
clpum_redraw()
clpum_redraw(void)
{
int row = clpum_row;
int col;
Expand Down Expand Up @@ -390,7 +390,7 @@ clpum_set_selected(
* Undisplay the popup menu (later).
*/
void
clpum_undisplay()
clpum_undisplay(void)
{
//FreeWild(clpum_size, clpum_array);
clpum_array = NULL;
Expand All @@ -407,7 +407,7 @@ clpum_undisplay()
* displayed item.
*/
void
clpum_clear()
clpum_clear(void)
{
clpum_first = 0;
}
Expand All @@ -417,7 +417,7 @@ clpum_clear()
* Overruled when "clpum_do_redraw" is set, used to redraw the status lines.
*/
int
clpum_visible()
clpum_visible(void)
{
return !clpum_do_redraw && clpum_array != NULL;
}
Expand All @@ -427,7 +427,7 @@ clpum_visible()
* Only valid when clpum_visible() returns TRUE!
*/
int
clpum_get_height()
clpum_get_height(void)
{
return clpum_height;
}
Expand Down
7 changes: 4 additions & 3 deletions src/eval.c
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,7 @@ static void f_changenr(typval_T *argvars, typval_T *rettv);
static void f_char2nr(typval_T *argvars, typval_T *rettv);
static void f_cindent(typval_T *argvars, typval_T *rettv);
static void f_clearmatches(typval_T *argvars, typval_T *rettv);
static void f_clpumvisible(typval_T *argvars, typval_T *rettv);
static void f_col(typval_T *argvars, typval_T *rettv);
#if defined(FEAT_INS_EXPAND)
static void f_complete(typval_T *argvars, typval_T *rettv);
Expand Down Expand Up @@ -10095,9 +10096,9 @@ f_clearmatches(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
* "clpumvisible()" function
*/
static void
f_clpumvisible(argvars, rettv)
typval_T *argvars UNUSED;
typval_T *rettv UNUSED;
f_clpumvisible(
typval_T *argvars UNUSED,
typval_T *rettv UNUSED)
{
#ifdef FEAT_CMDL_COMPL
if (clpum_visible())
Expand Down
25 changes: 17 additions & 8 deletions src/ex_getln.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ static void clpum_compl_upd_pum(void);
static void clpum_compl_del_pum(void);
static int clpum_wanted(void);
static int clpum_enough_matches(void);
static void clpum_compl_dictionaries(char_u *dict, char_u *pat, int flags, int thesaurus);
static void clpum_compl_files(int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir);
static char_u *find_line_end(char_u *ptr);
//static void clpum_compl_dictionaries(char_u *dict, char_u *pat, int flags, int thesaurus);
//static void clpum_compl_files(int count, char_u **files, int thesaurus, int flags, regmatch_T *regmatch, char_u *buf, int *dir);
//static char_u *find_line_end(char_u *ptr);
static void clpum_compl_free(void);
static void clpum_compl_clear(void);
static int clpum_compl_bs(void);
Expand All @@ -192,7 +192,7 @@ static void clpum_compl_set_original_text(char_u *str);
static void clpum_compl_addfrommatch(void);
static int clpum_compl_prep(int c);
//static void clpum_compl_fixRedoBufForLeader(char_u *ptr_arg);
static buf_T *clpum_compl_next_buf(buf_T *buf, int flag);
//static buf_T *clpum_compl_next_buf(buf_T *buf, int flag);
#if defined(FEAT_CMDL_COMPL) || defined(FEAT_EVAL)
static void clpum_compl_add_list(list_T *list);
static void clpum_compl_add_dict(dict_T *dict);
Expand Down Expand Up @@ -1021,8 +1021,11 @@ getcmdline(
* - wildcard expansion is only done when the 'wildchar' key is really
* typed, not when it comes from a macro
*/
if (!clpum_compl_started
&& ((c == p_wc && !gotesc && KeyTyped) || c == p_wcm))
if (
#ifdef FEAT_CMDL_COMPL
!clpum_compl_started &&
#endif
((c == p_wc && !gotesc && KeyTyped) || c == p_wcm))
{
if (xpc.xp_numfiles > 0) /* typed p_wc at least twice */
{
Expand Down Expand Up @@ -1130,7 +1133,11 @@ getcmdline(
gotesc = FALSE;

/* <S-Tab> goes to last match, in a clumsy way */
if (!clpum_compl_started && c == K_S_TAB && KeyTyped)
if (
#ifdef FEAT_CMDL_COMPL
!clpum_compl_started &&
#endif
c == K_S_TAB && KeyTyped)
{
if (nextwild(&xpc, WILD_EXPAND_KEEP, 0, firstc != '@') == OK
&& nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK
Expand Down Expand Up @@ -3462,8 +3469,10 @@ redrawcmdline(void)
need_wait_return = FALSE;
compute_cmdrow();
redrawcmd();
#ifdef FEAT_CMDL_COMPL
if (clpum_visible())
showmode();
#endif
cursorcmd();
}

Expand Down Expand Up @@ -8060,7 +8069,7 @@ clpum_compl_prep(int c)
}

#ifdef FEAT_CMDL_COMPL
static void expand_by_function __ARGS((char_u *base));
static void expand_by_function(char_u *base);

/*
* Execute user defined complete function 'clcompletefunc' and
Expand Down
12 changes: 6 additions & 6 deletions src/proto/clpum.pro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* clpum.c */
void clpum_display __ARGS((pumitem_T *array, int size, int selected, int disp_col));
void clpum_redraw __ARGS((void));
void clpum_undisplay __ARGS((void));
void clpum_clear __ARGS((void));
int clpum_visible __ARGS((void));
int clpum_get_height __ARGS((void));
void clpum_display(pumitem_T *array, int size, int selected, int disp_col);
void clpum_redraw(void);
void clpum_undisplay(void);
void clpum_clear(void);
int clpum_visible(void);
int clpum_get_height(void);
/* vim: set ft=c : */
2 changes: 1 addition & 1 deletion src/proto/ex_getln.pro
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ void write_viminfo_history(FILE *fp, int merge);
void cmd_pchar(int c, int offset);
int cmd_gchar(int offset);
char_u *script_get(exarg_T *eap, char_u *cmd);

int vim_is_clpum_key(int c);
int clpum_compl_add_infercase(char_u *str, int len, int icase, char_u *fname, int dir, int flags);
void clpum_compl_show_pum(void);
int clpum_compl_active(void);
int clpum_compl_add_tv(typval_T *tv, int dir);
Expand Down
5 changes: 3 additions & 2 deletions src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -9954,10 +9954,11 @@ showmode(void)
do_mode = ((p_smd && msg_silent == 0)
&& ((State & INSERT)
|| restart_edit
#ifdef FEAT_INS_EXPAND
#ifdef FEAT_CMDL_COMPL
|| (clpum_compl_active()
&& p_ch > (get_cmdline_len() + 1) / Columns + 1)))
&& p_ch > (get_cmdline_len() + 1) / Columns + 1)
#endif
))
|| VIsual_active;
if (do_mode || Recording)
{
Expand Down
4 changes: 2 additions & 2 deletions src/vim.h
Original file line number Diff line number Diff line change
Expand Up @@ -1897,8 +1897,8 @@ typedef int proftime_T; /* dummy for function prototypes */
#define VV_TRUE 64
#define VV_NULL 65
#define VV_NONE 66
#define VV_LEN 67 /* number of v: vars */
#define VV_CLCOMPLETED_ITEM 68
#define VV_CLCOMPLETED_ITEM 67
#define VV_LEN 68 /* number of v: vars */

/* used for v_number in VAR_SPECIAL */
#define VVAL_FALSE 0L
Expand Down

0 comments on commit e66c1a9

Please sign in to comment.