patch 9.0.0222: no good reason why text objects are only in larger builds

Problem:    No good reason why text objects are only in larger builds.
Solution:   Graduate +textobjects.
This commit is contained in:
Bram Moolenaar
2022-08-16 20:24:29 +01:00
parent 1889f499a4
commit 887748742d
16 changed files with 15 additions and 60 deletions

View File

@ -532,8 +532,6 @@ including white space, the commands starting with "i" select an "inner" object
without white space, or just the white space. Thus the "inner" commands
always select less text than the "a" commands.
These commands are not available when the |+textobjects| feature has been
disabled at compile time.
Also see `gn` and `gN`, operating on the last search pattern.
*v_aw* *aw*
@ -634,6 +632,7 @@ at "a tag block", select [count] tag blocks, from the
"</aaa>", including the "<aaa>" and "</aaa>".
See |tag-blocks| about the details.
When used in Visual mode it is made characterwise.
Only available when compiled with the |+eval| feature.
*v_it* *it*
it "inner tag block", select [count] tag blocks, from the

View File

@ -470,7 +470,7 @@ m *+terminal* Support for terminal window |terminal|
*+terminfo* uses |terminfo| instead of termcap
N *+termresponse* support for |t_RV| and |v:termresponse|
B *+termguicolors* 24-bit color in xterm-compatible terminals support
N *+textobjects* |text-objects| selection
T *+textobjects* |text-objects| selection. Always enabled since 9.0.0222.
N *+textprop* |text-properties|
*+tgetent* non-Unix only: able to use external termcap
N *+timers* the |timer_start()| function

View File

@ -2372,9 +2372,7 @@ free_buf_options(
#endif
clear_string_option(&buf->b_p_dict);
clear_string_option(&buf->b_p_tsr);
#ifdef FEAT_TEXTOBJ
clear_string_option(&buf->b_p_qe);
#endif
buf->b_p_ar = -1;
buf->b_p_ul = NO_LOCAL_UNDOLEVEL;
clear_string_option(&buf->b_p_lw);

View File

@ -6200,13 +6200,7 @@ f_has(typval_T *argvars, typval_T *rettv)
0
#endif
},
{"textobjects",
#ifdef FEAT_TEXTOBJ
1
#else
0
#endif
},
{"textobjects", 1},
{"textprop",
#ifdef FEAT_PROP_POPUP
1

View File

@ -114,6 +114,7 @@
* +lispindent lisp indenting (From Eric Fischer).
* +cindent C code indenting (From Eric Fischer).
* +smartindent smart C code indenting when the 'si' option is set.
* +textobjects Text objects: "vaw", "das", etc.
*
* Obsolete:
* +tag_old_static Old style static tags: "file:tag file ..".
@ -301,13 +302,6 @@
# define FEAT_TIMERS
#endif
/*
* +textobjects Text objects: "vaw", "das", etc.
*/
#if defined(FEAT_NORMAL) && defined(FEAT_EVAL)
# define FEAT_TEXTOBJ
#endif
/*
* Insert mode completion with 'completefunc'.
*/

View File

@ -650,7 +650,6 @@ check_visual_pos(void)
}
}
#if defined(FEAT_TEXTOBJ) || defined(PROTO)
/*
* Make sure curwin->w_cursor is not on the NUL at the end of the line.
* Allow it when in Visual mode and 'selection' is not "old".
@ -663,7 +662,6 @@ adjust_cursor_col(void)
&& gchar_cursor() == NUL)
--curwin->w_cursor.col;
}
#endif
/*
* When curwin->w_leftcol has changed, adjust the cursor position.

View File

@ -109,9 +109,7 @@ static void nv_normal(cmdarg_T *cap);
static void nv_esc(cmdarg_T *oap);
static void nv_edit(cmdarg_T *cap);
static void invoke_edit(cmdarg_T *cap, int repl, int cmd, int startln);
#ifdef FEAT_TEXTOBJ
static void nv_object(cmdarg_T *cap);
#endif
static void nv_record(cmdarg_T *cap);
static void nv_at(cmdarg_T *cap);
static void nv_halfpage(cmdarg_T *cap);
@ -6888,11 +6886,7 @@ nv_edit(cmdarg_T *cap)
else if ((cap->cmdchar == 'a' || cap->cmdchar == 'i')
&& (cap->oap->op_type != OP_NOP || VIsual_active))
{
#ifdef FEAT_TEXTOBJ
nv_object(cap);
#else
clearopbeep(cap->oap);
#endif
}
#ifdef FEAT_TERMINAL
else if (term_in_normal_mode())
@ -7044,7 +7038,6 @@ invoke_edit(
restart_edit = restart_edit_save;
}
#ifdef FEAT_TEXTOBJ
/*
* "a" or "i" while an operator is pending or in Visual mode: object motion.
*/
@ -7091,6 +7084,7 @@ nv_object(
case '>':
flag = current_block(cap->oap, cap->count1, include, '<', '>');
break;
#ifdef FEAT_EVAL
case 't': // "at" = a tag block (xml and html)
// Do not adjust oap->end in do_pending_operator()
// otherwise there are different results for 'dit'
@ -7101,6 +7095,7 @@ nv_object(
cap->retval |= CA_NO_ADJ_OP_END;
flag = current_tagblock(cap->oap, cap->count1, include);
break;
#endif
case 'p': // "ap" = a paragraph
flag = current_par(cap->oap, cap->count1, include, 'p');
break;
@ -7129,7 +7124,6 @@ nv_object(
adjust_cursor_col();
curwin->w_set_curswant = TRUE;
}
#endif
/*
* "q" command: Start/stop recording.

View File

@ -5514,9 +5514,7 @@ get_varp(struct vimoption *p)
case PV_MOD: return (char_u *)&(curbuf->b_changed);
case PV_NF: return (char_u *)&(curbuf->b_p_nf);
case PV_PI: return (char_u *)&(curbuf->b_p_pi);
#ifdef FEAT_TEXTOBJ
case PV_QE: return (char_u *)&(curbuf->b_p_qe);
#endif
case PV_RO: return (char_u *)&(curbuf->b_p_ro);
case PV_SI: return (char_u *)&(curbuf->b_p_si);
case PV_SN: return (char_u *)&(curbuf->b_p_sn);
@ -6132,10 +6130,8 @@ buf_copy_options(buf_T *buf, int flags)
#ifdef FEAT_COMPL_FUNC
buf->b_p_tsrfu = empty_option;
#endif
#ifdef FEAT_TEXTOBJ
buf->b_p_qe = vim_strsave(p_qe);
COPY_OPT_SCTX(buf, BV_QE);
#endif
#if defined(FEAT_BEVAL) && defined(FEAT_EVAL)
buf->b_p_bexpr = empty_option;
#endif

View File

@ -802,9 +802,7 @@ EXTERN char_u *p_pyhome; // 'pythonhome'
#if defined(FEAT_PYTHON) || defined(FEAT_PYTHON3)
EXTERN long p_pyx; // 'pyxversion'
#endif
#ifdef FEAT_TEXTOBJ
EXTERN char_u *p_qe; // 'quoteescape'
#endif
EXTERN int p_ro; // 'readonly'
#ifdef FEAT_RELTIME
EXTERN long p_rdt; // 'redrawtime'
@ -1183,9 +1181,7 @@ enum
#endif
, BV_PATH
, BV_PI
#ifdef FEAT_TEXTOBJ
, BV_QE
#endif
, BV_RO
, BV_SI
, BV_SN

View File

@ -108,9 +108,7 @@
#endif
#define PV_PATH OPT_BOTH(OPT_BUF(BV_PATH))
#define PV_PI OPT_BUF(BV_PI)
#ifdef FEAT_TEXTOBJ
# define PV_QE OPT_BUF(BV_QE)
#endif
#define PV_QE OPT_BUF(BV_QE)
#define PV_RO OPT_BUF(BV_RO)
#define PV_SI OPT_BUF(BV_SI)
#define PV_SN OPT_BUF(BV_SN)
@ -2009,14 +2007,8 @@ static struct vimoption options[] =
#endif
SCTX_INIT},
{"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF,
#ifdef FEAT_TEXTOBJ
(char_u *)&p_qe, PV_QE,
{(char_u *)"\\", (char_u *)0L}
#else
(char_u *)NULL, PV_NONE,
{(char_u *)NULL, (char_u *)0L}
#endif
SCTX_INIT},
{(char_u *)"\\", (char_u *)0L} SCTX_INIT},
{"readonly", "ro", P_BOOL|P_VI_DEF|P_RSTAT|P_NOGLOB,
(char_u *)&p_ro, PV_RO,
{(char_u *)FALSE, (char_u *)0L} SCTX_INIT},

View File

@ -242,9 +242,7 @@ check_buf_options(buf_T *buf)
check_string_option(&buf->b_p_cms);
#endif
check_string_option(&buf->b_p_nf);
#ifdef FEAT_TEXTOBJ
check_string_option(&buf->b_p_qe);
#endif
#ifdef FEAT_SYN_HL
check_string_option(&buf->b_p_syn);
check_string_option(&buf->b_s.b_syn_isk);

View File

@ -1378,6 +1378,7 @@ do_source_ext(
int sid;
scriptitem_T *si = NULL;
int save_estack_compiling = estack_compiling;
ESTACK_CHECK_DECLARATION
#endif
#ifdef STARTUPTIME
struct timeval tv_rel;
@ -1388,7 +1389,6 @@ do_source_ext(
#endif
int save_sticky_cmdmod_flags = sticky_cmdmod_flags;
int trigger_source_post = FALSE;
ESTACK_CHECK_DECLARATION
CLEAR_FIELD(cookie);
if (fname == NULL)
@ -1693,7 +1693,9 @@ do_source_ext(
if (got_int)
emsg(_(e_interrupted));
#ifdef FEAT_EVAL
ESTACK_CHECK_NOW
#endif
estack_pop();
if (p_verbose > 1)
{

View File

@ -2959,9 +2959,7 @@ struct file_buffer
int b_p_ma; // 'modifiable'
char_u *b_p_nf; // 'nrformats'
int b_p_pi; // 'preserveindent'
#ifdef FEAT_TEXTOBJ
char_u *b_p_qe; // 'quoteescape'
#endif
int b_p_ro; // 'readonly'
long b_p_sw; // 'shiftwidth'
int b_p_sn; // 'shortname'

View File

@ -1,7 +1,6 @@
" Test for textobjects
source check.vim
CheckFeature textobjects
func CpoM(line, useM, expected)
new

View File

@ -614,7 +614,6 @@ skip_chars(int cclass, int dir)
return FALSE;
}
#if defined(FEAT_TEXTOBJ) || defined(PROTO)
/*
* Go back to the start of the word or the start of white space
*/
@ -1189,6 +1188,7 @@ current_block(
return OK;
}
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Return TRUE if the cursor is on a "<aaa>" tag. Ignore "<aaa/>".
* When "end_tag" is TRUE return TRUE if the cursor is on "</aaa>".
@ -1470,6 +1470,7 @@ theend:
p_ws = save_p_ws;
return retval;
}
#endif
int
current_par(
@ -2001,5 +2002,3 @@ abort_search:
}
return FALSE;
}
#endif // FEAT_TEXTOBJ

View File

@ -614,11 +614,7 @@ static char *(features[]) =
#else
"-termresponse",
#endif
#ifdef FEAT_TEXTOBJ
"+textobjects",
#else
"-textobjects",
#endif
#ifdef FEAT_PROP_POPUP
"+textprop",
#else
@ -735,6 +731,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
222,
/**/
221,
/**/