comparison src/edit.c @ 301:006e9c8a6a8a v7.0079

updated for version 7.0079
author vimboss
date Sat, 04 Jun 2005 22:06:24 +0000
parents f9de3e679a04
children 6c62b9b939bd
comparison
equal deleted inserted replaced
300:86cd0a77d2ae 301:006e9c8a6a8a
4566 pos_T pos; 4566 pos_T pos;
4567 colnr_T len; 4567 colnr_T len;
4568 char_u *old; 4568 char_u *old;
4569 char_u *new, *pnew; 4569 char_u *new, *pnew;
4570 int wasatend; 4570 int wasatend;
4571 int cc;
4571 4572
4572 if (!has_format_option(FO_AUTO)) 4573 if (!has_format_option(FO_AUTO))
4573 return; 4574 return;
4574 4575
4575 pos = curwin->w_cursor; 4576 pos = curwin->w_cursor;
4585 * next they are not joined back together. */ 4586 * next they are not joined back together. */
4586 wasatend = (pos.col == STRLEN(old)); 4587 wasatend = (pos.col == STRLEN(old));
4587 if (*old != NUL && !trailblank && wasatend) 4588 if (*old != NUL && !trailblank && wasatend)
4588 { 4589 {
4589 dec_cursor(); 4590 dec_cursor();
4590 if (!WHITECHAR(gchar_cursor()) 4591 cc = gchar_cursor();
4591 && curwin->w_cursor.col > 0 4592 if (!WHITECHAR(cc) && curwin->w_cursor.col > 0
4592 && has_format_option(FO_ONE_LETTER)) 4593 && has_format_option(FO_ONE_LETTER))
4593 dec_cursor(); 4594 dec_cursor();
4594 if (WHITECHAR(gchar_cursor())) 4595 cc = gchar_cursor();
4596 if (WHITECHAR(cc))
4595 { 4597 {
4596 curwin->w_cursor = pos; 4598 curwin->w_cursor = pos;
4597 return; 4599 return;
4598 } 4600 }
4599 curwin->w_cursor = pos; 4601 curwin->w_cursor = pos;
4670 static void 4672 static void
4671 check_auto_format(end_insert) 4673 check_auto_format(end_insert)
4672 int end_insert; /* TRUE when ending Insert mode */ 4674 int end_insert; /* TRUE when ending Insert mode */
4673 { 4675 {
4674 int c = ' '; 4676 int c = ' ';
4677 int cc;
4675 4678
4676 if (did_add_space) 4679 if (did_add_space)
4677 { 4680 {
4678 if (!WHITECHAR(gchar_cursor())) 4681 cc = gchar_cursor();
4682 if (!WHITECHAR(cc))
4679 /* Somehow the space was removed already. */ 4683 /* Somehow the space was removed already. */
4680 did_add_space = FALSE; 4684 did_add_space = FALSE;
4681 else 4685 else
4682 { 4686 {
4683 if (!end_insert) 4687 if (!end_insert)