Patch 8.2.4953
Problem:    With 'smartindent' inserting '}' after completion goes wrong.
Solution:   Check the cursor is in indent.  (closes #10420)
Files:      src/indent.c, src/testdir/test_smartindent.vim


*** ../vim-8.2.4952/src/indent.c        2022-05-14 11:52:19.201341191 +0100
--- src/indent.c        2022-05-14 12:53:08.947681335 +0100
***************
*** 1197,1203 ****
      int               temp;
  
      // do some very smart indenting when entering '{' or '}'
!     if (((did_si || can_si_back) && c == '{') || (can_si && c == '}'))
      {
        // for '}' set indent equal to indent of line containing matching '{'
        if (c == '}' && (pos = findmatch(NULL, '{')) != NULL)
--- 1197,1204 ----
      int               temp;
  
      // do some very smart indenting when entering '{' or '}'
!     if (((did_si || can_si_back) && c == '{')
!           || (can_si && c == '}' && inindent(0)))
      {
        // for '}' set indent equal to indent of line containing matching '{'
        if (c == '}' && (pos = findmatch(NULL, '{')) != NULL)
*** ../vim-8.2.4952/src/testdir/test_smartindent.vim    2022-05-14 
11:52:19.205341190 +0100
--- src/testdir/test_smartindent.vim    2022-05-14 12:52:15.679712522 +0100
***************
*** 140,145 ****
--- 140,150 ----
    call setline(1, 'foo foot')
    call feedkeys("o  f\<C-X>\<C-N>#", 'tx')
    call assert_equal('  foo#', getline(2))
+ 
+   call setline(2, '')
+   call feedkeys("1Go  f\<C-X>\<C-N>}", 'tx')
+   call assert_equal('  foo}', getline(2))
+ 
    bwipe!
  endfunc
  
*** ../vim-8.2.4952/src/version.c       2022-05-14 12:34:39.868325473 +0100
--- src/version.c       2022-05-14 12:50:35.343771291 +0100
***************
*** 748,749 ****
--- 748,751 ----
  {   /* Add new patch number below this line */
+ /**/
+     4953,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
194. Your business cards contain your e-mail and home page address.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220514115443.2532F1C076B%40moolenaar.net.

Raspunde prin e-mail lui