annotate src/drawline.c @ 20433:5950284a517f v8.2.0771

patch 8.2.0771: Vim9: cannot call a compiled closure from not compiled code Commit: https://github.com/vim/vim/commit/6f5b6dfb16228c0ce1e4379b7bafed02eaddbab2 Author: Bram Moolenaar <Bram@vim.org> Date: Sat May 16 21:20:12 2020 +0200 patch 8.2.0771: Vim9: cannot call a compiled closure from not compiled code Problem: Vim9: cannot call a compiled closure from not compiled code. Solution: Pass funcexe to call_user_func().
author Bram Moolenaar <Bram@vim.org>
date Sat, 16 May 2020 21:30:10 +0200
parents 8c98c74176ac
children c4bce986c31a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 * drawline.c: Functions for drawing window lines on the screen.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 * This is the middle level, drawscreen. is the higher level and screen.c the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 * lower level.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 #include "vim.h"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 * Advance **color_cols and return TRUE when there are columns to draw.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 static int
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 advance_color_col(int vcol, int **color_cols)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 while (**color_cols >= 0 && vcol > **color_cols)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 ++*color_cols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 return (**color_cols >= 0);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 * Used when 'cursorlineopt' contains "screenline": compute the margins between
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 * which the highlighting is used.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 margin_columns_win(win_T *wp, int *left_col, int *right_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 // cache previous calculations depending on w_virtcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 static int saved_w_virtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 static win_T *prev_wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 static int prev_left_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 static int prev_right_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 static int prev_col_off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 int cur_col_off = win_col_off(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 int width1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 int width2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 if (saved_w_virtcol == wp->w_virtcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 && prev_wp == wp && prev_col_off == cur_col_off)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 *right_col = prev_right_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 *left_col = prev_left_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 width1 = wp->w_width - cur_col_off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 width2 = width1 + win_col_off2(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 *left_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 *right_col = width1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 if (wp->w_virtcol >= (colnr_T)width1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65 *right_col = width1 + ((wp->w_virtcol - width1) / width2 + 1) * width2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 if (wp->w_virtcol >= (colnr_T)width1 && width2 > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67 *left_col = (wp->w_virtcol - width1) / width2 * width2 + width1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 // cache values
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 prev_left_col = *left_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 prev_right_col = *right_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
72 prev_wp = wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
73 saved_w_virtcol = wp->w_virtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
74 prev_col_off = cur_col_off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
76 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
77
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 #ifdef FEAT_SIGNS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 * Get information needed to display the sign in line 'lnum' in window 'wp'.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 * If 'nrcol' is TRUE, the sign is going to be displayed in the number column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 * Otherwise the sign is going to be displayed in the sign column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 get_sign_display_info(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 int nrcol,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 win_T *wp,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 linenr_T lnum UNUSED,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 sign_attrs_T *sattr,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
90 int wcr_attr,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 int row,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 int startrow,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 int filler_lines UNUSED,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 int filler_todo UNUSED,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 int *c_extrap,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
96 int *c_finalp,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97 char_u *extra,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 char_u **pp_extra,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 int *n_extrap,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 int *char_attrp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 int text_sign;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 # ifdef FEAT_SIGN_ICONS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 int icon_sign;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107 // Draw two cells with the sign value or blank.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 *c_extrap = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 *c_finalp = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 if (nrcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111 *n_extrap = number_width(wp) + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 *char_attrp = hl_combine_attr(wcr_attr, HL_ATTR(HLF_SC));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 *n_extrap = 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 if (row == startrow
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 + filler_lines && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123 {
18422
1848b3e07266 patch 8.1.2205: sign entry structure has confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18390
diff changeset
124 text_sign = (sattr->sat_text != NULL) ? sattr->sat_typenr : 0;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 # ifdef FEAT_SIGN_ICONS
18422
1848b3e07266 patch 8.1.2205: sign entry structure has confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18390
diff changeset
126 icon_sign = (sattr->sat_icon != NULL) ? sattr->sat_typenr : 0;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 if (gui.in_use && icon_sign != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 // Use the image in this position.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 if (nrcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 *c_extrap = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 sprintf((char *)extra, "%-*c ", number_width(wp), SIGN_BYTE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 *pp_extra = extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135 *n_extrap = (int)STRLEN(*pp_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 *c_extrap = SIGN_BYTE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 # ifdef FEAT_NETBEANS_INTG
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 if (netbeans_active() && (buf_signcount(wp->w_buffer, lnum) > 1))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 if (nrcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 *c_extrap = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 sprintf((char *)extra, "%-*c ", number_width(wp),
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 MULTISIGN_BYTE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 *pp_extra = extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 *n_extrap = (int)STRLEN(*pp_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 *c_extrap = MULTISIGN_BYTE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 *c_finalp = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155 *char_attrp = icon_sign;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
156 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 if (text_sign != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 {
18422
1848b3e07266 patch 8.1.2205: sign entry structure has confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18390
diff changeset
161 *pp_extra = sattr->sat_text;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 if (*pp_extra != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 if (nrcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 int n, width = number_width(wp) - 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168 for (n = 0; n < width; n++)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 extra[n] = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 extra[n] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 STRCAT(extra, *pp_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 STRCAT(extra, " ");
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 *pp_extra = extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 *c_extrap = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 *c_finalp = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 *n_extrap = (int)STRLEN(*pp_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 }
18422
1848b3e07266 patch 8.1.2205: sign entry structure has confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18390
diff changeset
179 *char_attrp = sattr->sat_texthl;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18720
diff changeset
185 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 static textprop_T *current_text_props = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 static buf_T *current_buf = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 static int
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 text_prop_compare(const void *s1, const void *s2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 int idx1, idx2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 proptype_T *pt1, *pt2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 colnr_T col1, col2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 idx1 = *(int *)s1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 idx2 = *(int *)s2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 pt1 = text_prop_type_by_id(current_buf, current_text_props[idx1].tp_type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 pt2 = text_prop_type_by_id(current_buf, current_text_props[idx2].tp_type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 if (pt1 == pt2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 return 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 if (pt1 == NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 return -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 if (pt2 == NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 return 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 if (pt1->pt_priority != pt2->pt_priority)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 return pt1->pt_priority > pt2->pt_priority ? 1 : -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 col1 = current_text_props[idx1].tp_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209 col2 = current_text_props[idx2].tp_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 return col1 == col2 ? 0 : col1 > col2 ? 1 : -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 * Display line "lnum" of window 'wp' on the screen.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216 * Start at row "startrow", stop when "endrow" is reached.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 * wp->w_virtcol needs to be valid.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 * Return the number of last row the line occupies.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 int
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 win_line(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 win_T *wp,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224 linenr_T lnum,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 int startrow,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 int endrow,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227 int nochange UNUSED, // not updating for changed text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 int number_only) // only update the number column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 int col = 0; // visual column on screen
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 unsigned off; // offset in ScreenLines/ScreenAttrs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 int c = 0; // init for GCC
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 long vcol = 0; // virtual column (for tabs)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 long vcol_sbr = -1; // virtual column after showbreak
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 long vcol_prev = -1; // "vcol" of previous character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 char_u *line; // current line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 char_u *ptr; // current position in "line"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 int row; // row in the window, excl w_winrow
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 int screen_row; // row on the screen, incl w_winrow
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 char_u extra[21]; // "%ld " and 'fdc' must fit in here
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 int n_extra = 0; // number of extra chars
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 char_u *p_extra = NULL; // string of extra chars, plus NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 char_u *p_extra_free = NULL; // p_extra needs to be freed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 int c_extra = NUL; // extra chars, all the same
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 int c_final = NUL; // final char, mandatory if set
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 int extra_attr = 0; // attributes when n_extra != 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 static char_u *at_end_str = (char_u *)""; // used for p_extra when
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 // displaying lcs_eol at end-of-line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 int lcs_eol_one = lcs_eol; // lcs_eol until it's been used
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 int lcs_prec_todo = lcs_prec; // lcs_prec until it's been used
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 // saved "extra" items for when draw_state becomes WL_LINE (again)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256 int saved_n_extra = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 char_u *saved_p_extra = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 int saved_c_extra = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 int saved_c_final = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260 int saved_char_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 int n_attr = 0; // chars with special attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 int saved_attr2 = 0; // char_attr saved for n_attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 int n_attr3 = 0; // chars with overruling special attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 int saved_attr3 = 0; // char_attr saved for n_attr3
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 int n_skip = 0; // nr of chars to skip for 'nowrap'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269 int fromcol = -10; // start of inverting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 int tocol = MAXCOL; // end of inverting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 int fromcol_prev = -2; // start of inverting after cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 int noinvcur = FALSE; // don't invert the cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 int lnum_in_visual_area = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 pos_T pos;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 long v;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 int char_attr = 0; // attributes for next character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 int attr_pri = FALSE; // char_attr has priority
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279 int area_highlighting = FALSE; // Visual or incsearch highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
280 // in this line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
281 int vi_attr = 0; // attributes for Visual and incsearch
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
282 // highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
283 int wcr_attr = 0; // attributes from 'wincolor'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
284 int win_attr = 0; // background for whole window, except
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 // margins and "~" lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 int area_attr = 0; // attributes desired by highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 int search_attr = 0; // attributes desired by 'hlsearch'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
288 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289 int vcol_save_attr = 0; // saved attr for 'cursorcolumn'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 int syntax_attr = 0; // attributes desired by syntax
18323
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
291 int prev_syntax_col = -1; // column of prev_syntax_attr
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
292 int prev_syntax_attr = 0; // syntax_attr at prev_syntax_col
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 int has_syntax = FALSE; // this buffer has syntax highl.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 int save_did_emsg;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 int draw_color_col = FALSE; // highlight colorcolumn
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 int *color_cols = NULL; // pointer to according columns array
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
298 int eol_hl_off = 0; // 1 if highlighted char after EOL
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18720
diff changeset
299 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300 int text_prop_count;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 int text_prop_next = 0; // next text property to use
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
302 textprop_T *text_props = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 int *text_prop_idxs = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 int text_props_active = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 proptype_T *text_prop_type = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
306 int text_prop_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
307 int text_prop_combine = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
308 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 #ifdef FEAT_SPELL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 int has_spell = FALSE; // this buffer has spell checking
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
311 int can_spell;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 # define SPWORDLEN 150
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 char_u nextline[SPWORDLEN * 2];// text with start of the next line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 int nextlinecol = 0; // column where nextline[] starts
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 int nextline_idx = 0; // index in nextline[] where next line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 // starts
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 int spell_attr = 0; // attributes desired by spelling
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 int word_end = 0; // last byte with same spell_attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319 static linenr_T checked_lnum = 0; // line number for "checked_col"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 static int checked_col = 0; // column in "checked_lnum" up to which
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 // there are no spell errors
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 static int cap_col = -1; // column to check for Cap word
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323 static linenr_T capcol_lnum = 0; // line number where "cap_col" used
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 int cur_checked_col = 0; // checked column for current line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 int extra_check = 0; // has extra highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 int multi_attr = 0; // attributes desired by multibyte
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 int mb_l = 1; // multi-byte byte length
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 int mb_c = 0; // decoded multi-byte character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
330 int mb_utf8 = FALSE; // screen char is UTF-8 char
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
331 int u8cc[MAX_MCO]; // composing UTF-8 chars
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
332 #if defined(FEAT_DIFF) || defined(FEAT_SIGNS)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 int filler_lines = 0; // nr of filler lines to be drawn
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334 int filler_todo = 0; // nr of filler lines still to do + 1
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 hlf_T diff_hlf = (hlf_T)0; // type of diff highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 int change_start = MAXCOL; // first col of changed area
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339 int change_end = -1; // last col of changed area
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
340 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 colnr_T trailcol = MAXCOL; // start of trailing spaces
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 int need_showbreak = FALSE; // overlong line, skipping first x
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344 // chars
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
345 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
346 #if defined(FEAT_SIGNS) || defined(FEAT_QUICKFIX) \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
347 || defined(FEAT_SYN_HL) || defined(FEAT_DIFF)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
348 # define LINE_ATTR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
349 int line_attr = 0; // attribute for the whole line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
350 int line_attr_save;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
351 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 #ifdef FEAT_SIGNS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353 int sign_present = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 sign_attrs_T sattr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 #ifdef FEAT_ARABIC
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 int prev_c = 0; // previous Arabic character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358 int prev_c1 = 0; // first composing char for prev_c
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 #if defined(LINE_ATTR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361 int did_line_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 #ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 int get_term_attr = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367 int cul_attr = 0; // set when 'cursorline' active
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 // 'cursorlineopt' has "screenline" and cursor is in this line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 int cul_screenline = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 // margin columns for the screen line, needed for when 'cursorlineopt'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 // contains "screenline"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 int left_curline_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 int right_curline_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
378 // draw_state: items that are drawn in sequence:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 #define WL_START 0 // nothing done yet
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
380 #ifdef FEAT_CMDWIN
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
381 # define WL_CMDLINE WL_START + 1 // cmdline window column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
382 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
383 # define WL_CMDLINE WL_START
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
384 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
385 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
386 # define WL_FOLD WL_CMDLINE + 1 // 'foldcolumn'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
388 # define WL_FOLD WL_CMDLINE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
390 #ifdef FEAT_SIGNS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
391 # define WL_SIGN WL_FOLD + 1 // column for signs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
392 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
393 # define WL_SIGN WL_FOLD // column for signs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
394 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
395 #define WL_NR WL_SIGN + 1 // line number
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
396 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
397 # define WL_BRI WL_NR + 1 // 'breakindent'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
398 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
399 # define WL_BRI WL_NR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
400 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
401 #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
402 # define WL_SBR WL_BRI + 1 // 'showbreak' or 'diff'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
403 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
404 # define WL_SBR WL_BRI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
405 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
406 #define WL_LINE WL_SBR + 1 // text in the line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
407 int draw_state = WL_START; // what to draw next
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
408 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
409 int feedback_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
410 int feedback_old_attr = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
411 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
412 int screen_line_flags = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
413
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414 #if defined(FEAT_CONCEAL) || defined(FEAT_SEARCH_EXTRA)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415 int match_conc = 0; // cchar for match functions
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
417 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418 int syntax_flags = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419 int syntax_seqnr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
420 int prev_syntax_id = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 int conceal_attr = HL_ATTR(HLF_CONCEAL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
422 int is_concealing = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423 int boguscols = 0; // nonexistent columns added to force
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 // wrapping
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
425 int vcol_off = 0; // offset for concealed characters
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
426 int did_wcol = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427 int old_boguscols = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 # define VCOL_HLC (vcol - vcol_off)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 # define FIX_FOR_BOGUSCOLS \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430 { \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431 n_extra += vcol_off; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
432 vcol -= vcol_off; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433 vcol_off = 0; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
434 col -= boguscols; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
435 old_boguscols = boguscols; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436 boguscols = 0; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 # define VCOL_HLC (vcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442 if (startrow > endrow) // past the end already!
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 return startrow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 row = startrow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446 screen_row = row + W_WINROW(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 if (!number_only)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450 // To speed up the loop below, set extra_check when there is linebreak,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
451 // trailing white space and/or syntax processing to be done.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 extra_check = wp->w_p_lbr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456 if (syntax_present(wp) && !wp->w_s->b_syn_error
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
457 # ifdef SYN_TIME_LIMIT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458 && !wp->w_s->b_syn_slow
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
459 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
460 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
462 // Prepare for syntax highlighting in this line. When there is an
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 // error, stop syntax highlighting.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464 save_did_emsg = did_emsg;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
465 did_emsg = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466 syntax_start(wp, lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
467 if (did_emsg)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 wp->w_s->b_syn_error = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
469 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
470 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
471 did_emsg = save_did_emsg;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 #ifdef SYN_TIME_LIMIT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 if (!wp->w_s->b_syn_slow)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
475 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 has_syntax = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 extra_check = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
478 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
479 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
480 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
481
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 // Check for columns to display for 'colorcolumn'.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
483 color_cols = wp->w_p_cc_cols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
484 if (color_cols != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
485 draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
486 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488 #ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489 if (term_show_buffer(wp->w_buffer))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
490 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
491 extra_check = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
492 get_term_attr = TRUE;
19265
ce8c47ed54e5 patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 19174
diff changeset
493 win_attr = term_get_attr(wp, lnum, -1);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
494 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
495 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
496
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 #ifdef FEAT_SPELL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
498 if (wp->w_p_spell
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
499 && *wp->w_s->b_p_spl != NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
500 && wp->w_s->b_langp.ga_len > 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
501 && *(char **)(wp->w_s->b_langp.ga_data) != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
502 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
503 // Prepare for spell checking.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
504 has_spell = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
505 extra_check = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
506
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
507 // Get the start of the next line, so that words that wrap to the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
508 // next line are found too: "et<line-break>al.".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
509 // Trick: skip a few chars for C/shell/Vim comments
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
510 nextline[SPWORDLEN] = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
511 if (lnum < wp->w_buffer->b_ml.ml_line_count)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
512 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
513 line = ml_get_buf(wp->w_buffer, lnum + 1, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
514 spell_cat_line(nextline + SPWORDLEN, line, SPWORDLEN);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
515 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
516
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
517 // When a word wrapped from the previous line the start of the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
518 // current line is valid.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
519 if (lnum == checked_lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
520 cur_checked_col = checked_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
521 checked_lnum = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
522
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
523 // When there was a sentence end in the previous line may require a
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
524 // word starting with capital in this line. In line 1 always check
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
525 // the first word.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
526 if (lnum != capcol_lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
527 cap_col = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
528 if (lnum == 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
529 cap_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530 capcol_lnum = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
531 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
532 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
533
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
534 // handle Visual active in this window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
535 if (VIsual_active && wp->w_buffer == curwin->w_buffer)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
536 {
19816
f37028184d6a patch 8.2.0464: typos and other small problems
Bram Moolenaar <Bram@vim.org>
parents: 19503
diff changeset
537 pos_T *top, *bot;
f37028184d6a patch 8.2.0464: typos and other small problems
Bram Moolenaar <Bram@vim.org>
parents: 19503
diff changeset
538
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
539 if (LTOREQ_POS(curwin->w_cursor, VIsual))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
540 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
541 // Visual is after curwin->w_cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
542 top = &curwin->w_cursor;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543 bot = &VIsual;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
546 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547 // Visual is before curwin->w_cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
548 top = &VIsual;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549 bot = &curwin->w_cursor;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
551 lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552 if (VIsual_mode == Ctrl_V)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
554 // block mode
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
555 if (lnum_in_visual_area)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
556 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
557 fromcol = wp->w_old_cursor_fcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
558 tocol = wp->w_old_cursor_lcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
559 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
560 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
561 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
562 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
563 // non-block mode
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 if (lnum > top->lnum && lnum <= bot->lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565 fromcol = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 else if (lnum == top->lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 if (VIsual_mode == 'V') // linewise
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
569 fromcol = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 getvvcol(wp, top, (colnr_T *)&fromcol, NULL, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 if (gchar_pos(top) == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574 tocol = fromcol + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
577 if (VIsual_mode != 'V' && lnum == bot->lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579 if (*p_sel == 'e' && bot->col == 0 && bot->coladd == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 fromcol = -10;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 tocol = MAXCOL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 else if (bot->col == MAXCOL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 tocol = MAXCOL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
587 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 pos = *bot;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589 if (*p_sel == 'e')
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 getvvcol(wp, &pos, (colnr_T *)&tocol, NULL, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
591 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
593 getvvcol(wp, &pos, NULL, NULL, (colnr_T *)&tocol);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 ++tocol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
600 // Check if the character under the cursor should not be inverted
18422
1848b3e07266 patch 8.1.2205: sign entry structure has confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18390
diff changeset
601 if (!highlight_match && lnum == curwin->w_cursor.lnum
1848b3e07266 patch 8.1.2205: sign entry structure has confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18390
diff changeset
602 && wp == curwin
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603 #ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 && !gui.in_use
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 noinvcur = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
609 // if inverting in this line set area_highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610 if (fromcol >= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
612 area_highlighting = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613 vi_attr = HL_ATTR(HLF_V);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 if ((clip_star.available && !clip_star.owned
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 && clip_isautosel_star())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617 || (clip_plus.available && !clip_plus.owned
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
618 && clip_isautosel_plus()))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 vi_attr = HL_ATTR(HLF_VNC);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
620 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
622 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 // handle 'incsearch' and ":s///c" highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
625 else if (highlight_match
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626 && wp == curwin
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
627 && lnum >= curwin->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
628 && lnum <= curwin->w_cursor.lnum + search_match_lines)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
629 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
630 if (lnum == curwin->w_cursor.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
631 getvcol(curwin, &(curwin->w_cursor),
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
632 (colnr_T *)&fromcol, NULL, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
633 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
634 fromcol = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
635 if (lnum == curwin->w_cursor.lnum + search_match_lines)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 pos.lnum = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
638 pos.col = search_match_endcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
639 getvcol(curwin, &pos, (colnr_T *)&tocol, NULL, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
640 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642 tocol = MAXCOL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
643 // do at least one character; happens when past end of line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 if (fromcol == tocol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
645 tocol = fromcol + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646 area_highlighting = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647 vi_attr = HL_ATTR(HLF_I);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
648 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
649 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
650
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
651 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652 filler_lines = diff_check(wp, lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
653 if (filler_lines < 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
654 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
655 if (filler_lines == -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
656 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
657 if (diff_find_change(wp, lnum, &change_start, &change_end))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
658 diff_hlf = HLF_ADD; // added line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
659 else if (change_start == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
660 diff_hlf = HLF_TXD; // changed text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
661 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
662 diff_hlf = HLF_CHD; // changed line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
663 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
664 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
665 diff_hlf = HLF_ADD; // added line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
666 filler_lines = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
667 area_highlighting = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
668 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
669 if (lnum == wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
670 filler_lines = wp->w_topfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
671 filler_todo = filler_lines;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
672 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
673
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
674 #ifdef FEAT_SIGNS
18603
f249b44039e0 patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents: 18574
diff changeset
675 sign_present = buf_get_signattrs(wp, lnum, &sattr);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
676 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
677
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
678 #ifdef LINE_ATTR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
679 # ifdef FEAT_SIGNS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
680 // If this line has a sign with line highlighting set line_attr.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 if (sign_present)
18422
1848b3e07266 patch 8.1.2205: sign entry structure has confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18390
diff changeset
682 line_attr = sattr.sat_linehl;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
683 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
684 # if defined(FEAT_QUICKFIX)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
685 // Highlight the current line in the quickfix window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
686 if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
687 line_attr = HL_ATTR(HLF_QFL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
688 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
689 if (line_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
690 area_highlighting = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
691 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
692
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
693 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
694 ptr = line;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
695
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 #ifdef FEAT_SPELL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
697 if (has_spell && !number_only)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
698 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
699 // For checking first word with a capital skip white space.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
700 if (cap_col == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
701 cap_col = getwhitecols(line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
702
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 // To be able to spell-check over line boundaries copy the end of the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704 // current line into nextline[]. Above the start of the next line was
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
705 // copied to nextline[SPWORDLEN].
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
706 if (nextline[SPWORDLEN] == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
707 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
708 // No next line or it is empty.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
709 nextlinecol = MAXCOL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
710 nextline_idx = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
711 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
712 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
713 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
714 v = (long)STRLEN(line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
715 if (v < SPWORDLEN)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
716 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
717 // Short line, use it completely and append the start of the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
718 // next line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
719 nextlinecol = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
720 mch_memmove(nextline, line, (size_t)v);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
721 STRMOVE(nextline + v, nextline + SPWORDLEN);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
722 nextline_idx = v + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
723 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
724 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
725 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
726 // Long line, use only the last SPWORDLEN bytes.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
727 nextlinecol = v - SPWORDLEN;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
728 mch_memmove(nextline, line + nextlinecol, SPWORDLEN);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
729 nextline_idx = SPWORDLEN + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
730 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
731 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
732 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
733 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
734
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
735 if (wp->w_p_list)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
736 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
737 if (lcs_space || lcs_trail || lcs_nbsp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
738 extra_check = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
739 // find start of trailing whitespace
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
740 if (lcs_trail)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
741 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
742 trailcol = (colnr_T)STRLEN(ptr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
743 while (trailcol > (colnr_T)0 && VIM_ISWHITE(ptr[trailcol - 1]))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
744 --trailcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
745 trailcol += (colnr_T) (ptr - line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
746 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
749 wcr_attr = get_wcr_attr(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
750 if (wcr_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
751 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
752 win_attr = wcr_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
753 area_highlighting = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
754 }
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
755
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18720
diff changeset
756 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
757 if (WIN_IS_POPUP(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758 screen_line_flags |= SLF_POPUP;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
760
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
761 // 'nowrap' or 'wrap' and a single line that doesn't fit: Advance to the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
762 // first character to be displayed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
763 if (wp->w_p_wrap)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
764 v = wp->w_skipcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
765 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
766 v = wp->w_leftcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
767 if (v > 0 && !number_only)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 char_u *prev_ptr = ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771 while (vcol < v && *ptr != NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 c = win_lbr_chartabsize(wp, line, ptr, (colnr_T)vcol, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 vcol += c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775 prev_ptr = ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
776 MB_PTR_ADV(ptr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
777 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
778
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
779 // When:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
780 // - 'cuc' is set, or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
781 // - 'colorcolumn' is set, or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
782 // - 'virtualedit' is set, or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
783 // - the visual mode is active,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
784 // the end of the line may be before the start of the displayed part.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
785 if (vcol < v && (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
786 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
787 wp->w_p_cuc || draw_color_col ||
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
788 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
789 virtual_active() ||
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
790 (VIsual_active && wp->w_buffer == curwin->w_buffer)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
791 vcol = v;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
792
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
793 // Handle a character that's not completely on the screen: Put ptr at
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
794 // that character but skip the first few screen characters.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
795 if (vcol > v)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
796 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
797 vcol -= c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
798 ptr = prev_ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
799 // If the character fits on the screen, don't need to skip it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
800 // Except for a TAB.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
801 if (( (*mb_ptr2cells)(ptr) >= c || *ptr == TAB) && col == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
802 n_skip = v - vcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
803 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
804
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
805 // Adjust for when the inverted text is before the screen,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
806 // and when the start of the inverted text is before the screen.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
807 if (tocol <= vcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
808 fromcol = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
809 else if (fromcol >= 0 && fromcol < vcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
810 fromcol = vcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
811
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
813 // When w_skipcol is non-zero, first line needs 'showbreak'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
814 if (wp->w_p_wrap)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815 need_showbreak = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
816 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
817 #ifdef FEAT_SPELL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
818 // When spell checking a word we need to figure out the start of the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 // word and if it's badly spelled or not.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
820 if (has_spell)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
822 int len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
823 colnr_T linecol = (colnr_T)(ptr - line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
824 hlf_T spell_hlf = HLF_COUNT;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
825
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826 pos = wp->w_cursor;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827 wp->w_cursor.lnum = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
828 wp->w_cursor.col = linecol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
829 len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
830
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
831 // spell_move_to() may call ml_get() and make "line" invalid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
832 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
833 ptr = line + linecol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
834
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 if (len == 0 || (int)wp->w_cursor.col > ptr - line)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
836 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
837 // no bad word found at line start, don't check until end of a
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
838 // word
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
839 spell_hlf = HLF_COUNT;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
840 word_end = (int)(spell_to_word_end(ptr, wp) - line + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
841 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
842 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
843 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
844 // bad word found, use attributes until end of word
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
845 word_end = wp->w_cursor.col + len + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
846
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
847 // Turn index into actual attributes.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848 if (spell_hlf != HLF_COUNT)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
849 spell_attr = highlight_attr[spell_hlf];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
850 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
851 wp->w_cursor = pos;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
852
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
853 # ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
854 // Need to restart syntax highlighting for this line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
855 if (has_syntax)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
856 syntax_start(wp, lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
857 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
859 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
861
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
862 // Correct highlighting for cursor that can't be disabled.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
863 // Avoids having to check this for each character.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
864 if (fromcol >= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
865 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
866 if (noinvcur)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
867 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
868 if ((colnr_T)fromcol == wp->w_virtcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
869 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
870 // highlighting starts at cursor, let it start just after the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
871 // cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
872 fromcol_prev = fromcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
873 fromcol = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
874 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
875 else if ((colnr_T)fromcol < wp->w_virtcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
876 // restart highlighting after the cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
877 fromcol_prev = wp->w_virtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
878 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
879 if (fromcol >= tocol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
880 fromcol = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
881 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
882
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
883 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
884 if (!number_only)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
885 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
886 v = (long)(ptr - line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
887 area_highlighting |= prepare_search_hl_line(wp, lnum, (colnr_T)v,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
888 &line, &screen_search_hl,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
889 &search_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
890 ptr = line + v; // "line" may have been updated
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
891 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
892 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
893
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
894 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
895 // Cursor line highlighting for 'cursorline' in the current window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
896 if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
897 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
898 // Do not show the cursor line in the text when Visual mode is active,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
899 // because it's not clear what is selected then. Do update
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
900 // w_last_cursorline.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
901 if (!(wp == curwin && VIsual_active)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
902 && wp->w_p_culopt_flags != CULOPT_NBR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
903 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
904 cul_screenline = (wp->w_p_wrap
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
905 && (wp->w_p_culopt_flags & CULOPT_SCRLINE));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
906
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
907 // Only set line_attr here when "screenline" is not present in
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
908 // 'cursorlineopt'. Otherwise it's done later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
909 if (!cul_screenline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
910 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
911 cul_attr = HL_ATTR(HLF_CUL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
912 line_attr = cul_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
913 wp->w_last_cursorline = wp->w_cursor.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
914 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
915 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
916 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
917 line_attr_save = line_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
918 wp->w_last_cursorline = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
919 margin_columns_win(wp, &left_curline_col, &right_curline_col);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
920 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
921 area_highlighting = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
922 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
923 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
924 wp->w_last_cursorline = wp->w_cursor.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
925 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
926 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
927
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18720
diff changeset
928 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
929 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
930 char_u *prop_start;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
931
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
932 text_prop_count = get_text_props(wp->w_buffer, lnum,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
933 &prop_start, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
934 if (text_prop_count > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
935 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
936 // Make a copy of the properties, so that they are properly
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
937 // aligned.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
938 text_props = ALLOC_MULT(textprop_T, text_prop_count);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
939 if (text_props != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
940 mch_memmove(text_props, prop_start,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
941 text_prop_count * sizeof(textprop_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
942
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
943 // Allocate an array for the indexes.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
944 text_prop_idxs = ALLOC_MULT(int, text_prop_count);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
945 area_highlighting = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
946 extra_check = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
947 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
948 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
949 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
950
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
951 off = (unsigned)(current_ScreenLine - ScreenLines);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
952 col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
953
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
954 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
955 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
956 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
957 // Rightleft window: process the text in the normal direction, but put
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
958 // it in current_ScreenLine[] from right to left. Start at the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
959 // rightmost column of the window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
960 col = wp->w_width - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
961 off += col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
962 screen_line_flags |= SLF_RIGHTLEFT;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
963 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
964 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
965
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
966 // Repeat for the whole displayed line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
967 for (;;)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
968 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
969 #if defined(FEAT_CONCEAL) || defined(FEAT_SEARCH_EXTRA)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
970 int has_match_conc = 0; // match wants to conceal
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
971 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
972 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
973 int did_decrement_ptr = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
974 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
975 // Skip this quickly when working on the text.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
976 if (draw_state != WL_LINE)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
977 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
978 #ifdef FEAT_CMDWIN
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
979 if (draw_state == WL_CMDLINE - 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
980 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
981 draw_state = WL_CMDLINE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
982 if (cmdwin_type != 0 && wp == curwin)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
983 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
984 // Draw the cmdline character.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
985 n_extra = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
986 c_extra = cmdwin_type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
987 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
988 char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_AT));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
989 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
990 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
991 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
992
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
993 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
994 if (draw_state == WL_FOLD - 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
995 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
996 int fdc = compute_foldcolumn(wp, 0);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
997
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
998 draw_state = WL_FOLD;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
999 if (fdc > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1000 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1001 // Draw the 'foldcolumn'. Allocate a buffer, "extra" may
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1002 // already be in use.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1003 vim_free(p_extra_free);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1004 p_extra_free = alloc(12 + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1005
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1006 if (p_extra_free != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1007 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1008 fill_foldcolumn(p_extra_free, wp, FALSE, lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1009 n_extra = fdc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1010 p_extra_free[n_extra] = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1011 p_extra = p_extra_free;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1012 c_extra = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1013 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1014 char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_FC));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1015 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1016 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1017 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1018 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1019
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1020 #ifdef FEAT_SIGNS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1021 if (draw_state == WL_SIGN - 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1022 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1023 draw_state = WL_SIGN;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1024 // Show the sign column when there are any signs in this
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1025 // buffer or when using Netbeans.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1026 if (signcolumn_on(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1027 get_sign_display_info(FALSE, wp, lnum, &sattr, wcr_attr,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1028 row, startrow, filler_lines, filler_todo, &c_extra,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1029 &c_final, extra, &p_extra, &n_extra, &char_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1030 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1031 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1032
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1033 if (draw_state == WL_NR - 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1034 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1035 draw_state = WL_NR;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1036 // Display the absolute or relative line number. After the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1037 // first fill with blanks when the 'n' flag isn't in 'cpo'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1038 if ((wp->w_p_nu || wp->w_p_rnu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1039 && (row == startrow
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1040 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1041 + filler_lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1042 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1043 || vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1044 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1045 #ifdef FEAT_SIGNS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1046 // If 'signcolumn' is set to 'number' and a sign is present
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1047 // in 'lnum', then display the sign instead of the line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1048 // number.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1049 if ((*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1050 && sign_present)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1051 get_sign_display_info(TRUE, wp, lnum, &sattr, wcr_attr,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1052 row, startrow, filler_lines, filler_todo,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1053 &c_extra, &c_final, extra, &p_extra, &n_extra,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1054 &char_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1055 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1056 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1057 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1058 // Draw the line number (empty space after wrapping).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1059 if (row == startrow
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1060 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1061 + filler_lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1062 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1063 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1064 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1065 long num;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1066 char *fmt = "%*ld ";
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1067
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1068 if (wp->w_p_nu && !wp->w_p_rnu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1069 // 'number' + 'norelativenumber'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1070 num = (long)lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1071 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1072 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1073 // 'relativenumber', don't use negative numbers
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1074 num = labs((long)get_cursor_rel_lnum(wp, lnum));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1075 if (num == 0 && wp->w_p_nu && wp->w_p_rnu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1076 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1077 // 'number' + 'relativenumber'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1078 num = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1079 fmt = "%-*ld ";
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1080 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1081 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1082
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1083 sprintf((char *)extra, fmt,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1084 number_width(wp), num);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1085 if (wp->w_skipcol > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1086 for (p_extra = extra; *p_extra == ' '; ++p_extra)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1087 *p_extra = '-';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1088 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1089 if (wp->w_p_rl) // reverse line numbers
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1090 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1091 char_u *p1, *p2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1092 int t;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1093
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1094 // like rl_mirror(), but keep the space at the end
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1095 p2 = skiptowhite(extra) - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1096 for (p1 = extra; p1 < p2; ++p1, --p2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1097 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1098 t = *p1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1099 *p1 = *p2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1100 *p2 = t;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1101 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1102 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1103 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1104 p_extra = extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1105 c_extra = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1106 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1107 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1108 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1109 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1110 c_extra = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1111 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1112 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1113 n_extra = number_width(wp) + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1114 char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_N));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1115 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1116 // When 'cursorline' is set highlight the line number of
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1117 // the current line differently.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1118 // When 'cursorlineopt' has "screenline" only highlight
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1119 // the line number itself.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1120 // TODO: Can we use CursorLine instead of CursorLineNr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1121 // when CursorLineNr isn't set?
18245
1f5571e7f012 patch 8.1.2117: CursorLine highlight used while 'cursorline' is off
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
1122 if (wp->w_p_cul
1f5571e7f012 patch 8.1.2117: CursorLine highlight used while 'cursorline' is off
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
1123 && lnum == wp->w_cursor.lnum
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1124 && (wp->w_p_culopt_flags & CULOPT_NBR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1125 && (row == startrow
18245
1f5571e7f012 patch 8.1.2117: CursorLine highlight used while 'cursorline' is off
Bram Moolenaar <Bram@vim.org>
parents: 18152
diff changeset
1126 || wp->w_p_culopt_flags & CULOPT_LINE))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1127 char_attr = hl_combine_attr(wcr_attr, HL_ATTR(HLF_CLN));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1128 #endif
18471
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1129 if (wp->w_p_rnu && lnum < wp->w_cursor.lnum
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1130 && HL_ATTR(HLF_LNA) != 0)
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1131 // Use LineNrAbove
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1132 char_attr = hl_combine_attr(wcr_attr,
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1133 HL_ATTR(HLF_LNA));
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1134 if (wp->w_p_rnu && lnum > wp->w_cursor.lnum
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1135 && HL_ATTR(HLF_LNB) != 0)
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1136 // Use LineNrBelow
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1137 char_attr = hl_combine_attr(wcr_attr,
b9cf60801963 patch 8.1.2229: cannot color number column above/below cursor differently
Bram Moolenaar <Bram@vim.org>
parents: 18422
diff changeset
1138 HL_ATTR(HLF_LNB));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1139 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1140 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1141 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1142
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1143 #ifdef FEAT_LINEBREAK
19503
a4be2f9cfb01 patch 8.2.0309: window-local values have confusing name
Bram Moolenaar <Bram@vim.org>
parents: 19501
diff changeset
1144 if (wp->w_briopt_sbr && draw_state == WL_BRI - 1
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1145 && n_extra == 0 && *get_showbreak_value(wp) != NUL)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1146 // draw indent after showbreak value
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1147 draw_state = WL_BRI;
19503
a4be2f9cfb01 patch 8.2.0309: window-local values have confusing name
Bram Moolenaar <Bram@vim.org>
parents: 19501
diff changeset
1148 else if (wp->w_briopt_sbr && draw_state == WL_SBR && n_extra == 0)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1149 // After the showbreak, draw the breakindent
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1150 draw_state = WL_BRI - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1151
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1152 // draw 'breakindent': indent wrapped text accordingly
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1153 if (draw_state == WL_BRI - 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1154 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1155 draw_state = WL_BRI;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1156 // if need_showbreak is set, breakindent also applies
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1157 if (wp->w_p_bri && n_extra == 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1158 && (row != startrow || need_showbreak)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1159 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1160 && filler_lines == 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1161 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1162 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1163 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1164 char_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1165 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1166 if (diff_hlf != (hlf_T)0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1167 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1168 char_attr = HL_ATTR(diff_hlf);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1169 # ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1170 if (cul_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1171 char_attr = hl_combine_attr(char_attr, cul_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1172 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1173 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1174 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1175 p_extra = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1176 c_extra = ' ';
18502
3ebb15e3c28d patch 8.1.2245: third character of 'listchars' tab shows in wrong place
Bram Moolenaar <Bram@vim.org>
parents: 18494
diff changeset
1177 c_final = NUL;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1178 n_extra = get_breakindent_win(wp,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1179 ml_get_buf(wp->w_buffer, lnum, FALSE));
20423
8c98c74176ac patch 8.2.0766: display error when using 'number' and 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 20122
diff changeset
1180 if (row == startrow)
8c98c74176ac patch 8.2.0766: display error when using 'number' and 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 20122
diff changeset
1181 {
8c98c74176ac patch 8.2.0766: display error when using 'number' and 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 20122
diff changeset
1182 n_extra -= win_col_off2(wp);
8c98c74176ac patch 8.2.0766: display error when using 'number' and 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 20122
diff changeset
1183 if (n_extra < 0)
8c98c74176ac patch 8.2.0766: display error when using 'number' and 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 20122
diff changeset
1184 n_extra = 0;
8c98c74176ac patch 8.2.0766: display error when using 'number' and 'breakindent'
Bram Moolenaar <Bram@vim.org>
parents: 20122
diff changeset
1185 }
19503
a4be2f9cfb01 patch 8.2.0309: window-local values have confusing name
Bram Moolenaar <Bram@vim.org>
parents: 19501
diff changeset
1186 if (wp->w_skipcol > 0 && wp->w_p_wrap && wp->w_briopt_sbr)
19174
d5b793803236 patch 8.2.0146: wrong indent when 'showbreak' and 'breakindent' are set
Bram Moolenaar <Bram@vim.org>
parents: 18795
diff changeset
1187 need_showbreak = FALSE;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1188 // Correct end of highlighted area for 'breakindent',
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1189 // required when 'linebreak' is also set.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1190 if (tocol == vcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1191 tocol += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1192 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1193 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1194 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1195
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1196 #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1197 if (draw_state == WL_SBR - 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1198 {
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1199 char_u *sbr;
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1200
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1201 draw_state = WL_SBR;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1202 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1203 if (filler_todo > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1204 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1205 // Draw "deleted" diff line(s).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1206 if (char2cells(fill_diff) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1207 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1208 c_extra = '-';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1209 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1210 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1211 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1212 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1213 c_extra = fill_diff;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1214 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1215 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1216 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1217 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1218 n_extra = col + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1219 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1220 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1221 n_extra = wp->w_width - col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1222 char_attr = HL_ATTR(HLF_DED);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1223 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1224 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1225 # ifdef FEAT_LINEBREAK
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1226 sbr = get_showbreak_value(wp);
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1227 if (*sbr != NUL && need_showbreak)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1228 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1229 // Draw 'showbreak' at the start of each broken line.
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1230 p_extra = sbr;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1231 c_extra = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1232 c_final = NUL;
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1233 n_extra = (int)STRLEN(sbr);
19174
d5b793803236 patch 8.2.0146: wrong indent when 'showbreak' and 'breakindent' are set
Bram Moolenaar <Bram@vim.org>
parents: 18795
diff changeset
1234 if (wp->w_skipcol == 0 || !wp->w_p_wrap)
d5b793803236 patch 8.2.0146: wrong indent when 'showbreak' and 'breakindent' are set
Bram Moolenaar <Bram@vim.org>
parents: 18795
diff changeset
1235 need_showbreak = FALSE;
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
1236 vcol_sbr = vcol + MB_CHARLEN(sbr);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1237 // Correct end of highlighted area for 'showbreak',
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1238 // required when 'linebreak' is also set.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1239 if (tocol == vcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1240 tocol += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1241 // combine 'showbreak' with 'wincolor'
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
1242 char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1243 # ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1244 // combine 'showbreak' with 'cursorline'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1245 if (cul_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1246 char_attr = hl_combine_attr(char_attr, cul_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1247 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1248 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1249 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1250 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1251 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1252
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1253 if (draw_state == WL_LINE - 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1254 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1255 draw_state = WL_LINE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1256 if (saved_n_extra)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1257 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1258 // Continue item from end of wrapped line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1259 n_extra = saved_n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1260 c_extra = saved_c_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1261 c_final = saved_c_final;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1262 p_extra = saved_p_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1263 char_attr = saved_char_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1264 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1265 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1266 char_attr = win_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1267 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1268 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1269 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1270 if (cul_screenline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1271 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1272 if (draw_state == WL_LINE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1273 && vcol >= left_curline_col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1274 && vcol < right_curline_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1275 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1276 cul_attr = HL_ATTR(HLF_CUL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1277 line_attr = cul_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1278 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1279 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1280 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1281 cul_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1282 line_attr = line_attr_save;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1283 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1284 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1285 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1286
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1287 // When still displaying '$' of change command, stop at cursor.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1288 // When only displaying the (relative) line number and that's done,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1289 // stop here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1290 if ((dollar_vcol >= 0 && wp == curwin
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1291 && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1292 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1293 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1294 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1295 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1296 || (number_only && draw_state > WL_NR))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1297 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1298 screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1299 screen_line_flags);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1300 // Pretend we have finished updating the window. Except when
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1301 // 'cursorcolumn' is set.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1302 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1303 if (wp->w_p_cuc)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1304 row = wp->w_cline_row + wp->w_cline_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1305 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1306 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1307 row = wp->w_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1308 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1309 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1310
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1311 if (draw_state == WL_LINE && (area_highlighting || extra_check))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1312 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1313 // handle Visual or match highlighting in this line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1314 if (vcol == fromcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1315 || (has_mbyte && vcol + 1 == fromcol && n_extra == 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1316 && (*mb_ptr2cells)(ptr) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1317 || ((int)vcol_prev == fromcol_prev
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1318 && vcol_prev < vcol // not at margin
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1319 && vcol < tocol))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1320 area_attr = vi_attr; // start highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1321 else if (area_attr != 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1322 && (vcol == tocol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1323 || (noinvcur && (colnr_T)vcol == wp->w_virtcol)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1324 area_attr = 0; // stop highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1325
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1326 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1327 if (!n_extra)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1328 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1329 // Check for start/end of 'hlsearch' and other matches.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1330 // After end, check for start/end of next match.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1331 // When another match, have to check for start again.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1332 v = (long)(ptr - line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1333 search_attr = update_search_hl(wp, lnum, (colnr_T)v, &line,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1334 &screen_search_hl, &has_match_conc,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1335 &match_conc, did_line_attr, lcs_eol_one);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1336 ptr = line + v; // "line" may have been changed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1337 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1338 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1339
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1340 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1341 if (diff_hlf != (hlf_T)0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1342 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1343 if (diff_hlf == HLF_CHD && ptr - line >= change_start
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1344 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1345 diff_hlf = HLF_TXD; // changed text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1346 if (diff_hlf == HLF_TXD && ptr - line > change_end
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1347 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1348 diff_hlf = HLF_CHD; // changed line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1349 line_attr = HL_ATTR(diff_hlf);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1350 if (wp->w_p_cul && lnum == wp->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1351 && wp->w_p_culopt_flags != CULOPT_NBR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1352 && (!cul_screenline || (vcol >= left_curline_col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1353 && vcol <= right_curline_col)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1354 line_attr = hl_combine_attr(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1355 line_attr, HL_ATTR(HLF_CUL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1356 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1357 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1358
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18720
diff changeset
1359 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1360 if (text_props != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1361 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1362 int pi;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1363 int bcol = (int)(ptr - line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1364
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1365 if (n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1366 --bcol; // still working on the previous char, e.g. Tab
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1367
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1368 // Check if any active property ends.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1369 for (pi = 0; pi < text_props_active; ++pi)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1370 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1371 int tpi = text_prop_idxs[pi];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1372
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1373 if (bcol >= text_props[tpi].tp_col - 1
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1374 + text_props[tpi].tp_len)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1375 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1376 if (pi + 1 < text_props_active)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1377 mch_memmove(text_prop_idxs + pi,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1378 text_prop_idxs + pi + 1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1379 sizeof(int)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1380 * (text_props_active - (pi + 1)));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1381 --text_props_active;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1382 --pi;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1383 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1384 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1385
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1386 // Add any text property that starts in this column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1387 while (text_prop_next < text_prop_count
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1388 && bcol >= text_props[text_prop_next].tp_col - 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1389 text_prop_idxs[text_props_active++] = text_prop_next++;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1390
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1391 text_prop_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1392 text_prop_combine = FALSE;
18152
1acc94f17906 patch 8.1.2071: when 'wincolor' is set text property changes highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18131
diff changeset
1393 text_prop_type = NULL;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1394 if (text_props_active > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1395 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1396 // Sort the properties on priority and/or starting last.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1397 // Then combine the attributes, highest priority last.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1398 current_text_props = text_props;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1399 current_buf = wp->w_buffer;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1400 qsort((void *)text_prop_idxs, (size_t)text_props_active,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1401 sizeof(int), text_prop_compare);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1402
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1403 for (pi = 0; pi < text_props_active; ++pi)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1404 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1405 int tpi = text_prop_idxs[pi];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1406 proptype_T *pt = text_prop_type_by_id(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1407 wp->w_buffer, text_props[tpi].tp_type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1408
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1409 if (pt != NULL && pt->pt_hl_id > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1410 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1411 int pt_attr = syn_id2attr(pt->pt_hl_id);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1412
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1413 text_prop_type = pt;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1414 text_prop_attr =
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1415 hl_combine_attr(text_prop_attr, pt_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1416 text_prop_combine = pt->pt_flags & PT_FLAG_COMBINE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1417 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1418 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1419 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1420 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1421 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1422
18374
86c00b8fefea patch 8.1.2181: highlighting wrong when item follows tab
Bram Moolenaar <Bram@vim.org>
parents: 18364
diff changeset
1423 #ifdef FEAT_SYN_HL
86c00b8fefea patch 8.1.2181: highlighting wrong when item follows tab
Bram Moolenaar <Bram@vim.org>
parents: 18364
diff changeset
1424 if (extra_check && n_extra == 0)
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1425 {
18390
c34ee31d0878 patch 8.1.2189: syntax highlighting wrong for tab
Bram Moolenaar <Bram@vim.org>
parents: 18374
diff changeset
1426 syntax_attr = 0;
18374
86c00b8fefea patch 8.1.2181: highlighting wrong when item follows tab
Bram Moolenaar <Bram@vim.org>
parents: 18364
diff changeset
1427 # ifdef FEAT_TERMINAL
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1428 if (get_term_attr)
19265
ce8c47ed54e5 patch 8.2.0191: cannot put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 19174
diff changeset
1429 syntax_attr = term_get_attr(wp, lnum, vcol);
18374
86c00b8fefea patch 8.1.2181: highlighting wrong when item follows tab
Bram Moolenaar <Bram@vim.org>
parents: 18364
diff changeset
1430 # endif
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1431 // Get syntax attribute.
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1432 if (has_syntax)
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1433 {
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1434 // Get the syntax attribute for the character. If there
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1435 // is an error, disable syntax highlighting.
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1436 save_did_emsg = did_emsg;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1437 did_emsg = FALSE;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1438
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1439 v = (long)(ptr - line);
18323
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1440 if (v == prev_syntax_col)
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1441 // at same column again
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1442 syntax_attr = prev_syntax_attr;
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1443 else
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1444 {
18337
b08dbcb42399 patch 8.1.2163: cannot build with +spell but without +syntax
Bram Moolenaar <Bram@vim.org>
parents: 18331
diff changeset
1445 # ifdef FEAT_SPELL
18323
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1446 can_spell = TRUE;
18337
b08dbcb42399 patch 8.1.2163: cannot build with +spell but without +syntax
Bram Moolenaar <Bram@vim.org>
parents: 18331
diff changeset
1447 # endif
18323
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1448 syntax_attr = get_syntax_attr((colnr_T)v,
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1449 # ifdef FEAT_SPELL
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1450 has_spell ? &can_spell :
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1451 # endif
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1452 NULL, FALSE);
18323
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1453 prev_syntax_col = v;
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1454 prev_syntax_attr = syntax_attr;
72a0dbe1c004 patch 8.1.2156: first character after Tab is not highlighted
Bram Moolenaar <Bram@vim.org>
parents: 18321
diff changeset
1455 }
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1456
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1457 if (did_emsg)
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1458 {
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1459 wp->w_s->b_syn_error = TRUE;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1460 has_syntax = FALSE;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1461 syntax_attr = 0;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1462 }
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1463 else
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1464 did_emsg = save_did_emsg;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1465 # ifdef SYN_TIME_LIMIT
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1466 if (wp->w_s->b_syn_slow)
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1467 has_syntax = FALSE;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1468 # endif
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1469
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1470 // Need to get the line again, a multi-line regexp may
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1471 // have made it invalid.
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1472 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1473 ptr = line + v;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1474 # ifdef FEAT_CONCEAL
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1475 // no concealing past the end of the line, it interferes
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1476 // with line highlighting
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1477 if (*ptr == NUL)
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1478 syntax_flags = 0;
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1479 else
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1480 syntax_flags = get_syntax_info(&syntax_seqnr);
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1481 # endif
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1482 }
18374
86c00b8fefea patch 8.1.2181: highlighting wrong when item follows tab
Bram Moolenaar <Bram@vim.org>
parents: 18364
diff changeset
1483 }
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18720
diff changeset
1484 # ifdef FEAT_PROP_POPUP
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1485 // Combine text property highlight into syntax highlight.
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1486 if (text_prop_type != NULL)
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1487 {
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1488 if (text_prop_combine)
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1489 syntax_attr = hl_combine_attr(syntax_attr, text_prop_attr);
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1490 else
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1491 syntax_attr = text_prop_attr;
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1492 }
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1493 # endif
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1494 #endif
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1495
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1496 // Decide which of the highlight attributes to use.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1497 attr_pri = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1498 #ifdef LINE_ATTR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1499 if (area_attr != 0)
18364
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1500 {
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1501 char_attr = hl_combine_attr(line_attr, area_attr);
18364
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1502 # ifdef FEAT_SYN_HL
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1503 char_attr = hl_combine_attr(syntax_attr, char_attr);
18364
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1504 # endif
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1505 }
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1506 else if (search_attr != 0)
18364
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1507 {
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1508 char_attr = hl_combine_attr(line_attr, search_attr);
18364
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1509 # ifdef FEAT_SYN_HL
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1510 char_attr = hl_combine_attr(syntax_attr, char_attr);
18364
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1511 # endif
ee489bb09ea8 patch 8.1.2176: syntax attributes not combined with Visual highlighting
Bram Moolenaar <Bram@vim.org>
parents: 18356
diff changeset
1512 }
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1513 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1514 || vcol < fromcol || vcol_prev < fromcol_prev
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1515 || vcol >= tocol))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1516 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1517 // Use line_attr when not in the Visual or 'incsearch' area
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1518 // (area_attr may be 0 when "noinvcur" is set).
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1519 # ifdef FEAT_SYN_HL
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1520 char_attr = hl_combine_attr(syntax_attr, line_attr);
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1521 # else
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1522 char_attr = line_attr;
18317
d2228d4cf1f6 patch 8.1.2153: combining text property and syntax highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 18245
diff changeset
1523 # endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1524 attr_pri = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1525 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1526 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1527 if (area_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1528 char_attr = area_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1529 else if (search_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1530 char_attr = search_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1531 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1532 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1533 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1534 attr_pri = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1535 #ifdef FEAT_SYN_HL
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1536 char_attr = syntax_attr;
18374
86c00b8fefea patch 8.1.2181: highlighting wrong when item follows tab
Bram Moolenaar <Bram@vim.org>
parents: 18364
diff changeset
1537 #else
18570
0ac88fdbf089 patch 8.1.2279: computation of highlight attributes is too complicated
Bram Moolenaar <Bram@vim.org>
parents: 18502
diff changeset
1538 char_attr = 0;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1539 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1540 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1541 }
18494
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1542
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1543 // combine attribute with 'wincolor'
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1544 if (win_attr != 0)
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1545 {
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1546 if (char_attr == 0)
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1547 char_attr = win_attr;
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1548 else
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1549 char_attr = hl_combine_attr(win_attr, char_attr);
04a40c1514c4 patch 8.1.2241: match highlight does not combine with 'wincolor'
Bram Moolenaar <Bram@vim.org>
parents: 18471
diff changeset
1550 }
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1551
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1552 // Get the next character to put on the screen.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1553
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1554 // The "p_extra" points to the extra stuff that is inserted to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1555 // represent special characters (non-printable stuff) and other
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1556 // things. When all characters are the same, c_extra is used.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1557 // If c_final is set, it will compulsorily be used at the end.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1558 // "p_extra" must end in a NUL to avoid mb_ptr2len() reads past
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1559 // "p_extra[n_extra]".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1560 // For the '$' of the 'list' option, n_extra == 1, p_extra == "".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1561 if (n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1562 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1563 if (c_extra != NUL || (n_extra == 1 && c_final != NUL))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1564 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1565 c = (n_extra == 1 && c_final != NUL) ? c_final : c_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1566 mb_c = c; // doesn't handle non-utf-8 multi-byte!
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1567 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1568 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1569 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1570 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1571 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1572 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1573 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1574 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1575 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1576 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1577 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1578 c = *p_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1579 if (has_mbyte)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1580 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1581 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1582 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1583 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1584 // If the UTF-8 character is more than one byte:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1585 // Decode it into "mb_c".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1586 mb_l = utfc_ptr2len(p_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1587 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1588 if (mb_l > n_extra)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1589 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1590 else if (mb_l > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1591 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1592 mb_c = utfc_ptr2char(p_extra, u8cc);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1593 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1594 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1595 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1596 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1597 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1598 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1599 // if this is a DBCS character, put it in "mb_c"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1600 mb_l = MB_BYTE2LEN(c);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1601 if (mb_l >= n_extra)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1602 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1603 else if (mb_l > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1604 mb_c = (c << 8) + p_extra[1];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1605 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1606 if (mb_l == 0) // at the NUL at end-of-line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1607 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1608
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1609 // If a double-width char doesn't fit display a '>' in the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1610 // last column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1611 if ((
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1612 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1613 wp->w_p_rl ? (col <= 0) :
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1614 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1615 (col >= wp->w_width - 1))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1616 && (*mb_char2cells)(mb_c) == 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1617 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1618 c = '>';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1619 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1620 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1621 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1622 multi_attr = HL_ATTR(HLF_AT);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1623 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1624 if (cul_attr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1625 multi_attr = hl_combine_attr(multi_attr, cul_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1626 #endif
18720
7f066dff9d70 patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents: 18603
diff changeset
1627 multi_attr = hl_combine_attr(win_attr, multi_attr);
7f066dff9d70 patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents: 18603
diff changeset
1628
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1629 // put the pointer back to output the double-width
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1630 // character at the start of the next line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1631 ++n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1632 --p_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1633 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1634 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1635 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1636 n_extra -= mb_l - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1637 p_extra += mb_l - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1638 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1639 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1640 ++p_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1641 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1642 --n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1643 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1644 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1645 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1646 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1647 int c0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1648 #endif
18502
3ebb15e3c28d patch 8.1.2245: third character of 'listchars' tab shows in wrong place
Bram Moolenaar <Bram@vim.org>
parents: 18494
diff changeset
1649 VIM_CLEAR(p_extra_free);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1650
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1651 // Get a character from the line itself.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1652 c = *ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1653 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1654 c0 = *ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1655 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1656 if (has_mbyte)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1657 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1658 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1659 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1660 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1661 // If the UTF-8 character is more than one byte: Decode it
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1662 // into "mb_c".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1663 mb_l = utfc_ptr2len(ptr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1664 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1665 if (mb_l > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1666 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1667 mb_c = utfc_ptr2char(ptr, u8cc);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1668 // Overlong encoded ASCII or ASCII with composing char
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1669 // is displayed normally, except a NUL.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1670 if (mb_c < 0x80)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1671 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1672 c = mb_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1673 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1674 c0 = mb_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1675 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1676 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1677 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1678
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1679 // At start of the line we can have a composing char.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1680 // Draw it as a space with a composing char.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1681 if (utf_iscomposing(mb_c))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1682 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1683 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1684
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1685 for (i = Screen_mco - 1; i > 0; --i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1686 u8cc[i] = u8cc[i - 1];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1687 u8cc[0] = mb_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1688 mb_c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1689 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1690 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1691
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1692 if ((mb_l == 1 && c >= 0x80)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1693 || (mb_l >= 1 && mb_c == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1694 || (mb_l > 1 && (!vim_isprintc(mb_c))))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1695 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1696 // Illegal UTF-8 byte: display as <xx>.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1697 // Non-BMP character : display as ? or fullwidth ?.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1698 transchar_hex(extra, mb_c);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1699 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1700 if (wp->w_p_rl) // reverse
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1701 rl_mirror(extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1702 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1703 p_extra = extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1704 c = *p_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1705 mb_c = mb_ptr2char_adv(&p_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1706 mb_utf8 = (c >= 0x80);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1707 n_extra = (int)STRLEN(p_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1708 c_extra = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1709 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1710 if (area_attr == 0 && search_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1711 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1712 n_attr = n_extra + 1;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
1713 extra_attr = hl_combine_attr(
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
1714 win_attr, HL_ATTR(HLF_8));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1715 saved_attr2 = char_attr; // save current attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1716 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1717 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1718 else if (mb_l == 0) // at the NUL at end-of-line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1719 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1720 #ifdef FEAT_ARABIC
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1721 else if (p_arshape && !p_tbidi && ARABIC_CHAR(mb_c))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1722 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1723 // Do Arabic shaping.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1724 int pc, pc1, nc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1725 int pcc[MAX_MCO];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1726
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1727 // The idea of what is the previous and next
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1728 // character depends on 'rightleft'.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1729 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1730 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1731 pc = prev_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1732 pc1 = prev_c1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1733 nc = utf_ptr2char(ptr + mb_l);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1734 prev_c1 = u8cc[0];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1735 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1736 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1737 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1738 pc = utfc_ptr2char(ptr + mb_l, pcc);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1739 nc = prev_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1740 pc1 = pcc[0];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1741 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1742 prev_c = mb_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1743
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1744 mb_c = arabic_shape(mb_c, &c, &u8cc[0], pc, pc1, nc);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1745 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1746 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1747 prev_c = mb_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1748 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1749 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1750 else // enc_dbcs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1751 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1752 mb_l = MB_BYTE2LEN(c);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1753 if (mb_l == 0) // at the NUL at end-of-line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1754 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1755 else if (mb_l > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1756 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1757 // We assume a second byte below 32 is illegal.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1758 // Hopefully this is OK for all double-byte encodings!
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1759 if (ptr[1] >= 32)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1760 mb_c = (c << 8) + ptr[1];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1761 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1762 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1763 if (ptr[1] == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1764 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1765 // head byte at end of line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1766 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1767 transchar_nonprint(extra, c);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1768 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1769 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1770 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1771 // illegal tail byte
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1772 mb_l = 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1773 STRCPY(extra, "XX");
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1774 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1775 p_extra = extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1776 n_extra = (int)STRLEN(extra) - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1777 c_extra = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1778 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1779 c = *p_extra++;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1780 if (area_attr == 0 && search_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1781 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1782 n_attr = n_extra + 1;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
1783 extra_attr = hl_combine_attr(
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
1784 win_attr, HL_ATTR(HLF_8));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1785 saved_attr2 = char_attr; // save current attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1786 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1787 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1788 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1789 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1790 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1791 // If a double-width char doesn't fit display a '>' in the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1792 // last column; the character is displayed at the start of the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1793 // next line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1794 if ((
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1795 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1796 wp->w_p_rl ? (col <= 0) :
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1797 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1798 (col >= wp->w_width - 1))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1799 && (*mb_char2cells)(mb_c) == 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1800 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1801 c = '>';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1802 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1803 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1804 mb_l = 1;
18720
7f066dff9d70 patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents: 18603
diff changeset
1805 multi_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1806 // Put pointer back so that the character will be
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1807 // displayed at the start of the next line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1808 --ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1809 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1810 did_decrement_ptr = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1811 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1812 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1813 else if (*ptr != NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1814 ptr += mb_l - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1815
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1816 // If a double-width char doesn't fit at the left side display
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1817 // a '<' in the first column. Don't do this for unprintable
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1818 // characters.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1819 if (n_skip > 0 && mb_l > 1 && n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1820 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1821 n_extra = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1822 c_extra = MB_FILLER_CHAR;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1823 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1824 c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1825 if (area_attr == 0 && search_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1826 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1827 n_attr = n_extra + 1;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
1828 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1829 saved_attr2 = char_attr; // save current attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1830 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1831 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1832 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1833 mb_l = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1834 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1835
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1836 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1837 ++ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1838
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1839 if (extra_check)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1840 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1841 #ifdef FEAT_SPELL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1842 // Check spelling (unless at the end of the line).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1843 // Only do this when there is no syntax highlighting, the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1844 // @Spell cluster is not used or the current syntax item
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1845 // contains the @Spell cluster.
18356
596a04c49d76 patch 8.1.2172: spell highlight is wrong at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 18337
diff changeset
1846 v = (long)(ptr - line);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1847 if (has_spell && v >= word_end && v > cur_checked_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1848 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1849 spell_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1850 if (c != 0 && (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1851 # ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1852 !has_syntax ||
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1853 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1854 can_spell))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1855 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1856 char_u *prev_ptr, *p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1857 int len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1858 hlf_T spell_hlf = HLF_COUNT;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1859 if (has_mbyte)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1860 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1861 prev_ptr = ptr - mb_l;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1862 v -= mb_l - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1863 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1864 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1865 prev_ptr = ptr - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1866
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1867 // Use nextline[] if possible, it has the start of the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1868 // next line concatenated.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1869 if ((prev_ptr - line) - nextlinecol >= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1870 p = nextline + (prev_ptr - line) - nextlinecol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1871 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1872 p = prev_ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1873 cap_col -= (int)(prev_ptr - line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1874 len = spell_check(wp, p, &spell_hlf, &cap_col,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1875 nochange);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1876 word_end = v + len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1877
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1878 // In Insert mode only highlight a word that
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1879 // doesn't touch the cursor.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1880 if (spell_hlf != HLF_COUNT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1881 && (State & INSERT) != 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1882 && wp->w_cursor.lnum == lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1883 && wp->w_cursor.col >=
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1884 (colnr_T)(prev_ptr - line)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1885 && wp->w_cursor.col < (colnr_T)word_end)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1886 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1887 spell_hlf = HLF_COUNT;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1888 spell_redraw_lnum = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1889 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1890
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1891 if (spell_hlf == HLF_COUNT && p != prev_ptr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1892 && (p - nextline) + len > nextline_idx)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1893 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1894 // Remember that the good word continues at the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1895 // start of the next line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1896 checked_lnum = lnum + 1;
18356
596a04c49d76 patch 8.1.2172: spell highlight is wrong at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 18337
diff changeset
1897 checked_col = (int)((p - nextline)
596a04c49d76 patch 8.1.2172: spell highlight is wrong at start of the line
Bram Moolenaar <Bram@vim.org>
parents: 18337
diff changeset
1898 + len - nextline_idx);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1899 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1900
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1901 // Turn index into actual attributes.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1902 if (spell_hlf != HLF_COUNT)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1903 spell_attr = highlight_attr[spell_hlf];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1904
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1905 if (cap_col > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1906 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1907 if (p != prev_ptr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1908 && (p - nextline) + cap_col >= nextline_idx)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1909 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1910 // Remember that the word in the next line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1911 // must start with a capital.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1912 capcol_lnum = lnum + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1913 cap_col = (int)((p - nextline) + cap_col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1914 - nextline_idx);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1915 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1916 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1917 // Compute the actual column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1918 cap_col += (int)(prev_ptr - line);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1919 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1920 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1921 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1922 if (spell_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1923 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1924 if (!attr_pri)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1925 char_attr = hl_combine_attr(char_attr, spell_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1926 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1927 char_attr = hl_combine_attr(spell_attr, char_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1928 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1929 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1930 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1931 // Found last space before word: check for line break.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1932 if (wp->w_p_lbr && c0 == c
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1933 && VIM_ISBREAK(c) && !VIM_ISBREAK((int)*ptr))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1934 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1935 int mb_off = has_mbyte ? (*mb_head_off)(line, ptr - 1) : 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1936 char_u *p = ptr - (mb_off + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1937
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1938 // TODO: is passing p for start of the line OK?
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1939 n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1940 NULL) - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1941 if (c == TAB && n_extra + col > wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1942 # ifdef FEAT_VARTABS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1943 n_extra = tabstop_padding(vcol, wp->w_buffer->b_p_ts,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1944 wp->w_buffer->b_p_vts_array) - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1945 # else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1946 n_extra = (int)wp->w_buffer->b_p_ts
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1947 - vcol % (int)wp->w_buffer->b_p_ts - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1948 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1949
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1950 c_extra = mb_off > 0 ? MB_FILLER_CHAR : ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1951 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1952 if (VIM_ISWHITE(c))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1953 {
18773
38a3bef525e6 patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
1954 # ifdef FEAT_CONCEAL
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1955 if (c == TAB)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1956 // See "Tab alignment" below.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1957 FIX_FOR_BOGUSCOLS;
18773
38a3bef525e6 patch 8.1.2376: preprocessor indents are incorrect
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
1958 # endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1959 if (!wp->w_p_list)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1960 c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1961 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1962 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1963 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1964
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1965 // 'list': Change char 160 to lcs_nbsp and space to lcs_space.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1966 // But not when the character is followed by a composing
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1967 // character (use mb_l to check that).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1968 if (wp->w_p_list
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1969 && ((((c == 160 && mb_l == 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1970 || (mb_utf8
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1971 && ((mb_c == 160 && mb_l == 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1972 || (mb_c == 0x202f && mb_l == 3))))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1973 && lcs_nbsp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1974 || (c == ' '
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1975 && mb_l == 1
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1976 && lcs_space
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1977 && ptr - line <= trailcol)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1978 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1979 c = (c == ' ') ? lcs_space : lcs_nbsp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1980 if (area_attr == 0 && search_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1981 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1982 n_attr = 1;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
1983 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1984 saved_attr2 = char_attr; // save current attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1985 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1986 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1987 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1988 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1989 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1990 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1991 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1992 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1993 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1994 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1995 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1996
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1997 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1998 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1999 c = lcs_trail;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2000 if (!attr_pri)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2001 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2002 n_attr = 1;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
2003 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2004 saved_attr2 = char_attr; // save current attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2005 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2006 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2007 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2008 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2009 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2010 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2011 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2012 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2013 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2014 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2015 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2016 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2017
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2018 // Handling of non-printable characters.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2019 if (!vim_isprintc(c))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2020 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2021 // when getting a character from the file, we may have to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2022 // turn it into something else on the way to putting it
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2023 // into "ScreenLines".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2024 if (c == TAB && (!wp->w_p_list || lcs_tab1))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2025 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2026 int tab_len = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2027 long vcol_adjusted = vcol; // removed showbreak length
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2028 #ifdef FEAT_LINEBREAK
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
2029 char_u *sbr = get_showbreak_value(wp);
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
2030
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2031 // only adjust the tab_len, when at the first column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2032 // after the showbreak value was drawn
18574
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
2033 if (*sbr != NUL && vcol == vcol_sbr && wp->w_p_wrap)
8b0114ffde2b patch 8.1.2281: 'showbreak' cannot be set for one window
Bram Moolenaar <Bram@vim.org>
parents: 18570
diff changeset
2034 vcol_adjusted = vcol - MB_CHARLEN(sbr);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2035 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2036 // tab amount depends on current column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2037 #ifdef FEAT_VARTABS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2038 tab_len = tabstop_padding(vcol_adjusted,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2039 wp->w_buffer->b_p_ts,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2040 wp->w_buffer->b_p_vts_array) - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2041 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2042 tab_len = (int)wp->w_buffer->b_p_ts
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2043 - vcol_adjusted % (int)wp->w_buffer->b_p_ts - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2044 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2045
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2046 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2047 if (!wp->w_p_lbr || !wp->w_p_list)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2048 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2049 // tab amount depends on current column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2050 n_extra = tab_len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2051 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2052 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2053 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2054 char_u *p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2055 int len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2056 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2057 int saved_nextra = n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2058
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2059 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2060 if (vcol_off > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2061 // there are characters to conceal
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2062 tab_len += vcol_off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2063 // boguscols before FIX_FOR_BOGUSCOLS macro from above
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2064 if (wp->w_p_list && lcs_tab1 && old_boguscols > 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2065 && n_extra > tab_len)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2066 tab_len += n_extra - tab_len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2067 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2068
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2069 // if n_extra > 0, it gives the number of chars, to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2070 // use for a tab, else we need to calculate the width
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2071 // for a tab
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2072 len = (tab_len * mb_char2len(lcs_tab2));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2073 if (n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2074 len += n_extra - tab_len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2075 c = lcs_tab1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2076 p = alloc(len + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2077 vim_memset(p, ' ', len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2078 p[len] = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2079 vim_free(p_extra_free);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2080 p_extra_free = p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2081 for (i = 0; i < tab_len; i++)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2082 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2083 int lcs = lcs_tab2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2084
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2085 if (*p == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2086 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2087 tab_len = i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2088 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2089 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2090
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2091 // if lcs_tab3 is given, need to change the char
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2092 // for tab
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2093 if (lcs_tab3 && i == tab_len - 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2094 lcs = lcs_tab3;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2095 mb_char2bytes(lcs, p);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2096 p += mb_char2len(lcs);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2097 n_extra += mb_char2len(lcs)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2098 - (saved_nextra > 0 ? 1 : 0);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2099 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2100 p_extra = p_extra_free;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2101 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2102 // n_extra will be increased by FIX_FOX_BOGUSCOLS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2103 // macro below, so need to adjust for that here
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2104 if (vcol_off > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2105 n_extra -= vcol_off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2106 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2107 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2108 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2109 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2110 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2111 int vc_saved = vcol_off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2112
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2113 // Tab alignment should be identical regardless of
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2114 // 'conceallevel' value. So tab compensates of all
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2115 // previous concealed characters, and thus resets
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2116 // vcol_off and boguscols accumulated so far in the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2117 // line. Note that the tab can be longer than
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2118 // 'tabstop' when there are concealed characters.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2119 FIX_FOR_BOGUSCOLS;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2120
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2121 // Make sure, the highlighting for the tab char will be
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2122 // correctly set further below (effectively reverts the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2123 // FIX_FOR_BOGSUCOLS macro
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2124 if (n_extra == tab_len + vc_saved && wp->w_p_list
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2125 && lcs_tab1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2126 tab_len += vc_saved;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2127 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2128 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2129 mb_utf8 = FALSE; // don't draw as UTF-8
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2130 if (wp->w_p_list)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2131 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2132 c = (n_extra == 0 && lcs_tab3) ? lcs_tab3 : lcs_tab1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2133 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2134 if (wp->w_p_lbr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2135 c_extra = NUL; // using p_extra from above
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2136 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2137 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2138 c_extra = lcs_tab2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2139 c_final = lcs_tab3;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2140 n_attr = tab_len + 1;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
2141 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2142 saved_attr2 = char_attr; // save current attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2143 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2144 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2145 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2146 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2147 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2148 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2149 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2150 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2151 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2152 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2153 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2154 c_extra = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2155 c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2156 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2157 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2158 else if (c == NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2159 && (wp->w_p_list
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2160 || ((fromcol >= 0 || fromcol_prev >= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2161 && tocol > vcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2162 && VIsual_mode != Ctrl_V
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2163 && (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2164 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2165 wp->w_p_rl ? (col >= 0) :
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2166 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2167 (col < wp->w_width))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2168 && !(noinvcur
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2169 && lnum == wp->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2170 && (colnr_T)vcol == wp->w_virtcol)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2171 && lcs_eol_one > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2172 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2173 // Display a '$' after the line or highlight an extra
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2174 // character if the line break is included.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2175 #if defined(FEAT_DIFF) || defined(LINE_ATTR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2176 // For a diff line the highlighting continues after the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2177 // "$".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2178 if (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2179 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2180 diff_hlf == (hlf_T)0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2181 # ifdef LINE_ATTR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2182 &&
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2183 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2184 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2185 # ifdef LINE_ATTR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2186 line_attr == 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2187 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2188 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2189 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2190 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2191 // In virtualedit, visual selections may extend
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2192 // beyond end of line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2193 if (area_highlighting && virtual_active()
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2194 && tocol != MAXCOL && vcol < tocol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2195 n_extra = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2196 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2197 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2198 p_extra = at_end_str;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2199 n_extra = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2200 c_extra = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2201 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2202 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2203 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2204 if (wp->w_p_list && lcs_eol > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2205 c = lcs_eol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2206 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2207 c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2208 lcs_eol_one = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2209 --ptr; // put it back at the NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2210 if (!attr_pri)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2211 {
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
2212 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2213 n_attr = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2214 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2215 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2216 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2217 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2218 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2219 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2220 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2221 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2222 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2223 mb_utf8 = FALSE; // don't draw as UTF-8
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2224 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2225 else if (c != NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2226 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2227 p_extra = transchar(c);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2228 if (n_extra == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2229 n_extra = byte2cells(c) - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2230 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2231 if ((dy_flags & DY_UHEX) && wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2232 rl_mirror(p_extra); // reverse "<12>"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2233 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2234 c_extra = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2235 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2236 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2237 if (wp->w_p_lbr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2238 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2239 char_u *p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2240
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2241 c = *p_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2242 p = alloc(n_extra + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2243 vim_memset(p, ' ', n_extra);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2244 STRNCPY(p, p_extra + 1, STRLEN(p_extra) - 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2245 p[n_extra] = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2246 vim_free(p_extra_free);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2247 p_extra_free = p_extra = p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2248 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2249 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2250 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2251 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2252 n_extra = byte2cells(c) - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2253 c = *p_extra++;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2254 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2255 if (!attr_pri)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2256 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2257 n_attr = n_extra + 1;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
2258 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_8));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2259 saved_attr2 = char_attr; // save current attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2260 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2261 mb_utf8 = FALSE; // don't draw as UTF-8
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2262 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2263 else if (VIsual_active
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2264 && (VIsual_mode == Ctrl_V
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2265 || VIsual_mode == 'v')
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2266 && virtual_active()
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2267 && tocol != MAXCOL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2268 && vcol < tocol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2269 && (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2270 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2271 wp->w_p_rl ? (col >= 0) :
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2272 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2273 (col < wp->w_width)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2274 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2275 c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2276 --ptr; // put it back at the NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2277 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2278 #if defined(LINE_ATTR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2279 else if ((
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2280 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2281 diff_hlf != (hlf_T)0 ||
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2282 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2283 # ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2284 win_attr != 0 ||
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2285 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2286 line_attr != 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2287 ) && (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2288 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2289 wp->w_p_rl ? (col >= 0) :
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2290 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2291 (col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2292 # ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2293 - boguscols
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2294 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2295 < wp->w_width)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2296 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2297 // Highlight until the right side of the window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2298 c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2299 --ptr; // put it back at the NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2300
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2301 // Remember we do the char for line highlighting.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2302 ++did_line_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2303
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2304 // don't do search HL for the rest of the line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2305 if (line_attr != 0 && char_attr == search_attr
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2306 && (did_line_attr > 1
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2307 || (wp->w_p_list && lcs_eol > 0)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2308 char_attr = line_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2309 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2310 if (diff_hlf == HLF_TXD)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2311 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2312 diff_hlf = HLF_CHD;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2313 if (vi_attr == 0 || char_attr != vi_attr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2314 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2315 char_attr = HL_ATTR(diff_hlf);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2316 if (wp->w_p_cul && lnum == wp->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2317 && wp->w_p_culopt_flags != CULOPT_NBR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2318 && (!cul_screenline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2319 || (vcol >= left_curline_col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2320 && vcol <= right_curline_col)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2321 char_attr = hl_combine_attr(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2322 char_attr, HL_ATTR(HLF_CUL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2323 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2324 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2325 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2326 # ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2327 if (win_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2328 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2329 char_attr = win_attr;
18321
2ffe3309958c patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
2330 if (wp->w_p_cul && lnum == wp->w_cursor.lnum
2ffe3309958c patch 8.1.2155: in a terminal window 'cursorlineopt' does not work properly
Bram Moolenaar <Bram@vim.org>
parents: 18317
diff changeset
2331 && wp->w_p_culopt_flags != CULOPT_NBR)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2332 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2333 if (!cul_screenline || (vcol >= left_curline_col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2334 && vcol <= right_curline_col))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2335 char_attr = hl_combine_attr(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2336 char_attr, HL_ATTR(HLF_CUL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2337 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2338 else if (line_attr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2339 char_attr = hl_combine_attr(char_attr, line_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2340 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2341 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2342 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2343 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2344 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2345
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2346 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2347 if ( wp->w_p_cole > 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2348 && (wp != curwin || lnum != wp->w_cursor.lnum ||
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2349 conceal_cursor_line(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2350 && ((syntax_flags & HL_CONCEAL) != 0 || has_match_conc > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2351 && !(lnum_in_visual_area
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2352 && vim_strchr(wp->w_p_cocu, 'v') == NULL))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2353 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2354 char_attr = conceal_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2355 if ((prev_syntax_id != syntax_seqnr || has_match_conc > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2356 && (syn_get_sub_char() != NUL || match_conc
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2357 || wp->w_p_cole == 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2358 && wp->w_p_cole != 3)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2359 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2360 // First time at this concealed item: display one
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2361 // character.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2362 if (match_conc)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2363 c = match_conc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2364 else if (syn_get_sub_char() != NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2365 c = syn_get_sub_char();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2366 else if (lcs_conceal != NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2367 c = lcs_conceal;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2368 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2369 c = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2370
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2371 prev_syntax_id = syntax_seqnr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2372
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2373 if (n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2374 vcol_off += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2375 vcol += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2376 if (wp->w_p_wrap && n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2377 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2378 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2379 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2380 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2381 col -= n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2382 boguscols -= n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2383 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2384 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2385 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2386 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2387 boguscols += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2388 col += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2389 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2390 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2391 n_extra = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2392 n_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2393 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2394 else if (n_skip == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2395 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2396 is_concealing = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2397 n_skip = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2398 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2399 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2400 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2401 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2402 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2403 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2404 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2405 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2406 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2407 mb_utf8 = FALSE; // don't draw as UTF-8
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2408 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2409 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2410 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2411 prev_syntax_id = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2412 is_concealing = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2413 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2414
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2415 if (n_skip > 0 && did_decrement_ptr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2416 // not showing the '>', put pointer back to avoid getting stuck
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2417 ++ptr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2418
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2419 #endif // FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2420 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2421
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2422 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2423 // In the cursor line and we may be concealing characters: correct
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2424 // the cursor column when we reach its position.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2425 if (!did_wcol && draw_state == WL_LINE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2426 && wp == curwin && lnum == wp->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2427 && conceal_cursor_line(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2428 && (int)wp->w_virtcol <= vcol + n_skip)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2429 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2430 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2431 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2432 wp->w_wcol = wp->w_width - col + boguscols - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2433 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2434 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2435 wp->w_wcol = col - boguscols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2436 wp->w_wrow = row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2437 did_wcol = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2438 curwin->w_valid |= VALID_WCOL|VALID_WROW|VALID_VIRTCOL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2439 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2440 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2441
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2442 // Don't override visual selection highlighting.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2443 if (n_attr > 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2444 && draw_state == WL_LINE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2445 && !attr_pri)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2446 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2447 #ifdef LINE_ATTR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2448 if (line_attr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2449 char_attr = hl_combine_attr(extra_attr, line_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2450 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2451 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2452 char_attr = extra_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2453 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2454
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2455 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2456 // XIM don't send preedit_start and preedit_end, but they send
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2457 // preedit_changed and commit. Thus Vim can't set "im_is_active", use
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2458 // im_is_preediting() here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2459 if (p_imst == IM_ON_THE_SPOT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2460 && xic != NULL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2461 && lnum == wp->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2462 && (State & INSERT)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2463 && !p_imdisable
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2464 && im_is_preediting()
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2465 && draw_state == WL_LINE)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2466 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2467 colnr_T tcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2468
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2469 if (preedit_end_col == MAXCOL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2470 getvcol(curwin, &(wp->w_cursor), &tcol, NULL, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2471 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2472 tcol = preedit_end_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2473 if ((long)preedit_start_col <= vcol && vcol < (long)tcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2474 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2475 if (feedback_old_attr < 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2476 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2477 feedback_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2478 feedback_old_attr = char_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2479 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2480 char_attr = im_get_feedback_attr(feedback_col);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2481 if (char_attr < 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2482 char_attr = feedback_old_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2483 feedback_col++;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2484 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2485 else if (feedback_old_attr >= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2486 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2487 char_attr = feedback_old_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2488 feedback_old_attr = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2489 feedback_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2490 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2491 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2492 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2493 // Handle the case where we are in column 0 but not on the first
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2494 // character of the line and the user wants us to show us a
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2495 // special character (via 'listchars' option "precedes:<char>".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2496 if (lcs_prec_todo != NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2497 && wp->w_p_list
18131
851a014dfd8b patch 8.1.2060: "precedes" in 'listchars' not used properly
Bram Moolenaar <Bram@vim.org>
parents: 18124
diff changeset
2498 && (wp->w_p_wrap ?
851a014dfd8b patch 8.1.2060: "precedes" in 'listchars' not used properly
Bram Moolenaar <Bram@vim.org>
parents: 18124
diff changeset
2499 (wp->w_skipcol > 0 && row == 0) :
851a014dfd8b patch 8.1.2060: "precedes" in 'listchars' not used properly
Bram Moolenaar <Bram@vim.org>
parents: 18124
diff changeset
2500 wp->w_leftcol > 0)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2501 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2502 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2503 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2504 && draw_state > WL_NR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2505 && c != NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2506 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2507 c = lcs_prec;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2508 lcs_prec_todo = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2509 if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2510 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2511 // Double-width character being overwritten by the "precedes"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2512 // character, need to fill up half the character.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2513 c_extra = MB_FILLER_CHAR;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2514 c_final = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2515 n_extra = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2516 n_attr = 2;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
2517 extra_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2518 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2519 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2520 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2521 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2522 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2523 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2524 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2525 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2526 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2527 mb_utf8 = FALSE; // don't draw as UTF-8
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2528 if (!attr_pri)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2529 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2530 saved_attr3 = char_attr; // save current attr
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
2531 char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2532 n_attr3 = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2533 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2534 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2535
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2536 // At end of the text line or just after the last character.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2537 if ((c == NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2538 #if defined(LINE_ATTR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2539 || did_line_attr == 1
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2540 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2541 ) && eol_hl_off == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2542 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2543 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2544 // flag to indicate whether prevcol equals startcol of search_hl or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2545 // one of the matches
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2546 int prevcol_hl_flag = get_prevcol_hl_flag(wp, &screen_search_hl,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2547 (long)(ptr - line) - (c == NUL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2548 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2549 // Invert at least one char, used for Visual and empty line or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2550 // highlight match at end of line. If it's beyond the last
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2551 // char on the screen, just overwrite that one (tricky!) Not
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2552 // needed when a '$' was displayed for 'list'.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2553 if (lcs_eol == lcs_eol_one
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2554 && ((area_attr != 0 && vcol == fromcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2555 && (VIsual_mode != Ctrl_V
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2556 || lnum == VIsual.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2557 || lnum == curwin->w_cursor.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2558 && c == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2559 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2560 // highlight 'hlsearch' match at end of line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2561 || (prevcol_hl_flag
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2562 # ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2563 && !(wp->w_p_cul && lnum == wp->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2564 && !(wp == curwin && VIsual_active))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2565 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2566 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2567 && diff_hlf == (hlf_T)0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2568 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2569 # if defined(LINE_ATTR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2570 && did_line_attr <= 1
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2571 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2572 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2573 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2574 ))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2575 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2576 int n = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2577
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2578 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2579 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2580 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2581 if (col < 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2582 n = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2583 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2584 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2585 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2586 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2587 if (col >= wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2588 n = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2589 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2590 if (n != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2591 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2592 // At the window boundary, highlight the last character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2593 // instead (better than nothing).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2594 off += n;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2595 col += n;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2596 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2597 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2598 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2599 // Add a blank character to highlight.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2600 ScreenLines[off] = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2601 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2602 ScreenLinesUC[off] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2603 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2604 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2605 if (area_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2606 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2607 // Use attributes from match with highest priority among
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2608 // 'search_hl' and the match list.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2609 get_search_match_hl(wp, &screen_search_hl,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2610 (long)(ptr - line), &char_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2611 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2612 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2613 ScreenAttrs[off] = char_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2614 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2615 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2616 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2617 --col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2618 --off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2619 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2620 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2621 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2622 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2623 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2624 ++off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2625 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2626 ++vcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2627 eol_hl_off = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2628 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2629 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2630
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2631 // At end of the text line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2632 if (c == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2633 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2634 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2635 // Highlight 'cursorcolumn' & 'colorcolumn' past end of the line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2636 if (wp->w_p_wrap)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2637 v = wp->w_skipcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2638 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2639 v = wp->w_leftcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2640
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2641 // check if line ends before left margin
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2642 if (vcol < v + col - win_col_off(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2643 vcol = v + col - win_col_off(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2644 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2645 // Get rid of the boguscols now, we want to draw until the right
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2646 // edge for 'cursorcolumn'.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2647 col -= boguscols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2648 boguscols = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2649 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2650
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2651 if (draw_color_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2652 draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2653
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2654 if (((wp->w_p_cuc
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2655 && (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2656 && (int)wp->w_virtcol <
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2657 wp->w_width * (row - startrow + 1) + v
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2658 && lnum != wp->w_cursor.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2659 || draw_color_col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2660 || win_attr != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2661 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2662 && !wp->w_p_rl
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2663 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2664 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2665 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2666 int rightmost_vcol = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2667 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2668
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2669 if (wp->w_p_cuc)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2670 rightmost_vcol = wp->w_virtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2671 if (draw_color_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2672 // determine rightmost colorcolumn to possibly draw
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2673 for (i = 0; color_cols[i] >= 0; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2674 if (rightmost_vcol < color_cols[i])
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2675 rightmost_vcol = color_cols[i];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2676
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2677 while (col < wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2678 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2679 ScreenLines[off] = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2680 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2681 ScreenLinesUC[off] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2682 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2683 if (draw_color_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2684 draw_color_col = advance_color_col(VCOL_HLC,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2685 &color_cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2686
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2687 if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2688 ScreenAttrs[off++] = HL_ATTR(HLF_CUC);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2689 else if (draw_color_col && VCOL_HLC == *color_cols)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2690 ScreenAttrs[off++] = HL_ATTR(HLF_MC);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2691 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2692 ScreenAttrs[off++] = win_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2693
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2694 if (VCOL_HLC >= rightmost_vcol && win_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2695 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2696
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2697 ++vcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2698 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2699 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2700 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2701
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2702 screen_line(screen_row, wp->w_wincol, col,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2703 (int)wp->w_width, screen_line_flags);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2704 row++;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2705
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2706 // Update w_cline_height and w_cline_folded if the cursor line was
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2707 // updated (saves a call to plines() later).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2708 if (wp == curwin && lnum == curwin->w_cursor.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2709 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2710 curwin->w_cline_row = startrow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2711 curwin->w_cline_height = row - startrow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2712 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2713 curwin->w_cline_folded = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2714 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2715 curwin->w_valid |= (VALID_CHEIGHT|VALID_CROW);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2716 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2717
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2718 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2719 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2720
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2721 // Show "extends" character from 'listchars' if beyond the line end and
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2722 // 'list' is set.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2723 if (lcs_ext != NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2724 && wp->w_p_list
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2725 && !wp->w_p_wrap
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2726 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2727 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2728 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2729 && (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2730 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2731 wp->w_p_rl ? col == 0 :
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2732 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2733 col == wp->w_width - 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2734 && (*ptr != NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2735 || (wp->w_p_list && lcs_eol_one > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2736 || (n_extra && (c_extra != NUL || *p_extra != NUL))))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2737 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2738 c = lcs_ext;
18795
79b689ff168d patch 8.1.2386: 'wincolor' is not used for 'listchars'
Bram Moolenaar <Bram@vim.org>
parents: 18773
diff changeset
2739 char_attr = hl_combine_attr(win_attr, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2740 mb_c = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2741 if (enc_utf8 && utf_char2len(c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2742 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2743 mb_utf8 = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2744 u8cc[0] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2745 c = 0xc0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2746 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2747 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2748 mb_utf8 = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2749 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2750
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2751 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2752 // advance to the next 'colorcolumn'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2753 if (draw_color_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2754 draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2755
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2756 // Highlight the cursor column if 'cursorcolumn' is set. But don't
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2757 // highlight the cursor position itself.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2758 // Also highlight the 'colorcolumn' if it is different than
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2759 // 'cursorcolumn'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2760 vcol_save_attr = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2761 if (draw_state == WL_LINE && !lnum_in_visual_area
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2762 && search_attr == 0 && area_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2763 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2764 if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2765 && lnum != wp->w_cursor.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2766 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2767 vcol_save_attr = char_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2768 char_attr = hl_combine_attr(char_attr, HL_ATTR(HLF_CUC));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2769 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2770 else if (draw_color_col && VCOL_HLC == *color_cols)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2771 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2772 vcol_save_attr = char_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2773 char_attr = hl_combine_attr(char_attr, HL_ATTR(HLF_MC));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2774 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2775 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2776 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2777
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2778 // Store character to be displayed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2779 // Skip characters that are left of the screen for 'nowrap'.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2780 vcol_prev = vcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2781 if (draw_state < WL_LINE || n_skip <= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2782 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2783 // Store the character.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2784 #if defined(FEAT_RIGHTLEFT)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2785 if (has_mbyte && wp->w_p_rl && (*mb_char2cells)(mb_c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2786 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2787 // A double-wide character is: put first halve in left cell.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2788 --off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2789 --col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2790 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2791 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2792 ScreenLines[off] = c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2793 if (enc_dbcs == DBCS_JPNU)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2794 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2795 if ((mb_c & 0xff00) == 0x8e00)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2796 ScreenLines[off] = 0x8e;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2797 ScreenLines2[off] = mb_c & 0xff;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2798 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2799 else if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2800 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2801 if (mb_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2802 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2803 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2804
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2805 ScreenLinesUC[off] = mb_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2806 if ((c & 0xff) == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2807 ScreenLines[off] = 0x80; // avoid storing zero
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2808 for (i = 0; i < Screen_mco; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2809 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2810 ScreenLinesC[i][off] = u8cc[i];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2811 if (u8cc[i] == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2812 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2813 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2814 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2815 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2816 ScreenLinesUC[off] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2817 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2818 if (multi_attr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2819 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2820 ScreenAttrs[off] = multi_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2821 multi_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2822 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2823 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2824 ScreenAttrs[off] = char_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2825
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2826 if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2827 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2828 // Need to fill two screen columns.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2829 ++off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2830 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2831 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2832 // UTF-8: Put a 0 in the second screen char.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2833 ScreenLines[off] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2834 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2835 // DBCS: Put second byte in the second screen char.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2836 ScreenLines[off] = mb_c & 0xff;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2837 if (draw_state > WL_NR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2838 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2839 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2840 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2841 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2842 ++vcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2843 // When "tocol" is halfway a character, set it to the end of
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2844 // the character, otherwise highlighting won't stop.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2845 if (tocol == vcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2846 ++tocol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2847 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2848 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2849 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2850 // now it's time to backup one cell
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2851 --off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2852 --col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2853 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2854 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2855 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2856 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2857 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2858 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2859 --off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2860 --col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2861 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2862 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2863 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2864 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2865 ++off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2866 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2867 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2868 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2869 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2870 else if (wp->w_p_cole > 0 && is_concealing)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2871 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2872 --n_skip;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2873 ++vcol_off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2874 if (n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2875 vcol_off += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2876 if (wp->w_p_wrap)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2877 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2878 // Special voodoo required if 'wrap' is on.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2879 //
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2880 // Advance the column indicator to force the line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2881 // drawing to wrap early. This will make the line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2882 // take up the same screen space when parts are concealed,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2883 // so that cursor line computations aren't messed up.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2884 //
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2885 // To avoid the fictitious advance of 'col' causing
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2886 // trailing junk to be written out of the screen line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2887 // we are building, 'boguscols' keeps track of the number
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2888 // of bad columns we have advanced.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2889 if (n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2890 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2891 vcol += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2892 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2893 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2894 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2895 col -= n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2896 boguscols -= n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2897 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2898 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2899 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2900 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2901 col += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2902 boguscols += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2903 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2904 n_extra = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2905 n_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2906 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2907
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2908
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2909 if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2910 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2911 // Need to fill two screen columns.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2912 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2913 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2914 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2915 --boguscols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2916 --col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2917 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2918 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2919 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2920 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2921 ++boguscols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2922 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2923 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2924 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2925
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2926 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2927 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2928 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2929 --boguscols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2930 --col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2931 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2932 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2933 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2934 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2935 ++boguscols;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2936 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2937 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2938 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2939 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2940 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2941 if (n_extra > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2942 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2943 vcol += n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2944 n_extra = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2945 n_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2946 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2947 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2948
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2949 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2950 #endif // FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2951 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2952 --n_skip;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2953
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2954 // Only advance the "vcol" when after the 'number' or 'relativenumber'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2955 // column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2956 if (draw_state > WL_NR
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2957 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2958 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2959 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2960 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2961 ++vcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2962
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2963 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2964 if (vcol_save_attr >= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2965 char_attr = vcol_save_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2966 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2967
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2968 // restore attributes after "predeces" in 'listchars'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2969 if (draw_state > WL_NR && n_attr3 > 0 && --n_attr3 == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2970 char_attr = saved_attr3;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2971
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2972 // restore attributes after last 'listchars' or 'number' char
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2973 if (n_attr > 0 && draw_state == WL_LINE && --n_attr == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2974 char_attr = saved_attr2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2975
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2976 // At end of screen line and there is more to come: Display the line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2977 // so far. If there is no more to display it is caught above.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2978 if ((
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2979 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2980 wp->w_p_rl ? (col < 0) :
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2981 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2982 (col >= wp->w_width))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2983 && (*ptr != NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2984 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2985 || filler_todo > 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2986 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2987 || (wp->w_p_list && lcs_eol != NUL && p_extra != at_end_str)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2988 || (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2989 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2990 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2991 #ifdef FEAT_CONCEAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2992 screen_line(screen_row, wp->w_wincol, col - boguscols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2993 (int)wp->w_width, screen_line_flags);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2994 boguscols = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2995 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2996 screen_line(screen_row, wp->w_wincol, col,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2997 (int)wp->w_width, screen_line_flags);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2998 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2999 ++row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3000 ++screen_row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3001
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3002 // When not wrapping and finished diff lines, or when displayed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3003 // '$' and highlighting until last column, break here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3004 if ((!wp->w_p_wrap
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3005 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3006 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3007 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3008 ) || lcs_eol_one == -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3009 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3010
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3011 // When the window is too narrow draw all "@" lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3012 if (draw_state != WL_LINE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3013 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3014 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3015 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3016 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3017 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3018 win_draw_end(wp, '@', ' ', TRUE, row, wp->w_height, HLF_AT);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3019 draw_vsep_win(wp, row);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3020 row = endrow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3021 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3022
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3023 // When line got too long for screen break here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3024 if (row == endrow)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3025 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3026 ++row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3027 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3028 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3029
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3030 if (screen_cur_row == screen_row - 1
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3031 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3032 && filler_todo <= 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3033 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3034 && wp->w_width == Columns)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3035 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3036 // Remember that the line wraps, used for modeless copy.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3037 LineWraps[screen_row - 1] = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3038
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3039 // Special trick to make copy/paste of wrapped lines work with
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3040 // xterm/screen: write an extra character beyond the end of
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3041 // the line. This will work with all terminal types
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3042 // (regardless of the xn,am settings).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3043 // Only do this on a fast tty.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3044 // Only do this if the cursor is on the current line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3045 // (something has been written in it).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3046 // Don't do this for the GUI.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3047 // Don't do this for double-width characters.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3048 // Don't do this for a window not at the right screen border.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3049 if (p_tf
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3050 #ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3051 && !gui.in_use
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3052 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3053 && !(has_mbyte
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3054 && ((*mb_off2cells)(LineOffset[screen_row],
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3055 LineOffset[screen_row] + screen_Columns)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3056 == 2
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3057 || (*mb_off2cells)(LineOffset[screen_row - 1]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3058 + (int)Columns - 2,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3059 LineOffset[screen_row] + screen_Columns)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3060 == 2)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3061 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3062 // First make sure we are at the end of the screen line,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3063 // then output the same character again to let the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3064 // terminal know about the wrap. If the terminal doesn't
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3065 // auto-wrap, we overwrite the character.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3066 if (screen_cur_col != wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3067 screen_char(LineOffset[screen_row - 1]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3068 + (unsigned)Columns - 1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3069 screen_row - 1, (int)(Columns - 1));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3070
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3071 // When there is a multi-byte character, just output a
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3072 // space to keep it simple.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3073 if (has_mbyte && MB_BYTE2LEN(ScreenLines[LineOffset[
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3074 screen_row - 1] + (Columns - 1)]) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3075 out_char(' ');
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3076 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3077 out_char(ScreenLines[LineOffset[screen_row - 1]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3078 + (Columns - 1)]);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3079 // force a redraw of the first char on the next line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3080 ScreenAttrs[LineOffset[screen_row]] = (sattr_T)-1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3081 screen_start(); // don't know where cursor is now
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3082 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3083 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3084
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3085 col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3086 off = (unsigned)(current_ScreenLine - ScreenLines);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3087 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3088 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3089 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3090 col = wp->w_width - 1; // col is not used if breaking!
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3091 off += col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3092 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3093 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3094
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3095 // reset the drawing state for the start of a wrapped line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3096 draw_state = WL_START;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3097 saved_n_extra = n_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3098 saved_p_extra = p_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3099 saved_c_extra = c_extra;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3100 saved_c_final = c_final;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3101 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3102 if (!(cul_screenline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3103 # ifdef FEAT_DIFF
20122
3b57ed35764e patch 8.2.0616: build error when disabling the diff feature
Bram Moolenaar <Bram@vim.org>
parents: 19816
diff changeset
3104 && diff_hlf == (hlf_T)0
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3105 # endif
20122
3b57ed35764e patch 8.2.0616: build error when disabling the diff feature
Bram Moolenaar <Bram@vim.org>
parents: 19816
diff changeset
3106 ))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3107 saved_char_attr = char_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3108 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3109 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3110 saved_char_attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3111 n_extra = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3112 lcs_prec_todo = lcs_prec;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3113 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3114 # ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3115 if (filler_todo <= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3116 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3117 need_showbreak = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3118 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3119 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3120 --filler_todo;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3121 // When the filler lines are actually below the last line of the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3122 // file, don't draw the line itself, break here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3123 if (filler_todo == 0 && wp->w_botfill)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3124 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3125 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3126 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3127
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3128 } // for every character in the line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3129
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3130 #ifdef FEAT_SPELL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3131 // After an empty line check first word for capital.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3132 if (*skipwhite(line) == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3133 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3134 capcol_lnum = lnum + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3135 cap_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3136 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3137 #endif
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18720
diff changeset
3138 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3139 vim_free(text_props);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3140 vim_free(text_prop_idxs);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3141 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3142
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3143 vim_free(p_extra_free);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3144 return row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3145 }