diff src/ops.c @ 18265:fe5afdc03bd2 v8.1.2127

patch 8.1.2127: the indent.c file is a bit big Commit: https://github.com/vim/vim/commit/14c01f83487d5c53192297a710eda2b8a4ab17c9 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Oct 9 22:53:08 2019 +0200 patch 8.1.2127: the indent.c file is a bit big Problem: The indent.c file is a bit big. Solution: Move C-indent code a a new cindent.c file. Move other indent-related code to indent.c. (Yegappan Lakshmanan, closes #5031)
author Bram Moolenaar <Bram@vim.org>
date Wed, 09 Oct 2019 23:00:04 +0200
parents c8a53c0daeed
children 9f51d0cef8da
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -590,90 +590,6 @@ block_insert(
     State = oldstate;
 }
 
-#if defined(FEAT_LISP) || defined(FEAT_CINDENT) || defined(PROTO)
-/*
- * op_reindent - handle reindenting a block of lines.
- */
-    static void
-op_reindent(oparg_T *oap, int (*how)(void))
-{
-    long	i;
-    char_u	*l;
-    int		amount;
-    linenr_T	first_changed = 0;
-    linenr_T	last_changed = 0;
-    linenr_T	start_lnum = curwin->w_cursor.lnum;
-
-    /* Don't even try when 'modifiable' is off. */
-    if (!curbuf->b_p_ma)
-    {
-	emsg(_(e_modifiable));
-	return;
-    }
-
-    for (i = oap->line_count; --i >= 0 && !got_int; )
-    {
-	/* it's a slow thing to do, so give feedback so there's no worry that
-	 * the computer's just hung. */
-
-	if (i > 1
-		&& (i % 50 == 0 || i == oap->line_count - 1)
-		&& oap->line_count > p_report)
-	    smsg(_("%ld lines to indent... "), i);
-
-	/*
-	 * Be vi-compatible: For lisp indenting the first line is not
-	 * indented, unless there is only one line.
-	 */
-#ifdef FEAT_LISP
-	if (i != oap->line_count - 1 || oap->line_count == 1
-						    || how != get_lisp_indent)
-#endif
-	{
-	    l = skipwhite(ml_get_curline());
-	    if (*l == NUL)		    /* empty or blank line */
-		amount = 0;
-	    else
-		amount = how();		    /* get the indent for this line */
-
-	    if (amount >= 0 && set_indent(amount, SIN_UNDO))
-	    {
-		/* did change the indent, call changed_lines() later */
-		if (first_changed == 0)
-		    first_changed = curwin->w_cursor.lnum;
-		last_changed = curwin->w_cursor.lnum;
-	    }
-	}
-	++curwin->w_cursor.lnum;
-	curwin->w_cursor.col = 0;  /* make sure it's valid */
-    }
-
-    /* put cursor on first non-blank of indented line */
-    curwin->w_cursor.lnum = start_lnum;
-    beginline(BL_SOL | BL_FIX);
-
-    /* Mark changed lines so that they will be redrawn.  When Visual
-     * highlighting was present, need to continue until the last line.  When
-     * there is no change still need to remove the Visual highlighting. */
-    if (last_changed != 0)
-	changed_lines(first_changed, 0,
-		oap->is_VIsual ? start_lnum + oap->line_count :
-		last_changed + 1, 0L);
-    else if (oap->is_VIsual)
-	redraw_curbuf_later(INVERTED);
-
-    if (oap->line_count > p_report)
-    {
-	i = oap->line_count - (i + 1);
-	smsg(NGETTEXT("%ld line indented ",
-						 "%ld lines indented ", i), i);
-    }
-    /* set '[ and '] marks */
-    curbuf->b_op_start = oap->start;
-    curbuf->b_op_end = oap->end;
-}
-#endif /* defined(FEAT_LISP) || defined(FEAT_CINDENT) */
-
 /*
  * Stuff a string into the typeahead buffer, such that edit() will insert it
  * literally ("literally" TRUE) or interpret is as typed characters.
@@ -1917,29 +1833,6 @@ adjust_cursor_eol(void)
     }
 }
 
-#if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) || defined(PROTO)
-/*
- * Return TRUE if lines starting with '#' should be left aligned.
- */
-    int
-preprocs_left(void)
-{
-    return
-# ifdef FEAT_SMARTINDENT
-#  ifdef FEAT_CINDENT
-	(curbuf->b_p_si && !curbuf->b_p_cin) ||
-#  else
-	curbuf->b_p_si
-#  endif
-# endif
-# ifdef FEAT_CINDENT
-	(curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE)
-					   && curbuf->b_ind_hash_comment == 0)
-# endif
-	;
-}
-#endif
-
 /*
  * If "process" is TRUE and the line begins with a comment leader (possibly
  * after some white space), return a pointer to the text after it. Put a boolean