Mercurial > vim
comparison src/screen.c @ 5735:50dbef5e774a v7.4.212
updated for version 7.4.212
Problem: Now that the +visual feature is always enabled the #ifdefs for it
are not useful.
Solution: Remove the checks for FEAT_VISUAL.
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Sun, 23 Mar 2014 15:13:05 +0100 |
parents | 62c720661f81 |
children | 662ae48e7e24 |
comparison
equal
deleted
inserted
replaced
5734:657ade71d395 | 5735:50dbef5e774a |
---|---|
444 curwin->w_lines[i].wl_valid = FALSE; | 444 curwin->w_lines[i].wl_valid = FALSE; |
445 } | 445 } |
446 #endif | 446 #endif |
447 } | 447 } |
448 | 448 |
449 #if defined(FEAT_RUBY) || defined(FEAT_PERL) || defined(FEAT_VISUAL) || \ | |
450 (defined(FEAT_CLIPBOARD) && defined(FEAT_X11)) || defined(PROTO) | |
451 /* | 449 /* |
452 * update all windows that are editing the current buffer | 450 * update all windows that are editing the current buffer |
453 */ | 451 */ |
454 void | 452 void |
455 update_curbuf(type) | 453 update_curbuf(type) |
456 int type; | 454 int type; |
457 { | 455 { |
458 redraw_curbuf_later(type); | 456 redraw_curbuf_later(type); |
459 update_screen(type); | 457 update_screen(type); |
460 } | 458 } |
461 #endif | |
462 | 459 |
463 /* | 460 /* |
464 * update_screen() | 461 * update_screen() |
465 * | 462 * |
466 * Based on the current value of curwin->w_topline, transfer a screenfull | 463 * Based on the current value of curwin->w_topline, transfer a screenfull |
594 #ifdef FEAT_DIFF | 591 #ifdef FEAT_DIFF |
595 && curwin->w_topfill == curwin->w_old_topfill | 592 && curwin->w_topfill == curwin->w_old_topfill |
596 && curwin->w_botfill == curwin->w_old_botfill | 593 && curwin->w_botfill == curwin->w_old_botfill |
597 #endif | 594 #endif |
598 && curwin->w_topline == curwin->w_lines[0].wl_lnum) | 595 && curwin->w_topline == curwin->w_lines[0].wl_lnum) |
599 #ifdef FEAT_VISUAL | |
600 || (type == INVERTED | 596 || (type == INVERTED |
601 && VIsual_active | 597 && VIsual_active |
602 && curwin->w_old_cursor_lnum == curwin->w_cursor.lnum | 598 && curwin->w_old_cursor_lnum == curwin->w_cursor.lnum |
603 && curwin->w_old_visual_mode == VIsual_mode | 599 && curwin->w_old_visual_mode == VIsual_mode |
604 && (curwin->w_valid & VALID_VIRTCOL) | 600 && (curwin->w_valid & VALID_VIRTCOL) |
605 && curwin->w_old_curswant == curwin->w_curswant) | 601 && curwin->w_old_curswant == curwin->w_curswant) |
606 #endif | |
607 )) | 602 )) |
608 curwin->w_redr_type = type; | 603 curwin->w_redr_type = type; |
609 | 604 |
610 #ifdef FEAT_WINDOWS | 605 #ifdef FEAT_WINDOWS |
611 /* Redraw the tab pages line if needed. */ | 606 /* Redraw the tab pages line if needed. */ |
1028 updating. 999 when no mid area updating. */ | 1023 updating. 999 when no mid area updating. */ |
1029 int mid_end = 0; /* Below last row of the mid area that needs | 1024 int mid_end = 0; /* Below last row of the mid area that needs |
1030 updating. 0 when no mid area updating. */ | 1025 updating. 0 when no mid area updating. */ |
1031 int bot_start = 999;/* first row of the bot area that needs | 1026 int bot_start = 999;/* first row of the bot area that needs |
1032 updating. 999 when no bot area updating */ | 1027 updating. 999 when no bot area updating */ |
1033 #ifdef FEAT_VISUAL | |
1034 int scrolled_down = FALSE; /* TRUE when scrolled down when | 1028 int scrolled_down = FALSE; /* TRUE when scrolled down when |
1035 w_topline got smaller a bit */ | 1029 w_topline got smaller a bit */ |
1036 #endif | |
1037 #ifdef FEAT_SEARCH_EXTRA | 1030 #ifdef FEAT_SEARCH_EXTRA |
1038 matchitem_T *cur; /* points to the match list */ | 1031 matchitem_T *cur; /* points to the match list */ |
1039 int top_to_mod = FALSE; /* redraw above mod_top */ | 1032 int top_to_mod = FALSE; /* redraw above mod_top */ |
1040 #endif | 1033 #endif |
1041 | 1034 |
1352 if (wp->w_lines_valid != 0) | 1345 if (wp->w_lines_valid != 0) |
1353 { | 1346 { |
1354 /* Need to update rows that are new, stop at the | 1347 /* Need to update rows that are new, stop at the |
1355 * first one that scrolled down. */ | 1348 * first one that scrolled down. */ |
1356 top_end = i; | 1349 top_end = i; |
1357 #ifdef FEAT_VISUAL | |
1358 scrolled_down = TRUE; | 1350 scrolled_down = TRUE; |
1359 #endif | |
1360 | 1351 |
1361 /* Move the entries that were scrolled, disable | 1352 /* Move the entries that were scrolled, disable |
1362 * the entries for the lines to be redrawn. */ | 1353 * the entries for the lines to be redrawn. */ |
1363 if ((wp->w_lines_valid += j) > wp->w_height) | 1354 if ((wp->w_lines_valid += j) > wp->w_height) |
1364 wp->w_lines_valid = wp->w_height; | 1355 wp->w_lines_valid = wp->w_height; |
1511 mid_start = 0; | 1502 mid_start = 0; |
1512 mid_end = wp->w_height; | 1503 mid_end = wp->w_height; |
1513 type = NOT_VALID; | 1504 type = NOT_VALID; |
1514 } | 1505 } |
1515 | 1506 |
1516 #ifdef FEAT_VISUAL | |
1517 /* check if we are updating or removing the inverted part */ | 1507 /* check if we are updating or removing the inverted part */ |
1518 if ((VIsual_active && buf == curwin->w_buffer) | 1508 if ((VIsual_active && buf == curwin->w_buffer) |
1519 || (wp->w_old_cursor_lnum != 0 && type != NOT_VALID)) | 1509 || (wp->w_old_cursor_lnum != 0 && type != NOT_VALID)) |
1520 { | 1510 { |
1521 linenr_T from, to; | 1511 linenr_T from, to; |
1706 wp->w_old_visual_mode = 0; | 1696 wp->w_old_visual_mode = 0; |
1707 wp->w_old_cursor_lnum = 0; | 1697 wp->w_old_cursor_lnum = 0; |
1708 wp->w_old_visual_lnum = 0; | 1698 wp->w_old_visual_lnum = 0; |
1709 wp->w_old_visual_col = 0; | 1699 wp->w_old_visual_col = 0; |
1710 } | 1700 } |
1711 #endif /* FEAT_VISUAL */ | |
1712 | 1701 |
1713 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA) | 1702 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA) |
1714 /* reset got_int, otherwise regexp won't work */ | 1703 /* reset got_int, otherwise regexp won't work */ |
1715 save_got_int = got_int; | 1704 save_got_int = got_int; |
1716 got_int = 0; | 1705 got_int = 0; |
2668 | 2657 |
2669 /* | 2658 /* |
2670 * 6. set highlighting for the Visual area an other text. | 2659 * 6. set highlighting for the Visual area an other text. |
2671 * If all folded lines are in the Visual area, highlight the line. | 2660 * If all folded lines are in the Visual area, highlight the line. |
2672 */ | 2661 */ |
2673 #ifdef FEAT_VISUAL | |
2674 if (VIsual_active && wp->w_buffer == curwin->w_buffer) | 2662 if (VIsual_active && wp->w_buffer == curwin->w_buffer) |
2675 { | 2663 { |
2676 if (ltoreq(curwin->w_cursor, VIsual)) | 2664 if (ltoreq(curwin->w_cursor, VIsual)) |
2677 { | 2665 { |
2678 /* Visual is after curwin->w_cursor */ | 2666 /* Visual is after curwin->w_cursor */ |
2716 /* Set all attributes of the text */ | 2704 /* Set all attributes of the text */ |
2717 RL_MEMSET(txtcol, hl_attr(HLF_V), W_WIDTH(wp) - txtcol); | 2705 RL_MEMSET(txtcol, hl_attr(HLF_V), W_WIDTH(wp) - txtcol); |
2718 } | 2706 } |
2719 } | 2707 } |
2720 } | 2708 } |
2721 #endif | |
2722 | 2709 |
2723 #ifdef FEAT_SYN_HL | 2710 #ifdef FEAT_SYN_HL |
2724 /* Show 'cursorcolumn' in the fold line. */ | 2711 /* Show 'cursorcolumn' in the fold line. */ |
2725 if (wp->w_p_cuc) | 2712 if (wp->w_p_cuc) |
2726 { | 2713 { |
2874 int n_skip = 0; /* nr of chars to skip for 'nowrap' */ | 2861 int n_skip = 0; /* nr of chars to skip for 'nowrap' */ |
2875 | 2862 |
2876 int fromcol, tocol; /* start/end of inverting */ | 2863 int fromcol, tocol; /* start/end of inverting */ |
2877 int fromcol_prev = -2; /* start of inverting after cursor */ | 2864 int fromcol_prev = -2; /* start of inverting after cursor */ |
2878 int noinvcur = FALSE; /* don't invert the cursor */ | 2865 int noinvcur = FALSE; /* don't invert the cursor */ |
2879 #ifdef FEAT_VISUAL | |
2880 pos_T *top, *bot; | 2866 pos_T *top, *bot; |
2881 int lnum_in_visual_area = FALSE; | 2867 int lnum_in_visual_area = FALSE; |
2882 #endif | |
2883 pos_T pos; | 2868 pos_T pos; |
2884 long v; | 2869 long v; |
2885 | 2870 |
2886 int char_attr = 0; /* attributes for next character */ | 2871 int char_attr = 0; /* attributes for next character */ |
2887 int attr_pri = FALSE; /* char_attr has priority */ | 2872 int attr_pri = FALSE; /* char_attr has priority */ |
3088 /* | 3073 /* |
3089 * handle visual active in this window | 3074 * handle visual active in this window |
3090 */ | 3075 */ |
3091 fromcol = -10; | 3076 fromcol = -10; |
3092 tocol = MAXCOL; | 3077 tocol = MAXCOL; |
3093 #ifdef FEAT_VISUAL | |
3094 if (VIsual_active && wp->w_buffer == curwin->w_buffer) | 3078 if (VIsual_active && wp->w_buffer == curwin->w_buffer) |
3095 { | 3079 { |
3096 /* Visual is after curwin->w_cursor */ | 3080 /* Visual is after curwin->w_cursor */ |
3097 if (ltoreq(curwin->w_cursor, VIsual)) | 3081 if (ltoreq(curwin->w_cursor, VIsual)) |
3098 { | 3082 { |
3181 } | 3165 } |
3182 | 3166 |
3183 /* | 3167 /* |
3184 * handle 'incsearch' and ":s///c" highlighting | 3168 * handle 'incsearch' and ":s///c" highlighting |
3185 */ | 3169 */ |
3186 else | 3170 else if (highlight_match |
3187 #endif /* FEAT_VISUAL */ | |
3188 if (highlight_match | |
3189 && wp == curwin | 3171 && wp == curwin |
3190 && lnum >= curwin->w_cursor.lnum | 3172 && lnum >= curwin->w_cursor.lnum |
3191 && lnum <= curwin->w_cursor.lnum + search_match_lines) | 3173 && lnum <= curwin->w_cursor.lnum + search_match_lines) |
3192 { | 3174 { |
3193 if (lnum == curwin->w_cursor.lnum) | 3175 if (lnum == curwin->w_cursor.lnum) |
3322 prev_ptr = ptr; | 3304 prev_ptr = ptr; |
3323 #endif | 3305 #endif |
3324 mb_ptr_adv(ptr); | 3306 mb_ptr_adv(ptr); |
3325 } | 3307 } |
3326 | 3308 |
3327 #if defined(FEAT_SYN_HL) || defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL) | |
3328 /* When: | 3309 /* When: |
3329 * - 'cuc' is set, or | 3310 * - 'cuc' is set, or |
3330 * - 'colorcolumn' is set, or | 3311 * - 'colorcolumn' is set, or |
3331 * - 'virtualedit' is set, or | 3312 * - 'virtualedit' is set, or |
3332 * - the visual mode is active, | 3313 * - the visual mode is active, |
3333 * the end of the line may be before the start of the displayed part. | 3314 * the end of the line may be before the start of the displayed part. |
3334 */ | 3315 */ |
3335 if (vcol < v && ( | 3316 if (vcol < v && ( |
3336 # ifdef FEAT_SYN_HL | 3317 #ifdef FEAT_SYN_HL |
3337 wp->w_p_cuc | 3318 wp->w_p_cuc || draw_color_col || |
3338 || draw_color_col | 3319 #endif |
3339 # if defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL) | 3320 #ifdef FEAT_VIRTUALEDIT |
3340 || | 3321 virtual_active() || |
3341 # endif | 3322 #endif |
3342 # endif | 3323 (VIsual_active && wp->w_buffer == curwin->w_buffer))) |
3343 # ifdef FEAT_VIRTUALEDIT | |
3344 virtual_active() | |
3345 # ifdef FEAT_VISUAL | |
3346 || | |
3347 # endif | |
3348 # endif | |
3349 # ifdef FEAT_VISUAL | |
3350 (VIsual_active && wp->w_buffer == curwin->w_buffer) | |
3351 # endif | |
3352 )) | |
3353 { | 3324 { |
3354 vcol = v; | 3325 vcol = v; |
3355 } | 3326 } |
3356 #endif | |
3357 | 3327 |
3358 /* Handle a character that's not completely on the screen: Put ptr at | 3328 /* Handle a character that's not completely on the screen: Put ptr at |
3359 * that character but skip the first few screen characters. */ | 3329 * that character but skip the first few screen characters. */ |
3360 if (vcol > v) | 3330 if (vcol > v) |
3361 { | 3331 { |
4498 } | 4468 } |
4499 else if (c == NUL | 4469 else if (c == NUL |
4500 && ((wp->w_p_list && lcs_eol > 0) | 4470 && ((wp->w_p_list && lcs_eol > 0) |
4501 || ((fromcol >= 0 || fromcol_prev >= 0) | 4471 || ((fromcol >= 0 || fromcol_prev >= 0) |
4502 && tocol > vcol | 4472 && tocol > vcol |
4503 #ifdef FEAT_VISUAL | |
4504 && VIsual_mode != Ctrl_V | 4473 && VIsual_mode != Ctrl_V |
4505 #endif | |
4506 && ( | 4474 && ( |
4507 # ifdef FEAT_RIGHTLEFT | 4475 # ifdef FEAT_RIGHTLEFT |
4508 wp->w_p_rl ? (col >= 0) : | 4476 wp->w_p_rl ? (col >= 0) : |
4509 # endif | 4477 # endif |
4510 (col < W_WIDTH(wp))) | 4478 (col < W_WIDTH(wp))) |
4852 } | 4820 } |
4853 } | 4821 } |
4854 #endif | 4822 #endif |
4855 if (lcs_eol == lcs_eol_one | 4823 if (lcs_eol == lcs_eol_one |
4856 && ((area_attr != 0 && vcol == fromcol | 4824 && ((area_attr != 0 && vcol == fromcol |
4857 #ifdef FEAT_VISUAL | |
4858 && (VIsual_mode != Ctrl_V | 4825 && (VIsual_mode != Ctrl_V |
4859 || lnum == VIsual.lnum | 4826 || lnum == VIsual.lnum |
4860 || lnum == curwin->w_cursor.lnum) | 4827 || lnum == curwin->w_cursor.lnum) |
4861 #endif | |
4862 && c == NUL) | 4828 && c == NUL) |
4863 #ifdef FEAT_SEARCH_EXTRA | 4829 #ifdef FEAT_SEARCH_EXTRA |
4864 /* highlight 'hlsearch' match at end of line */ | 4830 /* highlight 'hlsearch' match at end of line */ |
4865 || (prevcol_hl_flag == TRUE | 4831 || (prevcol_hl_flag == TRUE |
4866 # if defined(LINE_ATTR) | 4832 # if defined(LINE_ATTR) |
9657 #endif | 9623 #endif |
9658 | 9624 |
9659 do_mode = ((p_smd && msg_silent == 0) | 9625 do_mode = ((p_smd && msg_silent == 0) |
9660 && ((State & INSERT) | 9626 && ((State & INSERT) |
9661 || restart_edit | 9627 || restart_edit |
9662 #ifdef FEAT_VISUAL | 9628 || VIsual_active)); |
9663 || VIsual_active | |
9664 #endif | |
9665 )); | |
9666 if (do_mode || Recording) | 9629 if (do_mode || Recording) |
9667 { | 9630 { |
9668 /* | 9631 /* |
9669 * Don't show mode right now, when not redrawing or inside a mapping. | 9632 * Don't show mode right now, when not redrawing or inside a mapping. |
9670 * Call char_avail() only when we are going to show something, because | 9633 * Call char_avail() only when we are going to show something, because |
9788 } | 9751 } |
9789 #endif | 9752 #endif |
9790 if ((State & INSERT) && p_paste) | 9753 if ((State & INSERT) && p_paste) |
9791 MSG_PUTS_ATTR(_(" (paste)"), attr); | 9754 MSG_PUTS_ATTR(_(" (paste)"), attr); |
9792 | 9755 |
9793 #ifdef FEAT_VISUAL | |
9794 if (VIsual_active) | 9756 if (VIsual_active) |
9795 { | 9757 { |
9796 char *p; | 9758 char *p; |
9797 | 9759 |
9798 /* Don't concatenate separate words to avoid translation | 9760 /* Don't concatenate separate words to avoid translation |
9808 case 5: p = N_(" SELECT LINE"); break; | 9770 case 5: p = N_(" SELECT LINE"); break; |
9809 default: p = N_(" SELECT BLOCK"); break; | 9771 default: p = N_(" SELECT BLOCK"); break; |
9810 } | 9772 } |
9811 MSG_PUTS_ATTR(_(p), attr); | 9773 MSG_PUTS_ATTR(_(p), attr); |
9812 } | 9774 } |
9813 #endif | |
9814 MSG_PUTS_ATTR(" --", attr); | 9775 MSG_PUTS_ATTR(" --", attr); |
9815 } | 9776 } |
9816 | 9777 |
9817 need_clear = TRUE; | 9778 need_clear = TRUE; |
9818 } | 9779 } |
9837 else if (clear_cmdline && msg_silent == 0) | 9798 else if (clear_cmdline && msg_silent == 0) |
9838 /* Clear the whole command line. Will reset "clear_cmdline". */ | 9799 /* Clear the whole command line. Will reset "clear_cmdline". */ |
9839 msg_clr_cmdline(); | 9800 msg_clr_cmdline(); |
9840 | 9801 |
9841 #ifdef FEAT_CMDL_INFO | 9802 #ifdef FEAT_CMDL_INFO |
9842 # ifdef FEAT_VISUAL | |
9843 /* In Visual mode the size of the selected area must be redrawn. */ | 9803 /* In Visual mode the size of the selected area must be redrawn. */ |
9844 if (VIsual_active) | 9804 if (VIsual_active) |
9845 clear_showcmd(); | 9805 clear_showcmd(); |
9846 # endif | |
9847 | 9806 |
9848 /* If the last window has no status line, the ruler is after the mode | 9807 /* If the last window has no status line, the ruler is after the mode |
9849 * message and must be redrawn */ | 9808 * message and must be redrawn */ |
9850 if (redrawing() | 9809 if (redrawing() |
9851 # ifdef FEAT_WINDOWS | 9810 # ifdef FEAT_WINDOWS |