Mercurial > vim
annotate src/screen.c @ 31182:645c854bbf74 v9.0.0925
patch 9.0.0925: two conditions are always false
Commit: https://github.com/vim/vim/commit/df3c0eb41e1f48596c85af88b42fed22e3cca328
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed Nov 23 11:23:17 2022 +0000
patch 9.0.0925: two conditions are always false
Problem: Two conditions are always false.
Solution: Remove the conditions. Update return value types to make clear
what could be returned. (closes #11593)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Wed, 23 Nov 2022 12:30:04 +0100 |
parents | 50405a481037 |
children | b1c66bff0a66 |
rev | line source |
---|---|
10042
4aead6a9b7a9
commit https://github.com/vim/vim/commit/edf3f97ae2af024708ebb4ac614227327033ca47
Christian Brabandt <cb@256bit.org>
parents:
9992
diff
changeset
|
1 /* vi:set ts=8 sts=4 sw=4 noet: |
7 | 2 * |
3 * VIM - Vi IMproved by Bram Moolenaar | |
4 * | |
5 * Do ":help uganda" in Vim to read copying and usage conditions. | |
6 * Do ":help credits" in Vim to see a list of people who contributed. | |
7 * See README.txt for an overview of the Vim source code. | |
8 */ | |
9 | |
10 /* | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
11 * screen.c: Lower level code for displaying on the screen. |
7 | 12 * |
13 * Output to the screen (console, terminal emulator or GUI window) is minimized | |
14 * by remembering what is already on the screen, and only updating the parts | |
15 * that changed. | |
16 * | |
17 * ScreenLines[off] Contains a copy of the whole screen, as it is currently | |
18 * displayed (excluding text written by external commands). | |
19 * ScreenAttrs[off] Contains the associated attributes. | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
20 * ScreenCols[off] Contains the byte offset in the line. -1 means not |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
21 * available (below last line), MAXCOL means after the end |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
22 * of the line. |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
23 * |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
24 * LineOffset[row] Contains the offset into ScreenLines*[], ScreenAttrs[] |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
25 * and ScreenCols[] for each line. |
7 | 26 * LineWraps[row] Flag for each line whether it wraps to the next line. |
27 * | |
28 * For double-byte characters, two consecutive bytes in ScreenLines[] can form | |
29 * one character which occupies two display cells. | |
30 * For UTF-8 a multi-byte character is converted to Unicode and stored in | |
31 * ScreenLinesUC[]. ScreenLines[] contains the first byte only. For an ASCII | |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
32 * character without composing chars ScreenLinesUC[] will be 0 and |
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
33 * ScreenLinesC[][] is not used. When the character occupies two display |
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
34 * cells the next byte in ScreenLines[] is 0. |
714 | 35 * ScreenLinesC[][] contain up to 'maxcombine' composing characters |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
36 * (drawn on top of the first character). There is 0 after the last one used. |
7 | 37 * ScreenLines2[] is only used for euc-jp to store the second byte if the |
38 * first byte is 0x8e (single-width character). | |
39 * | |
40 * The screen_*() functions write to the screen and handle updating | |
41 * ScreenLines[]. | |
42 */ | |
43 | |
44 #include "vim.h" | |
45 | |
46 /* | |
47 * The attributes that are actually active for writing to the screen. | |
48 */ | |
49 static int screen_attr = 0; | |
50 | |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
51 static void screen_char_2(unsigned off, int row, int col); |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
52 static int screenclear2(int doclear); |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
53 static void lineclear(unsigned off, int width, int attr); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
54 static void lineinvalid(unsigned off, int width); |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
55 static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del, int clear_attr); |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
56 static void win_rest_invalid(win_T *wp); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
57 static void msg_pos_mode(void); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
58 static void recording_mode(int attr); |
7 | 59 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
60 // Ugly global: overrule attribute used by screen_char() |
7 | 61 static int screen_char_attr = 0; |
62 | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2237
diff
changeset
|
63 #if defined(FEAT_CONCEAL) || defined(PROTO) |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
64 /* |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
65 * Return TRUE if the cursor line in window "wp" may be concealed, according |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
66 * to the 'concealcursor' option. |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
67 */ |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
68 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
69 conceal_cursor_line(win_T *wp) |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
70 { |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
71 int c; |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
72 |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
73 if (*wp->w_p_cocu == NUL) |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
74 return FALSE; |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
75 if (get_real_state() & MODE_VISUAL) |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
76 c = 'v'; |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
77 else if (State & MODE_INSERT) |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
78 c = 'i'; |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
79 else if (State & MODE_NORMAL) |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
80 c = 'n'; |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
81 else if (State & MODE_CMDLINE) |
2382
3a5ededa240a
Add the 'c' flag to 'concealcursor'.
Bram Moolenaar <bram@vim.org>
parents:
2381
diff
changeset
|
82 c = 'c'; |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
83 else |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
84 return FALSE; |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
85 return vim_strchr(wp->w_p_cocu, c) != NULL; |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
86 } |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
87 |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
88 /* |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
89 * Check if the cursor line needs to be redrawn because of 'concealcursor'. |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
90 * To be called after changing the state, "was_concealed" is the value of |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
91 * "conceal_cursor_line()" before the change. |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
92 * " |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
93 */ |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
94 void |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
95 conceal_check_cursor_line(int was_concealed) |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
96 { |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
97 if (curwin->w_p_cole > 0 && conceal_cursor_line(curwin) != was_concealed) |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
98 { |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
99 int wcol = curwin->w_wcol; |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
100 |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
101 need_cursor_line_redraw = TRUE; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
102 // Need to recompute cursor column, e.g., when starting Visual mode |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
103 // without concealing. |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
104 curs_columns(TRUE); |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
105 |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
106 // When concealing now w_wcol will be computed wrong, keep the previous |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
107 // value, it will be updated in win_line(). |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
108 if (!was_concealed) |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
109 curwin->w_wcol = wcol; |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
110 } |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
111 } |
7 | 112 #endif |
113 | |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
114 /* |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
115 * Get 'wincolor' attribute for window "wp". If not set and "wp" is a popup |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
116 * window then get the "Pmenu" highlight attribute. |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
117 */ |
17055
f4de7ccdfd8c
patch 8.1.1527: when moving popup window over the cmdline it is not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17041
diff
changeset
|
118 int |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
119 get_wcr_attr(win_T *wp) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
120 { |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
121 int wcr_attr = 0; |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
122 |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
123 if (*wp->w_p_wcr != NUL) |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
124 wcr_attr = syn_name2attr(wp->w_p_wcr); |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
125 #ifdef FEAT_PROP_POPUP |
17628
6146b10714de
patch 8.1.1811: popup window color cannot be set to "Normal"
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
126 else if (WIN_IS_POPUP(wp)) |
17771
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
127 { |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
128 if (wp->w_popup_flags & POPF_INFO) |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
129 wcr_attr = HL_ATTR(HLF_PSI); // PmenuSel |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
130 else |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
131 wcr_attr = HL_ATTR(HLF_PNI); // Pmenu |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
132 } |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
133 #endif |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
134 return wcr_attr; |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
135 } |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
136 |
7 | 137 /* |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
138 * Call screen_fill() with the columns adjusted for 'rightleft' if needed. |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
139 * Return the new offset. |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
140 */ |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
141 static int |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
142 screen_fill_end( |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
143 win_T *wp, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
144 int c1, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
145 int c2, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
146 int off, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
147 int width, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
148 int row, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
149 int endrow, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
150 int attr) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
151 { |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
152 int nn = off + width; |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
153 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
154 if (nn > wp->w_width) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
155 nn = wp->w_width; |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
156 #ifdef FEAT_RIGHTLEFT |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
157 if (wp->w_p_rl) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
158 { |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
159 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
160 W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - off, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
161 c1, c2, attr); |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
162 } |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
163 else |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
164 #endif |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
165 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
166 wp->w_wincol + off, (int)wp->w_wincol + nn, |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
167 c1, c2, attr); |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
168 return nn; |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
169 } |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
170 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
171 /* |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
172 * Clear lines near the end the window and mark the unused lines with "c1". |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
173 * use "c2" as the filler character. |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
174 * When "draw_margin" is TRUE then draw the sign, fold and number columns. |
7 | 175 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
176 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
177 win_draw_end( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
178 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
179 int c1, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
180 int c2, |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
181 int draw_margin, |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
182 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
183 int endrow, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
184 hlf_T hl) |
7 | 185 { |
186 int n = 0; | |
16788
f7268ec2c889
patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
187 int attr = HL_ATTR(hl); |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
188 int wcr_attr = get_wcr_attr(wp); |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
189 |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
190 attr = hl_combine_attr(wcr_attr, attr); |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
191 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
192 if (draw_margin) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
193 { |
6553 | 194 #ifdef FEAT_FOLDING |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
195 int fdc = compute_foldcolumn(wp, 0); |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
196 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
197 if (fdc > 0) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
198 // draw the fold column |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
199 n = screen_fill_end(wp, ' ', ' ', n, fdc, |
16788
f7268ec2c889
patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
200 row, endrow, hl_combine_attr(wcr_attr, HL_ATTR(HLF_FC))); |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
201 #endif |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
202 #ifdef FEAT_SIGNS |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
203 if (signcolumn_on(wp)) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
204 // draw the sign column |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
205 n = screen_fill_end(wp, ' ', ' ', n, 2, |
16788
f7268ec2c889
patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
206 row, endrow, hl_combine_attr(wcr_attr, HL_ATTR(HLF_SC))); |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
207 #endif |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
208 if ((wp->w_p_nu || wp->w_p_rnu) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
209 && vim_strchr(p_cpo, CPO_NUMCOL) == NULL) |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
210 // draw the number column |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
211 n = screen_fill_end(wp, ' ', ' ', n, number_width(wp) + 1, |
16788
f7268ec2c889
patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
212 row, endrow, hl_combine_attr(wcr_attr, HL_ATTR(HLF_N))); |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
213 } |
7 | 214 |
215 #ifdef FEAT_RIGHTLEFT | |
216 if (wp->w_p_rl) | |
217 { | |
218 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, | |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
219 wp->w_wincol, W_ENDCOL(wp) - 1 - n, |
16788
f7268ec2c889
patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
220 c2, c2, attr); |
7 | 221 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
222 W_ENDCOL(wp) - 1 - n, W_ENDCOL(wp) - n, |
16788
f7268ec2c889
patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
223 c1, c2, attr); |
7 | 224 } |
225 else | |
226 #endif | |
227 { | |
228 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, | |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
229 wp->w_wincol + n, (int)W_ENDCOL(wp), |
16788
f7268ec2c889
patch 8.1.1396: 'wincolor' does not apply to lines below the buffer
Bram Moolenaar <Bram@vim.org>
parents:
16782
diff
changeset
|
230 c1, c2, attr); |
7 | 231 } |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
232 |
7 | 233 set_empty_rows(wp, row); |
234 } | |
235 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
236 #if defined(FEAT_FOLDING) || defined(PROTO) |
7 | 237 /* |
6553 | 238 * Compute the width of the foldcolumn. Based on 'foldcolumn' and how much |
239 * space is available for window "wp", minus "col". | |
240 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
241 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
242 compute_foldcolumn(win_T *wp, int col) |
6553 | 243 { |
244 int fdc = wp->w_p_fdc; | |
245 int wmw = wp == curwin && p_wmw == 0 ? 1 : p_wmw; | |
12515
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
246 int wwidth = wp->w_width; |
6553 | 247 |
248 if (fdc > wwidth - (col + wmw)) | |
249 fdc = wwidth - (col + wmw); | |
250 return fdc; | |
251 } | |
252 | |
253 /* | |
7 | 254 * Fill the foldcolumn at "p" for window "wp". |
548 | 255 * Only to be called when 'foldcolumn' > 0. |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
256 * Returns the number of bytes stored in 'p'. When non-multibyte characters are |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
257 * used for the fold column markers, this is equal to 'fdc' setting. Otherwise, |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
258 * this will be greater than 'fdc'. |
7 | 259 */ |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
260 size_t |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
261 fill_foldcolumn( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
262 char_u *p, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
263 win_T *wp, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
264 int closed, // TRUE of FALSE |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
265 linenr_T lnum) // current line number |
7 | 266 { |
267 int i = 0; | |
268 int level; | |
269 int first_level; | |
519 | 270 int empty; |
6553 | 271 int fdc = compute_foldcolumn(wp, 0); |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
272 size_t byte_counter = 0; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
273 int symbol = 0; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
274 int len = 0; |
7 | 275 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
276 // Init to all spaces. |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
277 vim_memset(p, ' ', MAX_MCO * fdc + 1); |
7 | 278 |
279 level = win_foldinfo.fi_level; | |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
280 empty = (fdc == 1) ? 0 : 1; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
281 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
282 // If the column is too narrow, we start at the lowest level that |
24055
90d1636a8fcb
patch 8.2.2569: 'fillchars' "stl" and "stlnc" items must be single byte
Bram Moolenaar <Bram@vim.org>
parents:
24043
diff
changeset
|
283 // fits and use numbers to indicate the depth. |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
284 first_level = level - fdc - closed + 1 + empty; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
285 if (first_level < 1) |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
286 first_level = 1; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
287 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
288 for (i = 0; i < MIN(fdc, level); i++) |
7 | 289 { |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
290 if (win_foldinfo.fi_lnum == lnum |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
291 && first_level + i >= win_foldinfo.fi_low_level) |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
292 symbol = wp->w_fill_chars.foldopen; |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
293 else if (first_level == 1) |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
294 symbol = wp->w_fill_chars.foldsep; |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
295 else if (first_level + i <= 9) |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
296 symbol = '0' + first_level + i; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
297 else |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
298 symbol = '>'; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
299 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
300 len = utf_char2bytes(symbol, &p[byte_counter]); |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
301 byte_counter += len; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
302 if (first_level + i >= level) |
7 | 303 { |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
304 i++; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
305 break; |
7 | 306 } |
307 } | |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
308 |
7 | 309 if (closed) |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
310 { |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
311 if (symbol != 0) |
24184
8ebf8b3dfc08
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly
Bram Moolenaar <Bram@vim.org>
parents:
24055
diff
changeset
|
312 { |
8ebf8b3dfc08
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly
Bram Moolenaar <Bram@vim.org>
parents:
24055
diff
changeset
|
313 // rollback length and the character |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
314 byte_counter -= len; |
24184
8ebf8b3dfc08
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly
Bram Moolenaar <Bram@vim.org>
parents:
24055
diff
changeset
|
315 if (len > 1) |
8ebf8b3dfc08
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly
Bram Moolenaar <Bram@vim.org>
parents:
24055
diff
changeset
|
316 // for a multibyte character, erase all the bytes |
8ebf8b3dfc08
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly
Bram Moolenaar <Bram@vim.org>
parents:
24055
diff
changeset
|
317 vim_memset(p + byte_counter, ' ', len); |
8ebf8b3dfc08
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly
Bram Moolenaar <Bram@vim.org>
parents:
24055
diff
changeset
|
318 } |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
319 symbol = wp->w_fill_chars.foldclosed; |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
320 len = utf_char2bytes(symbol, &p[byte_counter]); |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
321 byte_counter += len; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
322 } |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
323 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
324 return MAX(byte_counter + (fdc - i), (size_t)fdc); |
7 | 325 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
326 #endif // FEAT_FOLDING |
7 | 327 |
714 | 328 /* |
329 * Return if the composing characters at "off_from" and "off_to" differ. | |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
330 * Only to be used when ScreenLinesUC[off_from] != 0. |
714 | 331 */ |
332 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
333 comp_char_differs(int off_from, int off_to) |
714 | 334 { |
335 int i; | |
336 | |
337 for (i = 0; i < Screen_mco; ++i) | |
338 { | |
339 if (ScreenLinesC[i][off_from] != ScreenLinesC[i][off_to]) | |
340 return TRUE; | |
341 if (ScreenLinesC[i][off_from] == 0) | |
342 break; | |
343 } | |
344 return FALSE; | |
345 } | |
346 | |
7 | 347 /* |
348 * Check whether the given character needs redrawing: | |
349 * - the (first byte of the) character is different | |
350 * - the attributes are different | |
351 * - the character is multi-byte and the next byte is different | |
1616 | 352 * - the character is two cells wide and the second cell differs. |
7 | 353 */ |
354 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
355 char_needs_redraw(int off_from, int off_to, int cols) |
7 | 356 { |
357 if (cols > 0 | |
358 && ((ScreenLines[off_from] != ScreenLines[off_to] | |
359 || ScreenAttrs[off_from] != ScreenAttrs[off_to]) | |
360 || (enc_dbcs != 0 | |
361 && MB_BYTE2LEN(ScreenLines[off_from]) > 1 | |
362 && (enc_dbcs == DBCS_JPNU && ScreenLines[off_from] == 0x8e | |
363 ? ScreenLines2[off_from] != ScreenLines2[off_to] | |
364 : (cols > 1 && ScreenLines[off_from + 1] | |
365 != ScreenLines[off_to + 1]))) | |
366 || (enc_utf8 | |
367 && (ScreenLinesUC[off_from] != ScreenLinesUC[off_to] | |
368 || (ScreenLinesUC[off_from] != 0 | |
1616 | 369 && comp_char_differs(off_from, off_to)) |
3759 | 370 || ((*mb_off2cells)(off_from, off_from + cols) > 1 |
371 && ScreenLines[off_from + 1] | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
372 != ScreenLines[off_to + 1]))))) |
7 | 373 return TRUE; |
374 return FALSE; | |
375 } | |
376 | |
11670
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
377 #if defined(FEAT_TERMINAL) || defined(PROTO) |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
378 /* |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
379 * Return the index in ScreenLines[] for the current screen line. |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
380 */ |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
381 int |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
382 screen_get_current_line_off() |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
383 { |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
384 return (int)(current_ScreenLine - ScreenLines); |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
385 } |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
386 #endif |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
387 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
388 #ifdef FEAT_PROP_POPUP |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
389 /* |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
390 * Return TRUE if this position has a higher level popup or this cell is |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
391 * transparent in the current popup. |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
392 */ |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
393 static int |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
394 blocked_by_popup(int row, int col) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
395 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
396 int off; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
397 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
398 if (!popup_visible) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
399 return FALSE; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
400 off = row * screen_Columns + col; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
401 return popup_mask[off] > screen_zindex || popup_transparent[off]; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
402 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
403 #endif |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
404 |
7 | 405 /* |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
406 * Reset the highlighting. Used before clearing the screen. |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
407 */ |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
408 void |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
409 reset_screen_attr(void) |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
410 { |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
411 #ifdef FEAT_GUI |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
412 if (gui.in_use) |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
413 // Use a code that will reset gui.highlight_mask in |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
414 // gui_stop_highlight(). |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
415 screen_attr = HL_ALL + 1; |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
416 else |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
417 #endif |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
418 // Use attributes that is very unlikely to appear in text. |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
419 screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE | HL_STRIKETHROUGH; |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
420 } |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
421 |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
422 /* |
30606
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
423 * Return TRUE if the character at "row" / "col" is under the popup menu and it |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
424 * will be redrawn soon or it is under another popup. |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
425 */ |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
426 static int |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
427 skip_for_popup(int row, int col) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
428 { |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
429 // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top. |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
430 if (pum_under_menu(row, col, TRUE) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
431 #ifdef FEAT_PROP_POPUP |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
432 && screen_zindex <= POPUPMENU_ZINDEX |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
433 #endif |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
434 ) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
435 return TRUE; |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
436 #ifdef FEAT_PROP_POPUP |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
437 if (blocked_by_popup(row, col)) |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
438 return TRUE; |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
439 #endif |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
440 return FALSE; |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
441 } |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
442 |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
443 /* |
7 | 444 * Move one "cooked" screen line to the screen, but only the characters that |
445 * have actually changed. Handle insert/delete character. | |
446 * "coloff" gives the first column on the screen for this line. | |
447 * "endcol" gives the columns where valid characters are. | |
448 * "clear_width" is the width of the window. It's > 0 if the rest of the line | |
449 * needs to be cleared, negative otherwise. | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
450 * "flags" can have bits: |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
451 * SLF_POPUP popup window |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
452 * SLF_RIGHTLEFT rightleft window: |
7 | 453 * When TRUE and "clear_width" > 0, clear columns 0 to "endcol" |
454 * When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width" | |
455 */ | |
11670
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
456 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
457 screen_line( |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
458 win_T *wp, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
459 int row, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
460 int coloff, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
461 int endcol, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
462 int clear_width, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
463 int flags UNUSED) |
7 | 464 { |
465 unsigned off_from; | |
466 unsigned off_to; | |
1378 | 467 unsigned max_off_from; |
468 unsigned max_off_to; | |
7 | 469 int col = 0; |
470 int hl; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
471 int force = FALSE; // force update rest of the line |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
472 int redraw_this // bool: does character need redraw? |
7 | 473 #ifdef FEAT_GUI |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
474 = TRUE // For GUI when while-loop empty |
7 | 475 #endif |
476 ; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
477 int redraw_next; // redraw_this for next character |
30771
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
478 #ifdef FEAT_GUI_MSWIN |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
479 int changed_this; // TRUE if character changed |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
480 int changed_next; // TRUE if next character changed |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
481 #endif |
7 | 482 int clear_next = FALSE; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
483 int char_cells; // 1: normal char |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
484 // 2: occupies two display cells |
7 | 485 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
486 // Check for illegal row and col, just in case. |
3413 | 487 if (row >= Rows) |
488 row = Rows - 1; | |
489 if (endcol > Columns) | |
490 endcol = Columns; | |
491 | |
7 | 492 # ifdef FEAT_CLIPBOARD |
493 clip_may_clear_selection(row, row); | |
494 # endif | |
495 | |
496 off_from = (unsigned)(current_ScreenLine - ScreenLines); | |
497 off_to = LineOffset[row] + coloff; | |
1378 | 498 max_off_from = off_from + screen_Columns; |
499 max_off_to = LineOffset[row] + screen_Columns; | |
7 | 500 |
501 #ifdef FEAT_RIGHTLEFT | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
502 if (flags & SLF_RIGHTLEFT) |
7 | 503 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
504 // Clear rest first, because it's left of the text. |
7 | 505 if (clear_width > 0) |
506 { | |
507 while (col <= endcol && ScreenLines[off_to] == ' ' | |
508 && ScreenAttrs[off_to] == 0 | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
509 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)) |
7 | 510 { |
511 ++off_to; | |
512 ++col; | |
513 } | |
514 if (col <= endcol) | |
515 screen_fill(row, row + 1, col + coloff, | |
516 endcol + coloff + 1, ' ', ' ', 0); | |
517 } | |
518 col = endcol + 1; | |
519 off_to = LineOffset[row] + col + coloff; | |
520 off_from += col; | |
521 endcol = (clear_width > 0 ? clear_width : -clear_width); | |
522 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
523 #endif // FEAT_RIGHTLEFT |
7 | 524 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
525 #ifdef FEAT_PROP_POPUP |
18720
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
526 // First char of a popup window may go on top of the right half of a |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
527 // double-wide character. Clear the left half to avoid it getting the popup |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
528 // window background color. |
22832
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
529 if (coloff > 0 && enc_utf8 |
8059beb101d0
patch 8.2.1963: crash when using a popup window with "latin1" encoding
Bram Moolenaar <Bram@vim.org>
parents:
22742
diff
changeset
|
530 && ScreenLines[off_to] == 0 |
21929
771904112b47
patch 8.2.1514: multibyte vertical separator is cleared when dragging popup
Bram Moolenaar <Bram@vim.org>
parents:
21919
diff
changeset
|
531 && ScreenLinesUC[off_to - 1] != 0 |
771904112b47
patch 8.2.1514: multibyte vertical separator is cleared when dragging popup
Bram Moolenaar <Bram@vim.org>
parents:
21919
diff
changeset
|
532 && (*mb_char2cells)(ScreenLinesUC[off_to - 1]) > 1) |
18720
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
533 { |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
534 ScreenLines[off_to - 1] = ' '; |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
535 ScreenLinesUC[off_to - 1] = 0; |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
536 screen_char(off_to - 1, row, col + coloff - 1); |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
537 } |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
538 #endif |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
539 |
7 | 540 redraw_next = char_needs_redraw(off_from, off_to, endcol - col); |
30771
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
541 #ifdef FEAT_GUI_MSWIN |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
542 changed_next = redraw_next; |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
543 #endif |
7 | 544 |
545 while (col < endcol) | |
546 { | |
547 if (has_mbyte && (col + 1 < endcol)) | |
1378 | 548 char_cells = (*mb_off2cells)(off_from, max_off_from); |
7 | 549 else |
550 char_cells = 1; | |
551 | |
552 redraw_this = redraw_next; | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
553 redraw_next = force || char_needs_redraw(off_from + char_cells, |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
554 off_to + char_cells, endcol - col - char_cells); |
7 | 555 |
556 #ifdef FEAT_GUI | |
30771
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
557 # ifdef FEAT_GUI_MSWIN |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
558 changed_this = changed_next; |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
559 changed_next = redraw_next; |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
560 # endif |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
561 // If the next character was bold, then redraw the current character to |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
562 // remove any pixels that might have spilt over into us. This only |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
563 // happens in the GUI. |
30771
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
564 // With MS-Windows antialiasing may also cause pixels to spill over |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
565 // from a previous character, no matter attributes, always redraw if a |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
566 // character changed. |
7 | 567 if (redraw_next && gui.in_use) |
568 { | |
30771
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
569 # ifndef FEAT_GUI_MSWIN |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
570 hl = ScreenAttrs[off_to + char_cells]; |
743 | 571 if (hl > HL_ALL) |
572 hl = syn_attr2attr(hl); | |
573 if (hl & HL_BOLD) | |
30771
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
574 # endif |
7 | 575 redraw_this = TRUE; |
576 } | |
577 #endif | |
30606
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
578 // Do not redraw if under the popup menu. |
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
579 if (redraw_this && skip_for_popup(row, col + coloff)) |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
580 redraw_this = FALSE; |
30606
c5356021a938
patch 9.0.0638: popup menu highlight wrong on top of preview popup
Bram Moolenaar <Bram@vim.org>
parents:
30598
diff
changeset
|
581 |
7 | 582 if (redraw_this) |
583 { | |
584 /* | |
585 * Special handling when 'xs' termcap flag set (hpterm): | |
586 * Attributes for characters are stored at the position where the | |
587 * cursor is when writing the highlighting code. The | |
588 * start-highlighting code must be written with the cursor on the | |
589 * first highlighted character. The stop-highlighting code must | |
590 * be written with the cursor just after the last highlighted | |
591 * character. | |
15034
6e4e0d43b20b
patch 8.1.0528: various typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
14877
diff
changeset
|
592 * Overwriting a character doesn't remove its highlighting. Need |
7 | 593 * to clear the rest of the line, and force redrawing it |
594 * completely. | |
595 */ | |
596 if ( p_wiv | |
597 && !force | |
598 #ifdef FEAT_GUI | |
599 && !gui.in_use | |
600 #endif | |
601 && ScreenAttrs[off_to] != 0 | |
602 && ScreenAttrs[off_from] != ScreenAttrs[off_to]) | |
603 { | |
604 /* | |
605 * Need to remove highlighting attributes here. | |
606 */ | |
607 windgoto(row, col + coloff); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
608 out_str(T_CE); // clear rest of this screen line |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
609 screen_start(); // don't know where cursor is now |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
610 force = TRUE; // force redraw of rest of the line |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
611 redraw_next = TRUE; // or else next char would miss out |
7 | 612 |
613 /* | |
614 * If the previous character was highlighted, need to stop | |
615 * highlighting at this character. | |
616 */ | |
617 if (col + coloff > 0 && ScreenAttrs[off_to - 1] != 0) | |
618 { | |
619 screen_attr = ScreenAttrs[off_to - 1]; | |
620 term_windgoto(row, col + coloff); | |
621 screen_stop_highlight(); | |
622 } | |
623 else | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
624 screen_attr = 0; // highlighting has stopped |
7 | 625 } |
626 if (enc_dbcs != 0) | |
627 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
628 // Check if overwriting a double-byte with a single-byte or |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
629 // the other way around requires another character to be |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
630 // redrawn. For UTF-8 this isn't needed, because comparing |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
631 // ScreenLinesUC[] is sufficient. |
7 | 632 if (char_cells == 1 |
633 && col + 1 < endcol | |
1378 | 634 && (*mb_off2cells)(off_to, max_off_to) > 1) |
7 | 635 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
636 // Writing a single-cell character over a double-cell |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
637 // character: need to redraw the next cell. |
7 | 638 ScreenLines[off_to + 1] = 0; |
639 redraw_next = TRUE; | |
640 } | |
641 else if (char_cells == 2 | |
642 && col + 2 < endcol | |
1378 | 643 && (*mb_off2cells)(off_to, max_off_to) == 1 |
644 && (*mb_off2cells)(off_to + 1, max_off_to) > 1) | |
7 | 645 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
646 // Writing the second half of a double-cell character over |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
647 // a double-cell character: need to redraw the second |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
648 // cell. |
7 | 649 ScreenLines[off_to + 2] = 0; |
650 redraw_next = TRUE; | |
651 } | |
652 | |
653 if (enc_dbcs == DBCS_JPNU) | |
654 ScreenLines2[off_to] = ScreenLines2[off_from]; | |
655 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
656 // When writing a single-width character over a double-width |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
657 // character and at the end of the redrawn text, need to clear out |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
658 // the right half of the old character. |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
659 // Also required when writing the right half of a double-width |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
660 // char over the left half of an existing one. |
7 | 661 if (has_mbyte && col + char_cells == endcol |
662 && ((char_cells == 1 | |
1378 | 663 && (*mb_off2cells)(off_to, max_off_to) > 1) |
7 | 664 || (char_cells == 2 |
1378 | 665 && (*mb_off2cells)(off_to, max_off_to) == 1 |
666 && (*mb_off2cells)(off_to + 1, max_off_to) > 1))) | |
7 | 667 clear_next = TRUE; |
668 | |
669 ScreenLines[off_to] = ScreenLines[off_from]; | |
670 if (enc_utf8) | |
671 { | |
672 ScreenLinesUC[off_to] = ScreenLinesUC[off_from]; | |
673 if (ScreenLinesUC[off_from] != 0) | |
674 { | |
714 | 675 int i; |
676 | |
677 for (i = 0; i < Screen_mco; ++i) | |
678 ScreenLinesC[i][off_to] = ScreenLinesC[i][off_from]; | |
7 | 679 } |
680 } | |
681 if (char_cells == 2) | |
682 ScreenLines[off_to + 1] = ScreenLines[off_from + 1]; | |
683 | |
684 #if defined(FEAT_GUI) || defined(UNIX) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
685 // The bold trick makes a single column of pixels appear in the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
686 // next character. When a bold character is removed, the next |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
687 // character should be redrawn too. This happens for our own GUI |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
688 // and for some xterms. |
7 | 689 if ( |
690 # ifdef FEAT_GUI | |
691 gui.in_use | |
692 # endif | |
693 # if defined(FEAT_GUI) && defined(UNIX) | |
694 || | |
695 # endif | |
696 # ifdef UNIX | |
697 term_is_xterm | |
698 # endif | |
699 ) | |
700 { | |
701 hl = ScreenAttrs[off_to]; | |
743 | 702 if (hl > HL_ALL) |
703 hl = syn_attr2attr(hl); | |
704 if (hl & HL_BOLD) | |
7 | 705 redraw_next = TRUE; |
706 } | |
707 #endif | |
30771
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
708 #ifdef FEAT_GUI_MSWIN |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
709 // MS-Windows antialiasing may spill over to the next character, |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
710 // redraw that one if this one changed, no matter attributes. |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
711 if (gui.in_use && changed_this) |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
712 redraw_next = TRUE; |
cf77f7a19ab6
patch 9.0.0720: MS-Windows GUI may have pixel dust from antialiasing
Bram Moolenaar <Bram@vim.org>
parents:
30643
diff
changeset
|
713 #endif |
7 | 714 ScreenAttrs[off_to] = ScreenAttrs[off_from]; |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
715 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
716 // For simplicity set the attributes of second half of a |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
717 // double-wide character equal to the first half. |
819 | 718 if (char_cells == 2) |
719 ScreenAttrs[off_to + 1] = ScreenAttrs[off_from]; | |
720 | |
7 | 721 if (enc_dbcs != 0 && char_cells == 2) |
722 screen_char_2(off_to, row, col + coloff); | |
723 else | |
724 screen_char(off_to, row, col + coloff); | |
725 } | |
726 else if ( p_wiv | |
727 #ifdef FEAT_GUI | |
728 && !gui.in_use | |
729 #endif | |
730 && col + coloff > 0) | |
731 { | |
732 if (ScreenAttrs[off_to] == ScreenAttrs[off_to - 1]) | |
733 { | |
734 /* | |
735 * Don't output stop-highlight when moving the cursor, it will | |
736 * stop the highlighting when it should continue. | |
737 */ | |
738 screen_attr = 0; | |
739 } | |
740 else if (screen_attr != 0) | |
741 screen_stop_highlight(); | |
742 } | |
743 | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
744 ScreenCols[off_to] = ScreenCols[off_from]; |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
745 if (char_cells == 2) |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
746 ScreenCols[off_to + 1] = ScreenCols[off_from]; |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
747 |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
748 off_to += char_cells; |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
749 off_from += char_cells; |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
750 col += char_cells; |
7 | 751 } |
752 | |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
753 if (clear_next && !skip_for_popup(row, col + coloff)) |
7 | 754 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
755 // Clear the second half of a double-wide character of which the left |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
756 // half was overwritten with a single-wide character. |
7 | 757 ScreenLines[off_to] = ' '; |
758 if (enc_utf8) | |
759 ScreenLinesUC[off_to] = 0; | |
760 screen_char(off_to, row, col + coloff); | |
761 } | |
762 | |
763 if (clear_width > 0 | |
764 #ifdef FEAT_RIGHTLEFT | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
765 && !(flags & SLF_RIGHTLEFT) |
7 | 766 #endif |
767 ) | |
768 { | |
769 #ifdef FEAT_GUI | |
770 int startCol = col; | |
771 #endif | |
772 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
773 // blank out the rest of the line |
7 | 774 while (col < clear_width && ScreenLines[off_to] == ' ' |
775 && ScreenAttrs[off_to] == 0 | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
776 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)) |
7 | 777 { |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
778 ScreenCols[off_to] = MAXCOL; |
7 | 779 ++off_to; |
780 ++col; | |
781 } | |
782 if (col < clear_width) | |
783 { | |
784 #ifdef FEAT_GUI | |
785 /* | |
786 * In the GUI, clearing the rest of the line may leave pixels | |
787 * behind if the first character cleared was bold. Some bold | |
788 * fonts spill over the left. In this case we redraw the previous | |
789 * character too. If we didn't skip any blanks above, then we | |
790 * only redraw if the character wasn't already redrawn anyway. | |
791 */ | |
996 | 792 if (gui.in_use && (col > startCol || !redraw_this)) |
7 | 793 { |
794 hl = ScreenAttrs[off_to]; | |
795 if (hl > HL_ALL || (hl & HL_BOLD)) | |
996 | 796 { |
797 int prev_cells = 1; | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
798 |
996 | 799 if (enc_utf8) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
800 // for utf-8, ScreenLines[char_offset + 1] == 0 means |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
801 // that its width is 2. |
996 | 802 prev_cells = ScreenLines[off_to - 1] == 0 ? 2 : 1; |
803 else if (enc_dbcs != 0) | |
804 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
805 // find previous character by counting from first |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
806 // column and get its width. |
996 | 807 unsigned off = LineOffset[row]; |
1378 | 808 unsigned max_off = LineOffset[row] + screen_Columns; |
996 | 809 |
810 while (off < off_to) | |
811 { | |
1378 | 812 prev_cells = (*mb_off2cells)(off, max_off); |
996 | 813 off += prev_cells; |
814 } | |
815 } | |
816 | |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
817 if (!skip_for_popup(row, col + coloff - prev_cells)) |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
818 { |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
819 if (enc_dbcs != 0 && prev_cells > 1) |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
820 screen_char_2(off_to - prev_cells, row, |
996 | 821 col + coloff - prev_cells); |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
822 else |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
823 screen_char(off_to - prev_cells, row, |
996 | 824 col + coloff - prev_cells); |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
825 } |
996 | 826 } |
7 | 827 } |
828 #endif | |
829 screen_fill(row, row + 1, col + coloff, clear_width + coloff, | |
830 ' ', ' ', 0); | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
831 while (col < clear_width) |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
832 { |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
833 ScreenCols[off_to++] = MAXCOL; |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
834 ++col; |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
835 } |
7 | 836 } |
837 } | |
838 | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
839 if (clear_width > 0 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
840 #ifdef FEAT_PROP_POPUP |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
841 && !(flags & SLF_POPUP) // no separator for popup window |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
842 #endif |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
843 ) |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
844 { |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
845 // For a window that has a right neighbor, draw the separator char |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
846 // right of the window contents. But not on top of a popup window. |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
847 if (coloff + col < Columns) |
7 | 848 { |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
849 if (!skip_for_popup(row, col + coloff)) |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
850 { |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
851 int c; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
852 |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
853 c = fillchar_vsep(&hl, wp); |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
854 if (ScreenLines[off_to] != (schar_T)c |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
855 || (enc_utf8 && (int)ScreenLinesUC[off_to] |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
856 != (c >= 0x80 ? c : 0)) |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
857 || ScreenAttrs[off_to] != hl) |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
858 { |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
859 ScreenLines[off_to] = c; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
860 ScreenAttrs[off_to] = hl; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
861 if (enc_utf8) |
7 | 862 { |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
863 if (c >= 0x80) |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
864 { |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
865 ScreenLinesUC[off_to] = c; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
866 ScreenLinesC[0][off_to] = 0; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
867 } |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
868 else |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
869 ScreenLinesUC[off_to] = 0; |
7 | 870 } |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
871 screen_char(off_to, row, col + coloff); |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
872 } |
7 | 873 } |
874 } | |
875 else | |
876 LineWraps[row] = FALSE; | |
877 } | |
878 } | |
879 | |
474 | 880 #if defined(FEAT_RIGHTLEFT) || defined(PROTO) |
7 | 881 /* |
474 | 882 * Mirror text "str" for right-left displaying. |
883 * Only works for single-byte characters (e.g., numbers). | |
7 | 884 */ |
474 | 885 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
886 rl_mirror(char_u *str) |
7 | 887 { |
888 char_u *p1, *p2; | |
889 int t; | |
890 | |
891 for (p1 = str, p2 = str + STRLEN(str) - 1; p1 < p2; ++p1, --p2) | |
892 { | |
893 t = *p1; | |
894 *p1 = *p2; | |
895 *p2 = t; | |
896 } | |
897 } | |
898 #endif | |
899 | |
900 /* | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
901 * Draw the verticap separator right of window "wp" starting with line "row". |
7 | 902 */ |
903 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
904 draw_vsep_win(win_T *wp, int row) |
7 | 905 { |
906 int hl; | |
907 int c; | |
908 | |
909 if (wp->w_vsep_width) | |
910 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
911 // draw the vertical separator right of this window |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
912 c = fillchar_vsep(&hl, wp); |
7 | 913 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, |
914 W_ENDCOL(wp), W_ENDCOL(wp) + 1, | |
915 c, ' ', hl); | |
916 } | |
917 } | |
918 | |
919 /* | |
920 * Return TRUE if the status line of window "wp" is connected to the status | |
921 * line of the window right of it. If not, then it's a vertical separator. | |
922 * Only call if (wp->w_vsep_width != 0). | |
923 */ | |
924 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
925 stl_connected(win_T *wp) |
7 | 926 { |
927 frame_T *fr; | |
928 | |
929 fr = wp->w_frame; | |
930 while (fr->fr_parent != NULL) | |
931 { | |
932 if (fr->fr_parent->fr_layout == FR_COL) | |
933 { | |
934 if (fr->fr_next != NULL) | |
935 break; | |
936 } | |
937 else | |
938 { | |
939 if (fr->fr_next != NULL) | |
940 return TRUE; | |
941 } | |
942 fr = fr->fr_parent; | |
943 } | |
944 return FALSE; | |
945 } | |
946 | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
947 |
7 | 948 /* |
949 * Get the value to show for the language mappings, active 'keymap'. | |
950 */ | |
951 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
952 get_keymap_str( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
953 win_T *wp, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
954 char_u *fmt, // format string containing one %s item |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
955 char_u *buf, // buffer for the result |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
956 int len) // length of buffer |
7 | 957 { |
958 char_u *p; | |
959 | |
960 if (wp->w_buffer->b_p_iminsert != B_IMODE_LMAP) | |
961 return FALSE; | |
962 | |
963 { | |
964 #ifdef FEAT_EVAL | |
965 buf_T *old_curbuf = curbuf; | |
966 win_T *old_curwin = curwin; | |
967 char_u *s; | |
968 | |
969 curbuf = wp->w_buffer; | |
970 curwin = wp; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
971 STRCPY(buf, "b:keymap_name"); // must be writable |
7 | 972 ++emsg_skip; |
30598
37aa9fd2ed72
patch 9.0.0634: evaluating "expr" options has more overhead than needed
Bram Moolenaar <Bram@vim.org>
parents:
30513
diff
changeset
|
973 s = p = eval_to_string(buf, FALSE, FALSE); |
7 | 974 --emsg_skip; |
975 curbuf = old_curbuf; | |
976 curwin = old_curwin; | |
977 if (p == NULL || *p == NUL) | |
978 #endif | |
979 { | |
980 #ifdef FEAT_KEYMAP | |
981 if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED) | |
982 p = wp->w_buffer->b_p_keymap; | |
983 else | |
984 #endif | |
985 p = (char_u *)"lang"; | |
986 } | |
9645
123d3c102035
commit https://github.com/vim/vim/commit/73ac0c4281a3606651604a3cbcc334bfb3859a87
Christian Brabandt <cb@256bit.org>
parents:
9489
diff
changeset
|
987 if (vim_snprintf((char *)buf, len, (char *)fmt, p) > len - 1) |
7 | 988 buf[0] = NUL; |
989 #ifdef FEAT_EVAL | |
990 vim_free(s); | |
991 #endif | |
992 } | |
993 return buf[0] != NUL; | |
994 } | |
995 | |
996 #if defined(FEAT_STL_OPT) || defined(PROTO) | |
997 /* | |
677 | 998 * Redraw the status line or ruler of window "wp". |
999 * When "wp" is NULL redraw the tab pages line from 'tabline'. | |
7 | 1000 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1001 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1002 win_redr_custom( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1003 win_T *wp, |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1004 int draw_ruler) // TRUE or FALSE |
7 | 1005 { |
5539 | 1006 static int entered = FALSE; |
7 | 1007 int attr; |
1008 int curattr; | |
1009 int row; | |
1010 int col = 0; | |
1011 int maxwidth; | |
1012 int width; | |
1013 int n; | |
1014 int len; | |
1015 int fillchar; | |
1016 char_u buf[MAXPATHL]; | |
1983 | 1017 char_u *stl; |
7 | 1018 char_u *p; |
31018
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1019 char_u *opt_name; |
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1020 int opt_scope = 0; |
22721
92a100fc5e17
patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents:
21929
diff
changeset
|
1021 stl_hlrec_T *hltab; |
92a100fc5e17
patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents:
21929
diff
changeset
|
1022 stl_hlrec_T *tabtab; |
2693 | 1023 win_T *ewp; |
1024 int p_crb_save; | |
7 | 1025 |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1026 // There is a tiny chance that this gets called recursively: When |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1027 // redrawing a status line triggers redrawing the ruler or tabline. |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1028 // Avoid trouble by not allowing recursion. |
5539 | 1029 if (entered) |
1030 return; | |
1031 entered = TRUE; | |
1032 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1033 // setup environment for the task at hand |
677 | 1034 if (wp == NULL) |
1035 { | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1036 // Use 'tabline'. Always at the first line of the screen. |
1983 | 1037 stl = p_tal; |
677 | 1038 row = 0; |
707 | 1039 fillchar = ' '; |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
1040 attr = HL_ATTR(HLF_TPF); |
677 | 1041 maxwidth = Columns; |
31018
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1042 opt_name = (char_u *)"tabline"; |
677 | 1043 } |
40 | 1044 else |
677 | 1045 { |
24289
8938c0c98149
patch 8.2.2685: custom statusline not drawn correctly with WinBar
Bram Moolenaar <Bram@vim.org>
parents:
24184
diff
changeset
|
1046 row = statusline_row(wp); |
11890
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
1047 fillchar = fillchar_status(&attr, wp); |
12515
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
1048 maxwidth = wp->w_width; |
677 | 1049 |
1050 if (draw_ruler) | |
1051 { | |
1983 | 1052 stl = p_ruf; |
31018
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1053 opt_name = (char_u *)"rulerformat"; |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1054 // advance past any leading group spec - implicit in ru_col |
1983 | 1055 if (*stl == '%') |
1056 { | |
1057 if (*++stl == '-') | |
1058 stl++; | |
1059 if (atoi((char *)stl)) | |
1060 while (VIM_ISDIGIT(*stl)) | |
1061 stl++; | |
1062 if (*stl++ != '(') | |
1063 stl = p_ruf; | |
677 | 1064 } |
12515
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
1065 col = ru_col - (Columns - wp->w_width); |
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
1066 if (col < (wp->w_width + 1) / 2) |
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
1067 col = (wp->w_width + 1) / 2; |
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
1068 maxwidth = wp->w_width - col; |
677 | 1069 if (!wp->w_status_height) |
1070 { | |
1071 row = Rows - 1; | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1072 --maxwidth; // writing in last column may cause scrolling |
677 | 1073 fillchar = ' '; |
1074 attr = 0; | |
1075 } | |
1076 } | |
1077 else | |
1078 { | |
31018
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1079 opt_name = (char_u *)"statusline"; |
677 | 1080 if (*wp->w_p_stl != NUL) |
31018
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1081 { |
1983 | 1082 stl = wp->w_p_stl; |
31018
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1083 opt_scope = OPT_LOCAL; |
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1084 } |
677 | 1085 else |
1983 | 1086 stl = p_stl; |
677 | 1087 } |
1088 | |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12510
diff
changeset
|
1089 col += wp->w_wincol; |
677 | 1090 } |
1091 | |
7 | 1092 if (maxwidth <= 0) |
5539 | 1093 goto theend; |
677 | 1094 |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1095 // Temporarily reset 'cursorbind', we don't want a side effect from moving |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1096 // the cursor away and back. |
2693 | 1097 ewp = wp == NULL ? curwin : wp; |
1098 p_crb_save = ewp->w_p_crb; | |
1099 ewp->w_p_crb = FALSE; | |
1100 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1101 // Make a copy, because the statusline may include a function call that |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1102 // might change the option value and free the memory. |
1983 | 1103 stl = vim_strsave(stl); |
2693 | 1104 width = build_stl_str_hl(ewp, buf, sizeof(buf), |
31018
9716c7d24c12
patch 9.0.0844: handling 'statusline' errors is spread out
Bram Moolenaar <Bram@vim.org>
parents:
30986
diff
changeset
|
1105 stl, opt_name, opt_scope, |
22721
92a100fc5e17
patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents:
21929
diff
changeset
|
1106 fillchar, maxwidth, &hltab, &tabtab); |
1983 | 1107 vim_free(stl); |
2693 | 1108 ewp->w_p_crb = p_crb_save; |
2661 | 1109 |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1110 // Make all characters printable. |
2661 | 1111 p = transstr(buf); |
1112 if (p != NULL) | |
1113 { | |
1114 vim_strncpy(buf, p, sizeof(buf) - 1); | |
1115 vim_free(p); | |
1116 } | |
1117 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1118 // fill up with "fillchar" |
835 | 1119 len = (int)STRLEN(buf); |
1883 | 1120 while (width < maxwidth && len < (int)sizeof(buf) - 1) |
7 | 1121 { |
1122 len += (*mb_char2bytes)(fillchar, buf + len); | |
1123 ++width; | |
1124 } | |
1125 buf[len] = NUL; | |
1126 | |
681 | 1127 /* |
1128 * Draw each snippet with the specified highlighting. | |
1129 */ | |
7 | 1130 curattr = attr; |
1131 p = buf; | |
681 | 1132 for (n = 0; hltab[n].start != NULL; n++) |
1133 { | |
1134 len = (int)(hltab[n].start - p); | |
7 | 1135 screen_puts_len(p, len, row, col, curattr); |
1136 col += vim_strnsize(p, len); | |
681 | 1137 p = hltab[n].start; |
1138 | |
1139 if (hltab[n].userhl == 0) | |
7 | 1140 curattr = attr; |
681 | 1141 else if (hltab[n].userhl < 0) |
1142 curattr = syn_id2attr(-hltab[n].userhl); | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
1143 #ifdef FEAT_TERMINAL |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
1144 else if (wp != NULL && wp != curwin && bt_terminal(wp->w_buffer) |
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
1145 && wp->w_status_height != 0) |
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
1146 curattr = highlight_stltermnc[hltab[n].userhl - 1]; |
12114
f306e6decaf9
patch 8.0.0937: user highlight groups not adjusted for terminal
Christian Brabandt <cb@256bit.org>
parents:
11981
diff
changeset
|
1147 else if (wp != NULL && bt_terminal(wp->w_buffer) |
f306e6decaf9
patch 8.0.0937: user highlight groups not adjusted for terminal
Christian Brabandt <cb@256bit.org>
parents:
11981
diff
changeset
|
1148 && wp->w_status_height != 0) |
f306e6decaf9
patch 8.0.0937: user highlight groups not adjusted for terminal
Christian Brabandt <cb@256bit.org>
parents:
11981
diff
changeset
|
1149 curattr = highlight_stlterm[hltab[n].userhl - 1]; |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
1150 #endif |
680 | 1151 else if (wp != NULL && wp != curwin && wp->w_status_height != 0) |
681 | 1152 curattr = highlight_stlnc[hltab[n].userhl - 1]; |
7 | 1153 else |
681 | 1154 curattr = highlight_user[hltab[n].userhl - 1]; |
7 | 1155 } |
1156 screen_puts(p, row, col, curattr); | |
681 | 1157 |
1158 if (wp == NULL) | |
1159 { | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1160 // Fill the TabPageIdxs[] array for clicking in the tab pagesline. |
681 | 1161 col = 0; |
1162 len = 0; | |
1163 p = buf; | |
1164 fillchar = 0; | |
1165 for (n = 0; tabtab[n].start != NULL; n++) | |
1166 { | |
1167 len += vim_strnsize(p, (int)(tabtab[n].start - p)); | |
1168 while (col < len) | |
1169 TabPageIdxs[col++] = fillchar; | |
1170 p = tabtab[n].start; | |
1171 fillchar = tabtab[n].userhl; | |
1172 } | |
1173 while (col < Columns) | |
1174 TabPageIdxs[col++] = fillchar; | |
1175 } | |
5539 | 1176 |
1177 theend: | |
1178 entered = FALSE; | |
7 | 1179 } |
1180 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1181 #endif // FEAT_STL_OPT |
7 | 1182 |
1183 /* | |
1184 * Output a single character directly to the screen and update ScreenLines. | |
1185 */ | |
1186 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1187 screen_putchar(int c, int row, int col, int attr) |
7 | 1188 { |
3549 | 1189 char_u buf[MB_MAXBYTES + 1]; |
1190 | |
1191 if (has_mbyte) | |
1192 buf[(*mb_char2bytes)(c, buf)] = NUL; | |
1193 else | |
1194 { | |
1195 buf[0] = c; | |
1196 buf[1] = NUL; | |
1197 } | |
7 | 1198 screen_puts(buf, row, col, attr); |
1199 } | |
1200 | |
1201 /* | |
1202 * Get a single character directly from ScreenLines into "bytes[]". | |
1203 * Also return its attribute in *attrp; | |
1204 */ | |
1205 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1206 screen_getbytes(int row, int col, char_u *bytes, int *attrp) |
7 | 1207 { |
1208 unsigned off; | |
1209 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1210 // safety check |
7 | 1211 if (ScreenLines != NULL && row < screen_Rows && col < screen_Columns) |
1212 { | |
1213 off = LineOffset[row] + col; | |
1214 *attrp = ScreenAttrs[off]; | |
1215 bytes[0] = ScreenLines[off]; | |
1216 bytes[1] = NUL; | |
1217 | |
1218 if (enc_utf8 && ScreenLinesUC[off] != 0) | |
1219 bytes[utfc_char2bytes(off, bytes)] = NUL; | |
1220 else if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e) | |
1221 { | |
1222 bytes[0] = ScreenLines[off]; | |
1223 bytes[1] = ScreenLines2[off]; | |
1224 bytes[2] = NUL; | |
1225 } | |
1226 else if (enc_dbcs && MB_BYTE2LEN(bytes[0]) > 1) | |
1227 { | |
1228 bytes[1] = ScreenLines[off + 1]; | |
1229 bytes[2] = NUL; | |
1230 } | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1231 } |
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1232 } |
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1233 |
714 | 1234 /* |
1235 * Return TRUE if composing characters for screen posn "off" differs from | |
1236 * composing characters in "u8cc". | |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1237 * Only to be used when ScreenLinesUC[off] != 0. |
714 | 1238 */ |
1239 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1240 screen_comp_differs(int off, int *u8cc) |
714 | 1241 { |
1242 int i; | |
1243 | |
1244 for (i = 0; i < Screen_mco; ++i) | |
1245 { | |
1246 if (ScreenLinesC[i][off] != (u8char_T)u8cc[i]) | |
1247 return TRUE; | |
1248 if (u8cc[i] == 0) | |
1249 break; | |
1250 } | |
1251 return FALSE; | |
1252 } | |
1253 | |
7 | 1254 /* |
1255 * Put string '*text' on the screen at position 'row' and 'col', with | |
1256 * attributes 'attr', and update ScreenLines[] and ScreenAttrs[]. | |
1257 * Note: only outputs within one row, message is truncated at screen boundary! | |
1258 * Note: if ScreenLines[], row and/or col is invalid, nothing is done. | |
1259 */ | |
1260 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1261 screen_puts( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1262 char_u *text, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1263 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1264 int col, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1265 int attr) |
7 | 1266 { |
1267 screen_puts_len(text, -1, row, col, attr); | |
1268 } | |
1269 | |
1270 /* | |
1271 * Like screen_puts(), but output "text[len]". When "len" is -1 output up to | |
1272 * a NUL. | |
1273 */ | |
1274 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1275 screen_puts_len( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1276 char_u *text, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1277 int textlen, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1278 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1279 int col, |
27944
05fa2837e8a1
patch 8.2.4497: wrong color for half of wide character next to pum scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
27730
diff
changeset
|
1280 int attr_arg) |
7 | 1281 { |
27944
05fa2837e8a1
patch 8.2.4497: wrong color for half of wide character next to pum scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
27730
diff
changeset
|
1282 int attr = attr_arg; |
7 | 1283 unsigned off; |
1284 char_u *ptr = text; | |
5923 | 1285 int len = textlen; |
7 | 1286 int c; |
1378 | 1287 unsigned max_off; |
7 | 1288 int mbyte_blen = 1; |
1289 int mbyte_cells = 1; | |
1290 int u8c = 0; | |
714 | 1291 int u8cc[MAX_MCO]; |
7 | 1292 int clear_next_cell = FALSE; |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1293 #ifdef FEAT_ARABIC |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1294 int prev_c = 0; // previous Arabic character |
714 | 1295 int pc, nc, nc1; |
1296 int pcc[MAX_MCO]; | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1297 #endif |
1843 | 1298 int force_redraw_this; |
1299 int force_redraw_next = FALSE; | |
1300 int need_redraw; | |
7 | 1301 |
16914
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1302 // Safety check. The check for negative row and column is to fix issue |
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1303 // #4102. TODO: find out why row/col could be negative. |
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1304 if (ScreenLines == NULL |
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1305 || row >= screen_Rows || row < 0 |
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1306 || col >= screen_Columns || col < 0) |
7 | 1307 return; |
1843 | 1308 off = LineOffset[row] + col; |
7 | 1309 |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
1310 // When drawing over the right half of a double-wide char clear out the |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
1311 // left half. Only needed in a terminal. |
1685 | 1312 if (has_mbyte && col > 0 && col < screen_Columns |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1313 #ifdef FEAT_GUI |
1668 | 1314 && !gui.in_use |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1315 #endif |
1668 | 1316 && mb_fix_col(col, row) != col) |
1843 | 1317 { |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1318 if (!skip_for_popup(row, col - 1)) |
1843 | 1319 { |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1320 ScreenLines[off - 1] = ' '; |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1321 ScreenAttrs[off - 1] = 0; |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1322 if (enc_utf8) |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1323 { |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1324 ScreenLinesUC[off - 1] = 0; |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1325 ScreenLinesC[0][off - 1] = 0; |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1326 } |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1327 // redraw the previous cell, make it empty |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1328 screen_char(off - 1, row, col - 1); |
1843 | 1329 } |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1330 // force the cell at "col" to be redrawn |
1843 | 1331 force_redraw_next = TRUE; |
1332 } | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1333 |
1378 | 1334 max_off = LineOffset[row] + screen_Columns; |
1340 | 1335 while (col < screen_Columns |
1336 && (len < 0 || (int)(ptr - text) < len) | |
1337 && *ptr != NUL) | |
7 | 1338 { |
1339 c = *ptr; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1340 // check if this is the first byte of a multibyte |
7 | 1341 if (has_mbyte) |
1342 { | |
29457
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1343 mbyte_blen = enc_utf8 && len > 0 |
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1344 ? utfc_ptr2len_len(ptr, (int)((text + len) - ptr)) |
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1345 : (*mb_ptr2len)(ptr); |
7 | 1346 if (enc_dbcs == DBCS_JPNU && c == 0x8e) |
1347 mbyte_cells = 1; | |
1348 else if (enc_dbcs != 0) | |
1349 mbyte_cells = mbyte_blen; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1350 else // enc_utf8 |
7 | 1351 { |
29457
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1352 u8c = len >= 0 |
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1353 ? utfc_ptr2char_len(ptr, u8cc, (int)((text + len) - ptr)) |
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1354 : utfc_ptr2char(ptr, u8cc); |
7 | 1355 mbyte_cells = utf_char2cells(u8c); |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1356 #ifdef FEAT_ARABIC |
7 | 1357 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) |
1358 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1359 // Do Arabic shaping. |
7 | 1360 if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) |
1361 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1362 // Past end of string to be displayed. |
7 | 1363 nc = NUL; |
1364 nc1 = NUL; | |
1365 } | |
1366 else | |
714 | 1367 { |
29457
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1368 nc = len >= 0 |
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1369 ? utfc_ptr2char_len(ptr + mbyte_blen, pcc, |
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1370 (int)((text + len) - ptr - mbyte_blen)) |
53d8ef8442d8
patch 9.0.0070: using utfc_ptr2char_len() when length is negative
Bram Moolenaar <Bram@vim.org>
parents:
29413
diff
changeset
|
1371 : utfc_ptr2char(ptr + mbyte_blen, pcc); |
714 | 1372 nc1 = pcc[0]; |
1373 } | |
7 | 1374 pc = prev_c; |
1375 prev_c = u8c; | |
714 | 1376 u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc); |
7 | 1377 } |
1378 else | |
1379 prev_c = u8c; | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1380 #endif |
2055
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1381 if (col + mbyte_cells > screen_Columns) |
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1382 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1383 // Only 1 cell left, but character requires 2 cells: |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1384 // display a '>' in the last column to avoid wrapping. |
2055
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1385 c = '>'; |
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1386 mbyte_cells = 1; |
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1387 } |
7 | 1388 } |
1389 } | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1390 |
1843 | 1391 force_redraw_this = force_redraw_next; |
1392 force_redraw_next = FALSE; | |
1393 | |
1394 need_redraw = ScreenLines[off] != c | |
7 | 1395 || (mbyte_cells == 2 |
1396 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0)) | |
1397 || (enc_dbcs == DBCS_JPNU | |
1398 && c == 0x8e | |
1399 && ScreenLines2[off] != ptr[1]) | |
1400 || (enc_utf8 | |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1401 && (ScreenLinesUC[off] != |
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1402 (u8char_T)(c < 0x80 && u8cc[0] == 0 ? 0 : u8c) |
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1403 || (ScreenLinesUC[off] != 0 |
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1404 && screen_comp_differs(off, u8cc)))) |
7 | 1405 || ScreenAttrs[off] != attr |
1843 | 1406 || exmode_active; |
1407 | |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1408 if ((need_redraw || force_redraw_this) && !skip_for_popup(row, col)) |
7 | 1409 { |
1410 #if defined(FEAT_GUI) || defined(UNIX) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1411 // The bold trick makes a single row of pixels appear in the next |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1412 // character. When a bold character is removed, the next |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1413 // character should be redrawn too. This happens for our own GUI |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1414 // and for some xterms. |
1843 | 1415 if (need_redraw && ScreenLines[off] != ' ' && ( |
7 | 1416 # ifdef FEAT_GUI |
1417 gui.in_use | |
1418 # endif | |
1419 # if defined(FEAT_GUI) && defined(UNIX) | |
1420 || | |
1421 # endif | |
1422 # ifdef UNIX | |
1423 term_is_xterm | |
1424 # endif | |
1843 | 1425 )) |
1426 { | |
1427 int n = ScreenAttrs[off]; | |
1428 | |
1429 if (n > HL_ALL) | |
1430 n = syn_attr2attr(n); | |
1431 if (n & HL_BOLD) | |
1432 force_redraw_next = TRUE; | |
7 | 1433 } |
1434 #endif | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1435 // When at the end of the text and overwriting a two-cell |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1436 // character with a one-cell character, need to clear the next |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
1437 // cell. Also when overwriting the left half of a two-cell char |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
1438 // with the right half of a two-cell char. Do this only once |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
1439 // (mb_off2cells() may return 2 on the right half). |
7 | 1440 if (clear_next_cell) |
1441 clear_next_cell = FALSE; | |
1442 else if (has_mbyte | |
1443 && (len < 0 ? ptr[mbyte_blen] == NUL | |
1444 : ptr + mbyte_blen >= text + len) | |
1378 | 1445 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) |
7 | 1446 || (mbyte_cells == 2 |
1378 | 1447 && (*mb_off2cells)(off, max_off) == 1 |
1448 && (*mb_off2cells)(off + 1, max_off) > 1))) | |
7 | 1449 clear_next_cell = TRUE; |
1450 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1451 // Make sure we never leave a second byte of a double-byte behind, |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1452 // it confuses mb_off2cells(). |
7 | 1453 if (enc_dbcs |
1378 | 1454 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) |
7 | 1455 || (mbyte_cells == 2 |
1378 | 1456 && (*mb_off2cells)(off, max_off) == 1 |
1457 && (*mb_off2cells)(off + 1, max_off) > 1))) | |
7 | 1458 ScreenLines[off + mbyte_blen] = 0; |
1459 ScreenLines[off] = c; | |
1460 ScreenAttrs[off] = attr; | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
1461 ScreenCols[off] = -1; |
7 | 1462 if (enc_utf8) |
1463 { | |
714 | 1464 if (c < 0x80 && u8cc[0] == 0) |
7 | 1465 ScreenLinesUC[off] = 0; |
1466 else | |
1467 { | |
714 | 1468 int i; |
1469 | |
7 | 1470 ScreenLinesUC[off] = u8c; |
714 | 1471 for (i = 0; i < Screen_mco; ++i) |
1472 { | |
1473 ScreenLinesC[i][off] = u8cc[i]; | |
1474 if (u8cc[i] == 0) | |
1475 break; | |
1476 } | |
7 | 1477 } |
1478 if (mbyte_cells == 2) | |
1479 { | |
1480 ScreenLines[off + 1] = 0; | |
1481 ScreenAttrs[off + 1] = attr; | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
1482 ScreenCols[off + 1] = -1; |
7 | 1483 } |
1484 screen_char(off, row, col); | |
1485 } | |
1486 else if (mbyte_cells == 2) | |
1487 { | |
1488 ScreenLines[off + 1] = ptr[1]; | |
1489 ScreenAttrs[off + 1] = attr; | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
1490 ScreenCols[off + 1] = -1; |
7 | 1491 screen_char_2(off, row, col); |
1492 } | |
1493 else if (enc_dbcs == DBCS_JPNU && c == 0x8e) | |
1494 { | |
1495 ScreenLines2[off] = ptr[1]; | |
1496 screen_char(off, row, col); | |
1497 } | |
1498 else | |
1499 screen_char(off, row, col); | |
1500 } | |
1501 if (has_mbyte) | |
1502 { | |
1503 off += mbyte_cells; | |
1504 col += mbyte_cells; | |
1505 ptr += mbyte_blen; | |
1506 if (clear_next_cell) | |
5923 | 1507 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1508 // This only happens at the end, display one space next. |
27944
05fa2837e8a1
patch 8.2.4497: wrong color for half of wide character next to pum scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
27730
diff
changeset
|
1509 // Keep the attribute from before. |
7 | 1510 ptr = (char_u *)" "; |
5923 | 1511 len = -1; |
27944
05fa2837e8a1
patch 8.2.4497: wrong color for half of wide character next to pum scrollbar
Bram Moolenaar <Bram@vim.org>
parents:
27730
diff
changeset
|
1512 attr = ScreenAttrs[off]; |
5923 | 1513 } |
7 | 1514 } |
1515 else | |
1516 { | |
1517 ++off; | |
1518 ++col; | |
1519 ++ptr; | |
1520 } | |
1521 } | |
1843 | 1522 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1523 // If we detected the next character needs to be redrawn, but the text |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1524 // doesn't extend up to there, update the character here. |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
1525 if (force_redraw_next && col < screen_Columns && !skip_for_popup(row, col)) |
1843 | 1526 { |
1527 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1) | |
1528 screen_char_2(off, row, col); | |
1529 else | |
1530 screen_char(off, row, col); | |
1531 } | |
7 | 1532 } |
1533 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1534 #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) |
7 | 1535 /* |
1326 | 1536 * Prepare for 'hlsearch' highlighting. |
7 | 1537 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1538 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1539 start_search_hl(void) |
7 | 1540 { |
1541 if (p_hls && !no_hlsearch) | |
1542 { | |
20251
9620ab71f4f3
patch 8.2.0681: pattern for 'hlsearch' highlighting may leak
Bram Moolenaar <Bram@vim.org>
parents:
20227
diff
changeset
|
1543 end_search_hl(); // just in case it wasn't called before |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1544 last_pat_prog(&screen_search_hl.rm); |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1545 screen_search_hl.attr = HL_ATTR(HLF_L); |
7 | 1546 } |
1547 } | |
1548 | |
1549 /* | |
1326 | 1550 * Clean up for 'hlsearch' highlighting. |
7 | 1551 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1552 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1553 end_search_hl(void) |
7 | 1554 { |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1555 if (screen_search_hl.rm.regprog != NULL) |
7 | 1556 { |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1557 vim_regfree(screen_search_hl.rm.regprog); |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1558 screen_search_hl.rm.regprog = NULL; |
7 | 1559 } |
1560 } | |
5985 | 1561 #endif |
5979 | 1562 |
7 | 1563 static void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1564 screen_start_highlight(int attr) |
7 | 1565 { |
1566 attrentry_T *aep = NULL; | |
1567 | |
1568 screen_attr = attr; | |
1569 if (full_screen | |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
1570 #ifdef MSWIN |
7 | 1571 && termcap_active |
1572 #endif | |
1573 ) | |
1574 { | |
1575 #ifdef FEAT_GUI | |
1576 if (gui.in_use) | |
1577 { | |
1578 char buf[20]; | |
1579 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1580 // The GUI handles this internally. |
27490
fb4c30606b4a
patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
1581 sprintf(buf, "\033|%dh", attr); |
7 | 1582 OUT_STR(buf); |
1583 } | |
1584 else | |
1585 #endif | |
1586 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1587 if (attr > HL_ALL) // special HL attr. |
7 | 1588 { |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1589 if (IS_CTERM) |
7 | 1590 aep = syn_cterm_attr2entry(attr); |
1591 else | |
1592 aep = syn_term_attr2entry(attr); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1593 if (aep == NULL) // did ":syntax clear" |
7 | 1594 attr = 0; |
1595 else | |
1596 attr = aep->ae_attr; | |
1597 } | |
18786
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1598 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1599 if (use_vtp()) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1600 { |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1601 guicolor_T defguifg, defguibg; |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1602 int defctermfg, defctermbg; |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1603 |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1604 // If FG and BG are unset, the color is undefined when |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1605 // BOLD+INVERSE. Use Normal as the default value. |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1606 get_default_console_color(&defctermfg, &defctermbg, &defguifg, |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1607 &defguibg); |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1608 |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1609 if (p_tgc) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1610 { |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1611 if (aep == NULL || COLOR_INVALID(aep->ae_u.cterm.fg_rgb)) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1612 term_fg_rgb_color(defguifg); |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1613 if (aep == NULL || COLOR_INVALID(aep->ae_u.cterm.bg_rgb)) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1614 term_bg_rgb_color(defguibg); |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1615 } |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1616 else if (t_colors >= 256) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1617 { |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1618 if (aep == NULL || aep->ae_u.cterm.fg_color == 0) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1619 term_fg_color(defctermfg); |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1620 if (aep == NULL || aep->ae_u.cterm.bg_color == 0) |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1621 term_bg_color(defctermbg); |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1622 } |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1623 } |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1624 #endif |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1625 if ((attr & HL_BOLD) && *T_MD != NUL) // bold |
7 | 1626 out_str(T_MD); |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1627 else if (aep != NULL && cterm_normal_fg_bold && ( |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1628 #ifdef FEAT_TERMGUICOLORS |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1629 p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1630 ? aep->ae_u.cterm.fg_rgb != INVALCOLOR |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1631 : |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1632 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1633 t_colors > 1 && aep->ae_u.cterm.fg_color)) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1634 // If the Normal FG color has BOLD attribute and the new HL |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1635 // has a FG color defined, clear BOLD. |
681 | 1636 out_str(T_ME); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1637 if ((attr & HL_STANDOUT) && *T_SO != NUL) // standout |
7 | 1638 out_str(T_SO); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1639 if ((attr & HL_UNDERCURL) && *T_UCS != NUL) // undercurl |
12964
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
1640 out_str(T_UCS); |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1641 if ((attr & HL_UNDERDOUBLE) && *T_USS != NUL) // double underline |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1642 out_str(T_USS); |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1643 if ((attr & HL_UNDERDOTTED) && *T_DS != NUL) // dotted underline |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1644 out_str(T_DS); |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1645 if ((attr & HL_UNDERDASHED) && *T_CDS != NUL) // dashed underline |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1646 out_str(T_CDS); |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1647 if (((attr & HL_UNDERLINE) // underline or undercurl, etc. |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1648 || ((attr & HL_UNDERCURL) && *T_UCS == NUL) |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1649 || ((attr & HL_UNDERDOUBLE) && *T_USS == NUL) |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1650 || ((attr & HL_UNDERDOTTED) && *T_DS == NUL) |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1651 || ((attr & HL_UNDERDASHED) && *T_CDS == NUL)) |
13094
72366f4e3264
patch 8.0.1422: no fallback to underline when undercurl is not set
Christian Brabandt <cb@256bit.org>
parents:
13024
diff
changeset
|
1652 && *T_US != NUL) |
7 | 1653 out_str(T_US); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1654 if ((attr & HL_ITALIC) && *T_CZH != NUL) // italic |
7 | 1655 out_str(T_CZH); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1656 if ((attr & HL_INVERSE) && *T_MR != NUL) // inverse (reverse) |
7 | 1657 out_str(T_MR); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1658 if ((attr & HL_STRIKETHROUGH) && *T_STS != NUL) // strike |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1659 out_str(T_STS); |
7 | 1660 |
1661 /* | |
1662 * Output the color or start string after bold etc., in case the | |
1663 * bold etc. override the color setting. | |
1664 */ | |
1665 if (aep != NULL) | |
1666 { | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1667 #ifdef FEAT_TERMGUICOLORS |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1668 // When 'termguicolors' is set but fg or bg is unset, |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1669 // fall back to the cterm colors. This helps for SpellBad, |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1670 // where the GUI uses a red undercurl. |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1671 if (p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1672 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1673 if (aep->ae_u.cterm.fg_rgb != INVALCOLOR) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1674 term_fg_rgb_color(aep->ae_u.cterm.fg_rgb); |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1675 } |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1676 else |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1677 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1678 if (t_colors > 1) |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1679 { |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1680 if (aep->ae_u.cterm.fg_color) |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1681 term_fg_color(aep->ae_u.cterm.fg_color - 1); |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1682 } |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1683 #ifdef FEAT_TERMGUICOLORS |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1684 if (p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR) |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1685 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1686 if (aep->ae_u.cterm.bg_rgb != INVALCOLOR) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1687 term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); |
7 | 1688 } |
1689 else | |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1690 #endif |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1691 if (t_colors > 1) |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1692 { |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1693 if (aep->ae_u.cterm.bg_color) |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1694 term_bg_color(aep->ae_u.cterm.bg_color - 1); |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1695 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1696 #ifdef FEAT_TERMGUICOLORS |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1697 if (p_tgc && aep->ae_u.cterm.ul_rgb != CTERMCOLOR) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1698 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1699 if (aep->ae_u.cterm.ul_rgb != INVALCOLOR) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1700 term_ul_rgb_color(aep->ae_u.cterm.ul_rgb); |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1701 } |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1702 else |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1703 #endif |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1704 if (t_colors > 1) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1705 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1706 if (aep->ae_u.cterm.ul_color) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1707 term_ul_color(aep->ae_u.cterm.ul_color - 1); |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1708 } |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1709 |
13452
9b09f6e470e0
patch 8.0.1600: crash when setting t_Co to zero when 'termguicolors' is set
Christian Brabandt <cb@256bit.org>
parents:
13400
diff
changeset
|
1710 if (!IS_CTERM) |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1711 { |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1712 if (aep->ae_u.term.start != NULL) |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1713 out_str(aep->ae_u.term.start); |
7 | 1714 } |
1715 } | |
1716 } | |
1717 } | |
1718 } | |
1719 | |
1720 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1721 screen_stop_highlight(void) |
7 | 1722 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1723 int do_ME = FALSE; // output T_ME code |
20227
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1724 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) |
20569
b6a0237e8478
patch 8.2.0838: MS-Windows: compiler warning for uninitialized variables
Bram Moolenaar <Bram@vim.org>
parents:
20251
diff
changeset
|
1725 int do_ME_fg = FALSE, do_ME_bg = FALSE; |
20227
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1726 #endif |
7 | 1727 |
1728 if (screen_attr != 0 | |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
1729 #ifdef MSWIN |
7 | 1730 && termcap_active |
1731 #endif | |
1732 ) | |
1733 { | |
1734 #ifdef FEAT_GUI | |
1735 if (gui.in_use) | |
1736 { | |
1737 char buf[20]; | |
1738 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1739 // use internal GUI code |
27490
fb4c30606b4a
patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
1740 sprintf(buf, "\033|%dH", screen_attr); |
7 | 1741 OUT_STR(buf); |
1742 } | |
1743 else | |
1744 #endif | |
1745 { | |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1746 int is_under; |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1747 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1748 if (screen_attr > HL_ALL) // special HL attr. |
7 | 1749 { |
1750 attrentry_T *aep; | |
1751 | |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1752 if (IS_CTERM) |
7 | 1753 { |
1754 /* | |
1755 * Assume that t_me restores the original colors! | |
1756 */ | |
1757 aep = syn_cterm_attr2entry(screen_attr); | |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1758 if (aep != NULL && (( |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1759 #ifdef FEAT_TERMGUICOLORS |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1760 p_tgc && aep->ae_u.cterm.fg_rgb != CTERMCOLOR |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1761 ? aep->ae_u.cterm.fg_rgb != INVALCOLOR |
20227
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1762 # ifdef FEAT_VTP |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1763 ? !(do_ME_fg = TRUE) : (do_ME_fg = FALSE) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1764 # endif |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1765 : |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1766 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1767 aep->ae_u.cterm.fg_color) || ( |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1768 #ifdef FEAT_TERMGUICOLORS |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1769 p_tgc && aep->ae_u.cterm.bg_rgb != CTERMCOLOR |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1770 ? aep->ae_u.cterm.bg_rgb != INVALCOLOR |
20227
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1771 # ifdef FEAT_VTP |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1772 ? !(do_ME_bg = TRUE) : (do_ME_bg = FALSE) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1773 # endif |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1774 : |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1775 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1776 aep->ae_u.cterm.bg_color))) |
7 | 1777 do_ME = TRUE; |
20227
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1778 #if defined(FEAT_VTP) && defined(FEAT_TERMGUICOLORS) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1779 if (use_vtp()) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1780 { |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1781 if (do_ME_fg && do_ME_bg) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1782 do_ME = TRUE; |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1783 |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1784 // FG and BG cannot be separated in T_ME, which is not |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1785 // efficient. |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1786 if (!do_ME && do_ME_fg) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1787 out_str((char_u *)"\033|39m"); // restore FG |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1788 if (!do_ME && do_ME_bg) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1789 out_str((char_u *)"\033|49m"); // restore BG |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1790 } |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1791 else |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1792 { |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1793 // Process FG and BG at once. |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1794 if (!do_ME) |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1795 do_ME = do_ME_fg | do_ME_bg; |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1796 } |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1797 #endif |
7 | 1798 } |
1799 else | |
1800 { | |
1801 aep = syn_term_attr2entry(screen_attr); | |
1802 if (aep != NULL && aep->ae_u.term.stop != NULL) | |
1803 { | |
1804 if (STRCMP(aep->ae_u.term.stop, T_ME) == 0) | |
1805 do_ME = TRUE; | |
1806 else | |
1807 out_str(aep->ae_u.term.stop); | |
1808 } | |
1809 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1810 if (aep == NULL) // did ":syntax clear" |
7 | 1811 screen_attr = 0; |
1812 else | |
1813 screen_attr = aep->ae_attr; | |
1814 } | |
1815 | |
1816 /* | |
1817 * Often all ending-codes are equal to T_ME. Avoid outputting the | |
1818 * same sequence several times. | |
1819 */ | |
1820 if (screen_attr & HL_STANDOUT) | |
1821 { | |
1822 if (STRCMP(T_SE, T_ME) == 0) | |
1823 do_ME = TRUE; | |
1824 else | |
1825 out_str(T_SE); | |
1826 } | |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1827 is_under = (screen_attr & (HL_UNDERCURL |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1828 | HL_UNDERDOUBLE | HL_UNDERDOTTED | HL_UNDERDASHED)); |
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1829 if (is_under && *T_UCE != NUL) |
12964
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
1830 { |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
1831 if (STRCMP(T_UCE, T_ME) == 0) |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
1832 do_ME = TRUE; |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
1833 else |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
1834 out_str(T_UCE); |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
1835 } |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1836 if ((screen_attr & HL_UNDERLINE) || (is_under && *T_UCE == NUL)) |
7 | 1837 { |
1838 if (STRCMP(T_UE, T_ME) == 0) | |
1839 do_ME = TRUE; | |
1840 else | |
1841 out_str(T_UE); | |
1842 } | |
1843 if (screen_attr & HL_ITALIC) | |
1844 { | |
1845 if (STRCMP(T_CZR, T_ME) == 0) | |
1846 do_ME = TRUE; | |
1847 else | |
1848 out_str(T_CZR); | |
1849 } | |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1850 if (screen_attr & HL_STRIKETHROUGH) |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1851 { |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1852 if (STRCMP(T_STE, T_ME) == 0) |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1853 do_ME = TRUE; |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1854 else |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1855 out_str(T_STE); |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
1856 } |
7 | 1857 if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE))) |
1858 out_str(T_ME); | |
1859 | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1860 #ifdef FEAT_TERMGUICOLORS |
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1861 if (p_tgc) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1862 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1863 if (cterm_normal_fg_gui_color != INVALCOLOR) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1864 term_fg_rgb_color(cterm_normal_fg_gui_color); |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1865 if (cterm_normal_bg_gui_color != INVALCOLOR) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1866 term_bg_rgb_color(cterm_normal_bg_gui_color); |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1867 if (cterm_normal_ul_gui_color != INVALCOLOR) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1868 term_ul_rgb_color(cterm_normal_ul_gui_color); |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1869 } |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1870 else |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1871 #endif |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1872 { |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1873 if (t_colors > 1) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1874 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1875 // set Normal cterm colors |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1876 if (cterm_normal_fg_color != 0) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1877 term_fg_color(cterm_normal_fg_color - 1); |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1878 if (cterm_normal_bg_color != 0) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1879 term_bg_color(cterm_normal_bg_color - 1); |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1880 if (cterm_normal_ul_color != 0) |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1881 term_ul_color(cterm_normal_ul_color - 1); |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1882 if (cterm_normal_fg_bold) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1883 out_str(T_MD); |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1884 } |
7 | 1885 } |
1886 } | |
1887 } | |
1888 screen_attr = 0; | |
1889 } | |
1890 | |
1891 /* | |
1892 * Reset the colors for a cterm. Used when leaving Vim. | |
1893 * The machine specific code may override this again. | |
1894 */ | |
1895 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1896 reset_cterm_colors(void) |
7 | 1897 { |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1898 if (IS_CTERM) |
7 | 1899 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1900 // set Normal cterm colors |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1901 #ifdef FEAT_TERMGUICOLORS |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1902 if (p_tgc ? (cterm_normal_fg_gui_color != INVALCOLOR |
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1903 || cterm_normal_bg_gui_color != INVALCOLOR) |
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1904 : (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1905 #else |
7 | 1906 if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1907 #endif |
7 | 1908 { |
1909 out_str(T_OP); | |
1910 screen_attr = -1; | |
1911 } | |
1912 if (cterm_normal_fg_bold) | |
1913 { | |
1914 out_str(T_ME); | |
1915 screen_attr = -1; | |
1916 } | |
1917 } | |
1918 } | |
1919 | |
1920 /* | |
1921 * Put character ScreenLines["off"] on the screen at position "row" and "col", | |
1922 * using the attributes from ScreenAttrs["off"]. | |
1923 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1924 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1925 screen_char(unsigned off, int row, int col) |
7 | 1926 { |
1927 int attr; | |
1928 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1929 // Check for illegal values, just in case (could happen just after |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1930 // resizing). |
7 | 1931 if (row >= screen_Rows || col >= screen_Columns) |
1932 return; | |
1933 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1934 // Outputting a character in the last cell on the screen may scroll the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1935 // screen up. Only do it when the "xn" termcap property is set, otherwise |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1936 // mark the character invalid (update it when scrolled up). |
6602 | 1937 if (*T_XN == NUL |
1938 && row == screen_Rows - 1 && col == screen_Columns - 1 | |
7 | 1939 #ifdef FEAT_RIGHTLEFT |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1940 // account for first command-line character in rightleft mode |
7 | 1941 && !cmdmsg_rl |
1942 #endif | |
1943 ) | |
1944 { | |
1945 ScreenAttrs[off] = (sattr_T)-1; | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
1946 ScreenCols[off] = -1; |
7 | 1947 return; |
1948 } | |
1949 | |
1950 /* | |
1951 * Stop highlighting first, so it's easier to move the cursor. | |
1952 */ | |
1953 if (screen_char_attr != 0) | |
1954 attr = screen_char_attr; | |
1955 else | |
1956 attr = ScreenAttrs[off]; | |
1957 if (screen_attr != attr) | |
1958 screen_stop_highlight(); | |
1959 | |
1960 windgoto(row, col); | |
1961 | |
1962 if (screen_attr != attr) | |
1963 screen_start_highlight(attr); | |
1964 | |
1965 if (enc_utf8 && ScreenLinesUC[off] != 0) | |
1966 { | |
1967 char_u buf[MB_MAXBYTES + 1]; | |
1968 | |
8819
a1132255e3e1
commit https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30
Christian Brabandt <cb@256bit.org>
parents:
8817
diff
changeset
|
1969 if (utf_ambiguous_width(ScreenLinesUC[off])) |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1970 { |
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1971 if (*p_ambw == 'd' |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1972 #ifdef FEAT_GUI |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1973 && !gui.in_use |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1974 #endif |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1975 ) |
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1976 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1977 // Clear the two screen cells. If the character is actually |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1978 // single width it won't change the second cell. |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1979 out_str((char_u *)" "); |
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1980 term_windgoto(row, col); |
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1981 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1982 // not sure where the cursor is after drawing the ambiguous width |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1983 // character |
8819
a1132255e3e1
commit https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30
Christian Brabandt <cb@256bit.org>
parents:
8817
diff
changeset
|
1984 screen_cur_col = 9999; |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1985 } |
8819
a1132255e3e1
commit https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30
Christian Brabandt <cb@256bit.org>
parents:
8817
diff
changeset
|
1986 else if (utf_char2cells(ScreenLinesUC[off]) > 1) |
7 | 1987 ++screen_cur_col; |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1988 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1989 // Convert the UTF-8 character to bytes and write it. |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1990 buf[utfc_char2bytes(off, buf)] = NUL; |
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
1991 out_str(buf); |
7 | 1992 } |
1993 else | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1994 { |
7 | 1995 out_flush_check(); |
1996 out_char(ScreenLines[off]); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1997 // double-byte character in single-width cell |
7 | 1998 if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e) |
1999 out_char(ScreenLines2[off]); | |
2000 } | |
2001 | |
2002 screen_cur_col++; | |
2003 } | |
2004 | |
2005 /* | |
2006 * Used for enc_dbcs only: Put one double-wide character at ScreenLines["off"] | |
2007 * on the screen at position 'row' and 'col'. | |
2008 * The attributes of the first byte is used for all. This is required to | |
2009 * output the two bytes of a double-byte character with nothing in between. | |
2010 */ | |
2011 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2012 screen_char_2(unsigned off, int row, int col) |
7 | 2013 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2014 // Check for illegal values (could be wrong when screen was resized). |
7 | 2015 if (off + 1 >= (unsigned)(screen_Rows * screen_Columns)) |
2016 return; | |
2017 | |
30986
360f286b5869
patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
2018 // Outputting the last character on the screen may scroll the screen up. |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2019 // Don't to it! Mark the character invalid (update it when scrolled up) |
7 | 2020 if (row == screen_Rows - 1 && col >= screen_Columns - 2) |
2021 { | |
2022 ScreenAttrs[off] = (sattr_T)-1; | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2023 ScreenCols[off] = -1; |
7 | 2024 return; |
2025 } | |
2026 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2027 // Output the first byte normally (positions the cursor), then write the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2028 // second byte directly. |
7 | 2029 screen_char(off, row, col); |
2030 out_char(ScreenLines[off + 1]); | |
2031 ++screen_cur_col; | |
2032 } | |
2033 | |
2034 /* | |
2035 * Draw a rectangle of the screen, inverted when "invert" is TRUE. | |
2036 * This uses the contents of ScreenLines[] and doesn't change it. | |
2037 */ | |
2038 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2039 screen_draw_rectangle( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2040 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2041 int col, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2042 int height, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2043 int width, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2044 int invert) |
7 | 2045 { |
2046 int r, c; | |
2047 int off; | |
1378 | 2048 int max_off; |
7 | 2049 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2050 // Can't use ScreenLines unless initialized |
534 | 2051 if (ScreenLines == NULL) |
2052 return; | |
2053 | |
7 | 2054 if (invert) |
2055 screen_char_attr = HL_INVERSE; | |
2056 for (r = row; r < row + height; ++r) | |
2057 { | |
2058 off = LineOffset[r]; | |
1378 | 2059 max_off = off + screen_Columns; |
7 | 2060 for (c = col; c < col + width; ++c) |
2061 { | |
1378 | 2062 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1) |
7 | 2063 { |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
2064 if (!skip_for_popup(r, c)) |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
2065 screen_char_2(off + c, r, c); |
7 | 2066 ++c; |
2067 } | |
2068 else | |
2069 { | |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
2070 if (!skip_for_popup(r, c)) |
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
2071 screen_char(off + c, r, c); |
1378 | 2072 if (utf_off2cells(off + c, max_off) > 1) |
7 | 2073 ++c; |
2074 } | |
2075 } | |
2076 } | |
2077 screen_char_attr = 0; | |
2078 } | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
2079 |
7 | 2080 /* |
2081 * Redraw the characters for a vertically split window. | |
2082 */ | |
2083 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2084 redraw_block(int row, int end, win_T *wp) |
7 | 2085 { |
2086 int col; | |
2087 int width; | |
2088 | |
2089 # ifdef FEAT_CLIPBOARD | |
2090 clip_may_clear_selection(row, end - 1); | |
2091 # endif | |
2092 | |
2093 if (wp == NULL) | |
2094 { | |
2095 col = 0; | |
2096 width = Columns; | |
2097 } | |
2098 else | |
2099 { | |
2100 col = wp->w_wincol; | |
2101 width = wp->w_width; | |
2102 } | |
2103 screen_draw_rectangle(row, col, end - row, width, FALSE); | |
2104 } | |
2105 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
2106 void |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2107 space_to_screenline(int off, int attr) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2108 { |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2109 ScreenLines[off] = ' '; |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2110 ScreenAttrs[off] = attr; |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2111 ScreenCols[off] = -1; |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2112 if (enc_utf8) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2113 ScreenLinesUC[off] = 0; |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2114 } |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2115 |
7 | 2116 /* |
28386
cf41a1f469f6
patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
28295
diff
changeset
|
2117 * Fill the screen from "start_row" to "end_row" (exclusive), from "start_col" |
cf41a1f469f6
patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
28295
diff
changeset
|
2118 * to "end_col" (exclusive) with character "c1" in first column followed by |
cf41a1f469f6
patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents:
28295
diff
changeset
|
2119 * "c2" in the other columns. Use attributes "attr". |
7 | 2120 */ |
2121 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2122 screen_fill( |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2123 int start_row, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2124 int end_row, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2125 int start_col, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2126 int end_col, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2127 int c1, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2128 int c2, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2129 int attr) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2130 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2131 int row; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2132 int col; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2133 int off; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2134 int end_off; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2135 int did_delete; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2136 int c; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2137 int norm_term; |
7 | 2138 #if defined(FEAT_GUI) || defined(UNIX) |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2139 int force_next = FALSE; |
7 | 2140 #endif |
2141 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2142 if (end_row > screen_Rows) // safety check |
7 | 2143 end_row = screen_Rows; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2144 if (end_col > screen_Columns) // safety check |
7 | 2145 end_col = screen_Columns; |
2146 if (ScreenLines == NULL | |
2147 || start_row >= end_row | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2148 || start_col >= end_col) // nothing to do |
7 | 2149 return; |
2150 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2151 // it's a "normal" terminal when not in a GUI or cterm |
7 | 2152 norm_term = ( |
2153 #ifdef FEAT_GUI | |
2154 !gui.in_use && | |
2155 #endif | |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2156 !IS_CTERM); |
7 | 2157 for (row = start_row; row < end_row; ++row) |
2158 { | |
1668 | 2159 if (has_mbyte |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2160 #ifdef FEAT_GUI |
1668 | 2161 && !gui.in_use |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2162 #endif |
1668 | 2163 ) |
2164 { | |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
2165 // When drawing over the right half of a double-wide char clear |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
2166 // out the left half. When drawing over the left half of a |
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
2167 // double wide-char clear out the right half. Only needed in a |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2168 // terminal. |
1685 | 2169 if (start_col > 0 && mb_fix_col(start_col, row) != start_col) |
1670 | 2170 screen_puts_len((char_u *)" ", 1, row, start_col - 1, 0); |
1677 | 2171 if (end_col < screen_Columns && mb_fix_col(end_col, row) != end_col) |
1670 | 2172 screen_puts_len((char_u *)" ", 1, row, end_col, 0); |
1668 | 2173 } |
7 | 2174 /* |
2175 * Try to use delete-line termcap code, when no attributes or in a | |
2176 * "normal" terminal, where a bold/italic space is just a | |
2177 * space. | |
2178 */ | |
2179 did_delete = FALSE; | |
2180 if (c2 == ' ' | |
2181 && end_col == Columns | |
2182 && can_clear(T_CE) | |
2183 && (attr == 0 | |
2184 || (norm_term | |
2185 && attr <= HL_ALL | |
2186 && ((attr & ~(HL_BOLD | HL_ITALIC)) == 0)))) | |
2187 { | |
2188 /* | |
2189 * check if we really need to clear something | |
2190 */ | |
2191 col = start_col; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2192 if (c1 != ' ') // don't clear first char |
7 | 2193 ++col; |
2194 | |
2195 off = LineOffset[row] + col; | |
2196 end_off = LineOffset[row] + end_col; | |
2197 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2198 // skip blanks (used often, keep it fast!) |
7 | 2199 if (enc_utf8) |
2200 while (off < end_off && ScreenLines[off] == ' ' | |
2201 && ScreenAttrs[off] == 0 && ScreenLinesUC[off] == 0) | |
2202 ++off; | |
2203 else | |
2204 while (off < end_off && ScreenLines[off] == ' ' | |
2205 && ScreenAttrs[off] == 0) | |
2206 ++off; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2207 if (off < end_off) // something to be cleared |
7 | 2208 { |
2209 col = off - LineOffset[row]; | |
2210 screen_stop_highlight(); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2211 term_windgoto(row, col);// clear rest of this screen line |
7 | 2212 out_str(T_CE); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2213 screen_start(); // don't know where cursor is now |
7 | 2214 col = end_col - col; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2215 while (col--) // clear chars in ScreenLines |
7 | 2216 { |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2217 space_to_screenline(off, 0); |
7 | 2218 ++off; |
2219 } | |
2220 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2221 did_delete = TRUE; // the chars are cleared now |
7 | 2222 } |
2223 | |
2224 off = LineOffset[row] + start_col; | |
2225 c = c1; | |
2226 for (col = start_col; col < end_col; ++col) | |
2227 { | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2228 if ((ScreenLines[off] != c |
714 | 2229 || (enc_utf8 && (int)ScreenLinesUC[off] |
2230 != (c >= 0x80 ? c : 0)) | |
7 | 2231 || ScreenAttrs[off] != attr |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2232 || must_redraw == UPD_CLEAR // screen clear pending |
7 | 2233 #if defined(FEAT_GUI) || defined(UNIX) |
2234 || force_next | |
2235 #endif | |
2236 ) | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2237 // Skip if under a(nother) popup. |
30608
c3398c601bfa
patch 9.0.0639: checking for popup in screen_char() is too late
Bram Moolenaar <Bram@vim.org>
parents:
30606
diff
changeset
|
2238 && !skip_for_popup(row, col)) |
7 | 2239 { |
2240 #if defined(FEAT_GUI) || defined(UNIX) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2241 // The bold trick may make a single row of pixels appear in |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2242 // the next character. When a bold character is removed, the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2243 // next character should be redrawn too. This happens for our |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2244 // own GUI and for some xterms. |
7 | 2245 if ( |
2246 # ifdef FEAT_GUI | |
2247 gui.in_use | |
2248 # endif | |
2249 # if defined(FEAT_GUI) && defined(UNIX) | |
2250 || | |
2251 # endif | |
2252 # ifdef UNIX | |
2253 term_is_xterm | |
2254 # endif | |
2255 ) | |
2256 { | |
2257 if (ScreenLines[off] != ' ' | |
2258 && (ScreenAttrs[off] > HL_ALL | |
2259 || ScreenAttrs[off] & HL_BOLD)) | |
2260 force_next = TRUE; | |
2261 else | |
2262 force_next = FALSE; | |
2263 } | |
30643
dfb02f9dcbe8
patch 9.0.0656: cannot specify another character to use instead of '@'
Bram Moolenaar <Bram@vim.org>
parents:
30608
diff
changeset
|
2264 #endif // FEAT_GUI || defined(UNIX) |
7 | 2265 ScreenLines[off] = c; |
2266 if (enc_utf8) | |
2267 { | |
2268 if (c >= 0x80) | |
2269 { | |
2270 ScreenLinesUC[off] = c; | |
714 | 2271 ScreenLinesC[0][off] = 0; |
7 | 2272 } |
2273 else | |
2274 ScreenLinesUC[off] = 0; | |
2275 } | |
2276 ScreenAttrs[off] = attr; | |
2277 if (!did_delete || c != ' ') | |
2278 screen_char(off, row, col); | |
2279 } | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2280 ScreenCols[off] = -1; |
7 | 2281 ++off; |
2282 if (col == start_col) | |
2283 { | |
2284 if (did_delete) | |
2285 break; | |
2286 c = c2; | |
2287 } | |
2288 } | |
2289 if (end_col == Columns) | |
2290 LineWraps[row] = FALSE; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2291 if (row == Rows - 1) // overwritten the command line |
7 | 2292 { |
2293 redraw_cmdline = TRUE; | |
13666
57da3d873f20
patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents:
13632
diff
changeset
|
2294 if (start_col == 0 && end_col == Columns |
57da3d873f20
patch 8.0.1705: when making a vertical split the mode message isn't updated
Christian Brabandt <cb@256bit.org>
parents:
13632
diff
changeset
|
2295 && c1 == ' ' && c2 == ' ' && attr == 0) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2296 clear_cmdline = FALSE; // command line has been cleared |
644 | 2297 if (start_col == 0) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2298 mode_displayed = FALSE; // mode cleared or overwritten |
7 | 2299 } |
2300 } | |
2301 } | |
2302 | |
2303 /* | |
2304 * Check if there should be a delay. Used before clearing or redrawing the | |
2305 * screen or the command line. | |
2306 */ | |
2307 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2308 check_for_delay(int check_msg_scroll) |
7 | 2309 { |
2310 if ((emsg_on_display || (check_msg_scroll && msg_scroll)) | |
2311 && !did_wait_return | |
22742
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22721
diff
changeset
|
2312 && emsg_silent == 0 |
f7f2d73ff85e
patch 8.2.1919: assert_fails() setting emsg_silent changes normal execution
Bram Moolenaar <Bram@vim.org>
parents:
22721
diff
changeset
|
2313 && !in_assert_fails) |
7 | 2314 { |
2315 out_flush(); | |
18642
bbea1f108187
patch 8.1.2313: debugging where a delay comes from is not easy
Bram Moolenaar <Bram@vim.org>
parents:
18603
diff
changeset
|
2316 ui_delay(1006L, TRUE); |
7 | 2317 emsg_on_display = FALSE; |
2318 if (check_msg_scroll) | |
2319 msg_scroll = FALSE; | |
2320 } | |
2321 } | |
2322 | |
2323 /* | |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2324 * Init TabPageIdxs[] to zero: Clicking outside of tabs has no effect. |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2325 */ |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2326 static void |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2327 clear_TabPageIdxs(void) |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2328 { |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2329 int scol; |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2330 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2331 for (scol = 0; scol < Columns; ++scol) |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2332 TabPageIdxs[scol] = 0; |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2333 } |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2334 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2335 /* |
7 | 2336 * screen_valid - allocate screen buffers if size changed |
3263 | 2337 * If "doclear" is TRUE: clear screen if it has been resized. |
7 | 2338 * Returns TRUE if there is a valid screen to write to. |
2339 * Returns FALSE when starting up and screen not initialized yet. | |
2340 */ | |
2341 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2342 screen_valid(int doclear) |
7 | 2343 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2344 screenalloc(doclear); // allocate screen buffers if size changed |
7 | 2345 return (ScreenLines != NULL); |
2346 } | |
2347 | |
2348 /* | |
2349 * Resize the shell to Rows and Columns. | |
2350 * Allocate ScreenLines[] and associated items. | |
2351 * | |
2352 * There may be some time between setting Rows and Columns and (re)allocating | |
2353 * ScreenLines[]. This happens when starting up and when (manually) changing | |
2354 * the shell size. Always use screen_Rows and screen_Columns to access items | |
2355 * in ScreenLines[]. Use Rows and Columns for positioning text etc. where the | |
2356 * final size of the shell is needed. | |
2357 */ | |
2358 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2359 screenalloc(int doclear) |
7 | 2360 { |
2361 int new_row, old_row; | |
2362 #ifdef FEAT_GUI | |
2363 int old_Rows; | |
2364 #endif | |
2365 win_T *wp; | |
2366 int outofmem = FALSE; | |
2367 int len; | |
2368 schar_T *new_ScreenLines; | |
2369 u8char_T *new_ScreenLinesUC = NULL; | |
714 | 2370 u8char_T *new_ScreenLinesC[MAX_MCO]; |
7 | 2371 schar_T *new_ScreenLines2 = NULL; |
714 | 2372 int i; |
7 | 2373 sattr_T *new_ScreenAttrs; |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2374 colnr_T *new_ScreenCols; |
7 | 2375 unsigned *new_LineOffset; |
2376 char_u *new_LineWraps; | |
681 | 2377 short *new_TabPageIdxs; |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2378 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2379 short *new_popup_mask; |
17034
d4a7c690c8e6
patch 8.1.1517: when a popup changes all windows are redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2380 short *new_popup_mask_next; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2381 char *new_popup_transparent; |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2382 #endif |
671 | 2383 tabpage_T *tp; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2384 static int entered = FALSE; // avoid recursiveness |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2385 static int done_outofmem_msg = FALSE; // did outofmem message |
1824 | 2386 int retry_count = 0; |
2387 | |
2388 retry: | |
7 | 2389 /* |
2390 * Allocation of the screen buffers is done only when the size changes and | |
2391 * when Rows and Columns have been set and we have started doing full | |
2392 * screen stuff. | |
2393 */ | |
2394 if ((ScreenLines != NULL | |
2395 && Rows == screen_Rows | |
2396 && Columns == screen_Columns | |
2397 && enc_utf8 == (ScreenLinesUC != NULL) | |
2398 && (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL) | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2399 && p_mco == Screen_mco) |
7 | 2400 || Rows == 0 |
2401 || Columns == 0 | |
2402 || (!full_screen && ScreenLines == NULL)) | |
2403 return; | |
2404 | |
2405 /* | |
2406 * It's possible that we produce an out-of-memory message below, which | |
2407 * will cause this function to be called again. To break the loop, just | |
2408 * return here. | |
2409 */ | |
2410 if (entered) | |
2411 return; | |
2412 entered = TRUE; | |
2413 | |
911 | 2414 /* |
2415 * Note that the window sizes are updated before reallocating the arrays, | |
2416 * thus we must not redraw here! | |
2417 */ | |
2418 ++RedrawingDisabled; | |
2419 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2420 win_new_shellsize(); // fit the windows in the new sized shell |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2421 |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2422 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2423 vim_lock_screen(); // be safe, put it here |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2424 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2425 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2426 comp_col(); // recompute columns for shown command and ruler |
7 | 2427 |
2428 /* | |
2429 * We're changing the size of the screen. | |
2430 * - Allocate new arrays for ScreenLines and ScreenAttrs. | |
2431 * - Move lines from the old arrays into the new arrays, clear extra | |
2432 * lines (unless the screen is going to be cleared). | |
2433 * - Free the old arrays. | |
2434 * | |
2435 * If anything fails, make ScreenLines NULL, so we don't do anything! | |
2436 * Continuing with the old ScreenLines may result in a crash, because the | |
2437 * size is wrong. | |
2438 */ | |
671 | 2439 FOR_ALL_TAB_WINDOWS(tp, wp) |
7 | 2440 win_free_lsize(wp); |
1946 | 2441 if (aucmd_win != NULL) |
2442 win_free_lsize(aucmd_win); | |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2443 #ifdef FEAT_PROP_POPUP |
16882
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2444 // global popup windows |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19824
diff
changeset
|
2445 FOR_ALL_POPUPWINS(wp) |
16882
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2446 win_free_lsize(wp); |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2447 // tab-local popup windows |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2448 FOR_ALL_TABPAGES(tp) |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19824
diff
changeset
|
2449 FOR_ALL_POPUPWINS_IN_TAB(tp, wp) |
16882
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2450 win_free_lsize(wp); |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2451 #endif |
7 | 2452 |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2453 new_ScreenLines = LALLOC_MULT(schar_T, (Rows + 1) * Columns); |
2122
476336a5ae95
updated for version 7.2.404
Bram Moolenaar <bram@zimbu.org>
parents:
2069
diff
changeset
|
2454 vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO); |
7 | 2455 if (enc_utf8) |
2456 { | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2457 new_ScreenLinesUC = LALLOC_MULT(u8char_T, (Rows + 1) * Columns); |
714 | 2458 for (i = 0; i < p_mco; ++i) |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2459 new_ScreenLinesC[i] = LALLOC_CLEAR_MULT(u8char_T, |
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2460 (Rows + 1) * Columns); |
7 | 2461 } |
2462 if (enc_dbcs == DBCS_JPNU) | |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2463 new_ScreenLines2 = LALLOC_MULT(schar_T, (Rows + 1) * Columns); |
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2464 new_ScreenAttrs = LALLOC_MULT(sattr_T, (Rows + 1) * Columns); |
30986
360f286b5869
patch 9.0.0828: various typos
Bram Moolenaar <Bram@vim.org>
parents:
30825
diff
changeset
|
2465 // Clear ScreenCols to avoid a warning for uninitialized memory in |
30331
ddbac2551dac
patch 9.0.0501: warning for using uninitialized value in mouse test
Bram Moolenaar <Bram@vim.org>
parents:
30222
diff
changeset
|
2466 // jump_to_mouse(). |
ddbac2551dac
patch 9.0.0501: warning for using uninitialized value in mouse test
Bram Moolenaar <Bram@vim.org>
parents:
30222
diff
changeset
|
2467 new_ScreenCols = LALLOC_CLEAR_MULT(colnr_T, (Rows + 1) * Columns); |
16825
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2468 new_LineOffset = LALLOC_MULT(unsigned, Rows); |
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2469 new_LineWraps = LALLOC_MULT(char_u, Rows); |
ce04ebdf26b8
patch 8.1.1414: alloc() returning "char_u *" causes a lot of type casts
Bram Moolenaar <Bram@vim.org>
parents:
16817
diff
changeset
|
2470 new_TabPageIdxs = LALLOC_MULT(short, Columns); |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2471 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2472 new_popup_mask = LALLOC_MULT(short, Rows * Columns); |
17034
d4a7c690c8e6
patch 8.1.1517: when a popup changes all windows are redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2473 new_popup_mask_next = LALLOC_MULT(short, Rows * Columns); |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2474 new_popup_transparent = LALLOC_MULT(char, Rows * Columns); |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2475 #endif |
7 | 2476 |
677 | 2477 FOR_ALL_TAB_WINDOWS(tp, wp) |
7 | 2478 { |
2479 if (win_alloc_lines(wp) == FAIL) | |
2480 { | |
2481 outofmem = TRUE; | |
1819 | 2482 goto give_up; |
2483 } | |
2484 } | |
1946 | 2485 if (aucmd_win != NULL && aucmd_win->w_lines == NULL |
2486 && win_alloc_lines(aucmd_win) == FAIL) | |
1906 | 2487 outofmem = TRUE; |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2488 #ifdef FEAT_PROP_POPUP |
16882
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2489 // global popup windows |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19824
diff
changeset
|
2490 FOR_ALL_POPUPWINS(wp) |
16882
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2491 if (win_alloc_lines(wp) == FAIL) |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2492 { |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2493 outofmem = TRUE; |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2494 goto give_up; |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2495 } |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2496 // tab-local popup windows |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2497 FOR_ALL_TABPAGES(tp) |
19888
435726a03481
patch 8.2.0500: using the same loop in many places
Bram Moolenaar <Bram@vim.org>
parents:
19824
diff
changeset
|
2498 FOR_ALL_POPUPWINS_IN_TAB(tp, wp) |
16882
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2499 if (win_alloc_lines(wp) == FAIL) |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2500 { |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2501 outofmem = TRUE; |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2502 goto give_up; |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2503 } |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2504 #endif |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2505 |
1819 | 2506 give_up: |
7 | 2507 |
714 | 2508 for (i = 0; i < p_mco; ++i) |
2509 if (new_ScreenLinesC[i] == NULL) | |
2510 break; | |
7 | 2511 if (new_ScreenLines == NULL |
714 | 2512 || (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco)) |
7 | 2513 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) |
2514 || new_ScreenAttrs == NULL | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2515 || new_ScreenCols == NULL |
7 | 2516 || new_LineOffset == NULL |
2517 || new_LineWraps == NULL | |
671 | 2518 || new_TabPageIdxs == NULL |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2519 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2520 || new_popup_mask == NULL |
17034
d4a7c690c8e6
patch 8.1.1517: when a popup changes all windows are redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2521 || new_popup_mask_next == NULL |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2522 || new_popup_transparent == NULL |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2523 #endif |
7 | 2524 || outofmem) |
2525 { | |
944 | 2526 if (ScreenLines != NULL || !done_outofmem_msg) |
534 | 2527 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2528 // guess the size |
534 | 2529 do_outofmem_msg((long_u)((Rows + 1) * Columns)); |
2530 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2531 // Remember we did this to avoid getting outofmem messages over |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2532 // and over again. |
944 | 2533 done_outofmem_msg = TRUE; |
534 | 2534 } |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2535 VIM_CLEAR(new_ScreenLines); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2536 VIM_CLEAR(new_ScreenLinesUC); |
714 | 2537 for (i = 0; i < p_mco; ++i) |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2538 VIM_CLEAR(new_ScreenLinesC[i]); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2539 VIM_CLEAR(new_ScreenLines2); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2540 VIM_CLEAR(new_ScreenAttrs); |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2541 VIM_CLEAR(new_ScreenCols); |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2542 VIM_CLEAR(new_LineOffset); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2543 VIM_CLEAR(new_LineWraps); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2544 VIM_CLEAR(new_TabPageIdxs); |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2545 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2546 VIM_CLEAR(new_popup_mask); |
17034
d4a7c690c8e6
patch 8.1.1517: when a popup changes all windows are redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2547 VIM_CLEAR(new_popup_mask_next); |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2548 VIM_CLEAR(new_popup_transparent); |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2549 #endif |
7 | 2550 } |
2551 else | |
2552 { | |
944 | 2553 done_outofmem_msg = FALSE; |
534 | 2554 |
7 | 2555 for (new_row = 0; new_row < Rows; ++new_row) |
2556 { | |
2557 new_LineOffset[new_row] = new_row * Columns; | |
2558 new_LineWraps[new_row] = FALSE; | |
2559 | |
2560 /* | |
2561 * If the screen is not going to be cleared, copy as much as | |
2562 * possible from the old screen to the new one and clear the rest | |
2563 * (used when resizing the window at the "--more--" prompt or when | |
2564 * executing an external command, for the GUI). | |
2565 */ | |
3263 | 2566 if (!doclear) |
7 | 2567 { |
2568 (void)vim_memset(new_ScreenLines + new_row * Columns, | |
2569 ' ', (size_t)Columns * sizeof(schar_T)); | |
2570 if (enc_utf8) | |
2571 { | |
2572 (void)vim_memset(new_ScreenLinesUC + new_row * Columns, | |
2573 0, (size_t)Columns * sizeof(u8char_T)); | |
714 | 2574 for (i = 0; i < p_mco; ++i) |
2575 (void)vim_memset(new_ScreenLinesC[i] | |
2576 + new_row * Columns, | |
7 | 2577 0, (size_t)Columns * sizeof(u8char_T)); |
2578 } | |
2579 if (enc_dbcs == DBCS_JPNU) | |
2580 (void)vim_memset(new_ScreenLines2 + new_row * Columns, | |
2581 0, (size_t)Columns * sizeof(schar_T)); | |
2582 (void)vim_memset(new_ScreenAttrs + new_row * Columns, | |
2583 0, (size_t)Columns * sizeof(sattr_T)); | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2584 (void)vim_memset(new_ScreenCols + new_row * Columns, |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2585 0, (size_t)Columns * sizeof(colnr_T)); |
7 | 2586 old_row = new_row + (screen_Rows - Rows); |
534 | 2587 if (old_row >= 0 && ScreenLines != NULL) |
7 | 2588 { |
2589 if (screen_Columns < Columns) | |
2590 len = screen_Columns; | |
2591 else | |
2592 len = Columns; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2593 // When switching to utf-8 don't copy characters, they |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2594 // may be invalid now. Also when p_mco changes. |
714 | 2595 if (!(enc_utf8 && ScreenLinesUC == NULL) |
2596 && p_mco == Screen_mco) | |
26 | 2597 mch_memmove(new_ScreenLines + new_LineOffset[new_row], |
2598 ScreenLines + LineOffset[old_row], | |
2599 (size_t)len * sizeof(schar_T)); | |
714 | 2600 if (enc_utf8 && ScreenLinesUC != NULL |
2601 && p_mco == Screen_mco) | |
7 | 2602 { |
2603 mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row], | |
2604 ScreenLinesUC + LineOffset[old_row], | |
2605 (size_t)len * sizeof(u8char_T)); | |
714 | 2606 for (i = 0; i < p_mco; ++i) |
2607 mch_memmove(new_ScreenLinesC[i] | |
2608 + new_LineOffset[new_row], | |
2609 ScreenLinesC[i] + LineOffset[old_row], | |
7 | 2610 (size_t)len * sizeof(u8char_T)); |
2611 } | |
2612 if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL) | |
2613 mch_memmove(new_ScreenLines2 + new_LineOffset[new_row], | |
2614 ScreenLines2 + LineOffset[old_row], | |
2615 (size_t)len * sizeof(schar_T)); | |
2616 mch_memmove(new_ScreenAttrs + new_LineOffset[new_row], | |
2617 ScreenAttrs + LineOffset[old_row], | |
2618 (size_t)len * sizeof(sattr_T)); | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2619 mch_memmove(new_ScreenCols + new_LineOffset[new_row], |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2620 ScreenAttrs + LineOffset[old_row], |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2621 (size_t)len * sizeof(colnr_T)); |
7 | 2622 } |
2623 } | |
2624 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2625 // Use the last line of the screen for the current line. |
7 | 2626 current_ScreenLine = new_ScreenLines + Rows * Columns; |
17696
03dcb660c4e8
patch 8.1.1845: may use NULL pointer when running out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
2627 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2628 #ifdef FEAT_PROP_POPUP |
17696
03dcb660c4e8
patch 8.1.1845: may use NULL pointer when running out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
2629 vim_memset(new_popup_mask, 0, Rows * Columns * sizeof(short)); |
03dcb660c4e8
patch 8.1.1845: may use NULL pointer when running out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
2630 vim_memset(new_popup_transparent, 0, Rows * Columns * sizeof(char)); |
03dcb660c4e8
patch 8.1.1845: may use NULL pointer when running out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
2631 #endif |
7 | 2632 } |
2633 | |
356 | 2634 free_screenlines(); |
2635 | |
17696
03dcb660c4e8
patch 8.1.1845: may use NULL pointer when running out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
2636 // NOTE: this may result in all pointers to become NULL. |
7 | 2637 ScreenLines = new_ScreenLines; |
2638 ScreenLinesUC = new_ScreenLinesUC; | |
714 | 2639 for (i = 0; i < p_mco; ++i) |
2640 ScreenLinesC[i] = new_ScreenLinesC[i]; | |
2641 Screen_mco = p_mco; | |
7 | 2642 ScreenLines2 = new_ScreenLines2; |
2643 ScreenAttrs = new_ScreenAttrs; | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2644 ScreenCols = new_ScreenCols; |
7 | 2645 LineOffset = new_LineOffset; |
2646 LineWraps = new_LineWraps; | |
671 | 2647 TabPageIdxs = new_TabPageIdxs; |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2648 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2649 popup_mask = new_popup_mask; |
17034
d4a7c690c8e6
patch 8.1.1517: when a popup changes all windows are redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2650 popup_mask_next = new_popup_mask_next; |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2651 popup_transparent = new_popup_transparent; |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2652 popup_mask_refresh = TRUE; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2653 #endif |
7 | 2654 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2655 // It's important that screen_Rows and screen_Columns reflect the actual |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2656 // size of ScreenLines[]. Set them before calling anything. |
7 | 2657 #ifdef FEAT_GUI |
2658 old_Rows = screen_Rows; | |
2659 #endif | |
2660 screen_Rows = Rows; | |
2661 screen_Columns = Columns; | |
2662 | |
29812
68ef14b21d01
patch 9.0.0245: mechanism to prevent recursive screen updating is incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29732
diff
changeset
|
2663 set_must_redraw(UPD_CLEAR); // need to clear the screen later |
3263 | 2664 if (doclear) |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2665 screenclear2(TRUE); |
7 | 2666 #ifdef FEAT_GUI |
2667 else if (gui.in_use | |
2668 && !gui.starting | |
2669 && ScreenLines != NULL | |
2670 && old_Rows != Rows) | |
2671 { | |
19824
09a621bdb0bc
patch 8.2.0468: GUI: pixel dust with some fonts and characters
Bram Moolenaar <Bram@vim.org>
parents:
19526
diff
changeset
|
2672 gui_redraw_block(0, 0, (int)Rows - 1, (int)Columns - 1, 0); |
09a621bdb0bc
patch 8.2.0468: GUI: pixel dust with some fonts and characters
Bram Moolenaar <Bram@vim.org>
parents:
19526
diff
changeset
|
2673 |
09a621bdb0bc
patch 8.2.0468: GUI: pixel dust with some fonts and characters
Bram Moolenaar <Bram@vim.org>
parents:
19526
diff
changeset
|
2674 // Adjust the position of the cursor, for when executing an external |
09a621bdb0bc
patch 8.2.0468: GUI: pixel dust with some fonts and characters
Bram Moolenaar <Bram@vim.org>
parents:
19526
diff
changeset
|
2675 // command. |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2676 if (msg_row >= Rows) // Rows got smaller |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2677 msg_row = Rows - 1; // put cursor at last row |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2678 else if (Rows > old_Rows) // Rows got bigger |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2679 msg_row += Rows - old_Rows; // put cursor in same place |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2680 if (msg_col >= Columns) // Columns got smaller |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2681 msg_col = Columns - 1; // put cursor at last column |
7 | 2682 } |
2683 #endif | |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2684 clear_TabPageIdxs(); |
7 | 2685 |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2686 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2687 vim_unlock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2688 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2689 |
7 | 2690 entered = FALSE; |
911 | 2691 --RedrawingDisabled; |
766 | 2692 |
1824 | 2693 /* |
2694 * Do not apply autocommands more than 3 times to avoid an endless loop | |
2695 * in case applying autocommands always changes Rows or Columns. | |
2696 */ | |
2697 if (starting == 0 && ++retry_count <= 3) | |
2698 { | |
766 | 2699 apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2700 // In rare cases, autocommands may have altered Rows or Columns, |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2701 // jump back to check if we need to allocate the screen again. |
1824 | 2702 goto retry; |
2703 } | |
7 | 2704 } |
2705 | |
2706 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2707 free_screenlines(void) |
356 | 2708 { |
714 | 2709 int i; |
2710 | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2711 VIM_CLEAR(ScreenLinesUC); |
714 | 2712 for (i = 0; i < Screen_mco; ++i) |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2713 VIM_CLEAR(ScreenLinesC[i]); |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2714 VIM_CLEAR(ScreenLines2); |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2715 VIM_CLEAR(ScreenLines); |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2716 VIM_CLEAR(ScreenAttrs); |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2717 VIM_CLEAR(ScreenCols); |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2718 VIM_CLEAR(LineOffset); |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2719 VIM_CLEAR(LineWraps); |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2720 VIM_CLEAR(TabPageIdxs); |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2721 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2722 VIM_CLEAR(popup_mask); |
17034
d4a7c690c8e6
patch 8.1.1517: when a popup changes all windows are redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
2723 VIM_CLEAR(popup_mask_next); |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2724 VIM_CLEAR(popup_transparent); |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2725 #endif |
356 | 2726 } |
2727 | |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2728 /* |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2729 * Clear the screen. |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2730 * May delay if there is something the user should read. |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2731 * Allocated the screen for resizing if needed. |
30598
37aa9fd2ed72
patch 9.0.0634: evaluating "expr" options has more overhead than needed
Bram Moolenaar <Bram@vim.org>
parents:
30513
diff
changeset
|
2732 * Returns TRUE when the screen was actually cleared, FALSE if all display |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2733 * cells were marked for updating. |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2734 */ |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2735 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2736 screenclear(void) |
7 | 2737 { |
2738 check_for_delay(FALSE); | |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2739 screenalloc(FALSE); // allocate screen buffers if size changed |
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2740 return screenclear2(TRUE); // clear the screen |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2741 } |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2742 |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2743 /* |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2744 * Do not clear the screen but mark everything for redraw. |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2745 */ |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2746 void |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2747 redraw_as_cleared(void) |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2748 { |
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2749 screenclear2(FALSE); |
7 | 2750 } |
2751 | |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2752 static int |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2753 screenclear2(int doclear) |
7 | 2754 { |
2755 int i; | |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2756 int did_clear = FALSE; |
7 | 2757 |
2758 if (starting == NO_SCREEN || ScreenLines == NULL | |
2759 #ifdef FEAT_GUI | |
2760 || (gui.in_use && gui.starting) | |
2761 #endif | |
2762 ) | |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2763 return FALSE; |
7 | 2764 |
2765 #ifdef FEAT_GUI | |
2766 if (!gui.in_use) | |
2767 #endif | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2768 screen_attr = -1; // force setting the Normal colors |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2769 screen_stop_highlight(); // don't want highlighting here |
7 | 2770 |
2771 #ifdef FEAT_CLIPBOARD | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2772 // disable selection without redrawing it |
7 | 2773 clip_scroll_selection(9999); |
2774 #endif | |
2775 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2776 // blank out ScreenLines |
7 | 2777 for (i = 0; i < Rows; ++i) |
2778 { | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
2779 lineclear(LineOffset[i], (int)Columns, 0); |
7 | 2780 LineWraps[i] = FALSE; |
2781 } | |
2782 | |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2783 if (doclear && can_clear(T_CL)) |
7 | 2784 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2785 out_str(T_CL); // clear the display |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2786 did_clear = TRUE; |
7 | 2787 clear_cmdline = FALSE; |
644 | 2788 mode_displayed = FALSE; |
7 | 2789 } |
2790 else | |
2791 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2792 // can't clear the screen, mark all chars with invalid attributes |
7 | 2793 for (i = 0; i < Rows; ++i) |
2794 lineinvalid(LineOffset[i], (int)Columns); | |
2795 clear_cmdline = TRUE; | |
2796 } | |
2797 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2798 screen_cleared = TRUE; // can use contents of ScreenLines now |
7 | 2799 |
29958
549994614a5a
patch 9.0.0317: when updating the whole screen a popup may not be redrawn
Bram Moolenaar <Bram@vim.org>
parents:
29900
diff
changeset
|
2800 win_rest_invalid(firstwin); // redraw all regular windows |
7 | 2801 redraw_cmdline = TRUE; |
673 | 2802 redraw_tabline = TRUE; |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29672
diff
changeset
|
2803 if (must_redraw == UPD_CLEAR) // no need to clear again |
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29672
diff
changeset
|
2804 must_redraw = UPD_NOT_VALID; |
30222
b871016ea7c1
patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents:
30005
diff
changeset
|
2805 msg_scrolled = 0; // compute_cmdrow() uses this |
7 | 2806 compute_cmdrow(); |
30222
b871016ea7c1
patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents:
30005
diff
changeset
|
2807 #ifdef FEAT_PROP_POPUP |
b871016ea7c1
patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents:
30005
diff
changeset
|
2808 popup_redraw_all(); // redraw all popup windows |
b871016ea7c1
patch 9.0.0447: using :echowin while at the hit-enter prompt causes problems
Bram Moolenaar <Bram@vim.org>
parents:
30005
diff
changeset
|
2809 #endif |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2810 msg_row = cmdline_row; // put cursor on last line for messages |
7 | 2811 msg_col = 0; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2812 screen_start(); // don't know where cursor is now |
7 | 2813 msg_didany = FALSE; |
2814 msg_didout = FALSE; | |
30513
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2815 |
ea15dfc9c155
patch 9.0.0592: display not cleared when scrolling back in messages
Bram Moolenaar <Bram@vim.org>
parents:
30331
diff
changeset
|
2816 return did_clear; |
7 | 2817 } |
2818 | |
2819 /* | |
2820 * Clear one line in ScreenLines. | |
2821 */ | |
2822 static void | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
2823 lineclear(unsigned off, int width, int attr) |
7 | 2824 { |
2825 (void)vim_memset(ScreenLines + off, ' ', (size_t)width * sizeof(schar_T)); | |
2826 if (enc_utf8) | |
2827 (void)vim_memset(ScreenLinesUC + off, 0, | |
2828 (size_t)width * sizeof(u8char_T)); | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
2829 (void)vim_memset(ScreenAttrs + off, attr, (size_t)width * sizeof(sattr_T)); |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2830 (void)vim_memset(ScreenCols + off, -1, (size_t)width * sizeof(colnr_T)); |
7 | 2831 } |
2832 | |
2833 /* | |
2834 * Mark one line in ScreenLines invalid by setting the attributes to an | |
2835 * invalid value. | |
2836 */ | |
2837 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2838 lineinvalid(unsigned off, int width) |
7 | 2839 { |
2840 (void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T)); | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2841 (void)vim_memset(ScreenCols + off, -1, (size_t)width * sizeof(colnr_T)); |
7 | 2842 } |
2843 | |
2844 /* | |
21226
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2845 * To be called when characters were sent to the terminal directly, outputting |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2846 * test on "screen_lnum". |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2847 */ |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2848 void |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2849 line_was_clobbered(int screen_lnum) |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2850 { |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2851 lineinvalid(LineOffset[screen_lnum], (int)Columns); |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2852 } |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2853 |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
2854 /* |
7 | 2855 * Copy part of a Screenline for vertically split window "wp". |
2856 */ | |
2857 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2858 linecopy(int to, int from, win_T *wp) |
7 | 2859 { |
2860 unsigned off_to = LineOffset[to] + wp->w_wincol; | |
2861 unsigned off_from = LineOffset[from] + wp->w_wincol; | |
2862 | |
2863 mch_memmove(ScreenLines + off_to, ScreenLines + off_from, | |
2864 wp->w_width * sizeof(schar_T)); | |
2865 if (enc_utf8) | |
2866 { | |
714 | 2867 int i; |
2868 | |
7 | 2869 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from, |
2870 wp->w_width * sizeof(u8char_T)); | |
714 | 2871 for (i = 0; i < p_mco; ++i) |
2872 mch_memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from, | |
2873 wp->w_width * sizeof(u8char_T)); | |
7 | 2874 } |
2875 if (enc_dbcs == DBCS_JPNU) | |
2876 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from, | |
2877 wp->w_width * sizeof(schar_T)); | |
2878 mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from, | |
2879 wp->w_width * sizeof(sattr_T)); | |
29413
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2880 mch_memmove(ScreenCols + off_to, ScreenCols + off_from, |
34e93e046526
patch 9.0.0048: cursor in wrong column with mouse click after concealed text
Bram Moolenaar <Bram@vim.org>
parents:
29395
diff
changeset
|
2881 wp->w_width * sizeof(colnr_T)); |
7 | 2882 } |
2883 | |
2884 /* | |
2885 * Return TRUE if clearing with term string "p" would work. | |
2886 * It can't work when the string is empty or it won't set the right background. | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2887 * Don't clear to end-of-line when there are popups, it may cause flicker. |
7 | 2888 */ |
2889 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2890 can_clear(char_u *p) |
7 | 2891 { |
2892 return (*p != NUL && (t_colors <= 1 | |
2893 #ifdef FEAT_GUI | |
2894 || gui.in_use | |
2895 #endif | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
2896 #ifdef FEAT_TERMGUICOLORS |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
2897 || (p_tgc && cterm_normal_bg_gui_color == INVALCOLOR) |
9320
b6472fd9f5ba
commit https://github.com/vim/vim/commit/d18f672fc9477f3c0cb7cc4ce8d9237ed825c612
Christian Brabandt <cb@256bit.org>
parents:
9282
diff
changeset
|
2898 || (!p_tgc && cterm_normal_bg_color == 0) |
b6472fd9f5ba
commit https://github.com/vim/vim/commit/d18f672fc9477f3c0cb7cc4ce8d9237ed825c612
Christian Brabandt <cb@256bit.org>
parents:
9282
diff
changeset
|
2899 #else |
b6472fd9f5ba
commit https://github.com/vim/vim/commit/d18f672fc9477f3c0cb7cc4ce8d9237ed825c612
Christian Brabandt <cb@256bit.org>
parents:
9282
diff
changeset
|
2900 || cterm_normal_bg_color == 0 |
b6472fd9f5ba
commit https://github.com/vim/vim/commit/d18f672fc9477f3c0cb7cc4ce8d9237ed825c612
Christian Brabandt <cb@256bit.org>
parents:
9282
diff
changeset
|
2901 #endif |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2902 || *T_UT != NUL) |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2903 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2904 && !(p == T_CE && popup_visible) |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2905 #endif |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2906 ); |
7 | 2907 } |
2908 | |
2909 /* | |
2910 * Reset cursor position. Use whenever cursor was moved because of outputting | |
2911 * something directly to the screen (shell commands) or a terminal control | |
2912 * code. | |
2913 */ | |
2914 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2915 screen_start(void) |
7 | 2916 { |
2917 screen_cur_row = screen_cur_col = 9999; | |
2918 } | |
2919 | |
2920 /* | |
2921 * Move the cursor to position "row","col" in the screen. | |
2922 * This tries to find the most efficient way to move, minimizing the number of | |
2923 * characters sent to the terminal. | |
2924 */ | |
2925 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2926 windgoto(int row, int col) |
7 | 2927 { |
205 | 2928 sattr_T *p; |
7 | 2929 int i; |
2930 int plan; | |
2931 int cost; | |
2932 int wouldbe_col; | |
2933 int noinvcurs; | |
2934 char_u *bs; | |
2935 int goto_cost; | |
2936 int attr; | |
2937 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2938 #define GOTO_COST 7 // assume a term_windgoto() takes about 7 chars |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2939 #define HIGHL_COST 5 // assume unhighlight takes 5 chars |
7 | 2940 |
2941 #define PLAN_LE 1 | |
2942 #define PLAN_CR 2 | |
2943 #define PLAN_NL 3 | |
2944 #define PLAN_WRITE 4 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2945 // Can't use ScreenLines unless initialized |
7 | 2946 if (ScreenLines == NULL) |
2947 return; | |
2948 if (col != screen_cur_col || row != screen_cur_row) | |
2949 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2950 // Check for valid position. |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2951 if (row < 0) // window without text lines? |
7 | 2952 row = 0; |
2953 if (row >= screen_Rows) | |
2954 row = screen_Rows - 1; | |
2955 if (col >= screen_Columns) | |
2956 col = screen_Columns - 1; | |
2957 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2958 // check if no cursor movement is allowed in highlight mode |
7 | 2959 if (screen_attr && *T_MS == NUL) |
2960 noinvcurs = HIGHL_COST; | |
2961 else | |
2962 noinvcurs = 0; | |
2963 goto_cost = GOTO_COST + noinvcurs; | |
2964 | |
2965 /* | |
2966 * Plan how to do the positioning: | |
2967 * 1. Use CR to move it to column 0, same row. | |
2968 * 2. Use T_LE to move it a few columns to the left. | |
2969 * 3. Use NL to move a few lines down, column 0. | |
2970 * 4. Move a few columns to the right with T_ND or by writing chars. | |
2971 * | |
2972 * Don't do this if the cursor went beyond the last column, the cursor | |
2973 * position is unknown then (some terminals wrap, some don't ) | |
2974 * | |
1213 | 2975 * First check if the highlighting attributes allow us to write |
7 | 2976 * characters to move the cursor to the right. |
2977 */ | |
2978 if (row >= screen_cur_row && screen_cur_col < Columns) | |
2979 { | |
2980 /* | |
2981 * If the cursor is in the same row, bigger col, we can use CR | |
2982 * or T_LE. | |
2983 */ | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2984 bs = NULL; // init for GCC |
7 | 2985 attr = screen_attr; |
2986 if (row == screen_cur_row && col < screen_cur_col) | |
2987 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2988 // "le" is preferred over "bc", because "bc" is obsolete |
7 | 2989 if (*T_LE) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2990 bs = T_LE; // "cursor left" |
7 | 2991 else |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2992 bs = T_BC; // "backspace character (old) |
7 | 2993 if (*bs) |
2994 cost = (screen_cur_col - col) * (int)STRLEN(bs); | |
2995 else | |
2996 cost = 999; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2997 if (col + 1 < cost) // using CR is less characters |
7 | 2998 { |
2999 plan = PLAN_CR; | |
3000 wouldbe_col = 0; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3001 cost = 1; // CR is just one character |
7 | 3002 } |
3003 else | |
3004 { | |
3005 plan = PLAN_LE; | |
3006 wouldbe_col = col; | |
3007 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3008 if (noinvcurs) // will stop highlighting |
7 | 3009 { |
3010 cost += noinvcurs; | |
3011 attr = 0; | |
3012 } | |
3013 } | |
3014 | |
3015 /* | |
3016 * If the cursor is above where we want to be, we can use CR LF. | |
3017 */ | |
3018 else if (row > screen_cur_row) | |
3019 { | |
3020 plan = PLAN_NL; | |
3021 wouldbe_col = 0; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3022 cost = (row - screen_cur_row) * 2; // CR LF |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3023 if (noinvcurs) // will stop highlighting |
7 | 3024 { |
3025 cost += noinvcurs; | |
3026 attr = 0; | |
3027 } | |
3028 } | |
3029 | |
3030 /* | |
3031 * If the cursor is in the same row, smaller col, just use write. | |
3032 */ | |
3033 else | |
3034 { | |
3035 plan = PLAN_WRITE; | |
3036 wouldbe_col = screen_cur_col; | |
3037 cost = 0; | |
3038 } | |
3039 | |
3040 /* | |
3041 * Check if any characters that need to be written have the | |
3042 * correct attributes. Also avoid UTF-8 characters. | |
3043 */ | |
3044 i = col - wouldbe_col; | |
3045 if (i > 0) | |
3046 cost += i; | |
3047 if (cost < goto_cost && i > 0) | |
3048 { | |
3049 /* | |
3050 * Check if the attributes are correct without additionally | |
3051 * stopping highlighting. | |
3052 */ | |
3053 p = ScreenAttrs + LineOffset[row] + wouldbe_col; | |
3054 while (i && *p++ == attr) | |
3055 --i; | |
3056 if (i != 0) | |
3057 { | |
3058 /* | |
3059 * Try if it works when highlighting is stopped here. | |
3060 */ | |
3061 if (*--p == 0) | |
3062 { | |
3063 cost += noinvcurs; | |
3064 while (i && *p++ == 0) | |
3065 --i; | |
3066 } | |
3067 if (i != 0) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3068 cost = 999; // different attributes, don't do it |
7 | 3069 } |
3070 if (enc_utf8) | |
3071 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3072 // Don't use an UTF-8 char for positioning, it's slow. |
7 | 3073 for (i = wouldbe_col; i < col; ++i) |
3074 if (ScreenLinesUC[LineOffset[row] + i] != 0) | |
3075 { | |
3076 cost = 999; | |
3077 break; | |
3078 } | |
3079 } | |
3080 } | |
3081 | |
3082 /* | |
3083 * We can do it without term_windgoto()! | |
3084 */ | |
3085 if (cost < goto_cost) | |
3086 { | |
3087 if (plan == PLAN_LE) | |
3088 { | |
3089 if (noinvcurs) | |
3090 screen_stop_highlight(); | |
3091 while (screen_cur_col > col) | |
3092 { | |
3093 out_str(bs); | |
3094 --screen_cur_col; | |
3095 } | |
3096 } | |
3097 else if (plan == PLAN_CR) | |
3098 { | |
3099 if (noinvcurs) | |
3100 screen_stop_highlight(); | |
3101 out_char('\r'); | |
3102 screen_cur_col = 0; | |
3103 } | |
3104 else if (plan == PLAN_NL) | |
3105 { | |
3106 if (noinvcurs) | |
3107 screen_stop_highlight(); | |
3108 while (screen_cur_row < row) | |
3109 { | |
3110 out_char('\n'); | |
3111 ++screen_cur_row; | |
3112 } | |
3113 screen_cur_col = 0; | |
3114 } | |
3115 | |
3116 i = col - screen_cur_col; | |
3117 if (i > 0) | |
3118 { | |
3119 /* | |
3120 * Use cursor-right if it's one character only. Avoids | |
3121 * removing a line of pixels from the last bold char, when | |
3122 * using the bold trick in the GUI. | |
3123 */ | |
3124 if (T_ND[0] != NUL && T_ND[1] == NUL) | |
3125 { | |
3126 while (i-- > 0) | |
3127 out_char(*T_ND); | |
3128 } | |
3129 else | |
3130 { | |
3131 int off; | |
3132 | |
3133 off = LineOffset[row] + screen_cur_col; | |
3134 while (i-- > 0) | |
3135 { | |
3136 if (ScreenAttrs[off] != screen_attr) | |
3137 screen_stop_highlight(); | |
3138 out_flush_check(); | |
3139 out_char(ScreenLines[off]); | |
3140 if (enc_dbcs == DBCS_JPNU | |
3141 && ScreenLines[off] == 0x8e) | |
3142 out_char(ScreenLines2[off]); | |
3143 ++off; | |
3144 } | |
3145 } | |
3146 } | |
3147 } | |
3148 } | |
3149 else | |
3150 cost = 999; | |
3151 | |
3152 if (cost >= goto_cost) | |
3153 { | |
3154 if (noinvcurs) | |
3155 screen_stop_highlight(); | |
5995 | 3156 if (row == screen_cur_row && (col > screen_cur_col) |
3157 && *T_CRI != NUL) | |
7 | 3158 term_cursor_right(col - screen_cur_col); |
3159 else | |
3160 term_windgoto(row, col); | |
3161 } | |
3162 screen_cur_row = row; | |
3163 screen_cur_col = col; | |
3164 } | |
3165 } | |
3166 | |
3167 /* | |
3168 * Set cursor to its position in the current window. | |
3169 */ | |
3170 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3171 setcursor(void) |
7 | 3172 { |
13400
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3173 setcursor_mayforce(FALSE); |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3174 } |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3175 |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3176 /* |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3177 * Set cursor to its position in the current window. |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3178 * When "force" is TRUE also when not redrawing. |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3179 */ |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3180 void |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3181 setcursor_mayforce(int force) |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3182 { |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3183 if (force || redrawing()) |
7 | 3184 { |
3185 validate_cursor(); | |
3186 windgoto(W_WINROW(curwin) + curwin->w_wrow, | |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12510
diff
changeset
|
3187 curwin->w_wincol + ( |
7 | 3188 #ifdef FEAT_RIGHTLEFT |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3189 // With 'rightleft' set and the cursor on a double-wide |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3190 // character, position it on the leftmost column. |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
3191 curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol |
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
3192 - ((has_mbyte |
1545 | 3193 && (*mb_ptr2cells)(ml_get_cursor()) == 2 |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
3194 && vim_isprintc(gchar_cursor())) ? 2 : 1)) : |
7 | 3195 #endif |
3196 curwin->w_wcol)); | |
3197 } | |
3198 } | |
3199 | |
3200 | |
3201 /* | |
11655
8014350fe51a
patch 8.0.0710: a job that writes to a buffer clears completion
Christian Brabandt <cb@256bit.org>
parents:
11607
diff
changeset
|
3202 * Insert 'line_count' lines at 'row' in window 'wp'. |
8014350fe51a
patch 8.0.0710: a job that writes to a buffer clears completion
Christian Brabandt <cb@256bit.org>
parents:
11607
diff
changeset
|
3203 * If 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated. |
8014350fe51a
patch 8.0.0710: a job that writes to a buffer clears completion
Christian Brabandt <cb@256bit.org>
parents:
11607
diff
changeset
|
3204 * If 'mayclear' is TRUE the screen will be cleared if it is faster than |
7 | 3205 * scrolling. |
3206 * Returns FAIL if the lines are not inserted, OK for success. | |
3207 */ | |
3208 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3209 win_ins_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3210 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3211 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3212 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3213 int invalid, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3214 int mayclear) |
7 | 3215 { |
3216 int did_delete; | |
3217 int nextrow; | |
3218 int lastrow; | |
3219 int retval; | |
3220 | |
3221 if (invalid) | |
3222 wp->w_lines_valid = 0; | |
3223 | |
29251
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3224 // with only a few lines it's not worth the effort |
7 | 3225 if (wp->w_height < 5) |
3226 return FAIL; | |
3227 | |
29251
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3228 // with the popup menu visible this might not work correctly |
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3229 if (pum_visible()) |
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3230 return FAIL; |
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3231 |
7 | 3232 if (line_count > wp->w_height - row) |
3233 line_count = wp->w_height - row; | |
3234 | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3235 retval = win_do_lines(wp, row, line_count, mayclear, FALSE, 0); |
7 | 3236 if (retval != MAYBE) |
3237 return retval; | |
3238 | |
3239 /* | |
3240 * If there is a next window or a status line, we first try to delete the | |
3241 * lines at the bottom to avoid messing what is after the window. | |
17628
6146b10714de
patch 8.1.1811: popup window color cannot be set to "Normal"
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
3242 * If this fails and there are following windows, don't do anything to |
6146b10714de
patch 8.1.1811: popup window color cannot be set to "Normal"
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
3243 * avoid messing up those windows, better just redraw. |
7 | 3244 */ |
3245 did_delete = FALSE; | |
3246 if (wp->w_next != NULL || wp->w_status_height) | |
3247 { | |
3248 if (screen_del_lines(0, W_WINROW(wp) + wp->w_height - line_count, | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3249 line_count, (int)Rows, FALSE, 0, NULL) == OK) |
7 | 3250 did_delete = TRUE; |
3251 else if (wp->w_next) | |
3252 return FAIL; | |
3253 } | |
3254 /* | |
3255 * if no lines deleted, blank the lines that will end up below the window | |
3256 */ | |
3257 if (!did_delete) | |
3258 { | |
3259 wp->w_redr_status = TRUE; | |
3260 redraw_cmdline = TRUE; | |
12529
158917d728b4
patch 8.0.1143: macros always expand to the same thing
Christian Brabandt <cb@256bit.org>
parents:
12515
diff
changeset
|
3261 nextrow = W_WINROW(wp) + wp->w_height + wp->w_status_height; |
7 | 3262 lastrow = nextrow + line_count; |
3263 if (lastrow > Rows) | |
3264 lastrow = Rows; | |
3265 screen_fill(nextrow - line_count, lastrow - line_count, | |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12510
diff
changeset
|
3266 wp->w_wincol, (int)W_ENDCOL(wp), |
7 | 3267 ' ', ' ', 0); |
3268 } | |
3269 | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3270 if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, 0, NULL) |
7 | 3271 == FAIL) |
3272 { | |
17628
6146b10714de
patch 8.1.1811: popup window color cannot be set to "Normal"
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
3273 // deletion will have messed up other windows |
7 | 3274 if (did_delete) |
3275 { | |
3276 wp->w_redr_status = TRUE; | |
3277 win_rest_invalid(W_NEXT(wp)); | |
3278 } | |
3279 return FAIL; | |
3280 } | |
3281 | |
3282 return OK; | |
3283 } | |
3284 | |
3285 /* | |
11655
8014350fe51a
patch 8.0.0710: a job that writes to a buffer clears completion
Christian Brabandt <cb@256bit.org>
parents:
11607
diff
changeset
|
3286 * Delete "line_count" window lines at "row" in window "wp". |
7 | 3287 * If "invalid" is TRUE curwin->w_lines[] is invalidated. |
3288 * If "mayclear" is TRUE the screen will be cleared if it is faster than | |
3289 * scrolling | |
3290 * Return OK for success, FAIL if the lines are not deleted. | |
3291 */ | |
3292 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3293 win_del_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3294 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3295 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3296 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3297 int invalid, |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3298 int mayclear, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3299 int clear_attr) // for clearing lines |
7 | 3300 { |
3301 int retval; | |
3302 | |
3303 if (invalid) | |
3304 wp->w_lines_valid = 0; | |
3305 | |
3306 if (line_count > wp->w_height - row) | |
3307 line_count = wp->w_height - row; | |
3308 | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3309 retval = win_do_lines(wp, row, line_count, mayclear, TRUE, clear_attr); |
7 | 3310 if (retval != MAYBE) |
3311 return retval; | |
3312 | |
3313 if (screen_del_lines(0, W_WINROW(wp) + row, line_count, | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3314 (int)Rows, FALSE, clear_attr, NULL) == FAIL) |
7 | 3315 return FAIL; |
3316 | |
3317 /* | |
3318 * If there are windows or status lines below, try to put them at the | |
3319 * correct place. If we can't do that, they have to be redrawn. | |
3320 */ | |
3321 if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1) | |
3322 { | |
3323 if (screen_ins_lines(0, W_WINROW(wp) + wp->w_height - line_count, | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3324 line_count, (int)Rows, clear_attr, NULL) == FAIL) |
7 | 3325 { |
3326 wp->w_redr_status = TRUE; | |
3327 win_rest_invalid(wp->w_next); | |
3328 } | |
3329 } | |
3330 /* | |
3331 * If this is the last window and there is no status line, redraw the | |
3332 * command line later. | |
3333 */ | |
3334 else | |
3335 redraw_cmdline = TRUE; | |
3336 return OK; | |
3337 } | |
3338 | |
3339 /* | |
3340 * Common code for win_ins_lines() and win_del_lines(). | |
3341 * Returns OK or FAIL when the work has been done. | |
3342 * Returns MAYBE when not finished yet. | |
3343 */ | |
3344 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3345 win_do_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3346 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3347 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3348 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3349 int mayclear, |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3350 int del, |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3351 int clear_attr) |
7 | 3352 { |
3353 int retval; | |
3354 | |
3355 if (!redrawing() || line_count <= 0) | |
3356 return FAIL; | |
3357 | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3358 // When inserting lines would result in loss of command output, just redraw |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3359 // the lines. |
11416
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3360 if (no_win_do_lines_ins && !del) |
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3361 return FAIL; |
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3362 |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3363 // only a few lines left: redraw is faster |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3364 if (mayclear && Rows - line_count < 5 && wp->w_width == Columns) |
7 | 3365 { |
11416
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3366 if (!no_win_do_lines_ins) |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3367 screenclear(); // will set wp->w_lines_valid to 0 |
7 | 3368 return FAIL; |
3369 } | |
3370 | |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
3371 #ifdef FEAT_PROP_POPUP |
17034
d4a7c690c8e6
patch 8.1.1517: when a popup changes all windows are redrawn
Bram Moolenaar <Bram@vim.org>
parents:
17022
diff
changeset
|
3372 // this doesn't work when there are popups visible |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3373 if (popup_visible) |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3374 return FAIL; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3375 #endif |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3376 |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3377 // Delete all remaining lines |
7 | 3378 if (row + line_count >= wp->w_height) |
3379 { | |
3380 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, | |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12510
diff
changeset
|
3381 wp->w_wincol, (int)W_ENDCOL(wp), |
7 | 3382 ' ', ' ', 0); |
3383 return OK; | |
3384 } | |
3385 | |
3386 /* | |
11416
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3387 * When scrolling, the message on the command line should be cleared, |
7 | 3388 * otherwise it will stay there forever. |
11416
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3389 * Don't do this when avoiding to insert lines. |
7 | 3390 */ |
11416
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3391 if (!no_win_do_lines_ins) |
32aed0993813
patch 8.0.0592: if a job writes to a buffer screen is not updated
Christian Brabandt <cb@256bit.org>
parents:
11277
diff
changeset
|
3392 clear_cmdline = TRUE; |
7 | 3393 |
3394 /* | |
3395 * If the terminal can set a scroll region, use that. | |
3396 * Always do this in a vertically split window. This will redraw from | |
3397 * ScreenLines[] when t_CV isn't defined. That's faster than using | |
3398 * win_line(). | |
3399 * Don't use a scroll region when we are going to redraw the text, writing | |
8212
05b88224cea1
commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce
Christian Brabandt <cb@256bit.org>
parents:
7833
diff
changeset
|
3400 * a character in the lower right corner of the scroll region may cause a |
05b88224cea1
commit https://github.com/vim/vim/commit/48e330aff911be1c798c88a973af6437a8141fce
Christian Brabandt <cb@256bit.org>
parents:
7833
diff
changeset
|
3401 * scroll-up . |
7 | 3402 */ |
12515
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
3403 if (scroll_region || wp->w_width != Columns) |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3404 { |
7 | 3405 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) |
3406 scroll_region_set(wp, row); | |
3407 if (del) | |
3408 retval = screen_del_lines(W_WINROW(wp) + row, 0, line_count, | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3409 wp->w_height - row, FALSE, clear_attr, wp); |
7 | 3410 else |
3411 retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count, | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3412 wp->w_height - row, clear_attr, wp); |
7 | 3413 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) |
3414 scroll_region_reset(); | |
3415 return retval; | |
3416 } | |
3417 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3418 if (wp->w_next != NULL && p_tf) // don't delete/insert on fast terminal |
7 | 3419 return FAIL; |
3420 | |
3421 return MAYBE; | |
3422 } | |
3423 | |
3424 /* | |
3425 * window 'wp' and everything after it is messed up, mark it for redraw | |
3426 */ | |
3427 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3428 win_rest_invalid(win_T *wp) |
7 | 3429 { |
3430 while (wp != NULL) | |
3431 { | |
29732
89e1d67814a9
patch 9.0.0206: redraw flags are not named specifically
Bram Moolenaar <Bram@vim.org>
parents:
29672
diff
changeset
|
3432 redraw_win_later(wp, UPD_NOT_VALID); |
7 | 3433 wp->w_redr_status = TRUE; |
3434 wp = wp->w_next; | |
3435 } | |
3436 redraw_cmdline = TRUE; | |
3437 } | |
3438 | |
3439 /* | |
3440 * The rest of the routines in this file perform screen manipulations. The | |
3441 * given operation is performed physically on the screen. The corresponding | |
3442 * change is also made to the internal screen image. In this way, the editor | |
3443 * anticipates the effect of editing changes on the appearance of the screen. | |
3444 * That way, when we call screenupdate a complete redraw isn't usually | |
3445 * necessary. Another advantage is that we can keep adding code to anticipate | |
3446 * screen changes, and in the meantime, everything still works. | |
3447 */ | |
3448 | |
3449 /* | |
3450 * types for inserting or deleting lines | |
3451 */ | |
3452 #define USE_T_CAL 1 | |
3453 #define USE_T_CDL 2 | |
3454 #define USE_T_AL 3 | |
3455 #define USE_T_CE 4 | |
3456 #define USE_T_DL 5 | |
3457 #define USE_T_SR 6 | |
3458 #define USE_NL 7 | |
3459 #define USE_T_CD 8 | |
3460 #define USE_REDRAW 9 | |
3461 | |
3462 /* | |
3463 * insert lines on the screen and update ScreenLines[] | |
28275
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3464 * "end" is the line after the scrolled part. Normally it is Rows. |
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3465 * When scrolling region used "off" is the offset from the top for the region. |
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3466 * "row" and "end" are relative to the start of the region. |
7 | 3467 * |
3468 * return FAIL for failure, OK for success. | |
3469 */ | |
446 | 3470 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3471 screen_ins_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3472 int off, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3473 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3474 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3475 int end, |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3476 int clear_attr, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3477 win_T *wp) // NULL or window to use width from |
7 | 3478 { |
3479 int i; | |
3480 int j; | |
3481 unsigned temp; | |
3482 int cursor_row; | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3483 int cursor_col = 0; |
7 | 3484 int type; |
3485 int result_empty; | |
3486 int can_ce = can_clear(T_CE); | |
3487 | |
3488 /* | |
3489 * FAIL if | |
3490 * - there is no valid screen | |
3491 * - the line count is less than one | |
3492 * - the line count is more than 'ttyscroll' | |
28275
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3493 * - "end" is more than "Rows" (safety check, should not happen) |
11698
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3494 * - redrawing for a callback and there is a modeless selection |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3495 * - there is a popup window |
7 | 3496 */ |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3497 if (!screen_valid(TRUE) |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3498 || line_count <= 0 || line_count > p_ttyscroll |
28275
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3499 || end > Rows |
11698
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3500 #ifdef FEAT_CLIPBOARD |
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3501 || (clip_star.state != SELECT_CLEARED |
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3502 && redrawing_for_callback > 0) |
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3503 #endif |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
3504 #ifdef FEAT_PROP_POPUP |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3505 || popup_visible |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3506 #endif |
11698
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3507 ) |
7 | 3508 return FAIL; |
3509 | |
3510 /* | |
3511 * There are seven ways to insert lines: | |
3512 * 0. When in a vertically split window and t_CV isn't set, redraw the | |
3513 * characters from ScreenLines[]. | |
3514 * 1. Use T_CD (clear to end of display) if it exists and the result of | |
3515 * the insert is just empty lines | |
3516 * 2. Use T_CAL (insert multiple lines) if it exists and T_AL is not | |
3517 * present or line_count > 1. It looks better if we do all the inserts | |
3518 * at once. | |
3519 * 3. Use T_CDL (delete multiple lines) if it exists and the result of the | |
3520 * insert is just empty lines and T_CE is not present or line_count > | |
3521 * 1. | |
3522 * 4. Use T_AL (insert line) if it exists. | |
3523 * 5. Use T_CE (erase line) if it exists and the result of the insert is | |
3524 * just empty lines. | |
3525 * 6. Use T_DL (delete line) if it exists and the result of the insert is | |
3526 * just empty lines. | |
3527 * 7. Use T_SR (scroll reverse) if it exists and inserting at row 0 and | |
3528 * the 'da' flag is not set or we have clear line capability. | |
3529 * 8. redraw the characters from ScreenLines[]. | |
3530 * | |
3531 * Careful: In a hpterm scroll reverse doesn't work as expected, it moves | |
3532 * the scrollbar for the window. It does have insert line, use that if it | |
3533 * exists. | |
3534 */ | |
3535 result_empty = (row + line_count >= end); | |
3536 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) | |
28295
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3537 { |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3538 // Avoid that lines are first cleared here and then redrawn, which |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3539 // results in many characters updated twice. This happens with CTRL-F |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3540 // in a vertically split window. With line-by-line scrolling |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3541 // USE_REDRAW should be faster. |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3542 if (line_count > 3) |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3543 return FAIL; |
7 | 3544 type = USE_REDRAW; |
28295
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3545 } |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3546 else if (can_clear(T_CD) && result_empty) |
7 | 3547 type = USE_T_CD; |
3548 else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL)) | |
3549 type = USE_T_CAL; | |
3550 else if (*T_CDL != NUL && result_empty && (line_count > 1 || !can_ce)) | |
3551 type = USE_T_CDL; | |
3552 else if (*T_AL != NUL) | |
3553 type = USE_T_AL; | |
3554 else if (can_ce && result_empty) | |
3555 type = USE_T_CE; | |
3556 else if (*T_DL != NUL && result_empty) | |
3557 type = USE_T_DL; | |
3558 else if (*T_SR != NUL && row == 0 && (*T_DA == NUL || can_ce)) | |
3559 type = USE_T_SR; | |
3560 else | |
3561 return FAIL; | |
3562 | |
3563 /* | |
3564 * For clearing the lines screen_del_lines() is used. This will also take | |
3565 * care of t_db if necessary. | |
3566 */ | |
3567 if (type == USE_T_CD || type == USE_T_CDL || | |
3568 type == USE_T_CE || type == USE_T_DL) | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3569 return screen_del_lines(off, row, line_count, end, FALSE, 0, wp); |
7 | 3570 |
3571 /* | |
3572 * If text is retained below the screen, first clear or delete as many | |
3573 * lines at the bottom of the window as are about to be inserted so that | |
3574 * the deleted lines won't later surface during a screen_del_lines. | |
3575 */ | |
3576 if (*T_DB) | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3577 screen_del_lines(off, end - line_count, line_count, end, FALSE, 0, wp); |
7 | 3578 |
3579 #ifdef FEAT_CLIPBOARD | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3580 // Remove a modeless selection when inserting lines halfway the screen |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3581 // or not the full width of the screen. |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3582 if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) |
3674 | 3583 clip_clear_selection(&clip_star); |
7 | 3584 else |
3585 clip_scroll_selection(-line_count); | |
3586 #endif | |
3587 | |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3588 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3589 vim_lock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3590 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3591 |
7 | 3592 #ifdef FEAT_GUI |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3593 // Don't update the GUI cursor here, ScreenLines[] is invalid until the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3594 // scrolling is actually carried out. |
9848
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3595 gui_dont_update_cursor(row + off <= gui.cursor_row); |
7 | 3596 #endif |
3597 | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3598 if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL) |
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3599 cursor_col = wp->w_wincol; |
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3600 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3601 if (*T_CCS != NUL) // cursor relative to region |
7 | 3602 cursor_row = row; |
3603 else | |
3604 cursor_row = row + off; | |
3605 | |
3606 /* | |
3607 * Shift LineOffset[] line_count down to reflect the inserted lines. | |
3608 * Clear the inserted lines in ScreenLines[]. | |
3609 */ | |
3610 row += off; | |
3611 end += off; | |
3612 for (i = 0; i < line_count; ++i) | |
3613 { | |
3614 if (wp != NULL && wp->w_width != Columns) | |
3615 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3616 // need to copy part of a line |
7 | 3617 j = end - 1 - i; |
3618 while ((j -= line_count) >= row) | |
3619 linecopy(j + line_count, j, wp); | |
3620 j += line_count; | |
3621 if (can_clear((char_u *)" ")) | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3622 lineclear(LineOffset[j] + wp->w_wincol, wp->w_width, |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3623 clear_attr); |
7 | 3624 else |
3625 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); | |
3626 LineWraps[j] = FALSE; | |
3627 } | |
3628 else | |
3629 { | |
3630 j = end - 1 - i; | |
3631 temp = LineOffset[j]; | |
3632 while ((j -= line_count) >= row) | |
3633 { | |
3634 LineOffset[j + line_count] = LineOffset[j]; | |
3635 LineWraps[j + line_count] = LineWraps[j]; | |
3636 } | |
3637 LineOffset[j + line_count] = temp; | |
3638 LineWraps[j + line_count] = FALSE; | |
3639 if (can_clear((char_u *)" ")) | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3640 lineclear(temp, (int)Columns, clear_attr); |
7 | 3641 else |
3642 lineinvalid(temp, (int)Columns); | |
3643 } | |
3644 } | |
3645 | |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3646 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3647 vim_unlock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3648 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3649 |
7 | 3650 screen_stop_highlight(); |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3651 windgoto(cursor_row, cursor_col); |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3652 if (clear_attr != 0) |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3653 screen_start_highlight(clear_attr); |
7 | 3654 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3655 // redraw the characters |
7 | 3656 if (type == USE_REDRAW) |
3657 redraw_block(row, end, wp); | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3658 else if (type == USE_T_CAL) |
7 | 3659 { |
3660 term_append_lines(line_count); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3661 screen_start(); // don't know where cursor is now |
7 | 3662 } |
3663 else | |
3664 { | |
3665 for (i = 0; i < line_count; i++) | |
3666 { | |
3667 if (type == USE_T_AL) | |
3668 { | |
3669 if (i && cursor_row != 0) | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3670 windgoto(cursor_row, cursor_col); |
7 | 3671 out_str(T_AL); |
3672 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3673 else // type == USE_T_SR |
7 | 3674 out_str(T_SR); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3675 screen_start(); // don't know where cursor is now |
7 | 3676 } |
3677 } | |
3678 | |
3679 /* | |
3680 * With scroll-reverse and 'da' flag set we need to clear the lines that | |
3681 * have been scrolled down into the region. | |
3682 */ | |
3683 if (type == USE_T_SR && *T_DA) | |
3684 { | |
3685 for (i = 0; i < line_count; ++i) | |
3686 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3687 windgoto(off + i, cursor_col); |
7 | 3688 out_str(T_CE); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3689 screen_start(); // don't know where cursor is now |
7 | 3690 } |
3691 } | |
3692 | |
3693 #ifdef FEAT_GUI | |
3694 gui_can_update_cursor(); | |
3695 if (gui.in_use) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3696 out_flush(); // always flush after a scroll |
7 | 3697 #endif |
3698 return OK; | |
3699 } | |
3700 | |
3701 /* | |
9848
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3702 * Delete lines on the screen and update ScreenLines[]. |
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3703 * "end" is the line after the scrolled part. Normally it is Rows. |
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3704 * When scrolling region used "off" is the offset from the top for the region. |
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3705 * "row" and "end" are relative to the start of the region. |
7 | 3706 * |
3707 * Return OK for success, FAIL if the lines are not deleted. | |
3708 */ | |
3709 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3710 screen_del_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3711 int off, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3712 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3713 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3714 int end, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3715 int force, // even when line_count > p_ttyscroll |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3716 int clear_attr, // used for clearing lines |
28295
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3717 win_T *wp) // NULL or window to use width from |
7 | 3718 { |
3719 int j; | |
3720 int i; | |
3721 unsigned temp; | |
3722 int cursor_row; | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3723 int cursor_col = 0; |
7 | 3724 int cursor_end; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3725 int result_empty; // result is empty until end of region |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3726 int can_delete; // deleting line codes can be used |
7 | 3727 int type; |
3728 | |
3729 /* | |
3730 * FAIL if | |
3731 * - there is no valid screen | |
3732 * - the screen has to be redrawn completely | |
3733 * - the line count is less than one | |
3734 * - the line count is more than 'ttyscroll' | |
28275
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3735 * - "end" is more than "Rows" (safety check, should not happen) |
11698
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3736 * - redrawing for a callback and there is a modeless selection |
7 | 3737 */ |
28275
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3738 if (!screen_valid(TRUE) |
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3739 || line_count <= 0 |
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3740 || (!force && line_count > p_ttyscroll) |
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3741 || end > Rows |
11698
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3742 #ifdef FEAT_CLIPBOARD |
28275
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3743 || (clip_star.state != SELECT_CLEARED && redrawing_for_callback > 0) |
11698
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3744 #endif |
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3745 ) |
7 | 3746 return FAIL; |
3747 | |
3748 /* | |
3749 * Check if the rest of the current region will become empty. | |
3750 */ | |
3751 result_empty = row + line_count >= end; | |
3752 | |
3753 /* | |
3754 * We can delete lines only when 'db' flag not set or when 'ce' option | |
3755 * available. | |
3756 */ | |
3757 can_delete = (*T_DB == NUL || can_clear(T_CE)); | |
3758 | |
3759 /* | |
3760 * There are six ways to delete lines: | |
3761 * 0. When in a vertically split window and t_CV isn't set, redraw the | |
3762 * characters from ScreenLines[]. | |
3763 * 1. Use T_CD if it exists and the result is empty. | |
3764 * 2. Use newlines if row == 0 and count == 1 or T_CDL does not exist. | |
3765 * 3. Use T_CDL (delete multiple lines) if it exists and line_count > 1 or | |
3766 * none of the other ways work. | |
3767 * 4. Use T_CE (erase line) if the result is empty. | |
3768 * 5. Use T_DL (delete line) if it exists. | |
3769 * 6. redraw the characters from ScreenLines[]. | |
3770 */ | |
3771 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL) | |
28295
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3772 { |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3773 // Avoid that lines are first cleared here and then redrawn, which |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3774 // results in many characters updated twice. This happens with CTRL-F |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3775 // in a vertically split window. With line-by-line scrolling |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3776 // USE_REDRAW should be faster. |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3777 if (line_count > 3) |
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3778 return FAIL; |
7 | 3779 type = USE_REDRAW; |
28295
8f92524d4556
patch 8.2.4673: redrawing a split window is slow when using CTRL-F and CTRL-B
Bram Moolenaar <Bram@vim.org>
parents:
28275
diff
changeset
|
3780 } |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3781 else if (can_clear(T_CD) && result_empty) |
7 | 3782 type = USE_T_CD; |
3783 else if (row == 0 && ( | |
3784 #ifndef AMIGA | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3785 // On the Amiga, somehow '\n' on the last line doesn't always scroll |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3786 // up, so use delete-line command |
7 | 3787 line_count == 1 || |
3788 #endif | |
3789 *T_CDL == NUL)) | |
3790 type = USE_NL; | |
3791 else if (*T_CDL != NUL && line_count > 1 && can_delete) | |
3792 type = USE_T_CDL; | |
3793 else if (can_clear(T_CE) && result_empty | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3794 && (wp == NULL || wp->w_width == Columns)) |
7 | 3795 type = USE_T_CE; |
3796 else if (*T_DL != NUL && can_delete) | |
3797 type = USE_T_DL; | |
3798 else if (*T_CDL != NUL && can_delete) | |
3799 type = USE_T_CDL; | |
3800 else | |
3801 return FAIL; | |
3802 | |
3803 #ifdef FEAT_CLIPBOARD | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3804 // Remove a modeless selection when deleting lines halfway the screen or |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3805 // not the full width of the screen. |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3806 if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) |
3674 | 3807 clip_clear_selection(&clip_star); |
7 | 3808 else |
3809 clip_scroll_selection(line_count); | |
3810 #endif | |
3811 | |
20154
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
3812 #ifdef FEAT_GUI_HAIKU |
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
3813 vim_lock_screen(); |
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
3814 #endif |
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
3815 |
7 | 3816 #ifdef FEAT_GUI |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3817 // Don't update the GUI cursor here, ScreenLines[] is invalid until the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3818 // scrolling is actually carried out. |
9848
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3819 gui_dont_update_cursor(gui.cursor_row >= row + off |
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3820 && gui.cursor_row < end + off); |
7 | 3821 #endif |
3822 | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3823 if (wp != NULL && wp->w_wincol != 0 && *T_CSV != NUL && *T_CCS == NUL) |
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3824 cursor_col = wp->w_wincol; |
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3825 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3826 if (*T_CCS != NUL) // cursor relative to region |
7 | 3827 { |
3828 cursor_row = row; | |
3829 cursor_end = end; | |
3830 } | |
3831 else | |
3832 { | |
3833 cursor_row = row + off; | |
3834 cursor_end = end + off; | |
3835 } | |
3836 | |
3837 /* | |
3838 * Now shift LineOffset[] line_count up to reflect the deleted lines. | |
3839 * Clear the inserted lines in ScreenLines[]. | |
3840 */ | |
3841 row += off; | |
3842 end += off; | |
3843 for (i = 0; i < line_count; ++i) | |
3844 { | |
3845 if (wp != NULL && wp->w_width != Columns) | |
3846 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3847 // need to copy part of a line |
7 | 3848 j = row + i; |
3849 while ((j += line_count) <= end - 1) | |
3850 linecopy(j - line_count, j, wp); | |
3851 j -= line_count; | |
3852 if (can_clear((char_u *)" ")) | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3853 lineclear(LineOffset[j] + wp->w_wincol, wp->w_width, |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3854 clear_attr); |
7 | 3855 else |
3856 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); | |
3857 LineWraps[j] = FALSE; | |
3858 } | |
3859 else | |
3860 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3861 // whole width, moving the line pointers is faster |
7 | 3862 j = row + i; |
3863 temp = LineOffset[j]; | |
3864 while ((j += line_count) <= end - 1) | |
3865 { | |
3866 LineOffset[j - line_count] = LineOffset[j]; | |
3867 LineWraps[j - line_count] = LineWraps[j]; | |
3868 } | |
3869 LineOffset[j - line_count] = temp; | |
3870 LineWraps[j - line_count] = FALSE; | |
3871 if (can_clear((char_u *)" ")) | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3872 lineclear(temp, (int)Columns, clear_attr); |
7 | 3873 else |
3874 lineinvalid(temp, (int)Columns); | |
3875 } | |
3876 } | |
3877 | |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3878 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3879 vim_unlock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3880 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3881 |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3882 if (screen_attr != clear_attr) |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3883 screen_stop_highlight(); |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3884 if (clear_attr != 0) |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3885 screen_start_highlight(clear_attr); |
7 | 3886 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3887 // redraw the characters |
7 | 3888 if (type == USE_REDRAW) |
3889 redraw_block(row, end, wp); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3890 else if (type == USE_T_CD) // delete the lines |
7 | 3891 { |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3892 windgoto(cursor_row, cursor_col); |
7 | 3893 out_str(T_CD); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3894 screen_start(); // don't know where cursor is now |
7 | 3895 } |
3896 else if (type == USE_T_CDL) | |
3897 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3898 windgoto(cursor_row, cursor_col); |
7 | 3899 term_delete_lines(line_count); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3900 screen_start(); // don't know where cursor is now |
7 | 3901 } |
3902 /* | |
3903 * Deleting lines at top of the screen or scroll region: Just scroll | |
3904 * the whole screen (scroll region) up by outputting newlines on the | |
3905 * last line. | |
3906 */ | |
3907 else if (type == USE_NL) | |
3908 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3909 windgoto(cursor_end - 1, cursor_col); |
7 | 3910 for (i = line_count; --i >= 0; ) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3911 out_char('\n'); // cursor will remain on same line |
7 | 3912 } |
3913 else | |
3914 { | |
3915 for (i = line_count; --i >= 0; ) | |
3916 { | |
3917 if (type == USE_T_DL) | |
3918 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3919 windgoto(cursor_row, cursor_col); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3920 out_str(T_DL); // delete a line |
7 | 3921 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3922 else // type == USE_T_CE |
7 | 3923 { |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3924 windgoto(cursor_row + i, cursor_col); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3925 out_str(T_CE); // erase a line |
7 | 3926 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3927 screen_start(); // don't know where cursor is now |
7 | 3928 } |
3929 } | |
3930 | |
3931 /* | |
3932 * If the 'db' flag is set, we need to clear the lines that have been | |
3933 * scrolled up at the bottom of the region. | |
3934 */ | |
3935 if (*T_DB && (type == USE_T_DL || type == USE_T_CDL)) | |
3936 { | |
3937 for (i = line_count; i > 0; --i) | |
3938 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3939 windgoto(cursor_end - i, cursor_col); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3940 out_str(T_CE); // erase a line |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3941 screen_start(); // don't know where cursor is now |
7 | 3942 } |
3943 } | |
3944 | |
3945 #ifdef FEAT_GUI | |
3946 gui_can_update_cursor(); | |
3947 if (gui.in_use) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3948 out_flush(); // always flush after a scroll |
7 | 3949 #endif |
3950 | |
3951 return OK; | |
3952 } | |
3953 | |
3954 /* | |
15629
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3955 * Return TRUE when postponing displaying the mode message: when not redrawing |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3956 * or inside a mapping. |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3957 */ |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3958 int |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3959 skip_showmode() |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3960 { |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3961 // Call char_avail() only when we are going to show something, because it |
29308
b1304512c036
patch 8.2.5170: tiny issues
Bram Moolenaar <Bram@vim.org>
parents:
29251
diff
changeset
|
3962 // takes a bit of time. redrawing() may also call char_avail(). |
15629
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3963 if (global_busy |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3964 || msg_silent != 0 |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3965 || !redrawing() |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3966 || (char_avail() && !KeyTyped)) |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3967 { |
16374
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
3968 redraw_mode = TRUE; // show mode later |
15629
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3969 return TRUE; |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3970 } |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3971 return FALSE; |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3972 } |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3973 |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3974 /* |
13308
ae312df8d0ab
patch 8.0.1528: dead code found
Christian Brabandt <cb@256bit.org>
parents:
13292
diff
changeset
|
3975 * Show the current mode and ruler. |
7 | 3976 * |
3977 * If clear_cmdline is TRUE, clear the rest of the cmdline. | |
3978 * If clear_cmdline is FALSE there may be a message there that needs to be | |
3979 * cleared only if a mode is shown. | |
16374
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
3980 * If redraw_mode is TRUE show or clear the mode. |
7 | 3981 * Return the length of the message (0 if no message). |
3982 */ | |
3983 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3984 showmode(void) |
7 | 3985 { |
3986 int need_clear; | |
3987 int length = 0; | |
3988 int do_mode; | |
3989 int attr; | |
3990 int nwr_save; | |
3991 int sub_attr; | |
3992 | |
30005
bb0e525e1393
patch 9.0.0340: the 'cmdheight' zero support causes too much trouble
Bram Moolenaar <Bram@vim.org>
parents:
29958
diff
changeset
|
3993 do_mode = p_smd && msg_silent == 0 |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
3994 && ((State & MODE_INSERT) |
14093
a9d94f10ecef
patch 8.1.0064: typing CTRL-W in a prompt buffer shows mode "-- --"
Christian Brabandt <cb@256bit.org>
parents:
14089
diff
changeset
|
3995 || restart_edit != NUL |
29900
a6721cafbc74
patch 9.0.0288: when 'cmdheight' is zero some messages are not displayed
Bram Moolenaar <Bram@vim.org>
parents:
29881
diff
changeset
|
3996 || VIsual_active); |
14004
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13968
diff
changeset
|
3997 if (do_mode || reg_recording != 0) |
7 | 3998 { |
15629
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
3999 if (skip_showmode()) |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4000 return 0; // show mode later |
7 | 4001 |
4002 nwr_save = need_wait_return; | |
4003 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4004 // wait a bit before overwriting an important message |
7 | 4005 check_for_delay(FALSE); |
4006 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4007 // if the cmdline is more than one line high, erase top lines |
7 | 4008 need_clear = clear_cmdline; |
4009 if (clear_cmdline && cmdline_row < Rows - 1) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4010 msg_clr_cmdline(); // will reset clear_cmdline |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4011 |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4012 // Position on the last line in the window, column 0 |
7 | 4013 msg_pos_mode(); |
4014 cursor_off(); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4015 attr = HL_ATTR(HLF_CM); // Highlight mode |
7 | 4016 if (do_mode) |
4017 { | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4018 msg_puts_attr("--", attr); |
7 | 4019 #if defined(FEAT_XIM) |
2520 | 4020 if ( |
4021 # ifdef FEAT_GUI_GTK | |
4022 preedit_get_status() | |
1668 | 4023 # else |
4024 im_get_status() | |
2520 | 4025 # endif |
1668 | 4026 ) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4027 # ifdef FEAT_GUI_GTK // most of the time, it's not XIM being used |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4028 msg_puts_attr(" IM", attr); |
7 | 4029 # else |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4030 msg_puts_attr(" XIM", attr); |
7 | 4031 # endif |
4032 #endif | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4033 // CTRL-X in Insert mode |
5946 | 4034 if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) |
7 | 4035 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4036 // These messages can get long, avoid a wrap in a narrow |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4037 // window. Prefer showing edit_submode_extra. |
7 | 4038 length = (Rows - msg_row) * Columns - 3; |
4039 if (edit_submode_extra != NULL) | |
4040 length -= vim_strsize(edit_submode_extra); | |
4041 if (length > 0) | |
4042 { | |
4043 if (edit_submode_pre != NULL) | |
4044 length -= vim_strsize(edit_submode_pre); | |
4045 if (length - vim_strsize(edit_submode) > 0) | |
4046 { | |
4047 if (edit_submode_pre != NULL) | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4048 msg_puts_attr((char *)edit_submode_pre, attr); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4049 msg_puts_attr((char *)edit_submode, attr); |
7 | 4050 } |
4051 if (edit_submode_extra != NULL) | |
4052 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4053 msg_puts_attr(" ", attr); // add a space in between |
7 | 4054 if ((int)edit_submode_highl < (int)HLF_COUNT) |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4055 sub_attr = HL_ATTR(edit_submode_highl); |
7 | 4056 else |
4057 sub_attr = attr; | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4058 msg_puts_attr((char *)edit_submode_extra, sub_attr); |
7 | 4059 } |
4060 } | |
4061 } | |
4062 else | |
4063 { | |
4064 if (State & VREPLACE_FLAG) | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4065 msg_puts_attr(_(" VREPLACE"), attr); |
14424
0a69e6e708f9
patch 8.1.0226: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
14218
diff
changeset
|
4066 else if (State & REPLACE_FLAG) |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4067 msg_puts_attr(_(" REPLACE"), attr); |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
4068 else if (State & MODE_INSERT) |
7 | 4069 { |
4070 #ifdef FEAT_RIGHTLEFT | |
4071 if (p_ri) | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4072 msg_puts_attr(_(" REVERSE"), attr); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4073 #endif |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4074 msg_puts_attr(_(" INSERT"), attr); |
7 | 4075 } |
22862
6d50182e7e24
patch 8.2.1978: making a mapping work in all modes is complicated
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4076 else if (restart_edit == 'I' || restart_edit == 'i' || |
6d50182e7e24
patch 8.2.1978: making a mapping work in all modes is complicated
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4077 restart_edit == 'a' || restart_edit == 'A') |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4078 msg_puts_attr(_(" (insert)"), attr); |
7 | 4079 else if (restart_edit == 'R') |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4080 msg_puts_attr(_(" (replace)"), attr); |
7 | 4081 else if (restart_edit == 'V') |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4082 msg_puts_attr(_(" (vreplace)"), attr); |
7 | 4083 #ifdef FEAT_RIGHTLEFT |
4084 if (p_hkmap) | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4085 msg_puts_attr(_(" Hebrew"), attr); |
7 | 4086 #endif |
4087 #ifdef FEAT_KEYMAP | |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
4088 if (State & MODE_LANGMAP) |
7 | 4089 { |
4090 # ifdef FEAT_ARABIC | |
4091 if (curwin->w_p_arab) | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4092 msg_puts_attr(_(" Arabic"), attr); |
7 | 4093 else |
4094 # endif | |
9645
123d3c102035
commit https://github.com/vim/vim/commit/73ac0c4281a3606651604a3cbcc334bfb3859a87
Christian Brabandt <cb@256bit.org>
parents:
9489
diff
changeset
|
4095 if (get_keymap_str(curwin, (char_u *)" (%s)", |
123d3c102035
commit https://github.com/vim/vim/commit/73ac0c4281a3606651604a3cbcc334bfb3859a87
Christian Brabandt <cb@256bit.org>
parents:
9489
diff
changeset
|
4096 NameBuff, MAXPATHL)) |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4097 msg_puts_attr((char *)NameBuff, attr); |
7 | 4098 } |
4099 #endif | |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
4100 if ((State & MODE_INSERT) && p_paste) |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4101 msg_puts_attr(_(" (paste)"), attr); |
7 | 4102 |
4103 if (VIsual_active) | |
4104 { | |
4105 char *p; | |
4106 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4107 // Don't concatenate separate words to avoid translation |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4108 // problems. |
7 | 4109 switch ((VIsual_select ? 4 : 0) |
4110 + (VIsual_mode == Ctrl_V) * 2 | |
4111 + (VIsual_mode == 'V')) | |
4112 { | |
4113 case 0: p = N_(" VISUAL"); break; | |
4114 case 1: p = N_(" VISUAL LINE"); break; | |
4115 case 2: p = N_(" VISUAL BLOCK"); break; | |
4116 case 4: p = N_(" SELECT"); break; | |
4117 case 5: p = N_(" SELECT LINE"); break; | |
4118 default: p = N_(" SELECT BLOCK"); break; | |
4119 } | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4120 msg_puts_attr(_(p), attr); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4121 } |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4122 msg_puts_attr(" --", attr); |
7 | 4123 } |
644 | 4124 |
7 | 4125 need_clear = TRUE; |
4126 } | |
14004
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13968
diff
changeset
|
4127 if (reg_recording != 0 |
17809
59f8948b7590
patch 8.1.1901: the +insert_expand feature is not always available
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
4128 && edit_submode == NULL) // otherwise it gets too long |
7 | 4129 { |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4130 recording_mode(attr); |
7 | 4131 need_clear = TRUE; |
4132 } | |
644 | 4133 |
4134 mode_displayed = TRUE; | |
16374
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
4135 if (need_clear || clear_cmdline || redraw_mode) |
7 | 4136 msg_clr_eos(); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4137 msg_didout = FALSE; // overwrite this message |
7 | 4138 length = msg_col; |
4139 msg_col = 0; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4140 need_wait_return = nwr_save; // never ask for hit-return for this |
7 | 4141 } |
4142 else if (clear_cmdline && msg_silent == 0) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4143 // Clear the whole command line. Will reset "clear_cmdline". |
7 | 4144 msg_clr_cmdline(); |
16374
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
4145 else if (redraw_mode) |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
4146 { |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
4147 msg_pos_mode(); |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
4148 msg_clr_eos(); |
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
4149 } |
7 | 4150 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4151 // In Visual mode the size of the selected area must be redrawn. |
7 | 4152 if (VIsual_active) |
4153 clear_showcmd(); | |
4154 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4155 // If the last window has no status line, the ruler is after the mode |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4156 // message and must be redrawn |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
4157 if (redrawing() && lastwin->w_status_height == 0) |
14089
ae53a9274f50
patch 8.1.0062: popup menu broken if a callback changes the window layout
Christian Brabandt <cb@256bit.org>
parents:
14081
diff
changeset
|
4158 win_redr_ruler(lastwin, TRUE, FALSE); |
30825
c7983f593fa7
patch 9.0.0747: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
30771
diff
changeset
|
4159 |
7 | 4160 redraw_cmdline = FALSE; |
16374
57c37c17ff9d
patch 8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Bram Moolenaar <Bram@vim.org>
parents:
16320
diff
changeset
|
4161 redraw_mode = FALSE; |
7 | 4162 clear_cmdline = FALSE; |
4163 | |
4164 return length; | |
4165 } | |
4166 | |
4167 /* | |
4168 * Position for a mode message. | |
4169 */ | |
4170 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4171 msg_pos_mode(void) |
7 | 4172 { |
4173 msg_col = 0; | |
4174 msg_row = Rows - 1; | |
4175 } | |
4176 | |
4177 /* | |
4178 * Delete mode message. Used when ESC is typed which is expected to end | |
4179 * Insert mode (but Insert mode didn't end yet!). | |
644 | 4180 * Caller should check "mode_displayed". |
7 | 4181 */ |
4182 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4183 unshowmode(int force) |
7 | 4184 { |
4185 /* | |
2055
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
4186 * Don't delete it right now, when not redrawing or inside a mapping. |
7 | 4187 */ |
4188 if (!redrawing() || (!force && char_avail() && !KeyTyped)) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4189 redraw_cmdline = TRUE; // delete mode later |
7 | 4190 else |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4191 clearmode(); |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4192 } |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4193 |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4194 /* |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4195 * Clear the mode message. |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4196 */ |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4197 void |
9282
9f97a6290c63
commit https://github.com/vim/vim/commit/cf089463492fab53b2a5d81517829d22f882f82e
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
4198 clearmode(void) |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4199 { |
13968
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4200 int save_msg_row = msg_row; |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4201 int save_msg_col = msg_col; |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4202 |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4203 msg_pos_mode(); |
14004
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13968
diff
changeset
|
4204 if (reg_recording != 0) |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4205 recording_mode(HL_ATTR(HLF_CM)); |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4206 msg_clr_eos(); |
13968
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4207 |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4208 msg_col = save_msg_col; |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4209 msg_row = save_msg_row; |
7 | 4210 } |
4211 | |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4212 static void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4213 recording_mode(int attr) |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4214 { |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4215 msg_puts_attr(_("recording"), attr); |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4216 if (!shortmess(SHM_RECORDING)) |
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4217 { |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4218 char s[4]; |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4219 |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4220 sprintf(s, " @%c", reg_recording); |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4221 msg_puts_attr(s, attr); |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4222 } |
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4223 } |
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4224 |
667 | 4225 /* |
4226 * Draw the tab pages line at the top of the Vim window. | |
4227 */ | |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
15384
diff
changeset
|
4228 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4229 draw_tabline(void) |
667 | 4230 { |
4231 int tabcount = 0; | |
4232 tabpage_T *tp; | |
4233 int tabwidth; | |
4234 int col = 0; | |
673 | 4235 int scol = 0; |
667 | 4236 int attr; |
4237 win_T *wp; | |
671 | 4238 win_T *cwp; |
4239 int wincount; | |
4240 int modified; | |
667 | 4241 int c; |
4242 int len; | |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4243 int attr_sel = HL_ATTR(HLF_TPS); |
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4244 int attr_nosel = HL_ATTR(HLF_TP); |
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4245 int attr_fill = HL_ATTR(HLF_TPF); |
673 | 4246 char_u *p; |
677 | 4247 int room; |
4248 int use_sep_chars = (t_colors < 8 | |
4249 #ifdef FEAT_GUI | |
4250 && !gui.in_use | |
4251 #endif | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
4252 #ifdef FEAT_TERMGUICOLORS |
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
4253 && !p_tgc |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
4254 #endif |
677 | 4255 ); |
673 | 4256 |
10538
c7f671dfd735
patch 8.0.0159: crash on startup when updating tabline
Christian Brabandt <cb@256bit.org>
parents:
10466
diff
changeset
|
4257 if (ScreenLines == NULL) |
c7f671dfd735
patch 8.0.0159: crash on startup when updating tabline
Christian Brabandt <cb@256bit.org>
parents:
10466
diff
changeset
|
4258 return; |
673 | 4259 redraw_tabline = FALSE; |
667 | 4260 |
685 | 4261 #ifdef FEAT_GUI_TABLINE |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4262 // Take care of a GUI tabline. |
685 | 4263 if (gui_use_tabline()) |
4264 { | |
4265 gui_update_tabline(); | |
4266 return; | |
4267 } | |
4268 #endif | |
4269 | |
4270 if (tabline_height() < 1) | |
667 | 4271 return; |
4272 | |
677 | 4273 #if defined(FEAT_STL_OPT) |
16320
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
4274 clear_TabPageIdxs(); |
681 | 4275 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4276 // Use the 'tabline' option if it's set. |
677 | 4277 if (*p_tal != NUL) |
4278 win_redr_custom(NULL, FALSE); | |
680 | 4279 else |
4280 #endif | |
4281 { | |
9649
fd9727ae3c49
commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents:
9645
diff
changeset
|
4282 FOR_ALL_TABPAGES(tp) |
680 | 4283 ++tabcount; |
4284 | |
4285 tabwidth = (Columns - 1 + tabcount / 2) / tabcount; | |
4286 if (tabwidth < 6) | |
4287 tabwidth = 6; | |
4288 | |
4289 attr = attr_nosel; | |
4290 tabcount = 0; | |
699 | 4291 for (tp = first_tabpage; tp != NULL && col < Columns - 4; |
4292 tp = tp->tp_next) | |
680 | 4293 { |
4294 scol = col; | |
4295 | |
4296 if (tp->tp_topframe == topframe) | |
4297 attr = attr_sel; | |
4298 if (use_sep_chars && col > 0) | |
4299 screen_putchar('|', 0, col++, attr); | |
4300 | |
4301 if (tp->tp_topframe != topframe) | |
4302 attr = attr_nosel; | |
4303 | |
4304 screen_putchar(' ', 0, col++, attr); | |
4305 | |
4306 if (tp == curtab) | |
4307 { | |
4308 cwp = curwin; | |
4309 wp = firstwin; | |
4310 } | |
4311 else | |
4312 { | |
4313 cwp = tp->tp_curwin; | |
4314 wp = tp->tp_firstwin; | |
4315 } | |
4316 | |
4317 modified = FALSE; | |
4318 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount) | |
4319 if (bufIsChanged(wp->w_buffer)) | |
4320 modified = TRUE; | |
4321 if (modified || wincount > 1) | |
4322 { | |
4323 if (wincount > 1) | |
4324 { | |
4325 vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount); | |
835 | 4326 len = (int)STRLEN(NameBuff); |
699 | 4327 if (col + len >= Columns - 3) |
4328 break; | |
680 | 4329 screen_puts_len(NameBuff, len, 0, col, |
677 | 4330 #if defined(FEAT_SYN_HL) |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4331 hl_combine_attr(attr, HL_ATTR(HLF_T)) |
677 | 4332 #else |
6106 | 4333 attr |
680 | 4334 #endif |
4335 ); | |
4336 col += len; | |
4337 } | |
4338 if (modified) | |
4339 screen_puts_len((char_u *)"+", 1, 0, col++, attr); | |
4340 screen_putchar(' ', 0, col++, attr); | |
4341 } | |
4342 | |
4343 room = scol - col + tabwidth - 1; | |
4344 if (room > 0) | |
4345 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4346 // Get buffer name in NameBuff[] |
685 | 4347 get_trans_bufname(cwp->w_buffer); |
819 | 4348 shorten_dir(NameBuff); |
680 | 4349 len = vim_strsize(NameBuff); |
4350 p = NameBuff; | |
4351 if (has_mbyte) | |
4352 while (len > room) | |
4353 { | |
4354 len -= ptr2cells(p); | |
11127
506f5d8b7d8b
patch 8.0.0451: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11121
diff
changeset
|
4355 MB_PTR_ADV(p); |
680 | 4356 } |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
4357 else if (len > room) |
677 | 4358 { |
680 | 4359 p += len - room; |
4360 len = room; | |
677 | 4361 } |
699 | 4362 if (len > Columns - col - 1) |
4363 len = Columns - col - 1; | |
680 | 4364 |
835 | 4365 screen_puts_len(p, (int)STRLEN(p), 0, col, attr); |
680 | 4366 col += len; |
4367 } | |
4368 screen_putchar(' ', 0, col++, attr); | |
4369 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4370 // Store the tab page number in TabPageIdxs[], so that |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4371 // jump_to_mouse() knows where each one is. |
680 | 4372 ++tabcount; |
4373 while (scol < col) | |
4374 TabPageIdxs[scol++] = tabcount; | |
4375 } | |
4376 | |
4377 if (use_sep_chars) | |
4378 c = '_'; | |
4379 else | |
4380 c = ' '; | |
4381 screen_fill(0, 1, col, (int)Columns, c, c, attr_fill); | |
681 | 4382 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4383 // Put an "X" for closing the current tab if there are several. |
681 | 4384 if (first_tabpage->tp_next != NULL) |
4385 { | |
4386 screen_putchar('X', 0, (int)Columns - 1, attr_nosel); | |
4387 TabPageIdxs[Columns - 1] = -999; | |
4388 } | |
4389 } | |
834 | 4390 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4391 // Reset the flag here again, in case evaluating 'tabline' causes it to be |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4392 // set. |
834 | 4393 redraw_tabline = FALSE; |
667 | 4394 } |
685 | 4395 |
4396 /* | |
4397 * Get buffer name for "buf" into NameBuff[]. | |
4398 * Takes care of special buffer names and translates special characters. | |
4399 */ | |
4400 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4401 get_trans_bufname(buf_T *buf) |
685 | 4402 { |
4403 if (buf_spname(buf) != NULL) | |
3839 | 4404 vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1); |
685 | 4405 else |
4406 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE); | |
4407 trans_characters(NameBuff, MAXPATHL); | |
4408 } | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
4409 |
7 | 4410 /* |
4411 * Get the character to use in a status line. Get its attributes in "*attr". | |
4412 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
4413 int |
11890
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4414 fillchar_status(int *attr, win_T *wp) |
7 | 4415 { |
4416 int fill; | |
11890
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4417 |
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4418 #ifdef FEAT_TERMINAL |
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4419 if (bt_terminal(wp->w_buffer)) |
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4420 { |
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4421 if (wp == curwin) |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4422 { |
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4423 *attr = HL_ATTR(HLF_ST); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4424 fill = wp->w_fill_chars.stl; |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4425 } |
11890
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4426 else |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4427 { |
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4428 *attr = HL_ATTR(HLF_STNC); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4429 fill = wp->w_fill_chars.stlnc; |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4430 } |
11890
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4431 } |
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4432 else |
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4433 #endif |
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4434 if (wp == curwin) |
7 | 4435 { |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4436 *attr = HL_ATTR(HLF_S); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4437 fill = wp->w_fill_chars.stl; |
7 | 4438 } |
4439 else | |
4440 { | |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4441 *attr = HL_ATTR(HLF_SNC); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4442 fill = wp->w_fill_chars.stlnc; |
7 | 4443 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4444 // Use fill when there is highlighting, and highlighting of current |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4445 // window differs, or the fillchars differ, or this is not the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4446 // current window |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4447 if (*attr != 0 && ((HL_ATTR(HLF_S) != HL_ATTR(HLF_SNC) |
11890
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4448 || wp != curwin || ONE_WINDOW) |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4449 || (wp->w_fill_chars.stl != wp->w_fill_chars.stlnc))) |
7 | 4450 return fill; |
11890
318ae82d8ba4
patch 8.0.0825: not easy to see that a window is a terminal window
Christian Brabandt <cb@256bit.org>
parents:
11866
diff
changeset
|
4451 if (wp == curwin) |
7 | 4452 return '^'; |
4453 return '='; | |
4454 } | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
4455 |
7 | 4456 /* |
4457 * Get the character to use in a separator between vertically split windows. | |
4458 * Get its attributes in "*attr". | |
4459 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
4460 int |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4461 fillchar_vsep(int *attr, win_T *wp) |
7 | 4462 { |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4463 *attr = HL_ATTR(HLF_C); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4464 if (*attr == 0 && wp->w_fill_chars.vert == ' ') |
7 | 4465 return '|'; |
4466 else | |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4467 return wp->w_fill_chars.vert; |
7 | 4468 } |
4469 | |
4470 /* | |
4471 * Return TRUE if redrawing should currently be done. | |
4472 */ | |
4473 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4474 redrawing(void) |
7 | 4475 { |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4476 #ifdef FEAT_EVAL |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4477 if (disable_redraw_for_testing) |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4478 return 0; |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4479 else |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4480 #endif |
14673
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4481 return ((!RedrawingDisabled |
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4482 #ifdef FEAT_EVAL |
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4483 || ignore_redraw_flag_for_testing |
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4484 #endif |
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4485 ) && !(p_lz && char_avail() && !KeyTyped && !do_redraw)); |
7 | 4486 } |
4487 | |
4488 /* | |
4489 * Return TRUE if printing messages should currently be done. | |
4490 */ | |
4491 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4492 messaging(void) |
7 | 4493 { |
30005
bb0e525e1393
patch 9.0.0340: the 'cmdheight' zero support causes too much trouble
Bram Moolenaar <Bram@vim.org>
parents:
29958
diff
changeset
|
4494 return (!(p_lz && char_avail() && !KeyTyped)); |
7 | 4495 } |
4496 | |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4497 /* |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4498 * Compute columns for ruler and shown command. 'sc_col' is also used to |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4499 * decide what the maximum length of a message on the status line can be. |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4500 * If there is a status line for the last window, 'sc_col' is independent |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4501 * of 'ru_col'. |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4502 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4503 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4504 #define COL_RULER 17 // columns needed by standard ruler |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4505 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4506 void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4507 comp_col(void) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4508 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4509 int last_has_status = (p_ls == 2 || (p_ls == 1 && !ONE_WINDOW)); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4510 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4511 sc_col = 0; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4512 ru_col = 0; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4513 if (p_ru) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4514 { |
30825
c7983f593fa7
patch 9.0.0747: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
30771
diff
changeset
|
4515 #ifdef FEAT_STL_OPT |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4516 ru_col = (ru_wid ? ru_wid : COL_RULER) + 1; |
30825
c7983f593fa7
patch 9.0.0747: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
30771
diff
changeset
|
4517 #else |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4518 ru_col = COL_RULER + 1; |
30825
c7983f593fa7
patch 9.0.0747: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
30771
diff
changeset
|
4519 #endif |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4520 // no last status line, adjust sc_col |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4521 if (!last_has_status) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4522 sc_col = ru_col; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4523 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4524 if (p_sc) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4525 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4526 sc_col += SHOWCMD_COLS; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4527 if (!p_ru || last_has_status) // no need for separating space |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4528 ++sc_col; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4529 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4530 sc_col = Columns - sc_col; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4531 ru_col = Columns - ru_col; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4532 if (sc_col <= 0) // screen too narrow, will become a mess |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4533 sc_col = 1; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4534 if (ru_col <= 0) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4535 ru_col = 1; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4536 #ifdef FEAT_EVAL |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4537 set_vim_var_nr(VV_ECHOSPACE, sc_col - 1); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4538 #endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4539 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4540 |
13 | 4541 #if defined(FEAT_LINEBREAK) || defined(PROTO) |
4542 /* | |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2124
diff
changeset
|
4543 * Return the width of the 'number' and 'relativenumber' column. |
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2124
diff
changeset
|
4544 * Caller may need to check if 'number' or 'relativenumber' is set. |
13 | 4545 * Otherwise it depends on 'numberwidth' and the line count. |
4546 */ | |
4547 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4548 number_width(win_T *wp) |
13 | 4549 { |
4550 int n; | |
4551 linenr_T lnum; | |
4552 | |
4736
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4553 if (wp->w_p_rnu && !wp->w_p_nu) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4554 // cursor line shows "0" |
4736
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4555 lnum = wp->w_height; |
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4556 else |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4557 // cursor line shows absolute line number |
4736
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4558 lnum = wp->w_buffer->b_ml.ml_line_count; |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2124
diff
changeset
|
4559 |
6679 | 4560 if (lnum == wp->w_nrwidth_line_count && wp->w_nuw_cached == wp->w_p_nuw) |
13 | 4561 return wp->w_nrwidth_width; |
4562 wp->w_nrwidth_line_count = lnum; | |
4563 | |
4564 n = 0; | |
4565 do | |
4566 { | |
856 | 4567 lnum /= 10; |
4568 ++n; | |
13 | 4569 } while (lnum > 0); |
4570 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4571 // 'numberwidth' gives the minimal width plus one |
13 | 4572 if (n < wp->w_p_nuw - 1) |
4573 n = wp->w_p_nuw - 1; | |
4574 | |
17247
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4575 # ifdef FEAT_SIGNS |
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4576 // If 'signcolumn' is set to 'number' and there is a sign to display, then |
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4577 // the minimal width for the number column is 2. |
18603
f249b44039e0
patch 8.1.2295: if buffer of popup is in another window cursorline sign shows
Bram Moolenaar <Bram@vim.org>
parents:
18124
diff
changeset
|
4578 if (n < 2 && get_first_valid_sign(wp) != NULL |
17247
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4579 && (*wp->w_p_scl == 'n' && *(wp->w_p_scl + 1) == 'u')) |
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4580 n = 2; |
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4581 # endif |
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4582 |
13 | 4583 wp->w_nrwidth_width = n; |
6679 | 4584 wp->w_nuw_cached = wp->w_p_nuw; |
13 | 4585 return n; |
4586 } | |
4587 #endif | |
3986 | 4588 |
15555
d89c5b339c2a
patch 8.1.0785: depending on the configuration some functions are unused
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
4589 #if defined(FEAT_EVAL) || defined(PROTO) |
3986 | 4590 /* |
4591 * Return the current cursor column. This is the actual position on the | |
4592 * screen. First column is 0. | |
4593 */ | |
4594 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4595 screen_screencol(void) |
3986 | 4596 { |
4597 return screen_cur_col; | |
4598 } | |
4599 | |
4600 /* | |
4601 * Return the current cursor row. This is the actual position on the screen. | |
4602 * First row is 0. | |
4603 */ | |
4604 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4605 screen_screenrow(void) |
3986 | 4606 { |
4607 return screen_cur_row; | |
4608 } | |
15555
d89c5b339c2a
patch 8.1.0785: depending on the configuration some functions are unused
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
4609 #endif |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4610 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4611 /* |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4612 * Calls mb_ptr2char_adv(p) and returns the character. |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4613 * If "p" starts with "\x", "\u" or "\U" the hex or unicode value is used. |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4614 */ |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4615 static int |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4616 get_encoded_char_adv(char_u **p) |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4617 { |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4618 char_u *s = *p; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4619 |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4620 if (s[0] == '\\' && (s[1] == 'x' || s[1] == 'u' || s[1] == 'U')) |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4621 { |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4622 varnumber_T num = 0; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4623 int bytes; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4624 int n; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4625 |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4626 for (bytes = s[1] == 'x' ? 1 : s[1] == 'u' ? 2 : 4; bytes > 0; --bytes) |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4627 { |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4628 *p += 2; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4629 n = hexhex2nr(*p); |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4630 if (n < 0) |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4631 return 0; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4632 num = num * 256 + n; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4633 } |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4634 *p += 2; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4635 return num; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4636 } |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4637 return mb_ptr2char_adv(p); |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4638 } |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4639 |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4640 /* |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4641 * Handle setting 'listchars' or 'fillchars'. |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4642 * "varp" points to either the global or the window-local value. |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4643 * When "apply" is FALSE do not store the flags, only check for errors. |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4644 * Assume monocell characters. |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4645 * Returns error message, NULL if it's OK. |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4646 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4647 char * |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4648 set_chars_option(win_T *wp, char_u **varp, int apply) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4649 { |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4650 int round, i, len, len2, entries; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4651 char_u *p, *s; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4652 int c1 = 0, c2 = 0, c3 = 0; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4653 char_u *last_multispace = NULL; // Last occurrence of "multispace:" |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4654 char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:" |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4655 int multispace_len = 0; // Length of lcs-multispace string |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4656 int lead_multispace_len = 0; // Length of lcs-leadmultispace string |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4657 int is_listchars = (varp == &p_lcs || varp == &wp->w_p_lcs); |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4658 char_u *value = *varp; |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4659 |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4660 struct charstab |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4661 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4662 int *cp; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4663 char *name; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4664 }; |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4665 struct charstab *tab; |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4666 |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4667 static fill_chars_T fill_chars; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4668 static struct charstab filltab[] = |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4669 { |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4670 {&fill_chars.stl, "stl"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4671 {&fill_chars.stlnc, "stlnc"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4672 {&fill_chars.vert, "vert"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4673 {&fill_chars.fold, "fold"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4674 {&fill_chars.foldopen, "foldopen"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4675 {&fill_chars.foldclosed, "foldclose"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4676 {&fill_chars.foldsep, "foldsep"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4677 {&fill_chars.diff, "diff"}, |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4678 {&fill_chars.eob, "eob"}, |
30643
dfb02f9dcbe8
patch 9.0.0656: cannot specify another character to use instead of '@'
Bram Moolenaar <Bram@vim.org>
parents:
30608
diff
changeset
|
4679 {&fill_chars.lastline, "lastline"}, |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4680 }; |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4681 |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4682 static lcs_chars_T lcs_chars; |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4683 struct charstab lcstab[] = |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4684 { |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4685 {&lcs_chars.eol, "eol"}, |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4686 {&lcs_chars.ext, "extends"}, |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4687 {&lcs_chars.nbsp, "nbsp"}, |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4688 {&lcs_chars.prec, "precedes"}, |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4689 {&lcs_chars.space, "space"}, |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4690 {&lcs_chars.tab2, "tab"}, |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4691 {&lcs_chars.trail, "trail"}, |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4692 {&lcs_chars.lead, "lead"}, |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4693 #ifdef FEAT_CONCEAL |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4694 {&lcs_chars.conceal, "conceal"}, |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4695 #else |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4696 {NULL, "conceal"}, |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4697 #endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4698 }; |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4699 |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4700 if (is_listchars) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4701 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4702 tab = lcstab; |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4703 CLEAR_FIELD(lcs_chars); |
24768
7334bf933510
patch 8.2.2922: computing array length is done in various ways
Bram Moolenaar <Bram@vim.org>
parents:
24289
diff
changeset
|
4704 entries = ARRAY_LENGTH(lcstab); |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4705 if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL) |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4706 value = p_lcs; // local value is empty, us the global value |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4707 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4708 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4709 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4710 tab = filltab; |
24768
7334bf933510
patch 8.2.2922: computing array length is done in various ways
Bram Moolenaar <Bram@vim.org>
parents:
24289
diff
changeset
|
4711 entries = ARRAY_LENGTH(filltab); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4712 if (varp == &wp->w_p_fcs && wp->w_p_fcs[0] == NUL) |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4713 value = p_fcs; // local value is empty, us the global value |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4714 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4715 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4716 // first round: check for valid value, second round: assign values |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4717 for (round = 0; round <= 1; ++round) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4718 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4719 if (round > 0) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4720 { |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4721 // After checking that the value is valid: set defaults. |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4722 if (is_listchars) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4723 { |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4724 for (i = 0; i < entries; ++i) |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4725 if (tab[i].cp != NULL) |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4726 *(tab[i].cp) = NUL; |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4727 lcs_chars.tab1 = NUL; |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4728 lcs_chars.tab3 = NUL; |
29098
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
4729 |
25804
bf09d07f098e
patch 8.2.3437: compiler warnings for 32/64 bit usage
Bram Moolenaar <Bram@vim.org>
parents:
25780
diff
changeset
|
4730 if (multispace_len > 0) |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4731 { |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4732 lcs_chars.multispace = ALLOC_MULT(int, multispace_len + 1); |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4733 if (lcs_chars.multispace != NULL) |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4734 lcs_chars.multispace[multispace_len] = NUL; |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4735 } |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4736 else |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4737 lcs_chars.multispace = NULL; |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4738 |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4739 if (lead_multispace_len > 0) |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4740 { |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4741 lcs_chars.leadmultispace = |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4742 ALLOC_MULT(int, lead_multispace_len + 1); |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4743 lcs_chars.leadmultispace[lead_multispace_len] = NUL; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4744 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4745 else |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4746 lcs_chars.leadmultispace = NULL; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4747 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4748 else |
23932
4549133c1e77
patch 8.2.2508: cannot change the character displayed in non existing lines
Bram Moolenaar <Bram@vim.org>
parents:
23825
diff
changeset
|
4749 { |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4750 fill_chars.stl = ' '; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4751 fill_chars.stlnc = ' '; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4752 fill_chars.vert = ' '; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4753 fill_chars.fold = '-'; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4754 fill_chars.foldopen = '-'; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4755 fill_chars.foldclosed = '+'; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4756 fill_chars.foldsep = '|'; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4757 fill_chars.diff = '-'; |
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4758 fill_chars.eob = '~'; |
30643
dfb02f9dcbe8
patch 9.0.0656: cannot specify another character to use instead of '@'
Bram Moolenaar <Bram@vim.org>
parents:
30608
diff
changeset
|
4759 fill_chars.lastline = '@'; |
23932
4549133c1e77
patch 8.2.2508: cannot change the character displayed in non existing lines
Bram Moolenaar <Bram@vim.org>
parents:
23825
diff
changeset
|
4760 } |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4761 } |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4762 p = value; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4763 while (*p) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4764 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4765 for (i = 0; i < entries; ++i) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4766 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4767 len = (int)STRLEN(tab[i].name); |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4768 if (STRNCMP(p, tab[i].name, len) == 0 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4769 && p[len] == ':' |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4770 && p[len + 1] != NUL) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4771 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4772 c2 = c3 = 0; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4773 s = p + len + 1; |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4774 c1 = get_encoded_char_adv(&s); |
26634
c75f70257cf5
patch 8.2.3846: no error when using control character for 'lcs' or 'fcs'
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
4775 if (char2cells(c1) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4776 return e_invalid_argument; |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4777 if (tab[i].cp == &lcs_chars.tab2) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4778 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4779 if (*s == NUL) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4780 return e_invalid_argument; |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4781 c2 = get_encoded_char_adv(&s); |
26634
c75f70257cf5
patch 8.2.3846: no error when using control character for 'lcs' or 'fcs'
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
4782 if (char2cells(c2) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4783 return e_invalid_argument; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4784 if (!(*s == ',' || *s == NUL)) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4785 { |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4786 c3 = get_encoded_char_adv(&s); |
26634
c75f70257cf5
patch 8.2.3846: no error when using control character for 'lcs' or 'fcs'
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
4787 if (char2cells(c3) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4788 return e_invalid_argument; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4789 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4790 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4791 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4792 if (*s == ',' || *s == NUL) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4793 { |
25804
bf09d07f098e
patch 8.2.3437: compiler warnings for 32/64 bit usage
Bram Moolenaar <Bram@vim.org>
parents:
25780
diff
changeset
|
4794 if (round > 0) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4795 { |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4796 if (tab[i].cp == &lcs_chars.tab2) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4797 { |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4798 lcs_chars.tab1 = c1; |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4799 lcs_chars.tab2 = c2; |
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4800 lcs_chars.tab3 = c3; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4801 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4802 else if (tab[i].cp != NULL) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4803 *(tab[i].cp) = c1; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4804 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4805 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4806 p = s; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4807 break; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4808 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4809 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4810 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4811 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4812 if (i == entries) |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4813 { |
25804
bf09d07f098e
patch 8.2.3437: compiler warnings for 32/64 bit usage
Bram Moolenaar <Bram@vim.org>
parents:
25780
diff
changeset
|
4814 len = (int)STRLEN("multispace"); |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4815 len2 = (int)STRLEN("leadmultispace"); |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4816 if (is_listchars |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4817 && STRNCMP(p, "multispace", len) == 0 |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4818 && p[len] == ':' |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4819 && p[len + 1] != NUL) |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4820 { |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4821 s = p + len + 1; |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4822 if (round == 0) |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4823 { |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4824 // Get length of lcs-multispace string in first round |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4825 last_multispace = p; |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4826 multispace_len = 0; |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4827 while (*s != NUL && *s != ',') |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4828 { |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4829 c1 = get_encoded_char_adv(&s); |
26634
c75f70257cf5
patch 8.2.3846: no error when using control character for 'lcs' or 'fcs'
Bram Moolenaar <Bram@vim.org>
parents:
26165
diff
changeset
|
4830 if (char2cells(c1) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4831 return e_invalid_argument; |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4832 ++multispace_len; |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4833 } |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4834 if (multispace_len == 0) |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4835 // lcs-multispace cannot be an empty string |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4836 return e_invalid_argument; |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4837 p = s; |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4838 } |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4839 else |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4840 { |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4841 int multispace_pos = 0; |
25804
bf09d07f098e
patch 8.2.3437: compiler warnings for 32/64 bit usage
Bram Moolenaar <Bram@vim.org>
parents:
25780
diff
changeset
|
4842 |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4843 while (*s != NUL && *s != ',') |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4844 { |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4845 c1 = get_encoded_char_adv(&s); |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4846 if (p == last_multispace) |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4847 lcs_chars.multispace[multispace_pos++] = c1; |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4848 } |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4849 p = s; |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4850 } |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4851 } |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4852 |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4853 else if (is_listchars |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4854 && STRNCMP(p, "leadmultispace", len2) == 0 |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4855 && p[len2] == ':' |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4856 && p[len2 + 1] != NUL) |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4857 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4858 s = p + len2 + 1; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4859 if (round == 0) |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4860 { |
29098
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
4861 // get length of lcs-leadmultispace string in first |
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
4862 // round |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4863 last_lmultispace = p; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4864 lead_multispace_len = 0; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4865 while (*s != NUL && *s != ',') |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4866 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4867 c1 = get_encoded_char_adv(&s); |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4868 if (char2cells(c1) > 1) |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4869 return e_invalid_argument; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4870 ++lead_multispace_len; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4871 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4872 if (lead_multispace_len == 0) |
29098
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
4873 // lcs-leadmultispace cannot be an empty string |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4874 return e_invalid_argument; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4875 p = s; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4876 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4877 else |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4878 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4879 int multispace_pos = 0; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4880 |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4881 while (*s != NUL && *s != ',') |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4882 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4883 c1 = get_encoded_char_adv(&s); |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4884 if (p == last_lmultispace) |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4885 lcs_chars.leadmultispace[multispace_pos++] = c1; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4886 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4887 p = s; |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4888 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4889 } |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4890 else |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4891 return e_invalid_argument; |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4892 } |
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4893 |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4894 if (*p == ',') |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4895 ++p; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4896 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4897 } |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4898 |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4899 if (apply) |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4900 { |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4901 if (is_listchars) |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4902 { |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4903 vim_free(wp->w_lcs_chars.multispace); |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4904 vim_free(wp->w_lcs_chars.leadmultispace); |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4905 wp->w_lcs_chars = lcs_chars; |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4906 } |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4907 else |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4908 { |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4909 wp->w_fill_chars = fill_chars; |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4910 } |
25778
373278f5bd51
patch 8.2.3424: a sequence of spaces is hard to see in list mode
Bram Moolenaar <Bram@vim.org>
parents:
25074
diff
changeset
|
4911 } |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4912 else if (is_listchars) |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4913 { |
29395
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4914 vim_free(lcs_chars.multispace); |
caaf5b270018
patch 9.0.0040: use of set_chars_option() is confusing
Bram Moolenaar <Bram@vim.org>
parents:
29387
diff
changeset
|
4915 vim_free(lcs_chars.leadmultispace); |
29387
9dce192d1ac2
patch 9.0.0036: 'fillchars' cannot have window-local values
Bram Moolenaar <Bram@vim.org>
parents:
29328
diff
changeset
|
4916 } |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4917 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4918 return NULL; // no error |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4919 } |
29672
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4920 |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4921 /* |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4922 * Check all global and local values of 'listchars' and 'fillchars'. |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4923 * Return an untranslated error messages if any of them is invalid, NULL |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4924 * otherwise. |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4925 */ |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4926 char * |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4927 check_chars_options(void) |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4928 { |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4929 tabpage_T *tp; |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4930 win_T *wp; |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4931 |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4932 if (set_chars_option(curwin, &p_lcs, FALSE) != NULL) |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4933 return e_conflicts_with_value_of_listchars; |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4934 if (set_chars_option(curwin, &p_fcs, FALSE) != NULL) |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4935 return e_conflicts_with_value_of_fillchars; |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4936 FOR_ALL_TAB_WINDOWS(tp, wp) |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4937 { |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4938 if (set_chars_option(wp, &wp->w_p_lcs, FALSE) != NULL) |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4939 return e_conflicts_with_value_of_listchars; |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4940 if (set_chars_option(wp, &wp->w_p_fcs, FALSE) != NULL) |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4941 return e_conflicts_with_value_of_fillchars; |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4942 } |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4943 return NULL; |
6b8aaf16af99
patch 9.0.0176: checking character options is duplicated and incomplete
Bram Moolenaar <Bram@vim.org>
parents:
29546
diff
changeset
|
4944 } |