Skip to content

Commit d293b2b

Browse files
committed
patch 7.4.1612
Problem: Can't build with small features. Solution: Move code and #ifdefs.
1 parent 44a2f92 commit d293b2b

2 files changed

Lines changed: 94 additions & 90 deletions

File tree

src/ex_getln.c

Lines changed: 92 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -5653,96 +5653,6 @@ get_history_idx(int histype)
56535653
return history[histype][hisidx[histype]].hisnum;
56545654
}
56555655

5656-
static struct cmdline_info *get_ccline_ptr(void);
5657-
5658-
/*
5659-
* Get pointer to the command line info to use. cmdline_paste() may clear
5660-
* ccline and put the previous value in prev_ccline.
5661-
*/
5662-
static struct cmdline_info *
5663-
get_ccline_ptr(void)
5664-
{
5665-
if ((State & CMDLINE) == 0)
5666-
return NULL;
5667-
if (ccline.cmdbuff != NULL)
5668-
return &ccline;
5669-
if (prev_ccline_used && prev_ccline.cmdbuff != NULL)
5670-
return &prev_ccline;
5671-
return NULL;
5672-
}
5673-
5674-
/*
5675-
* Get the current command line in allocated memory.
5676-
* Only works when the command line is being edited.
5677-
* Returns NULL when something is wrong.
5678-
*/
5679-
char_u *
5680-
get_cmdline_str(void)
5681-
{
5682-
struct cmdline_info *p = get_ccline_ptr();
5683-
5684-
if (p == NULL)
5685-
return NULL;
5686-
return vim_strnsave(p->cmdbuff, p->cmdlen);
5687-
}
5688-
5689-
/*
5690-
* Get the current command line position, counted in bytes.
5691-
* Zero is the first position.
5692-
* Only works when the command line is being edited.
5693-
* Returns -1 when something is wrong.
5694-
*/
5695-
int
5696-
get_cmdline_pos(void)
5697-
{
5698-
struct cmdline_info *p = get_ccline_ptr();
5699-
5700-
if (p == NULL)
5701-
return -1;
5702-
return p->cmdpos;
5703-
}
5704-
5705-
/*
5706-
* Set the command line byte position to "pos". Zero is the first position.
5707-
* Only works when the command line is being edited.
5708-
* Returns 1 when failed, 0 when OK.
5709-
*/
5710-
int
5711-
set_cmdline_pos(
5712-
int pos)
5713-
{
5714-
struct cmdline_info *p = get_ccline_ptr();
5715-
5716-
if (p == NULL)
5717-
return 1;
5718-
5719-
/* The position is not set directly but after CTRL-\ e or CTRL-R = has
5720-
* changed the command line. */
5721-
if (pos < 0)
5722-
new_cmdpos = 0;
5723-
else
5724-
new_cmdpos = pos;
5725-
return 0;
5726-
}
5727-
5728-
/*
5729-
* Get the current command-line type.
5730-
* Returns ':' or '/' or '?' or '@' or '>' or '-'
5731-
* Only works when the command line is being edited.
5732-
* Returns NUL when something is wrong.
5733-
*/
5734-
int
5735-
get_cmdline_type(void)
5736-
{
5737-
struct cmdline_info *p = get_ccline_ptr();
5738-
5739-
if (p == NULL)
5740-
return NUL;
5741-
if (p->cmdfirstc == NUL)
5742-
return (p->input_fn) ? '@' : '-';
5743-
return p->cmdfirstc;
5744-
}
5745-
57465656
/*
57475657
* Calculate history index from a number:
57485658
* num > 0: seen as identifying number of a history entry
@@ -5951,6 +5861,98 @@ remove_key_from_history(void)
59515861

59525862
#endif /* FEAT_CMDHIST */
59535863

5864+
#if defined(FEAT_EVAL) || defined(PROTO)
5865+
/*
5866+
* Get pointer to the command line info to use. cmdline_paste() may clear
5867+
* ccline and put the previous value in prev_ccline.
5868+
*/
5869+
static struct cmdline_info *
5870+
get_ccline_ptr(void)
5871+
{
5872+
if ((State & CMDLINE) == 0)
5873+
return NULL;
5874+
if (ccline.cmdbuff != NULL)
5875+
return &ccline;
5876+
if (prev_ccline_used && prev_ccline.cmdbuff != NULL)
5877+
return &prev_ccline;
5878+
return NULL;
5879+
}
5880+
5881+
/*
5882+
* Get the current command line in allocated memory.
5883+
* Only works when the command line is being edited.
5884+
* Returns NULL when something is wrong.
5885+
*/
5886+
char_u *
5887+
get_cmdline_str(void)
5888+
{
5889+
struct cmdline_info *p = get_ccline_ptr();
5890+
5891+
if (p == NULL)
5892+
return NULL;
5893+
return vim_strnsave(p->cmdbuff, p->cmdlen);
5894+
}
5895+
5896+
/*
5897+
* Get the current command line position, counted in bytes.
5898+
* Zero is the first position.
5899+
* Only works when the command line is being edited.
5900+
* Returns -1 when something is wrong.
5901+
*/
5902+
int
5903+
get_cmdline_pos(void)
5904+
{
5905+
struct cmdline_info *p = get_ccline_ptr();
5906+
5907+
if (p == NULL)
5908+
return -1;
5909+
return p->cmdpos;
5910+
}
5911+
5912+
/*
5913+
* Set the command line byte position to "pos". Zero is the first position.
5914+
* Only works when the command line is being edited.
5915+
* Returns 1 when failed, 0 when OK.
5916+
*/
5917+
int
5918+
set_cmdline_pos(
5919+
int pos)
5920+
{
5921+
struct cmdline_info *p = get_ccline_ptr();
5922+
5923+
if (p == NULL)
5924+
return 1;
5925+
5926+
/* The position is not set directly but after CTRL-\ e or CTRL-R = has
5927+
* changed the command line. */
5928+
if (pos < 0)
5929+
new_cmdpos = 0;
5930+
else
5931+
new_cmdpos = pos;
5932+
return 0;
5933+
}
5934+
#endif
5935+
5936+
#if defined(FEAT_EVAL) || defined(FEAT_CMDWIN) || defined(PROTO)
5937+
/*
5938+
* Get the current command-line type.
5939+
* Returns ':' or '/' or '?' or '@' or '>' or '-'
5940+
* Only works when the command line is being edited.
5941+
* Returns NUL when something is wrong.
5942+
*/
5943+
int
5944+
get_cmdline_type(void)
5945+
{
5946+
struct cmdline_info *p = get_ccline_ptr();
5947+
5948+
if (p == NULL)
5949+
return NUL;
5950+
if (p->cmdfirstc == NUL)
5951+
return (p->input_fn) ? '@' : '-';
5952+
return p->cmdfirstc;
5953+
}
5954+
#endif
5955+
59545956
#if defined(FEAT_QUICKFIX) || defined(FEAT_CMDHIST) || defined(PROTO)
59555957
/*
59565958
* Get indices "num1,num2" that specify a range within a list (not a range of

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,8 @@ static char *(features[]) =
748748

749749
static int included_patches[] =
750750
{ /* Add new patch number below this line */
751+
/**/
752+
1612,
751753
/**/
752754
1611,
753755
/**/

0 commit comments

Comments
 (0)