To: vim_dev@googlegroups.com Subject: Patch 9.0.0222 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 9.0.0222 Problem: No good reason why text objects are only in larger builds. Solution: Graduate +textobjects. Files: runtime/doc/motion.txt, runtime/doc/various.txt, src/buffer.c, src/evalfunc.c, src/misc2.c, src/normal.c, src/option.c, src/optionstr.c, src/textobject.c, src/scriptfile.c, src/version.c, src/feature.h, src/option.h, src/optiondefs.h, src/structs.h, src/testdir/test_textobjects.vim *** ../vim-9.0.0221/runtime/doc/motion.txt 2022-06-28 11:21:06.000000000 +0100 --- runtime/doc/motion.txt 2022-08-16 20:18:06.633546718 +0100 *************** *** 532,539 **** 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* --- 532,537 ---- *************** *** 612,618 **** i( *vib* *v_ib* *v_i(* *ib* ib "inner block", select [count] blocks, from "[count] [(" to the matching ')', excluding the '(' and ')' (see ! |[(|). When used in Visual mode it is made characterwise. a> *v_a>* *v_a<* *a>* *a<* --- 610,617 ---- i( *vib* *v_ib* *v_i(* *ib* ib "inner block", select [count] blocks, from "[count] [(" to the matching ')', excluding the '(' and ')' (see ! |[(|). If the cursor is not inside a () block, then ! find the next "(". When used in Visual mode it is made characterwise. a> *v_a>* *v_a<* *a>* *a<* *************** *** 633,638 **** --- 632,638 ---- "", including the "" and "". 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 *** ../vim-9.0.0221/runtime/doc/various.txt 2022-06-28 11:21:07.000000000 +0100 --- runtime/doc/various.txt 2022-08-16 20:04:06.730285676 +0100 *************** *** 470,476 **** *+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 N *+textprop* |text-properties| *+tgetent* non-Unix only: able to use external termcap N *+timers* the |timer_start()| function --- 470,476 ---- *+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 ! 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 *** ../vim-9.0.0221/src/buffer.c 2022-08-14 14:16:07.983582313 +0100 --- src/buffer.c 2022-08-16 19:56:45.154861940 +0100 *************** *** 2372,2380 **** #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); --- 2372,2378 ---- *** ../vim-9.0.0221/src/evalfunc.c 2022-08-14 12:07:06.918862666 +0100 --- src/evalfunc.c 2022-08-16 19:56:56.230849174 +0100 *************** *** 6200,6212 **** 0 #endif }, ! {"textobjects", ! #ifdef FEAT_TEXTOBJ ! 1 ! #else ! 0 ! #endif ! }, {"textprop", #ifdef FEAT_PROP_POPUP 1 --- 6200,6206 ---- 0 #endif }, ! {"textobjects", 1}, {"textprop", #ifdef FEAT_PROP_POPUP 1 *** ../vim-9.0.0221/src/misc2.c 2022-08-14 14:16:07.995582211 +0100 --- src/misc2.c 2022-08-16 19:57:05.570838324 +0100 *************** *** 650,656 **** } } - #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". --- 650,655 ---- *************** *** 663,669 **** && gchar_cursor() == NUL) --curwin->w_cursor.col; } - #endif /* * When curwin->w_leftcol has changed, adjust the cursor position. --- 662,667 ---- *** ../vim-9.0.0221/src/normal.c 2022-08-14 14:16:07.995582211 +0100 --- src/normal.c 2022-08-16 20:17:43.325819090 +0100 *************** *** 109,117 **** 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); --- 109,115 ---- *************** *** 6888,6898 **** 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()) --- 6886,6892 ---- *************** *** 7044,7050 **** restart_edit = restart_edit_save; } - #ifdef FEAT_TEXTOBJ /* * "a" or "i" while an operator is pending or in Visual mode: object motion. */ --- 7038,7043 ---- *************** *** 7091,7096 **** --- 7084,7090 ---- 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,7106 **** --- 7095,7101 ---- 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,7135 **** adjust_cursor_col(); curwin->w_set_curswant = TRUE; } - #endif /* * "q" command: Start/stop recording. --- 7124,7129 ---- *** ../vim-9.0.0221/src/option.c 2022-08-14 14:16:07.995582211 +0100 --- src/option.c 2022-08-16 19:57:35.534802985 +0100 *************** *** 5514,5522 **** 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); --- 5514,5520 ---- *************** *** 6132,6141 **** #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 --- 6130,6137 ---- *** ../vim-9.0.0221/src/optionstr.c 2022-08-14 14:16:07.995582211 +0100 --- src/optionstr.c 2022-08-16 19:57:40.334797254 +0100 *************** *** 242,250 **** 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); --- 242,248 ---- *** ../vim-9.0.0221/src/textobject.c 2022-08-14 14:16:08.003582142 +0100 --- src/textobject.c 2022-08-16 20:18:42.365144459 +0100 *************** *** 614,620 **** return FALSE; } - #if defined(FEAT_TEXTOBJ) || defined(PROTO) /* * Go back to the start of the word or the start of white space */ --- 614,619 ---- *************** *** 1189,1194 **** --- 1188,1194 ---- return OK; } + #if defined(FEAT_EVAL) || defined(PROTO) /* * Return TRUE if the cursor is on a "" tag. Ignore "". * When "end_tag" is TRUE return TRUE if the cursor is on "". *************** *** 1470,1475 **** --- 1470,1476 ---- p_ws = save_p_ws; return retval; } + #endif int current_par( *************** *** 2001,2005 **** } return FALSE; } - - #endif // FEAT_TEXTOBJ --- 2002,2004 ---- *** ../vim-9.0.0221/src/scriptfile.c 2022-08-15 17:53:51.908974683 +0100 --- src/scriptfile.c 2022-08-16 20:16:22.682828088 +0100 *************** *** 1378,1383 **** --- 1378,1384 ---- int sid; scriptitem_T *si = NULL; int save_estack_compiling = estack_compiling; + ESTACK_CHECK_DECLARATION #endif #ifdef STARTUPTIME struct timeval tv_rel; *************** *** 1388,1394 **** #endif int save_sticky_cmdmod_flags = sticky_cmdmod_flags; int trigger_source_post = FALSE; - ESTACK_CHECK_DECLARATION CLEAR_FIELD(cookie); if (fname == NULL) --- 1389,1394 ---- *************** *** 1693,1699 **** --- 1693,1701 ---- if (got_int) emsg(_(e_interrupted)); + #ifdef FEAT_EVAL ESTACK_CHECK_NOW + #endif estack_pop(); if (p_verbose > 1) { *** ../vim-9.0.0221/src/version.c 2022-08-16 19:34:40.863551410 +0100 --- src/version.c 2022-08-16 19:58:02.842770121 +0100 *************** *** 614,624 **** #else "-termresponse", #endif - #ifdef FEAT_TEXTOBJ "+textobjects", - #else - "-textobjects", - #endif #ifdef FEAT_PROP_POPUP "+textprop", #else --- 614,620 ---- *** ../vim-9.0.0221/src/feature.h 2022-05-21 19:39:11.000000000 +0100 --- src/feature.h 2022-08-16 19:58:28.602738570 +0100 *************** *** 114,119 **** --- 114,120 ---- * +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 ..". *************** *** 302,314 **** #endif /* - * +textobjects Text objects: "vaw", "das", etc. - */ - #if defined(FEAT_NORMAL) && defined(FEAT_EVAL) - # define FEAT_TEXTOBJ - #endif - - /* * Insert mode completion with 'completefunc'. */ #if defined(FEAT_EVAL) --- 303,308 ---- *** ../vim-9.0.0221/src/option.h 2022-07-04 17:34:06.386292140 +0100 --- src/option.h 2022-08-16 19:58:36.682728570 +0100 *************** *** 802,810 **** #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' --- 802,808 ---- *************** *** 1183,1191 **** #endif , BV_PATH , BV_PI - #ifdef FEAT_TEXTOBJ , BV_QE - #endif , BV_RO , BV_SI , BV_SN --- 1181,1187 ---- *** ../vim-9.0.0221/src/optiondefs.h 2022-07-04 17:34:06.386292140 +0100 --- src/optiondefs.h 2022-08-16 19:58:51.318710328 +0100 *************** *** 108,116 **** #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_RO OPT_BUF(BV_RO) #define PV_SI OPT_BUF(BV_SI) #define PV_SN OPT_BUF(BV_SN) --- 108,114 ---- #endif #define PV_PATH OPT_BOTH(OPT_BUF(BV_PATH)) #define PV_PI OPT_BUF(BV_PI) ! #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,2022 **** #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}, {"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}, --- 2007,2014 ---- #endif SCTX_INIT}, {"quoteescape", "qe", P_STRING|P_ALLOCED|P_VI_DEF, (char_u *)&p_qe, PV_QE, ! {(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}, *** ../vim-9.0.0221/src/structs.h 2022-08-14 14:16:08.003582142 +0100 --- src/structs.h 2022-08-16 19:58:57.218702930 +0100 *************** *** 2959,2967 **** 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' --- 2959,2965 ---- *** ../vim-9.0.0221/src/testdir/test_textobjects.vim 2022-05-24 11:48:24.000000000 +0100 --- src/testdir/test_textobjects.vim 2022-08-16 20:02:08.382451148 +0100 *************** *** 1,7 **** " Test for textobjects source check.vim - CheckFeature textobjects func CpoM(line, useM, expected) new --- 1,6 ---- *** ../vim-9.0.0221/src/version.c 2022-08-16 19:34:40.863551410 +0100 --- src/version.c 2022-08-16 19:58:02.842770121 +0100 *************** *** 737,738 **** --- 733,736 ---- { /* Add new patch number below this line */ + /**/ + 222, /**/ -- There are 2 kinds of people in my world: those who know Unix, Perl, Vim, GNU, Linux, etc, and those who know COBOL. It gets very difficult for me at parties, not knowing which group to socialise with :-) Sitaram Chamarty /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///