To: z69@csi.com Cc: Vim development list Subject: patch 5.4.25 (was: problem with cin) In-Reply-To: <19990812150404.A694@styx> Fcc: outbox From: Bram Moolenaar ------------ Louis-David Mitterrand wrote: > With vim-5.4.21 try the command: > > % vim -u NONE -U NONE -c "set nocompatible fo=crq cin" test.java > > When creating a three part comment and typing or arriving at > the maximum tw the leading character is positioned incorrectly instead > of keeping the same indent: > > /** CellDisplayer interface method. Should this column display trend > * arrows in cells? > */ > public boolean isArrowCell(int i) { > return false; > } > > Now try the same command with "ai" instead of "cin" and the comment is fine: Setting 'autoindent' is required in this situation. In fact, 'cindent' isn't used at all for this kind of comment formatting. Hmm, I suppose you would expect that 'cindent' would also do the indenting of comments, even when 'autoindent' isn't set. Patch 5.4.25 Problem: When 'cindent' is set, but 'autoindent' isn't, comments are not properly indented when starting a new line. (Mitterand) Solution: When there is a comment leader for the new line, but 'autoindent' isn't set, do C-indenting. Files: src/misc1.c *** ../vim-5.4.24/src/misc1.c Tue Aug 10 16:10:00 1999 --- src/misc1.c Thu Aug 12 23:10:20 1999 *************** *** 1004,1012 **** * May do indenting after opening a new line. */ if ( ! #ifdef COMMENTS ! leader == NULL && ! #endif curbuf->b_p_cin && in_cinkeys(dir == FORWARD ? KEY_OPEN_FORW : KEY_OPEN_BACK, ' ', linewhite(curwin->w_cursor.lnum))) --- 1004,1012 ---- * May do indenting after opening a new line. */ if ( ! # ifdef COMMENTS ! (leader == NULL || !curbuf->b_p_ai) && ! # endif curbuf->b_p_cin && in_cinkeys(dir == FORWARD ? KEY_OPEN_FORW : KEY_OPEN_BACK, ' ', linewhite(curwin->w_cursor.lnum))) *** ../vim-5.4.24/src/version.h Thu Aug 12 23:37:02 1999 --- src/version.h Thu Aug 12 23:36:37 1999 *************** *** 19,26 **** #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 24 ! #define VIM_VERSION_PATCHLEVEL_STR "24" /* * VIM_VERSION_NODOT is used for the runtime directory name. --- 19,26 ---- #define VIM_VERSION_MINOR_STR "4" #define VIM_VERSION_BUILD 57 #define VIM_VERSION_BUILD_STR "57" ! #define VIM_VERSION_PATCHLEVEL 25 ! #define VIM_VERSION_PATCHLEVEL_STR "25" /* * VIM_VERSION_NODOT is used for the runtime directory name. *************** *** 30,35 **** */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.24" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.24 (1999 Aug 12)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.24 (1999 Aug 12, compiled " --- 30,35 ---- */ #define VIM_VERSION_NODOT "vim54" #define VIM_VERSION_SHORT "5.4" ! #define VIM_VERSION_MEDIUM "5.4.25" ! #define VIM_VERSION_LONG "VIM - Vi IMproved 5.4.25 (1999 Aug 12)" ! #define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 5.4.25 (1999 Aug 12, compiled " -- hundred-and-one symptoms of being an internet addict: 64. The remote to the T.V. is missing...and you don't even care. --/-/---- Bram Moolenaar ---- Bram@moolenaar.net ---- Bram@vim.org ---\-\-- \ \ www.vim.org/iccf www.moolenaar.net www.vim.org / /