Mercurial > vim
comparison src/screen.c @ 12477:68d7bc045dbe v8.0.1118
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
commit https://github.com/vim/vim/commit/4033c55eca575777718c0701e26635a0cc47d907
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 16 20:54:51 2017 +0200
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Problem: FEAT_WINDOWS adds a lot of #ifdefs while it is nearly always
enabled and only adds 7% to the binary size of the tiny build.
Solution: Graduate FEAT_WINDOWS.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sat, 16 Sep 2017 21:00:06 +0200 |
parents | 854f49cf0abe |
children | 3f16cf18386c |
comparison
equal
deleted
inserted
replaced
12476:2516383741e6 | 12477:68d7bc045dbe |
---|---|
128 static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); | 128 static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); |
129 static void copy_text_attr(int off, char_u *buf, int len, int attr); | 129 static void copy_text_attr(int off, char_u *buf, int len, int attr); |
130 #endif | 130 #endif |
131 static int win_line(win_T *, linenr_T, int, int, int nochange, proftime_T *syntax_tm); | 131 static int win_line(win_T *, linenr_T, int, int, int nochange, proftime_T *syntax_tm); |
132 static int char_needs_redraw(int off_from, int off_to, int cols); | 132 static int char_needs_redraw(int off_from, int off_to, int cols); |
133 #ifdef FEAT_WINDOWS | |
134 static void draw_vsep_win(win_T *wp, int row); | 133 static void draw_vsep_win(win_T *wp, int row); |
135 #endif | |
136 #ifdef FEAT_STL_OPT | 134 #ifdef FEAT_STL_OPT |
137 static void redraw_custom_statusline(win_T *wp); | 135 static void redraw_custom_statusline(win_T *wp); |
138 #endif | 136 #endif |
139 #ifdef FEAT_SEARCH_EXTRA | 137 #ifdef FEAT_SEARCH_EXTRA |
140 # define SEARCH_HL_PRIORITY 0 | 138 # define SEARCH_HL_PRIORITY 0 |
151 static void screen_char_2(unsigned off, int row, int col); | 149 static void screen_char_2(unsigned off, int row, int col); |
152 #endif | 150 #endif |
153 static void screenclear2(void); | 151 static void screenclear2(void); |
154 static void lineclear(unsigned off, int width, int attr); | 152 static void lineclear(unsigned off, int width, int attr); |
155 static void lineinvalid(unsigned off, int width); | 153 static void lineinvalid(unsigned off, int width); |
156 #ifdef FEAT_WINDOWS | |
157 static void linecopy(int to, int from, win_T *wp); | 154 static void linecopy(int to, int from, win_T *wp); |
158 static void redraw_block(int row, int end, win_T *wp); | 155 static void redraw_block(int row, int end, win_T *wp); |
159 #endif | |
160 static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del, int clear_attr); | 156 static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del, int clear_attr); |
161 static void win_rest_invalid(win_T *wp); | 157 static void win_rest_invalid(win_T *wp); |
162 static void msg_pos_mode(void); | 158 static void msg_pos_mode(void); |
163 static void recording_mode(int attr); | 159 static void recording_mode(int attr); |
164 #if defined(FEAT_WINDOWS) | |
165 static void draw_tabline(void); | 160 static void draw_tabline(void); |
166 #endif | |
167 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) | |
168 static int fillchar_status(int *attr, win_T *wp); | 161 static int fillchar_status(int *attr, win_T *wp); |
169 #endif | |
170 #ifdef FEAT_WINDOWS | |
171 static int fillchar_vsep(int *attr); | 162 static int fillchar_vsep(int *attr); |
172 #endif | |
173 #ifdef FEAT_STL_OPT | 163 #ifdef FEAT_STL_OPT |
174 static void win_redr_custom(win_T *wp, int draw_ruler); | 164 static void win_redr_custom(win_T *wp, int draw_ruler); |
175 #endif | 165 #endif |
176 #ifdef FEAT_CMDL_INFO | 166 #ifdef FEAT_CMDL_INFO |
177 static void win_redr_ruler(win_T *wp, int always); | 167 static void win_redr_ruler(win_T *wp, int always); |
178 #endif | 168 #endif |
179 | 169 |
180 #if defined(FEAT_CLIPBOARD) || defined(FEAT_WINDOWS) | |
181 /* Ugly global: overrule attribute used by screen_char() */ | 170 /* Ugly global: overrule attribute used by screen_char() */ |
182 static int screen_char_attr = 0; | 171 static int screen_char_attr = 0; |
183 #endif | |
184 | 172 |
185 #if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) | 173 #if defined(FEAT_SYN_HL) && defined(FEAT_RELTIME) |
186 /* Can limit syntax highlight time to 'redrawtime'. */ | 174 /* Can limit syntax highlight time to 'redrawtime'. */ |
187 # define SYN_TIME_LIMIT 1 | 175 # define SYN_TIME_LIMIT 1 |
188 #endif | 176 #endif |
287 FOR_ALL_WINDOWS(wp) | 275 FOR_ALL_WINDOWS(wp) |
288 { | 276 { |
289 if (wp->w_buffer == buf) | 277 if (wp->w_buffer == buf) |
290 { | 278 { |
291 redraw_win_later(wp, type); | 279 redraw_win_later(wp, type); |
292 #ifdef FEAT_WINDOWS | |
293 wp->w_redr_status = TRUE; | 280 wp->w_redr_status = TRUE; |
294 #endif | |
295 } | 281 } |
296 } | 282 } |
297 } | 283 } |
298 | 284 |
299 /* | 285 /* |
628 wp->w_redr_type = REDRAW_TOP; | 614 wp->w_redr_type = REDRAW_TOP; |
629 } | 615 } |
630 else | 616 else |
631 { | 617 { |
632 wp->w_redr_type = NOT_VALID; | 618 wp->w_redr_type = NOT_VALID; |
633 #ifdef FEAT_WINDOWS | |
634 if (W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp) | 619 if (W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp) |
635 <= msg_scrolled) | 620 <= msg_scrolled) |
636 wp->w_redr_status = TRUE; | 621 wp->w_redr_status = TRUE; |
637 #endif | |
638 } | 622 } |
639 } | 623 } |
640 } | 624 } |
641 if (!no_update) | 625 if (!no_update) |
642 redraw_cmdline = TRUE; | 626 redraw_cmdline = TRUE; |
643 #ifdef FEAT_WINDOWS | |
644 redraw_tabline = TRUE; | 627 redraw_tabline = TRUE; |
645 #endif | |
646 } | 628 } |
647 msg_scrolled = 0; | 629 msg_scrolled = 0; |
648 need_wait_return = FALSE; | 630 need_wait_return = FALSE; |
649 } | 631 } |
650 | 632 |
695 && (curwin->w_valid & VALID_VIRTCOL) | 677 && (curwin->w_valid & VALID_VIRTCOL) |
696 && curwin->w_old_curswant == curwin->w_curswant) | 678 && curwin->w_old_curswant == curwin->w_curswant) |
697 )) | 679 )) |
698 curwin->w_redr_type = type; | 680 curwin->w_redr_type = type; |
699 | 681 |
700 #ifdef FEAT_WINDOWS | |
701 /* Redraw the tab pages line if needed. */ | 682 /* Redraw the tab pages line if needed. */ |
702 if (redraw_tabline || type >= NOT_VALID) | 683 if (redraw_tabline || type >= NOT_VALID) |
703 draw_tabline(); | 684 draw_tabline(); |
704 #endif | |
705 | 685 |
706 #ifdef FEAT_SYN_HL | 686 #ifdef FEAT_SYN_HL |
707 /* | 687 /* |
708 * Correct stored syntax highlighting info for changes in each displayed | 688 * Correct stored syntax highlighting info for changes in each displayed |
709 * buffer. Each buffer must only be done once. | 689 * buffer. Each buffer must only be done once. |
710 */ | 690 */ |
711 FOR_ALL_WINDOWS(wp) | 691 FOR_ALL_WINDOWS(wp) |
712 { | 692 { |
713 if (wp->w_buffer->b_mod_set) | 693 if (wp->w_buffer->b_mod_set) |
714 { | 694 { |
715 # ifdef FEAT_WINDOWS | |
716 win_T *wwp; | 695 win_T *wwp; |
717 | 696 |
718 /* Check if we already did this buffer. */ | 697 /* Check if we already did this buffer. */ |
719 for (wwp = firstwin; wwp != wp; wwp = wwp->w_next) | 698 for (wwp = firstwin; wwp != wp; wwp = wwp->w_next) |
720 if (wwp->w_buffer == wp->w_buffer) | 699 if (wwp->w_buffer == wp->w_buffer) |
721 break; | 700 break; |
722 # endif | 701 if (wwp == wp && syntax_present(wp)) |
723 if ( | |
724 # ifdef FEAT_WINDOWS | |
725 wwp == wp && | |
726 # endif | |
727 syntax_present(wp)) | |
728 syn_stack_apply_changes(wp->w_buffer); | 702 syn_stack_apply_changes(wp->w_buffer); |
729 } | 703 } |
730 } | 704 } |
731 #endif | 705 #endif |
732 | 706 |
774 } | 748 } |
775 #endif | 749 #endif |
776 win_update(wp); | 750 win_update(wp); |
777 } | 751 } |
778 | 752 |
779 #ifdef FEAT_WINDOWS | |
780 /* redraw status line after the window to minimize cursor movement */ | 753 /* redraw status line after the window to minimize cursor movement */ |
781 if (wp->w_redr_status) | 754 if (wp->w_redr_status) |
782 { | 755 { |
783 cursor_off(); | 756 cursor_off(); |
784 win_redr_status(wp); | 757 win_redr_status(wp); |
785 } | 758 } |
786 #endif | |
787 } | 759 } |
788 #if defined(FEAT_SEARCH_EXTRA) | 760 #if defined(FEAT_SEARCH_EXTRA) |
789 end_search_hl(); | 761 end_search_hl(); |
790 #endif | 762 #endif |
791 #ifdef FEAT_INS_EXPAND | 763 #ifdef FEAT_INS_EXPAND |
792 /* May need to redraw the popup menu. */ | 764 /* May need to redraw the popup menu. */ |
793 if (pum_visible()) | 765 if (pum_visible()) |
794 pum_redraw(); | 766 pum_redraw(); |
795 #endif | 767 #endif |
796 | 768 |
797 #ifdef FEAT_WINDOWS | |
798 /* Reset b_mod_set flags. Going through all windows is probably faster | 769 /* Reset b_mod_set flags. Going through all windows is probably faster |
799 * than going through all buffers (there could be many buffers). */ | 770 * than going through all buffers (there could be many buffers). */ |
800 FOR_ALL_WINDOWS(wp) | 771 FOR_ALL_WINDOWS(wp) |
801 wp->w_buffer->b_mod_set = FALSE; | 772 wp->w_buffer->b_mod_set = FALSE; |
802 #else | |
803 curbuf->b_mod_set = FALSE; | |
804 #endif | |
805 | 773 |
806 updating_screen = FALSE; | 774 updating_screen = FALSE; |
807 #ifdef FEAT_GUI | 775 #ifdef FEAT_GUI |
808 gui_may_resize_shell(); | 776 gui_may_resize_shell(); |
809 #endif | 777 #endif |
1036 return; | 1004 return; |
1037 | 1005 |
1038 /* update all windows that need updating */ | 1006 /* update all windows that need updating */ |
1039 update_prepare(); | 1007 update_prepare(); |
1040 | 1008 |
1041 # ifdef FEAT_WINDOWS | |
1042 FOR_ALL_WINDOWS(wp) | 1009 FOR_ALL_WINDOWS(wp) |
1043 { | 1010 { |
1044 if (wp->w_redr_type != 0) | 1011 if (wp->w_redr_type != 0) |
1045 win_update(wp); | 1012 win_update(wp); |
1046 if (wp->w_redr_status) | 1013 if (wp->w_redr_status) |
1047 win_redr_status(wp); | 1014 win_redr_status(wp); |
1048 } | 1015 } |
1049 # else | |
1050 if (curwin->w_redr_type != 0) | |
1051 win_update(curwin); | |
1052 # endif | |
1053 | 1016 |
1054 update_finish(); | 1017 update_finish(); |
1055 } | 1018 } |
1056 #endif | 1019 #endif |
1057 | 1020 |
1078 clip_update_selection(&clip_plus); | 1041 clip_update_selection(&clip_plus); |
1079 #endif | 1042 #endif |
1080 | 1043 |
1081 win_update(wp); | 1044 win_update(wp); |
1082 | 1045 |
1083 #ifdef FEAT_WINDOWS | |
1084 /* When the screen was cleared redraw the tab pages line. */ | 1046 /* When the screen was cleared redraw the tab pages line. */ |
1085 if (redraw_tabline) | 1047 if (redraw_tabline) |
1086 draw_tabline(); | 1048 draw_tabline(); |
1087 | 1049 |
1088 if (wp->w_redr_status | 1050 if (wp->w_redr_status |
1092 # ifdef FEAT_STL_OPT | 1054 # ifdef FEAT_STL_OPT |
1093 || *p_stl != NUL || *wp->w_p_stl != NUL | 1055 || *p_stl != NUL || *wp->w_p_stl != NUL |
1094 # endif | 1056 # endif |
1095 ) | 1057 ) |
1096 win_redr_status(wp); | 1058 win_redr_status(wp); |
1097 #endif | |
1098 | 1059 |
1099 update_finish(); | 1060 update_finish(); |
1100 } | 1061 } |
1101 #endif | 1062 #endif |
1102 | 1063 |
1181 | 1142 |
1182 type = wp->w_redr_type; | 1143 type = wp->w_redr_type; |
1183 | 1144 |
1184 if (type == NOT_VALID) | 1145 if (type == NOT_VALID) |
1185 { | 1146 { |
1186 #ifdef FEAT_WINDOWS | |
1187 wp->w_redr_status = TRUE; | 1147 wp->w_redr_status = TRUE; |
1188 #endif | |
1189 wp->w_lines_valid = 0; | 1148 wp->w_lines_valid = 0; |
1190 } | 1149 } |
1191 | 1150 |
1192 /* Window is zero-height: nothing to draw. */ | 1151 /* Window is zero-height: nothing to draw. */ |
1193 if (wp->w_height == 0) | 1152 if (wp->w_height == 0) |
1194 { | 1153 { |
1195 wp->w_redr_type = 0; | 1154 wp->w_redr_type = 0; |
1196 return; | 1155 return; |
1197 } | 1156 } |
1198 | 1157 |
1199 #ifdef FEAT_WINDOWS | |
1200 /* Window is zero-width: Only need to draw the separator. */ | 1158 /* Window is zero-width: Only need to draw the separator. */ |
1201 if (wp->w_width == 0) | 1159 if (wp->w_width == 0) |
1202 { | 1160 { |
1203 /* draw the vertical separator right of this window */ | 1161 /* draw the vertical separator right of this window */ |
1204 draw_vsep_win(wp, 0); | 1162 draw_vsep_win(wp, 0); |
1205 wp->w_redr_type = 0; | 1163 wp->w_redr_type = 0; |
1206 return; | 1164 return; |
1207 } | 1165 } |
1208 #endif | |
1209 | 1166 |
1210 #ifdef FEAT_TERMINAL | 1167 #ifdef FEAT_TERMINAL |
1211 /* If this window contains a terminal, redraw works completely differently. | 1168 /* If this window contains a terminal, redraw works completely differently. |
1212 */ | 1169 */ |
1213 if (term_update_window(wp) == OK) | 1170 if (term_update_window(wp) == OK) |
1601 /* Clear the screen when it was not done by win_del_lines() or | 1558 /* Clear the screen when it was not done by win_del_lines() or |
1602 * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE | 1559 * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE |
1603 * then. */ | 1560 * then. */ |
1604 if (screen_cleared != TRUE) | 1561 if (screen_cleared != TRUE) |
1605 screenclear(); | 1562 screenclear(); |
1606 #ifdef FEAT_WINDOWS | |
1607 /* The screen was cleared, redraw the tab pages line. */ | 1563 /* The screen was cleared, redraw the tab pages line. */ |
1608 if (redraw_tabline) | 1564 if (redraw_tabline) |
1609 draw_tabline(); | 1565 draw_tabline(); |
1610 #endif | |
1611 } | 1566 } |
1612 } | 1567 } |
1613 | 1568 |
1614 /* When win_del_lines() or win_ins_lines() caused the screen to be | 1569 /* When win_del_lines() or win_ins_lines() caused the screen to be |
1615 * cleared (only happens for the first window) or when screenclear() | 1570 * cleared (only happens for the first window) or when screenclear() |
2273 wp->w_botline = lnum; | 2228 wp->w_botline = lnum; |
2274 } | 2229 } |
2275 } | 2230 } |
2276 else | 2231 else |
2277 { | 2232 { |
2278 #ifdef FEAT_WINDOWS | |
2279 draw_vsep_win(wp, row); | 2233 draw_vsep_win(wp, row); |
2280 #endif | |
2281 if (eof) /* we hit the end of the file */ | 2234 if (eof) /* we hit the end of the file */ |
2282 { | 2235 { |
2283 wp->w_botline = buf->b_ml.ml_line_count + 1; | 2236 wp->w_botline = buf->b_ml.ml_line_count + 1; |
2284 #ifdef FEAT_DIFF | 2237 #ifdef FEAT_DIFF |
2285 j = diff_check_fill(wp, wp->w_botline); | 2238 j = diff_check_fill(wp, wp->w_botline); |
3114 colnr_T trailcol = MAXCOL; /* start of trailing spaces */ | 3067 colnr_T trailcol = MAXCOL; /* start of trailing spaces */ |
3115 #ifdef FEAT_LINEBREAK | 3068 #ifdef FEAT_LINEBREAK |
3116 int need_showbreak = FALSE; /* overlong line, skipping first x | 3069 int need_showbreak = FALSE; /* overlong line, skipping first x |
3117 chars */ | 3070 chars */ |
3118 #endif | 3071 #endif |
3119 #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \ | 3072 #if defined(FEAT_SIGNS) || defined(FEAT_QUICKFIX) \ |
3120 || defined(FEAT_SYN_HL) || defined(FEAT_DIFF) | 3073 || defined(FEAT_SYN_HL) || defined(FEAT_DIFF) |
3121 # define LINE_ATTR | 3074 # define LINE_ATTR |
3122 int line_attr = 0; /* attribute for the whole line */ | 3075 int line_attr = 0; /* attribute for the whole line */ |
3123 #endif | 3076 #endif |
3124 #ifdef FEAT_SEARCH_EXTRA | 3077 #ifdef FEAT_SEARCH_EXTRA |
3448 /* If this line has a sign with line highlighting set line_attr. */ | 3401 /* If this line has a sign with line highlighting set line_attr. */ |
3449 v = buf_getsigntype(wp->w_buffer, lnum, SIGN_LINEHL); | 3402 v = buf_getsigntype(wp->w_buffer, lnum, SIGN_LINEHL); |
3450 if (v != 0) | 3403 if (v != 0) |
3451 line_attr = sign_get_attr((int)v, TRUE); | 3404 line_attr = sign_get_attr((int)v, TRUE); |
3452 # endif | 3405 # endif |
3453 # if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS) | 3406 # if defined(FEAT_QUICKFIX) |
3454 /* Highlight the current line in the quickfix window. */ | 3407 /* Highlight the current line in the quickfix window. */ |
3455 if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum) | 3408 if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum) |
3456 line_attr = HL_ATTR(HLF_QFL); | 3409 line_attr = HL_ATTR(HLF_QFL); |
3457 # endif | 3410 # endif |
3458 if (line_attr != 0) | 3411 if (line_attr != 0) |
5838 && filler_todo <= 0 | 5791 && filler_todo <= 0 |
5839 #endif | 5792 #endif |
5840 ) | 5793 ) |
5841 { | 5794 { |
5842 win_draw_end(wp, '@', ' ', row, wp->w_height, HLF_AT); | 5795 win_draw_end(wp, '@', ' ', row, wp->w_height, HLF_AT); |
5843 #ifdef FEAT_WINDOWS | |
5844 draw_vsep_win(wp, row); | 5796 draw_vsep_win(wp, row); |
5845 #endif | |
5846 row = endrow; | 5797 row = endrow; |
5847 } | 5798 } |
5848 | 5799 |
5849 /* When line got too long for screen break here. */ | 5800 /* When line got too long for screen break here. */ |
5850 if (row == endrow) | 5801 if (row == endrow) |
5855 | 5806 |
5856 if (screen_cur_row == screen_row - 1 | 5807 if (screen_cur_row == screen_row - 1 |
5857 #ifdef FEAT_DIFF | 5808 #ifdef FEAT_DIFF |
5858 && filler_todo <= 0 | 5809 && filler_todo <= 0 |
5859 #endif | 5810 #endif |
5860 #ifdef FEAT_WINDOWS | 5811 && W_WIDTH(wp) == Columns) |
5861 && W_WIDTH(wp) == Columns | |
5862 #endif | |
5863 ) | |
5864 { | 5812 { |
5865 /* Remember that the line wraps, used for modeless copy. */ | 5813 /* Remember that the line wraps, used for modeless copy. */ |
5866 LineWraps[screen_row - 1] = TRUE; | 5814 LineWraps[screen_row - 1] = TRUE; |
5867 | 5815 |
5868 /* | 5816 /* |
6058 #ifdef FEAT_MBYTE | 6006 #ifdef FEAT_MBYTE |
6059 unsigned max_off_from; | 6007 unsigned max_off_from; |
6060 unsigned max_off_to; | 6008 unsigned max_off_to; |
6061 #endif | 6009 #endif |
6062 int col = 0; | 6010 int col = 0; |
6063 #if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_WINDOWS) | |
6064 int hl; | 6011 int hl; |
6065 #endif | |
6066 int force = FALSE; /* force update rest of the line */ | 6012 int force = FALSE; /* force update rest of the line */ |
6067 int redraw_this /* bool: does character need redraw? */ | 6013 int redraw_this /* bool: does character need redraw? */ |
6068 #ifdef FEAT_GUI | 6014 #ifdef FEAT_GUI |
6069 = TRUE /* For GUI when while-loop empty */ | 6015 = TRUE /* For GUI when while-loop empty */ |
6070 #endif | 6016 #endif |
6397 } | 6343 } |
6398 } | 6344 } |
6399 #endif | 6345 #endif |
6400 screen_fill(row, row + 1, col + coloff, clear_width + coloff, | 6346 screen_fill(row, row + 1, col + coloff, clear_width + coloff, |
6401 ' ', ' ', 0); | 6347 ' ', ' ', 0); |
6402 #ifdef FEAT_WINDOWS | |
6403 off_to += clear_width - col; | 6348 off_to += clear_width - col; |
6404 col = clear_width; | 6349 col = clear_width; |
6405 #endif | |
6406 } | 6350 } |
6407 } | 6351 } |
6408 | 6352 |
6409 if (clear_width > 0) | 6353 if (clear_width > 0) |
6410 { | 6354 { |
6411 #ifdef FEAT_WINDOWS | |
6412 /* For a window that's left of another, draw the separator char. */ | 6355 /* For a window that's left of another, draw the separator char. */ |
6413 if (col + coloff < Columns) | 6356 if (col + coloff < Columns) |
6414 { | 6357 { |
6415 int c; | 6358 int c; |
6416 | 6359 |
6417 c = fillchar_vsep(&hl); | 6360 c = fillchar_vsep(&hl); |
6418 if (ScreenLines[off_to] != (schar_T)c | 6361 if (ScreenLines[off_to] != (schar_T)c |
6419 # ifdef FEAT_MBYTE | 6362 #ifdef FEAT_MBYTE |
6420 || (enc_utf8 && (int)ScreenLinesUC[off_to] | 6363 || (enc_utf8 && (int)ScreenLinesUC[off_to] |
6421 != (c >= 0x80 ? c : 0)) | 6364 != (c >= 0x80 ? c : 0)) |
6422 # endif | 6365 #endif |
6423 || ScreenAttrs[off_to] != hl) | 6366 || ScreenAttrs[off_to] != hl) |
6424 { | 6367 { |
6425 ScreenLines[off_to] = c; | 6368 ScreenLines[off_to] = c; |
6426 ScreenAttrs[off_to] = hl; | 6369 ScreenAttrs[off_to] = hl; |
6427 # ifdef FEAT_MBYTE | 6370 #ifdef FEAT_MBYTE |
6428 if (enc_utf8) | 6371 if (enc_utf8) |
6429 { | 6372 { |
6430 if (c >= 0x80) | 6373 if (c >= 0x80) |
6431 { | 6374 { |
6432 ScreenLinesUC[off_to] = c; | 6375 ScreenLinesUC[off_to] = c; |
6433 ScreenLinesC[0][off_to] = 0; | 6376 ScreenLinesC[0][off_to] = 0; |
6434 } | 6377 } |
6435 else | 6378 else |
6436 ScreenLinesUC[off_to] = 0; | 6379 ScreenLinesUC[off_to] = 0; |
6437 } | 6380 } |
6438 # endif | 6381 #endif |
6439 screen_char(off_to, row, col + coloff); | 6382 screen_char(off_to, row, col + coloff); |
6440 } | 6383 } |
6441 } | 6384 } |
6442 else | 6385 else |
6443 #endif | |
6444 LineWraps[row] = FALSE; | 6386 LineWraps[row] = FALSE; |
6445 } | 6387 } |
6446 } | 6388 } |
6447 | 6389 |
6448 #if defined(FEAT_RIGHTLEFT) || defined(PROTO) | 6390 #if defined(FEAT_RIGHTLEFT) || defined(PROTO) |
6463 *p2 = t; | 6405 *p2 = t; |
6464 } | 6406 } |
6465 } | 6407 } |
6466 #endif | 6408 #endif |
6467 | 6409 |
6468 #if defined(FEAT_WINDOWS) || defined(PROTO) | |
6469 /* | 6410 /* |
6470 * mark all status lines for redraw; used after first :cd | 6411 * mark all status lines for redraw; used after first :cd |
6471 */ | 6412 */ |
6472 void | 6413 void |
6473 status_redraw_all(void) | 6414 status_redraw_all(void) |
6510 if (wp->w_redr_status) | 6451 if (wp->w_redr_status) |
6511 win_redr_status(wp); | 6452 win_redr_status(wp); |
6512 if (redraw_tabline) | 6453 if (redraw_tabline) |
6513 draw_tabline(); | 6454 draw_tabline(); |
6514 } | 6455 } |
6515 #endif | 6456 |
6516 | 6457 #if defined(FEAT_WILDMENU) || defined(PROTO) |
6517 #if (defined(FEAT_WILDMENU) && defined(FEAT_WINDOWS)) || defined(PROTO) | |
6518 /* | 6458 /* |
6519 * Redraw all status lines at the bottom of frame "frp". | 6459 * Redraw all status lines at the bottom of frame "frp". |
6520 */ | 6460 */ |
6521 void | 6461 void |
6522 win_redraw_last_status(frame_T *frp) | 6462 win_redraw_last_status(frame_T *frp) |
6536 win_redraw_last_status(frp); | 6476 win_redraw_last_status(frp); |
6537 } | 6477 } |
6538 } | 6478 } |
6539 #endif | 6479 #endif |
6540 | 6480 |
6541 #ifdef FEAT_WINDOWS | |
6542 /* | 6481 /* |
6543 * Draw the verticap separator right of window "wp" starting with line "row". | 6482 * Draw the verticap separator right of window "wp" starting with line "row". |
6544 */ | 6483 */ |
6545 static void | 6484 static void |
6546 draw_vsep_win(win_T *wp, int row) | 6485 draw_vsep_win(win_T *wp, int row) |
6555 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, | 6494 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, |
6556 W_ENDCOL(wp), W_ENDCOL(wp) + 1, | 6495 W_ENDCOL(wp), W_ENDCOL(wp) + 1, |
6557 c, ' ', hl); | 6496 c, ' ', hl); |
6558 } | 6497 } |
6559 } | 6498 } |
6560 #endif | |
6561 | 6499 |
6562 #ifdef FEAT_WILDMENU | 6500 #ifdef FEAT_WILDMENU |
6563 static int status_match_len(expand_T *xp, char_u *s); | 6501 static int status_match_len(expand_T *xp, char_u *s); |
6564 static int skip_status_match_char(expand_T *xp, char_u *s); | 6502 static int skip_status_match_char(expand_T *xp, char_u *s); |
6565 | 6503 |
6829 } | 6767 } |
6830 | 6768 |
6831 screen_fill(row, row + 1, clen, (int)Columns, fillchar, fillchar, attr); | 6769 screen_fill(row, row + 1, clen, (int)Columns, fillchar, fillchar, attr); |
6832 } | 6770 } |
6833 | 6771 |
6834 #ifdef FEAT_WINDOWS | |
6835 win_redraw_last_status(topframe); | 6772 win_redraw_last_status(topframe); |
6836 #else | |
6837 lastwin->w_redr_status = TRUE; | |
6838 #endif | |
6839 vim_free(buf); | 6773 vim_free(buf); |
6840 } | 6774 } |
6841 #endif | 6775 #endif |
6842 | 6776 |
6843 #if defined(FEAT_WINDOWS) || defined(PROTO) | |
6844 /* | 6777 /* |
6845 * Redraw the status line of window wp. | 6778 * Redraw the status line of window wp. |
6846 * | 6779 * |
6847 * If inversion is possible we use it. Else '=' characters are used. | 6780 * If inversion is possible we use it. Else '=' characters are used. |
6848 */ | 6781 */ |
7058 fr = fr->fr_parent; | 6991 fr = fr->fr_parent; |
7059 } | 6992 } |
7060 return FALSE; | 6993 return FALSE; |
7061 } | 6994 } |
7062 | 6995 |
7063 #endif /* FEAT_WINDOWS */ | 6996 |
7064 | |
7065 #if defined(FEAT_WINDOWS) || defined(FEAT_STL_OPT) || defined(PROTO) | |
7066 /* | 6997 /* |
7067 * Get the value to show for the language mappings, active 'keymap'. | 6998 * Get the value to show for the language mappings, active 'keymap'. |
7068 */ | 6999 */ |
7069 int | 7000 int |
7070 get_keymap_str( | 7001 get_keymap_str( |
7108 vim_free(s); | 7039 vim_free(s); |
7109 #endif | 7040 #endif |
7110 } | 7041 } |
7111 return buf[0] != NUL; | 7042 return buf[0] != NUL; |
7112 } | 7043 } |
7113 #endif | |
7114 | 7044 |
7115 #if defined(FEAT_STL_OPT) || defined(PROTO) | 7045 #if defined(FEAT_STL_OPT) || defined(PROTO) |
7116 /* | 7046 /* |
7117 * Redraw the status line or ruler of window "wp". | 7047 * Redraw the status line or ruler of window "wp". |
7118 * When "wp" is NULL redraw the tab pages line from 'tabline'. | 7048 * When "wp" is NULL redraw the tab pages line from 'tabline'. |
7179 while (VIM_ISDIGIT(*stl)) | 7109 while (VIM_ISDIGIT(*stl)) |
7180 stl++; | 7110 stl++; |
7181 if (*stl++ != '(') | 7111 if (*stl++ != '(') |
7182 stl = p_ruf; | 7112 stl = p_ruf; |
7183 } | 7113 } |
7184 #ifdef FEAT_WINDOWS | |
7185 col = ru_col - (Columns - W_WIDTH(wp)); | 7114 col = ru_col - (Columns - W_WIDTH(wp)); |
7186 if (col < (W_WIDTH(wp) + 1) / 2) | 7115 if (col < (W_WIDTH(wp) + 1) / 2) |
7187 col = (W_WIDTH(wp) + 1) / 2; | 7116 col = (W_WIDTH(wp) + 1) / 2; |
7188 #else | |
7189 col = ru_col; | |
7190 if (col > (Columns + 1) / 2) | |
7191 col = (Columns + 1) / 2; | |
7192 #endif | |
7193 maxwidth = W_WIDTH(wp) - col; | 7117 maxwidth = W_WIDTH(wp) - col; |
7194 #ifdef FEAT_WINDOWS | |
7195 if (!wp->w_status_height) | 7118 if (!wp->w_status_height) |
7196 #endif | |
7197 { | 7119 { |
7198 row = Rows - 1; | 7120 row = Rows - 1; |
7199 --maxwidth; /* writing in last column may cause scrolling */ | 7121 --maxwidth; /* writing in last column may cause scrolling */ |
7200 fillchar = ' '; | 7122 fillchar = ' '; |
7201 attr = 0; | 7123 attr = 0; |
7215 use_sandbox = was_set_insecurely((char_u *)"statusline", | 7137 use_sandbox = was_set_insecurely((char_u *)"statusline", |
7216 *wp->w_p_stl == NUL ? 0 : OPT_LOCAL); | 7138 *wp->w_p_stl == NUL ? 0 : OPT_LOCAL); |
7217 # endif | 7139 # endif |
7218 } | 7140 } |
7219 | 7141 |
7220 #ifdef FEAT_WINDOWS | |
7221 col += W_WINCOL(wp); | 7142 col += W_WINCOL(wp); |
7222 #endif | |
7223 } | 7143 } |
7224 | 7144 |
7225 if (maxwidth <= 0) | 7145 if (maxwidth <= 0) |
7226 goto theend; | 7146 goto theend; |
7227 | 7147 |
7275 | 7195 |
7276 if (hltab[n].userhl == 0) | 7196 if (hltab[n].userhl == 0) |
7277 curattr = attr; | 7197 curattr = attr; |
7278 else if (hltab[n].userhl < 0) | 7198 else if (hltab[n].userhl < 0) |
7279 curattr = syn_id2attr(-hltab[n].userhl); | 7199 curattr = syn_id2attr(-hltab[n].userhl); |
7280 #ifdef FEAT_WINDOWS | 7200 #ifdef FEAT_TERMINAL |
7281 # ifdef FEAT_TERMINAL | |
7282 else if (wp != NULL && wp != curwin && bt_terminal(wp->w_buffer) | 7201 else if (wp != NULL && wp != curwin && bt_terminal(wp->w_buffer) |
7283 && wp->w_status_height != 0) | 7202 && wp->w_status_height != 0) |
7284 curattr = highlight_stltermnc[hltab[n].userhl - 1]; | 7203 curattr = highlight_stltermnc[hltab[n].userhl - 1]; |
7285 else if (wp != NULL && bt_terminal(wp->w_buffer) | 7204 else if (wp != NULL && bt_terminal(wp->w_buffer) |
7286 && wp->w_status_height != 0) | 7205 && wp->w_status_height != 0) |
7287 curattr = highlight_stlterm[hltab[n].userhl - 1]; | 7206 curattr = highlight_stlterm[hltab[n].userhl - 1]; |
7288 # endif | 7207 #endif |
7289 else if (wp != NULL && wp != curwin && wp->w_status_height != 0) | 7208 else if (wp != NULL && wp != curwin && wp->w_status_height != 0) |
7290 curattr = highlight_stlnc[hltab[n].userhl - 1]; | 7209 curattr = highlight_stlnc[hltab[n].userhl - 1]; |
7291 #endif | |
7292 else | 7210 else |
7293 curattr = highlight_user[hltab[n].userhl - 1]; | 7211 curattr = highlight_user[hltab[n].userhl - 1]; |
7294 } | 7212 } |
7295 screen_puts(p, row, col, curattr); | 7213 screen_puts(p, row, col, curattr); |
7296 | 7214 |
8324 } | 8242 } |
8325 | 8243 |
8326 /* | 8244 /* |
8327 * Stop highlighting first, so it's easier to move the cursor. | 8245 * Stop highlighting first, so it's easier to move the cursor. |
8328 */ | 8246 */ |
8329 #if defined(FEAT_CLIPBOARD) || defined(FEAT_WINDOWS) | |
8330 if (screen_char_attr != 0) | 8247 if (screen_char_attr != 0) |
8331 attr = screen_char_attr; | 8248 attr = screen_char_attr; |
8332 else | 8249 else |
8333 #endif | |
8334 attr = ScreenAttrs[off]; | 8250 attr = ScreenAttrs[off]; |
8335 if (screen_attr != attr) | 8251 if (screen_attr != attr) |
8336 screen_stop_highlight(); | 8252 screen_stop_highlight(); |
8337 | 8253 |
8338 windgoto(row, col); | 8254 windgoto(row, col); |
8401 out_char(ScreenLines[off + 1]); | 8317 out_char(ScreenLines[off + 1]); |
8402 ++screen_cur_col; | 8318 ++screen_cur_col; |
8403 } | 8319 } |
8404 #endif | 8320 #endif |
8405 | 8321 |
8406 #if defined(FEAT_CLIPBOARD) || defined(FEAT_WINDOWS) || defined(PROTO) | |
8407 /* | 8322 /* |
8408 * Draw a rectangle of the screen, inverted when "invert" is TRUE. | 8323 * Draw a rectangle of the screen, inverted when "invert" is TRUE. |
8409 * This uses the contents of ScreenLines[] and doesn't change it. | 8324 * This uses the contents of ScreenLines[] and doesn't change it. |
8410 */ | 8325 */ |
8411 void | 8326 void |
8453 } | 8368 } |
8454 } | 8369 } |
8455 } | 8370 } |
8456 screen_char_attr = 0; | 8371 screen_char_attr = 0; |
8457 } | 8372 } |
8458 #endif | 8373 |
8459 | |
8460 #ifdef FEAT_WINDOWS | |
8461 /* | 8374 /* |
8462 * Redraw the characters for a vertically split window. | 8375 * Redraw the characters for a vertically split window. |
8463 */ | 8376 */ |
8464 static void | 8377 static void |
8465 redraw_block(int row, int end, win_T *wp) | 8378 redraw_block(int row, int end, win_T *wp) |
8481 col = wp->w_wincol; | 8394 col = wp->w_wincol; |
8482 width = wp->w_width; | 8395 width = wp->w_width; |
8483 } | 8396 } |
8484 screen_draw_rectangle(row, col, end - row, width, FALSE); | 8397 screen_draw_rectangle(row, col, end - row, width, FALSE); |
8485 } | 8398 } |
8486 #endif | |
8487 | 8399 |
8488 /* | 8400 /* |
8489 * Fill the screen from 'start_row' to 'end_row', from 'start_col' to 'end_col' | 8401 * Fill the screen from 'start_row' to 'end_row', from 'start_col' to 'end_col' |
8490 * with character 'c1' in first column followed by 'c2' in the other columns. | 8402 * with character 'c1' in first column followed by 'c2' in the other columns. |
8491 * Use attributes 'attr'. | 8403 * Use attributes 'attr'. |
8740 int i; | 8652 int i; |
8741 #endif | 8653 #endif |
8742 sattr_T *new_ScreenAttrs; | 8654 sattr_T *new_ScreenAttrs; |
8743 unsigned *new_LineOffset; | 8655 unsigned *new_LineOffset; |
8744 char_u *new_LineWraps; | 8656 char_u *new_LineWraps; |
8745 #ifdef FEAT_WINDOWS | |
8746 short *new_TabPageIdxs; | 8657 short *new_TabPageIdxs; |
8747 tabpage_T *tp; | 8658 tabpage_T *tp; |
8748 #endif | |
8749 static int entered = FALSE; /* avoid recursiveness */ | 8659 static int entered = FALSE; /* avoid recursiveness */ |
8750 static int done_outofmem_msg = FALSE; /* did outofmem message */ | 8660 static int done_outofmem_msg = FALSE; /* did outofmem message */ |
8751 #ifdef FEAT_AUTOCMD | 8661 #ifdef FEAT_AUTOCMD |
8752 int retry_count = 0; | 8662 int retry_count = 0; |
8753 | 8663 |
8828 new_ScreenAttrs = (sattr_T *)lalloc((long_u)( | 8738 new_ScreenAttrs = (sattr_T *)lalloc((long_u)( |
8829 (Rows + 1) * Columns * sizeof(sattr_T)), FALSE); | 8739 (Rows + 1) * Columns * sizeof(sattr_T)), FALSE); |
8830 new_LineOffset = (unsigned *)lalloc((long_u)( | 8740 new_LineOffset = (unsigned *)lalloc((long_u)( |
8831 Rows * sizeof(unsigned)), FALSE); | 8741 Rows * sizeof(unsigned)), FALSE); |
8832 new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE); | 8742 new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE); |
8833 #ifdef FEAT_WINDOWS | |
8834 new_TabPageIdxs = (short *)lalloc((long_u)(Columns * sizeof(short)), FALSE); | 8743 new_TabPageIdxs = (short *)lalloc((long_u)(Columns * sizeof(short)), FALSE); |
8835 #endif | |
8836 | 8744 |
8837 FOR_ALL_TAB_WINDOWS(tp, wp) | 8745 FOR_ALL_TAB_WINDOWS(tp, wp) |
8838 { | 8746 { |
8839 if (win_alloc_lines(wp) == FAIL) | 8747 if (win_alloc_lines(wp) == FAIL) |
8840 { | 8748 { |
8841 outofmem = TRUE; | 8749 outofmem = TRUE; |
8842 #ifdef FEAT_WINDOWS | |
8843 goto give_up; | 8750 goto give_up; |
8844 #endif | |
8845 } | 8751 } |
8846 } | 8752 } |
8847 #ifdef FEAT_AUTOCMD | 8753 #ifdef FEAT_AUTOCMD |
8848 if (aucmd_win != NULL && aucmd_win->w_lines == NULL | 8754 if (aucmd_win != NULL && aucmd_win->w_lines == NULL |
8849 && win_alloc_lines(aucmd_win) == FAIL) | 8755 && win_alloc_lines(aucmd_win) == FAIL) |
8850 outofmem = TRUE; | 8756 outofmem = TRUE; |
8851 #endif | 8757 #endif |
8852 #ifdef FEAT_WINDOWS | |
8853 give_up: | 8758 give_up: |
8854 #endif | |
8855 | 8759 |
8856 #ifdef FEAT_MBYTE | 8760 #ifdef FEAT_MBYTE |
8857 for (i = 0; i < p_mco; ++i) | 8761 for (i = 0; i < p_mco; ++i) |
8858 if (new_ScreenLinesC[i] == NULL) | 8762 if (new_ScreenLinesC[i] == NULL) |
8859 break; | 8763 break; |
8864 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) | 8768 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) |
8865 #endif | 8769 #endif |
8866 || new_ScreenAttrs == NULL | 8770 || new_ScreenAttrs == NULL |
8867 || new_LineOffset == NULL | 8771 || new_LineOffset == NULL |
8868 || new_LineWraps == NULL | 8772 || new_LineWraps == NULL |
8869 #ifdef FEAT_WINDOWS | |
8870 || new_TabPageIdxs == NULL | 8773 || new_TabPageIdxs == NULL |
8871 #endif | |
8872 || outofmem) | 8774 || outofmem) |
8873 { | 8775 { |
8874 if (ScreenLines != NULL || !done_outofmem_msg) | 8776 if (ScreenLines != NULL || !done_outofmem_msg) |
8875 { | 8777 { |
8876 /* guess the size */ | 8778 /* guess the size */ |
8897 new_ScreenAttrs = NULL; | 8799 new_ScreenAttrs = NULL; |
8898 vim_free(new_LineOffset); | 8800 vim_free(new_LineOffset); |
8899 new_LineOffset = NULL; | 8801 new_LineOffset = NULL; |
8900 vim_free(new_LineWraps); | 8802 vim_free(new_LineWraps); |
8901 new_LineWraps = NULL; | 8803 new_LineWraps = NULL; |
8902 #ifdef FEAT_WINDOWS | |
8903 vim_free(new_TabPageIdxs); | 8804 vim_free(new_TabPageIdxs); |
8904 new_TabPageIdxs = NULL; | 8805 new_TabPageIdxs = NULL; |
8905 #endif | |
8906 } | 8806 } |
8907 else | 8807 else |
8908 { | 8808 { |
8909 done_outofmem_msg = FALSE; | 8809 done_outofmem_msg = FALSE; |
8910 | 8810 |
8994 ScreenLines2 = new_ScreenLines2; | 8894 ScreenLines2 = new_ScreenLines2; |
8995 #endif | 8895 #endif |
8996 ScreenAttrs = new_ScreenAttrs; | 8896 ScreenAttrs = new_ScreenAttrs; |
8997 LineOffset = new_LineOffset; | 8897 LineOffset = new_LineOffset; |
8998 LineWraps = new_LineWraps; | 8898 LineWraps = new_LineWraps; |
8999 #ifdef FEAT_WINDOWS | |
9000 TabPageIdxs = new_TabPageIdxs; | 8899 TabPageIdxs = new_TabPageIdxs; |
9001 #endif | |
9002 | 8900 |
9003 /* It's important that screen_Rows and screen_Columns reflect the actual | 8901 /* It's important that screen_Rows and screen_Columns reflect the actual |
9004 * size of ScreenLines[]. Set them before calling anything. */ | 8902 * size of ScreenLines[]. Set them before calling anything. */ |
9005 #ifdef FEAT_GUI | 8903 #ifdef FEAT_GUI |
9006 old_Rows = screen_Rows; | 8904 old_Rows = screen_Rows; |
9063 #endif | 8961 #endif |
9064 vim_free(ScreenLines); | 8962 vim_free(ScreenLines); |
9065 vim_free(ScreenAttrs); | 8963 vim_free(ScreenAttrs); |
9066 vim_free(LineOffset); | 8964 vim_free(LineOffset); |
9067 vim_free(LineWraps); | 8965 vim_free(LineWraps); |
9068 #ifdef FEAT_WINDOWS | |
9069 vim_free(TabPageIdxs); | 8966 vim_free(TabPageIdxs); |
9070 #endif | |
9071 } | 8967 } |
9072 | 8968 |
9073 void | 8969 void |
9074 screenclear(void) | 8970 screenclear(void) |
9075 { | 8971 { |
9124 | 9020 |
9125 screen_cleared = TRUE; /* can use contents of ScreenLines now */ | 9021 screen_cleared = TRUE; /* can use contents of ScreenLines now */ |
9126 | 9022 |
9127 win_rest_invalid(firstwin); | 9023 win_rest_invalid(firstwin); |
9128 redraw_cmdline = TRUE; | 9024 redraw_cmdline = TRUE; |
9129 #ifdef FEAT_WINDOWS | |
9130 redraw_tabline = TRUE; | 9025 redraw_tabline = TRUE; |
9131 #endif | |
9132 if (must_redraw == CLEAR) /* no need to clear again */ | 9026 if (must_redraw == CLEAR) /* no need to clear again */ |
9133 must_redraw = NOT_VALID; | 9027 must_redraw = NOT_VALID; |
9134 compute_cmdrow(); | 9028 compute_cmdrow(); |
9135 msg_row = cmdline_row; /* put cursor on last line for messages */ | 9029 msg_row = cmdline_row; /* put cursor on last line for messages */ |
9136 msg_col = 0; | 9030 msg_col = 0; |
9163 lineinvalid(unsigned off, int width) | 9057 lineinvalid(unsigned off, int width) |
9164 { | 9058 { |
9165 (void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T)); | 9059 (void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T)); |
9166 } | 9060 } |
9167 | 9061 |
9168 #ifdef FEAT_WINDOWS | |
9169 /* | 9062 /* |
9170 * Copy part of a Screenline for vertically split window "wp". | 9063 * Copy part of a Screenline for vertically split window "wp". |
9171 */ | 9064 */ |
9172 static void | 9065 static void |
9173 linecopy(int to, int from, win_T *wp) | 9066 linecopy(int to, int from, win_T *wp) |
9175 unsigned off_to = LineOffset[to] + wp->w_wincol; | 9068 unsigned off_to = LineOffset[to] + wp->w_wincol; |
9176 unsigned off_from = LineOffset[from] + wp->w_wincol; | 9069 unsigned off_from = LineOffset[from] + wp->w_wincol; |
9177 | 9070 |
9178 mch_memmove(ScreenLines + off_to, ScreenLines + off_from, | 9071 mch_memmove(ScreenLines + off_to, ScreenLines + off_from, |
9179 wp->w_width * sizeof(schar_T)); | 9072 wp->w_width * sizeof(schar_T)); |
9180 # ifdef FEAT_MBYTE | 9073 #ifdef FEAT_MBYTE |
9181 if (enc_utf8) | 9074 if (enc_utf8) |
9182 { | 9075 { |
9183 int i; | 9076 int i; |
9184 | 9077 |
9185 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from, | 9078 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from, |
9189 wp->w_width * sizeof(u8char_T)); | 9082 wp->w_width * sizeof(u8char_T)); |
9190 } | 9083 } |
9191 if (enc_dbcs == DBCS_JPNU) | 9084 if (enc_dbcs == DBCS_JPNU) |
9192 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from, | 9085 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from, |
9193 wp->w_width * sizeof(schar_T)); | 9086 wp->w_width * sizeof(schar_T)); |
9194 # endif | 9087 #endif |
9195 mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from, | 9088 mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from, |
9196 wp->w_width * sizeof(sattr_T)); | 9089 wp->w_width * sizeof(sattr_T)); |
9197 } | 9090 } |
9198 #endif | |
9199 | 9091 |
9200 /* | 9092 /* |
9201 * Return TRUE if clearing with term string "p" would work. | 9093 * Return TRUE if clearing with term string "p" would work. |
9202 * It can't work when the string is empty or it won't set the right background. | 9094 * It can't work when the string is empty or it won't set the right background. |
9203 */ | 9095 */ |
9547 * lines at the bottom to avoid messing what is after the window. | 9439 * lines at the bottom to avoid messing what is after the window. |
9548 * If this fails and there are following windows, don't do anything to avoid | 9440 * If this fails and there are following windows, don't do anything to avoid |
9549 * messing up those windows, better just redraw. | 9441 * messing up those windows, better just redraw. |
9550 */ | 9442 */ |
9551 did_delete = FALSE; | 9443 did_delete = FALSE; |
9552 #ifdef FEAT_WINDOWS | |
9553 if (wp->w_next != NULL || wp->w_status_height) | 9444 if (wp->w_next != NULL || wp->w_status_height) |
9554 { | 9445 { |
9555 if (screen_del_lines(0, W_WINROW(wp) + wp->w_height - line_count, | 9446 if (screen_del_lines(0, W_WINROW(wp) + wp->w_height - line_count, |
9556 line_count, (int)Rows, FALSE, 0, NULL) == OK) | 9447 line_count, (int)Rows, FALSE, 0, NULL) == OK) |
9557 did_delete = TRUE; | 9448 did_delete = TRUE; |
9558 else if (wp->w_next) | 9449 else if (wp->w_next) |
9559 return FAIL; | 9450 return FAIL; |
9560 } | 9451 } |
9561 #endif | |
9562 /* | 9452 /* |
9563 * if no lines deleted, blank the lines that will end up below the window | 9453 * if no lines deleted, blank the lines that will end up below the window |
9564 */ | 9454 */ |
9565 if (!did_delete) | 9455 if (!did_delete) |
9566 { | 9456 { |
9567 #ifdef FEAT_WINDOWS | |
9568 wp->w_redr_status = TRUE; | 9457 wp->w_redr_status = TRUE; |
9569 #endif | |
9570 redraw_cmdline = TRUE; | 9458 redraw_cmdline = TRUE; |
9571 nextrow = W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp); | 9459 nextrow = W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp); |
9572 lastrow = nextrow + line_count; | 9460 lastrow = nextrow + line_count; |
9573 if (lastrow > Rows) | 9461 if (lastrow > Rows) |
9574 lastrow = Rows; | 9462 lastrow = Rows; |
9581 == FAIL) | 9469 == FAIL) |
9582 { | 9470 { |
9583 /* deletion will have messed up other windows */ | 9471 /* deletion will have messed up other windows */ |
9584 if (did_delete) | 9472 if (did_delete) |
9585 { | 9473 { |
9586 #ifdef FEAT_WINDOWS | |
9587 wp->w_redr_status = TRUE; | 9474 wp->w_redr_status = TRUE; |
9588 #endif | |
9589 win_rest_invalid(W_NEXT(wp)); | 9475 win_rest_invalid(W_NEXT(wp)); |
9590 } | 9476 } |
9591 return FAIL; | 9477 return FAIL; |
9592 } | 9478 } |
9593 | 9479 |
9624 | 9510 |
9625 if (screen_del_lines(0, W_WINROW(wp) + row, line_count, | 9511 if (screen_del_lines(0, W_WINROW(wp) + row, line_count, |
9626 (int)Rows, FALSE, clear_attr, NULL) == FAIL) | 9512 (int)Rows, FALSE, clear_attr, NULL) == FAIL) |
9627 return FAIL; | 9513 return FAIL; |
9628 | 9514 |
9629 #ifdef FEAT_WINDOWS | |
9630 /* | 9515 /* |
9631 * If there are windows or status lines below, try to put them at the | 9516 * If there are windows or status lines below, try to put them at the |
9632 * correct place. If we can't do that, they have to be redrawn. | 9517 * correct place. If we can't do that, they have to be redrawn. |
9633 */ | 9518 */ |
9634 if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1) | 9519 if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1) |
9643 /* | 9528 /* |
9644 * If this is the last window and there is no status line, redraw the | 9529 * If this is the last window and there is no status line, redraw the |
9645 * command line later. | 9530 * command line later. |
9646 */ | 9531 */ |
9647 else | 9532 else |
9648 #endif | |
9649 redraw_cmdline = TRUE; | 9533 redraw_cmdline = TRUE; |
9650 return OK; | 9534 return OK; |
9651 } | 9535 } |
9652 | 9536 |
9653 /* | 9537 /* |
9673 * the lines. */ | 9557 * the lines. */ |
9674 if (no_win_do_lines_ins && !del) | 9558 if (no_win_do_lines_ins && !del) |
9675 return FAIL; | 9559 return FAIL; |
9676 | 9560 |
9677 /* only a few lines left: redraw is faster */ | 9561 /* only a few lines left: redraw is faster */ |
9678 if (mayclear && Rows - line_count < 5 | 9562 if (mayclear && Rows - line_count < 5 && wp->w_width == Columns) |
9679 #ifdef FEAT_WINDOWS | |
9680 && wp->w_width == Columns | |
9681 #endif | |
9682 ) | |
9683 { | 9563 { |
9684 if (!no_win_do_lines_ins) | 9564 if (!no_win_do_lines_ins) |
9685 screenclear(); /* will set wp->w_lines_valid to 0 */ | 9565 screenclear(); /* will set wp->w_lines_valid to 0 */ |
9686 return FAIL; | 9566 return FAIL; |
9687 } | 9567 } |
9712 * win_line(). | 9592 * win_line(). |
9713 * Don't use a scroll region when we are going to redraw the text, writing | 9593 * Don't use a scroll region when we are going to redraw the text, writing |
9714 * a character in the lower right corner of the scroll region may cause a | 9594 * a character in the lower right corner of the scroll region may cause a |
9715 * scroll-up . | 9595 * scroll-up . |
9716 */ | 9596 */ |
9717 if (scroll_region | 9597 if (scroll_region || W_WIDTH(wp) != Columns) |
9718 #ifdef FEAT_WINDOWS | 9598 { |
9719 || W_WIDTH(wp) != Columns | |
9720 #endif | |
9721 ) | |
9722 { | |
9723 #ifdef FEAT_WINDOWS | |
9724 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) | 9599 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) |
9725 #endif | |
9726 scroll_region_set(wp, row); | 9600 scroll_region_set(wp, row); |
9727 if (del) | 9601 if (del) |
9728 retval = screen_del_lines(W_WINROW(wp) + row, 0, line_count, | 9602 retval = screen_del_lines(W_WINROW(wp) + row, 0, line_count, |
9729 wp->w_height - row, FALSE, clear_attr, wp); | 9603 wp->w_height - row, FALSE, clear_attr, wp); |
9730 else | 9604 else |
9731 retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count, | 9605 retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count, |
9732 wp->w_height - row, clear_attr, wp); | 9606 wp->w_height - row, clear_attr, wp); |
9733 #ifdef FEAT_WINDOWS | |
9734 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) | 9607 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) |
9735 #endif | |
9736 scroll_region_reset(); | 9608 scroll_region_reset(); |
9737 return retval; | 9609 return retval; |
9738 } | 9610 } |
9739 | 9611 |
9740 #ifdef FEAT_WINDOWS | |
9741 if (wp->w_next != NULL && p_tf) /* don't delete/insert on fast terminal */ | 9612 if (wp->w_next != NULL && p_tf) /* don't delete/insert on fast terminal */ |
9742 return FAIL; | 9613 return FAIL; |
9743 #endif | |
9744 | 9614 |
9745 return MAYBE; | 9615 return MAYBE; |
9746 } | 9616 } |
9747 | 9617 |
9748 /* | 9618 /* |
9749 * window 'wp' and everything after it is messed up, mark it for redraw | 9619 * window 'wp' and everything after it is messed up, mark it for redraw |
9750 */ | 9620 */ |
9751 static void | 9621 static void |
9752 win_rest_invalid(win_T *wp) | 9622 win_rest_invalid(win_T *wp) |
9753 { | 9623 { |
9754 #ifdef FEAT_WINDOWS | |
9755 while (wp != NULL) | 9624 while (wp != NULL) |
9756 #else | |
9757 if (wp != NULL) | |
9758 #endif | |
9759 { | 9625 { |
9760 redraw_win_later(wp, NOT_VALID); | 9626 redraw_win_later(wp, NOT_VALID); |
9761 #ifdef FEAT_WINDOWS | |
9762 wp->w_redr_status = TRUE; | 9627 wp->w_redr_status = TRUE; |
9763 wp = wp->w_next; | 9628 wp = wp->w_next; |
9764 #endif | |
9765 } | 9629 } |
9766 redraw_cmdline = TRUE; | 9630 redraw_cmdline = TRUE; |
9767 } | 9631 } |
9768 | 9632 |
9769 /* | 9633 /* |
9854 * Careful: In a hpterm scroll reverse doesn't work as expected, it moves | 9718 * Careful: In a hpterm scroll reverse doesn't work as expected, it moves |
9855 * the scrollbar for the window. It does have insert line, use that if it | 9719 * the scrollbar for the window. It does have insert line, use that if it |
9856 * exists. | 9720 * exists. |
9857 */ | 9721 */ |
9858 result_empty = (row + line_count >= end); | 9722 result_empty = (row + line_count >= end); |
9859 #ifdef FEAT_WINDOWS | |
9860 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) | 9723 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) |
9861 type = USE_REDRAW; | 9724 type = USE_REDRAW; |
9862 else | 9725 else if (can_clear(T_CD) && result_empty) |
9863 #endif | |
9864 if (can_clear(T_CD) && result_empty) | |
9865 type = USE_T_CD; | 9726 type = USE_T_CD; |
9866 else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL)) | 9727 else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL)) |
9867 type = USE_T_CAL; | 9728 type = USE_T_CAL; |
9868 else if (*T_CDL != NUL && result_empty && (line_count > 1 || !can_ce)) | 9729 else if (*T_CDL != NUL && result_empty && (line_count > 1 || !can_ce)) |
9869 type = USE_T_CDL; | 9730 type = USE_T_CDL; |
9895 screen_del_lines(off, end - line_count, line_count, end, FALSE, 0, wp); | 9756 screen_del_lines(off, end - line_count, line_count, end, FALSE, 0, wp); |
9896 | 9757 |
9897 #ifdef FEAT_CLIPBOARD | 9758 #ifdef FEAT_CLIPBOARD |
9898 /* Remove a modeless selection when inserting lines halfway the screen | 9759 /* Remove a modeless selection when inserting lines halfway the screen |
9899 * or not the full width of the screen. */ | 9760 * or not the full width of the screen. */ |
9900 if (off + row > 0 | 9761 if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) |
9901 # ifdef FEAT_WINDOWS | |
9902 || (wp != NULL && wp->w_width != Columns) | |
9903 # endif | |
9904 ) | |
9905 clip_clear_selection(&clip_star); | 9762 clip_clear_selection(&clip_star); |
9906 else | 9763 else |
9907 clip_scroll_selection(-line_count); | 9764 clip_scroll_selection(-line_count); |
9908 #endif | 9765 #endif |
9909 | 9766 |
9924 */ | 9781 */ |
9925 row += off; | 9782 row += off; |
9926 end += off; | 9783 end += off; |
9927 for (i = 0; i < line_count; ++i) | 9784 for (i = 0; i < line_count; ++i) |
9928 { | 9785 { |
9929 #ifdef FEAT_WINDOWS | |
9930 if (wp != NULL && wp->w_width != Columns) | 9786 if (wp != NULL && wp->w_width != Columns) |
9931 { | 9787 { |
9932 /* need to copy part of a line */ | 9788 /* need to copy part of a line */ |
9933 j = end - 1 - i; | 9789 j = end - 1 - i; |
9934 while ((j -= line_count) >= row) | 9790 while ((j -= line_count) >= row) |
9940 else | 9796 else |
9941 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); | 9797 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); |
9942 LineWraps[j] = FALSE; | 9798 LineWraps[j] = FALSE; |
9943 } | 9799 } |
9944 else | 9800 else |
9945 #endif | |
9946 { | 9801 { |
9947 j = end - 1 - i; | 9802 j = end - 1 - i; |
9948 temp = LineOffset[j]; | 9803 temp = LineOffset[j]; |
9949 while ((j -= line_count) >= row) | 9804 while ((j -= line_count) >= row) |
9950 { | 9805 { |
9963 screen_stop_highlight(); | 9818 screen_stop_highlight(); |
9964 windgoto(cursor_row, 0); | 9819 windgoto(cursor_row, 0); |
9965 if (clear_attr != 0) | 9820 if (clear_attr != 0) |
9966 screen_start_highlight(clear_attr); | 9821 screen_start_highlight(clear_attr); |
9967 | 9822 |
9968 #ifdef FEAT_WINDOWS | |
9969 /* redraw the characters */ | 9823 /* redraw the characters */ |
9970 if (type == USE_REDRAW) | 9824 if (type == USE_REDRAW) |
9971 redraw_block(row, end, wp); | 9825 redraw_block(row, end, wp); |
9972 else | 9826 else if (type == USE_T_CAL) |
9973 #endif | |
9974 if (type == USE_T_CAL) | |
9975 { | 9827 { |
9976 term_append_lines(line_count); | 9828 term_append_lines(line_count); |
9977 screen_start(); /* don't know where cursor is now */ | 9829 screen_start(); /* don't know where cursor is now */ |
9978 } | 9830 } |
9979 else | 9831 else |
10079 * none of the other ways work. | 9931 * none of the other ways work. |
10080 * 4. Use T_CE (erase line) if the result is empty. | 9932 * 4. Use T_CE (erase line) if the result is empty. |
10081 * 5. Use T_DL (delete line) if it exists. | 9933 * 5. Use T_DL (delete line) if it exists. |
10082 * 6. redraw the characters from ScreenLines[]. | 9934 * 6. redraw the characters from ScreenLines[]. |
10083 */ | 9935 */ |
10084 #ifdef FEAT_WINDOWS | |
10085 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) | 9936 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) |
10086 type = USE_REDRAW; | 9937 type = USE_REDRAW; |
10087 else | 9938 else if (can_clear(T_CD) && result_empty) |
10088 #endif | |
10089 if (can_clear(T_CD) && result_empty) | |
10090 type = USE_T_CD; | 9939 type = USE_T_CD; |
10091 #if defined(__BEOS__) && defined(BEOS_DR8) | 9940 #if defined(__BEOS__) && defined(BEOS_DR8) |
10092 /* | 9941 /* |
10093 * USE_NL does not seem to work in Terminal of DR8 so we set T_DB="" in | 9942 * USE_NL does not seem to work in Terminal of DR8 so we set T_DB="" in |
10094 * its internal termcap... this works okay for tests which test *T_DB != | 9943 * its internal termcap... this works okay for tests which test *T_DB != |
10111 #endif | 9960 #endif |
10112 type = USE_NL; | 9961 type = USE_NL; |
10113 else if (*T_CDL != NUL && line_count > 1 && can_delete) | 9962 else if (*T_CDL != NUL && line_count > 1 && can_delete) |
10114 type = USE_T_CDL; | 9963 type = USE_T_CDL; |
10115 else if (can_clear(T_CE) && result_empty | 9964 else if (can_clear(T_CE) && result_empty |
10116 #ifdef FEAT_WINDOWS | 9965 && (wp == NULL || wp->w_width == Columns)) |
10117 && (wp == NULL || wp->w_width == Columns) | |
10118 #endif | |
10119 ) | |
10120 type = USE_T_CE; | 9966 type = USE_T_CE; |
10121 else if (*T_DL != NUL && can_delete) | 9967 else if (*T_DL != NUL && can_delete) |
10122 type = USE_T_DL; | 9968 type = USE_T_DL; |
10123 else if (*T_CDL != NUL && can_delete) | 9969 else if (*T_CDL != NUL && can_delete) |
10124 type = USE_T_CDL; | 9970 type = USE_T_CDL; |
10126 return FAIL; | 9972 return FAIL; |
10127 | 9973 |
10128 #ifdef FEAT_CLIPBOARD | 9974 #ifdef FEAT_CLIPBOARD |
10129 /* Remove a modeless selection when deleting lines halfway the screen or | 9975 /* Remove a modeless selection when deleting lines halfway the screen or |
10130 * not the full width of the screen. */ | 9976 * not the full width of the screen. */ |
10131 if (off + row > 0 | 9977 if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) |
10132 # ifdef FEAT_WINDOWS | |
10133 || (wp != NULL && wp->w_width != Columns) | |
10134 # endif | |
10135 ) | |
10136 clip_clear_selection(&clip_star); | 9978 clip_clear_selection(&clip_star); |
10137 else | 9979 else |
10138 clip_scroll_selection(line_count); | 9980 clip_scroll_selection(line_count); |
10139 #endif | 9981 #endif |
10140 | 9982 |
10162 */ | 10004 */ |
10163 row += off; | 10005 row += off; |
10164 end += off; | 10006 end += off; |
10165 for (i = 0; i < line_count; ++i) | 10007 for (i = 0; i < line_count; ++i) |
10166 { | 10008 { |
10167 #ifdef FEAT_WINDOWS | |
10168 if (wp != NULL && wp->w_width != Columns) | 10009 if (wp != NULL && wp->w_width != Columns) |
10169 { | 10010 { |
10170 /* need to copy part of a line */ | 10011 /* need to copy part of a line */ |
10171 j = row + i; | 10012 j = row + i; |
10172 while ((j += line_count) <= end - 1) | 10013 while ((j += line_count) <= end - 1) |
10178 else | 10019 else |
10179 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); | 10020 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); |
10180 LineWraps[j] = FALSE; | 10021 LineWraps[j] = FALSE; |
10181 } | 10022 } |
10182 else | 10023 else |
10183 #endif | |
10184 { | 10024 { |
10185 /* whole width, moving the line pointers is faster */ | 10025 /* whole width, moving the line pointers is faster */ |
10186 j = row + i; | 10026 j = row + i; |
10187 temp = LineOffset[j]; | 10027 temp = LineOffset[j]; |
10188 while ((j += line_count) <= end - 1) | 10028 while ((j += line_count) <= end - 1) |
10202 if (screen_attr != clear_attr) | 10042 if (screen_attr != clear_attr) |
10203 screen_stop_highlight(); | 10043 screen_stop_highlight(); |
10204 if (clear_attr != 0) | 10044 if (clear_attr != 0) |
10205 screen_start_highlight(clear_attr); | 10045 screen_start_highlight(clear_attr); |
10206 | 10046 |
10207 #ifdef FEAT_WINDOWS | |
10208 /* redraw the characters */ | 10047 /* redraw the characters */ |
10209 if (type == USE_REDRAW) | 10048 if (type == USE_REDRAW) |
10210 redraw_block(row, end, wp); | 10049 redraw_block(row, end, wp); |
10211 else | 10050 else if (type == USE_T_CD) /* delete the lines */ |
10212 #endif | |
10213 if (type == USE_T_CD) /* delete the lines */ | |
10214 { | 10051 { |
10215 windgoto(cursor_row, 0); | 10052 windgoto(cursor_row, 0); |
10216 out_str(T_CD); | 10053 out_str(T_CD); |
10217 screen_start(); /* don't know where cursor is now */ | 10054 screen_start(); /* don't know where cursor is now */ |
10218 } | 10055 } |
10485 if (VIsual_active) | 10322 if (VIsual_active) |
10486 clear_showcmd(); | 10323 clear_showcmd(); |
10487 | 10324 |
10488 /* If the last window has no status line, the ruler is after the mode | 10325 /* If the last window has no status line, the ruler is after the mode |
10489 * message and must be redrawn */ | 10326 * message and must be redrawn */ |
10490 if (redrawing() | 10327 if (redrawing() && lastwin->w_status_height == 0) |
10491 # ifdef FEAT_WINDOWS | |
10492 && lastwin->w_status_height == 0 | |
10493 # endif | |
10494 ) | |
10495 win_redr_ruler(lastwin, TRUE); | 10328 win_redr_ruler(lastwin, TRUE); |
10496 #endif | 10329 #endif |
10497 redraw_cmdline = FALSE; | 10330 redraw_cmdline = FALSE; |
10498 clear_cmdline = FALSE; | 10331 clear_cmdline = FALSE; |
10499 | 10332 |
10549 sprintf((char *)s, " @%c", Recording); | 10382 sprintf((char *)s, " @%c", Recording); |
10550 MSG_PUTS_ATTR(s, attr); | 10383 MSG_PUTS_ATTR(s, attr); |
10551 } | 10384 } |
10552 } | 10385 } |
10553 | 10386 |
10554 #if defined(FEAT_WINDOWS) | |
10555 /* | 10387 /* |
10556 * Draw the tab pages line at the top of the Vim window. | 10388 * Draw the tab pages line at the top of the Vim window. |
10557 */ | 10389 */ |
10558 static void | 10390 static void |
10559 draw_tabline(void) | 10391 draw_tabline(void) |
10752 vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1); | 10584 vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1); |
10753 else | 10585 else |
10754 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE); | 10586 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE); |
10755 trans_characters(NameBuff, MAXPATHL); | 10587 trans_characters(NameBuff, MAXPATHL); |
10756 } | 10588 } |
10757 #endif | 10589 |
10758 | |
10759 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) | |
10760 /* | 10590 /* |
10761 * Get the character to use in a status line. Get its attributes in "*attr". | 10591 * Get the character to use in a status line. Get its attributes in "*attr". |
10762 */ | 10592 */ |
10763 static int | 10593 static int |
10764 fillchar_status(int *attr, win_T *wp) | 10594 fillchar_status(int *attr, win_T *wp) |
10800 return fill; | 10630 return fill; |
10801 if (wp == curwin) | 10631 if (wp == curwin) |
10802 return '^'; | 10632 return '^'; |
10803 return '='; | 10633 return '='; |
10804 } | 10634 } |
10805 #endif | 10635 |
10806 | |
10807 #ifdef FEAT_WINDOWS | |
10808 /* | 10636 /* |
10809 * Get the character to use in a separator between vertically split windows. | 10637 * Get the character to use in a separator between vertically split windows. |
10810 * Get its attributes in "*attr". | 10638 * Get its attributes in "*attr". |
10811 */ | 10639 */ |
10812 static int | 10640 static int |
10816 if (*attr == 0 && fill_vert == ' ') | 10644 if (*attr == 0 && fill_vert == ' ') |
10817 return '|'; | 10645 return '|'; |
10818 else | 10646 else |
10819 return fill_vert; | 10647 return fill_vert; |
10820 } | 10648 } |
10821 #endif | |
10822 | 10649 |
10823 /* | 10650 /* |
10824 * Return TRUE if redrawing should currently be done. | 10651 * Return TRUE if redrawing should currently be done. |
10825 */ | 10652 */ |
10826 int | 10653 int |
10854 if (!always && !redrawing()) | 10681 if (!always && !redrawing()) |
10855 return; | 10682 return; |
10856 #ifdef FEAT_INS_EXPAND | 10683 #ifdef FEAT_INS_EXPAND |
10857 if (pum_visible()) | 10684 if (pum_visible()) |
10858 { | 10685 { |
10859 # ifdef FEAT_WINDOWS | |
10860 /* Don't redraw right now, do it later. */ | 10686 /* Don't redraw right now, do it later. */ |
10861 curwin->w_redr_status = TRUE; | 10687 curwin->w_redr_status = TRUE; |
10862 # endif | |
10863 return; | 10688 return; |
10864 } | 10689 } |
10865 #endif | 10690 #endif |
10866 #if defined(FEAT_STL_OPT) && defined(FEAT_WINDOWS) | 10691 #if defined(FEAT_STL_OPT) |
10867 if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height) | 10692 if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height) |
10868 { | 10693 { |
10869 redraw_custom_statusline(curwin); | 10694 redraw_custom_statusline(curwin); |
10870 } | 10695 } |
10871 else | 10696 else |
10881 || (p_title && (stl_syntax & STL_IN_TITLE)) | 10706 || (p_title && (stl_syntax & STL_IN_TITLE)) |
10882 # endif | 10707 # endif |
10883 ) | 10708 ) |
10884 maketitle(); | 10709 maketitle(); |
10885 #endif | 10710 #endif |
10886 #ifdef FEAT_WINDOWS | |
10887 /* Redraw the tab pages line if needed. */ | 10711 /* Redraw the tab pages line if needed. */ |
10888 if (redraw_tabline) | 10712 if (redraw_tabline) |
10889 draw_tabline(); | 10713 draw_tabline(); |
10890 #endif | |
10891 } | 10714 } |
10892 | 10715 |
10893 #ifdef FEAT_CMDL_INFO | 10716 #ifdef FEAT_CMDL_INFO |
10894 static void | 10717 static void |
10895 win_redr_ruler(win_T *wp, int always) | 10718 win_redr_ruler(win_T *wp, int always) |
10902 int empty_line = FALSE; | 10725 int empty_line = FALSE; |
10903 colnr_T virtcol; | 10726 colnr_T virtcol; |
10904 int i; | 10727 int i; |
10905 size_t len; | 10728 size_t len; |
10906 int o; | 10729 int o; |
10907 #ifdef FEAT_WINDOWS | |
10908 int this_ru_col; | 10730 int this_ru_col; |
10909 int off = 0; | 10731 int off = 0; |
10910 int width = Columns; | 10732 int width = Columns; |
10911 # define WITH_OFF(x) x | |
10912 # define WITH_WIDTH(x) x | |
10913 #else | |
10914 # define WITH_OFF(x) 0 | |
10915 # define WITH_WIDTH(x) Columns | |
10916 # define this_ru_col ru_col | |
10917 #endif | |
10918 | 10733 |
10919 /* If 'ruler' off or redrawing disabled, don't do anything */ | 10734 /* If 'ruler' off or redrawing disabled, don't do anything */ |
10920 if (!p_ru) | 10735 if (!p_ru) |
10921 return; | 10736 return; |
10922 | 10737 |
10928 return; | 10743 return; |
10929 | 10744 |
10930 #ifdef FEAT_INS_EXPAND | 10745 #ifdef FEAT_INS_EXPAND |
10931 /* Don't draw the ruler while doing insert-completion, it might overwrite | 10746 /* Don't draw the ruler while doing insert-completion, it might overwrite |
10932 * the (long) mode message. */ | 10747 * the (long) mode message. */ |
10933 # ifdef FEAT_WINDOWS | |
10934 if (wp == lastwin && lastwin->w_status_height == 0) | 10748 if (wp == lastwin && lastwin->w_status_height == 0) |
10935 # endif | |
10936 if (edit_submode != NULL) | 10749 if (edit_submode != NULL) |
10937 return; | 10750 return; |
10938 /* Don't draw the ruler when the popup menu is visible, it may overlap. */ | 10751 /* Don't draw the ruler when the popup menu is visible, it may overlap. */ |
10939 if (pum_visible()) | 10752 if (pum_visible()) |
10940 return; | 10753 return; |
10980 || wp->w_topfill != wp->w_ru_topfill | 10793 || wp->w_topfill != wp->w_ru_topfill |
10981 #endif | 10794 #endif |
10982 || empty_line != wp->w_ru_empty) | 10795 || empty_line != wp->w_ru_empty) |
10983 { | 10796 { |
10984 cursor_off(); | 10797 cursor_off(); |
10985 #ifdef FEAT_WINDOWS | |
10986 if (wp->w_status_height) | 10798 if (wp->w_status_height) |
10987 { | 10799 { |
10988 row = W_WINROW(wp) + wp->w_height; | 10800 row = W_WINROW(wp) + wp->w_height; |
10989 fillchar = fillchar_status(&attr, wp); | 10801 fillchar = fillchar_status(&attr, wp); |
10990 off = W_WINCOL(wp); | 10802 off = W_WINCOL(wp); |
10991 width = W_WIDTH(wp); | 10803 width = W_WIDTH(wp); |
10992 } | 10804 } |
10993 else | 10805 else |
10994 #endif | |
10995 { | 10806 { |
10996 row = Rows - 1; | 10807 row = Rows - 1; |
10997 fillchar = ' '; | 10808 fillchar = ' '; |
10998 attr = 0; | 10809 attr = 0; |
10999 #ifdef FEAT_WINDOWS | |
11000 width = Columns; | 10810 width = Columns; |
11001 off = 0; | 10811 off = 0; |
11002 #endif | |
11003 } | 10812 } |
11004 | 10813 |
11005 /* In list mode virtcol needs to be recomputed */ | 10814 /* In list mode virtcol needs to be recomputed */ |
11006 virtcol = wp->w_virtcol; | 10815 virtcol = wp->w_virtcol; |
11007 if (wp->w_p_list && lcs_tab1 == NUL) | 10816 if (wp->w_p_list && lcs_tab1 == NUL) |
11030 * screen up on some terminals). | 10839 * screen up on some terminals). |
11031 */ | 10840 */ |
11032 i = (int)STRLEN(buffer); | 10841 i = (int)STRLEN(buffer); |
11033 get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1); | 10842 get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1); |
11034 o = i + vim_strsize(buffer + i + 1); | 10843 o = i + vim_strsize(buffer + i + 1); |
11035 #ifdef FEAT_WINDOWS | |
11036 if (wp->w_status_height == 0) /* can't use last char of screen */ | 10844 if (wp->w_status_height == 0) /* can't use last char of screen */ |
11037 #endif | |
11038 ++o; | 10845 ++o; |
11039 #ifdef FEAT_WINDOWS | |
11040 this_ru_col = ru_col - (Columns - width); | 10846 this_ru_col = ru_col - (Columns - width); |
11041 if (this_ru_col < 0) | 10847 if (this_ru_col < 0) |
11042 this_ru_col = 0; | 10848 this_ru_col = 0; |
11043 #endif | |
11044 /* Never use more than half the window/screen width, leave the other | 10849 /* Never use more than half the window/screen width, leave the other |
11045 * half for the filename. */ | 10850 * half for the filename. */ |
11046 if (this_ru_col < (WITH_WIDTH(width) + 1) / 2) | 10851 if (this_ru_col < (width + 1) / 2) |
11047 this_ru_col = (WITH_WIDTH(width) + 1) / 2; | 10852 this_ru_col = (width + 1) / 2; |
11048 if (this_ru_col + o < WITH_WIDTH(width)) | 10853 if (this_ru_col + o < width) |
11049 { | 10854 { |
11050 /* need at least 3 chars left for get_rel_pos() + NUL */ | 10855 /* need at least 3 chars left for get_rel_pos() + NUL */ |
11051 while (this_ru_col + o < WITH_WIDTH(width) && RULER_BUF_LEN > i + 4) | 10856 while (this_ru_col + o < width && RULER_BUF_LEN > i + 4) |
11052 { | 10857 { |
11053 #ifdef FEAT_MBYTE | 10858 #ifdef FEAT_MBYTE |
11054 if (has_mbyte) | 10859 if (has_mbyte) |
11055 i += (*mb_char2bytes)(fillchar, buffer + i); | 10860 i += (*mb_char2bytes)(fillchar, buffer + i); |
11056 else | 10861 else |
11066 { | 10871 { |
11067 o = 0; | 10872 o = 0; |
11068 for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) | 10873 for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i)) |
11069 { | 10874 { |
11070 o += (*mb_ptr2cells)(buffer + i); | 10875 o += (*mb_ptr2cells)(buffer + i); |
11071 if (this_ru_col + o > WITH_WIDTH(width)) | 10876 if (this_ru_col + o > width) |
11072 { | 10877 { |
11073 buffer[i] = NUL; | 10878 buffer[i] = NUL; |
11074 break; | 10879 break; |
11075 } | 10880 } |
11076 } | 10881 } |
11077 } | 10882 } |
11078 else | 10883 else |
11079 #endif | 10884 #endif |
11080 if (this_ru_col + (int)STRLEN(buffer) > WITH_WIDTH(width)) | 10885 if (this_ru_col + (int)STRLEN(buffer) > width) |
11081 buffer[WITH_WIDTH(width) - this_ru_col] = NUL; | 10886 buffer[width - this_ru_col] = NUL; |
11082 | 10887 |
11083 screen_puts(buffer, row, this_ru_col + WITH_OFF(off), attr); | 10888 screen_puts(buffer, row, this_ru_col + off, attr); |
11084 i = redraw_cmdline; | 10889 i = redraw_cmdline; |
11085 screen_fill(row, row + 1, | 10890 screen_fill(row, row + 1, |
11086 this_ru_col + WITH_OFF(off) + (int)STRLEN(buffer), | 10891 this_ru_col + off + (int)STRLEN(buffer), |
11087 (int)(WITH_OFF(off) + WITH_WIDTH(width)), | 10892 (int)(off + width), |
11088 fillchar, fillchar, attr); | 10893 fillchar, fillchar, attr); |
11089 /* don't redraw the cmdline because of showing the ruler */ | 10894 /* don't redraw the cmdline because of showing the ruler */ |
11090 redraw_cmdline = i; | 10895 redraw_cmdline = i; |
11091 wp->w_ru_cursor = wp->w_cursor; | 10896 wp->w_ru_cursor = wp->w_cursor; |
11092 wp->w_ru_virtcol = wp->w_virtcol; | 10897 wp->w_ru_virtcol = wp->w_virtcol; |