Mercurial > vim
comparison src/screen.c @ 386:607d3cd9364f
updated for version 7.0100
author | vimboss |
---|---|
date | Sat, 02 Jul 2005 23:19:16 +0000 |
parents | 6b49757d378c |
children | 169f2a51b527 |
comparison
equal
deleted
inserted
replaced
385:bd4c7ce1da02 | 386:607d3cd9364f |
---|---|
2510 int spell_attr = 0; /* attributes desired by spelling */ | 2510 int spell_attr = 0; /* attributes desired by spelling */ |
2511 int word_end = 0; /* last byte with same spell_attr */ | 2511 int word_end = 0; /* last byte with same spell_attr */ |
2512 static linenr_T checked_lnum = 0; /* line number for "checked_col" */ | 2512 static linenr_T checked_lnum = 0; /* line number for "checked_col" */ |
2513 static int checked_col = 0; /* column in "checked_lnum" up to which | 2513 static int checked_col = 0; /* column in "checked_lnum" up to which |
2514 * there are no spell errors */ | 2514 * there are no spell errors */ |
2515 static int cap_col = -1; /* column to check for Cap word */ | |
2516 static linenr_T capcol_lnum = 0; /* line number where "cap_col" used */ | |
2515 int cur_checked_col = 0; /* checked column for current line */ | 2517 int cur_checked_col = 0; /* checked column for current line */ |
2516 #endif | 2518 #endif |
2517 int extra_check; /* has syntax or linebreak */ | 2519 int extra_check; /* has syntax or linebreak */ |
2518 #ifdef FEAT_MBYTE | 2520 #ifdef FEAT_MBYTE |
2519 int multi_attr = 0; /* attributes desired by multibyte */ | 2521 int multi_attr = 0; /* attributes desired by multibyte */ |
2632 /* When a word wrapped from the previous line the start of the current | 2634 /* When a word wrapped from the previous line the start of the current |
2633 * line is valid. */ | 2635 * line is valid. */ |
2634 if (lnum == checked_lnum) | 2636 if (lnum == checked_lnum) |
2635 cur_checked_col = checked_col; | 2637 cur_checked_col = checked_col; |
2636 checked_lnum = 0; | 2638 checked_lnum = 0; |
2639 | |
2640 /* When there was a sentence end in the previous line may require a | |
2641 * word starting with capital in this line. In line 1 always check | |
2642 * the first word. */ | |
2643 if (lnum != capcol_lnum) | |
2644 cap_col = -1; | |
2645 if (lnum == 1) | |
2646 cap_col = 0; | |
2647 capcol_lnum = 0; | |
2637 } | 2648 } |
2638 #endif | 2649 #endif |
2639 | 2650 |
2640 /* | 2651 /* |
2641 * handle visual active in this window | 2652 * handle visual active in this window |
2800 ptr = line; | 2811 ptr = line; |
2801 | 2812 |
2802 #ifdef FEAT_SYN_HL | 2813 #ifdef FEAT_SYN_HL |
2803 if (has_spell) | 2814 if (has_spell) |
2804 { | 2815 { |
2816 /* For checking first word with a capital skip white space. */ | |
2817 if (cap_col == 0) | |
2818 cap_col = skipwhite(line) - line; | |
2819 | |
2805 /* To be able to spell-check over line boundaries copy the end of the | 2820 /* To be able to spell-check over line boundaries copy the end of the |
2806 * current line into nextline[]. Above the start of the next line was | 2821 * current line into nextline[]. Above the start of the next line was |
2807 * copied to nextline[SPWORDLEN]. */ | 2822 * copied to nextline[SPWORDLEN]. */ |
2808 if (nextline[SPWORDLEN] == NUL) | 2823 if (nextline[SPWORDLEN] == NUL) |
2809 { | 2824 { |
3671 * next line concatenated. */ | 3686 * next line concatenated. */ |
3672 if ((prev_ptr - line) - nextlinecol >= 0) | 3687 if ((prev_ptr - line) - nextlinecol >= 0) |
3673 p = nextline + (prev_ptr - line) - nextlinecol; | 3688 p = nextline + (prev_ptr - line) - nextlinecol; |
3674 else | 3689 else |
3675 p = prev_ptr; | 3690 p = prev_ptr; |
3676 len = spell_check(wp, p, &spell_attr); | 3691 cap_col -= (prev_ptr - line); |
3692 len = spell_check(wp, p, &spell_attr, &cap_col); | |
3677 word_end = v + len; | 3693 word_end = v + len; |
3678 | 3694 |
3679 /* In Insert mode only highlight a word that | 3695 /* In Insert mode only highlight a word that |
3680 * doesn't touch the cursor. */ | 3696 * doesn't touch the cursor. */ |
3681 if (spell_attr != 0 | 3697 if (spell_attr != 0 |
3694 { | 3710 { |
3695 /* Remember that the good word continues at the | 3711 /* Remember that the good word continues at the |
3696 * start of the next line. */ | 3712 * start of the next line. */ |
3697 checked_lnum = lnum + 1; | 3713 checked_lnum = lnum + 1; |
3698 checked_col = (p - nextline) + len - nextline_idx; | 3714 checked_col = (p - nextline) + len - nextline_idx; |
3715 } | |
3716 | |
3717 if (cap_col > 0) | |
3718 { | |
3719 if (p != prev_ptr | |
3720 && (p - nextline) + cap_col >= nextline_idx) | |
3721 { | |
3722 /* Remember that the word in the next line | |
3723 * must start with a capital. */ | |
3724 capcol_lnum = lnum + 1; | |
3725 cap_col = (p - nextline) + cap_col | |
3726 - nextline_idx; | |
3727 } | |
3728 else | |
3729 /* Compute the actual column. */ | |
3730 cap_col += (prev_ptr - line); | |
3699 } | 3731 } |
3700 } | 3732 } |
3701 } | 3733 } |
3702 if (spell_attr != 0) | 3734 if (spell_attr != 0) |
3703 { | 3735 { |
4364 break; | 4396 break; |
4365 #endif | 4397 #endif |
4366 } | 4398 } |
4367 | 4399 |
4368 } /* for every character in the line */ | 4400 } /* for every character in the line */ |
4401 | |
4402 #ifdef FEAT_SYN_HL | |
4403 /* After an empty line check first word for capital. */ | |
4404 if (*skipwhite(line) == NUL) | |
4405 { | |
4406 capcol_lnum = lnum + 1; | |
4407 cap_col = 0; | |
4408 } | |
4409 #endif | |
4369 | 4410 |
4370 return row; | 4411 return row; |
4371 } | 4412 } |
4372 | 4413 |
4373 /* | 4414 /* |