To: vim-dev@vim.org Subject: Patch 5.6.062 Fcc: outbox From: Bram Moolenaar ------------ Patch 5.6.062 Problem: The documentation says that setting 'smartindent' doesn't have an effect when 'cindent' is set, but it does make a difference for lines starting with "#". (Neil Bird) Solution: Really ignore 'smartindent' when 'cindent' is set. Files: src/misc1.c, src/ops.c *** ../vim-5.6.61/src/misc1.c Sun Apr 2 13:04:17 2000 --- src/misc1.c Wed Apr 12 13:41:21 2000 *************** *** 187,192 **** --- 187,197 ---- int new_plines = 0; /* init for GCC */ int extra_plines = 0; #ifdef SMARTINDENT + int do_si = (curbuf->b_p_si + # ifdef CINDENT + && !curbuf->b_p_cin + # endif + ); int no_si = FALSE; /* reset did_si afterwards */ int first_char = NUL; /* init for GCC */ #endif *************** *** 238,244 **** { p_extra = saved_line + curwin->w_cursor.col; #ifdef SMARTINDENT ! if (curbuf->b_p_si) /* need first char after new line break */ { p = skipwhite(p_extra); first_char = *p; --- 243,249 ---- { p_extra = saved_line + curwin->w_cursor.col; #ifdef SMARTINDENT ! if (do_si) /* need first char after new line break */ { p = skipwhite(p_extra); first_char = *p; *************** *** 271,277 **** */ if (curbuf->b_p_ai #ifdef SMARTINDENT ! || curbuf->b_p_si #endif ) { --- 276,282 ---- */ if (curbuf->b_p_ai #ifdef SMARTINDENT ! || do_si #endif ) { *************** *** 290,296 **** * don't add an indent. Fixes inserting a NL before '{' in line * "if (condition) {" */ ! if (!trunc_line && curbuf->b_p_si && *saved_line != NUL && (p_extra == NULL || first_char != '{')) { char_u *ptr; --- 295,301 ---- * don't add an indent. Fixes inserting a NL before '{' in line * "if (condition) {" */ ! if (!trunc_line && do_si && *saved_line != NUL && (p_extra == NULL || first_char != '{')) { char_u *ptr; *************** *** 445,451 **** } curwin->w_cursor = old_cursor; } ! if (curbuf->b_p_si) can_si = TRUE; #endif /* SMARTINDENT */ --- 450,456 ---- } curwin->w_cursor = old_cursor; } ! if (do_si) can_si = TRUE; #endif /* SMARTINDENT */ *************** *** 692,698 **** /* Recompute the indent, it may have changed. */ if (curbuf->b_p_ai #ifdef SMARTINDENT ! || curbuf->b_p_si #endif ) newindent = get_indent_str(leader); --- 697,703 ---- /* Recompute the indent, it may have changed. */ if (curbuf->b_p_ai #ifdef SMARTINDENT ! || do_si #endif ) newindent = get_indent_str(leader); *************** *** 764,770 **** if (comment_end[0] == '*' && comment_end[1] == '/' && (curbuf->b_p_ai #ifdef SMARTINDENT ! || curbuf->b_p_si #endif )) { --- 769,775 ---- if (comment_end[0] == '*' && comment_end[1] == '/' && (curbuf->b_p_ai #ifdef SMARTINDENT ! || do_si #endif )) { *** ../vim-5.6.61/src/ops.c Sun Apr 2 11:57:11 2000 --- src/ops.c Wed Apr 12 15:18:58 2000 *************** *** 214,227 **** shift_block(oap, amount); #endif else ! /* Don't move the line right if it starts with # and p_si is set. */ #if defined(SMARTINDENT) || defined(CINDENT) if (first_char != '#' || ( # ifdef SMARTINDENT !curbuf->b_p_si ! # endif ! # if defined(SMARTINDENT) && defined(CINDENT) ! && # endif # ifdef CINDENT (!curbuf->b_p_cin || !in_cinkeys('#', ' ', TRUE)) --- 214,229 ---- shift_block(oap, amount); #endif else ! /* Move the line right if it doesn't start with '#', 'smartindent' ! * isn't set or 'cindent' isn't set or '#' isn't in 'cino'. */ #if defined(SMARTINDENT) || defined(CINDENT) if (first_char != '#' || ( # ifdef SMARTINDENT + # ifdef CINDENT + (!curbuf->b_p_si || curbuf->b_p_cin) && + # else !curbuf->b_p_si ! # endif # endif # ifdef CINDENT (!curbuf->b_p_cin || !in_cinkeys('#', ' ', TRUE)) *************** *** 1955,1961 **** { l = 0; #ifdef SMARTINDENT ! if (curbuf->b_p_si) can_si = TRUE; /* It's like opening a new line, do si */ #endif } --- 1958,1968 ---- { l = 0; #ifdef SMARTINDENT ! if (curbuf->b_p_si ! # ifdef CINDENT ! && !curbuf->b_p_cin ! # endif ! ) can_si = TRUE; /* It's like opening a new line, do si */ #endif } *************** *** 2786,2799 **** if (count == 0 && i == y_size - 1) lendiff = STRLEN(ptr); #if defined(SMARTINDENT) || defined(CINDENT) ! if (*ptr == '#' # ifdef SMARTINDENT ! && curbuf->b_p_si # endif # ifdef CINDENT ! && curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE) # endif ! ) indent = 0; /* Leave # lines at start */ else #endif --- 2793,2810 ---- if (count == 0 && i == y_size - 1) lendiff = STRLEN(ptr); #if defined(SMARTINDENT) || defined(CINDENT) ! if (*ptr == '#' && ( # ifdef SMARTINDENT ! # ifdef CINDENT ! (curbuf->b_p_si && !curbuf->b_p_cin) || ! # else ! curbuf->b_p_si ! # endif # endif # ifdef CINDENT ! (curbuf->b_p_cin && in_cinkeys('#', ' ', TRUE)) # endif ! )) indent = 0; /* Leave # lines at start */ else #endif *** ../vim-5.6.61/src/version.c Fri Apr 7 10:12:54 2000 --- src/version.c Wed Apr 12 18:43:17 2000 *************** *** 420,421 **** --- 420,423 ---- { /* Add new patch number below this line */ + /**/ + 62, /**/ -- The Feynman problem solving Algorithm: 1) Write down the problem 2) Think real hard 3) Write down the answer /-/-- Bram Moolenaar --- Bram@moolenaar.net --- http://www.moolenaar.net --\-\ \-\-- Vim: http://www.vim.org ---- ICCF Holland: http://www.vim.org/iccf --/-/