Mercurial > vim
annotate src/screen.c @ 29346:336c99d14cc5 v9.0.0016
patch 9.0.0016: comparing line pointer for 'breakindent' is not reliable
Commit: https://github.com/vim/vim/commit/c2a79b87fc31080ba24394c0b30bab45f1bea852
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Jul 1 13:15:35 2022 +0100
patch 9.0.0016: comparing line pointer for 'breakindent' is not reliable
Problem: Comparing line pointer for 'breakindent' is not reliable.
Solution: Make a copy of the line.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 01 Jul 2022 14:30:03 +0200 |
parents | 60977de70684 |
children | 9dce192d1ac2 |
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. | |
20 * LineOffset[row] Contains the offset into ScreenLines*[] and ScreenAttrs[] | |
21 * for each line. | |
22 * LineWraps[row] Flag for each line whether it wraps to the next line. | |
23 * | |
24 * For double-byte characters, two consecutive bytes in ScreenLines[] can form | |
25 * one character which occupies two display cells. | |
26 * For UTF-8 a multi-byte character is converted to Unicode and stored in | |
27 * 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
|
28 * 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
|
29 * 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
|
30 * cells the next byte in ScreenLines[] is 0. |
714 | 31 * ScreenLinesC[][] contain up to 'maxcombine' composing characters |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
32 * (drawn on top of the first character). There is 0 after the last one used. |
7 | 33 * ScreenLines2[] is only used for euc-jp to store the second byte if the |
34 * first byte is 0x8e (single-width character). | |
35 * | |
36 * The screen_*() functions write to the screen and handle updating | |
37 * ScreenLines[]. | |
38 */ | |
39 | |
40 #include "vim.h" | |
41 | |
42 /* | |
43 * The attributes that are actually active for writing to the screen. | |
44 */ | |
45 static int screen_attr = 0; | |
46 | |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
47 static void screen_char_2(unsigned off, int row, int col); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
48 static void screenclear2(void); |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
49 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
|
50 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
|
51 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
|
52 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
|
53 static void msg_pos_mode(void); |
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
54 static void recording_mode(int attr); |
7 | 55 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
56 // Ugly global: overrule attribute used by screen_char() |
7 | 57 static int screen_char_attr = 0; |
58 | |
2250
1bac28a53fae
Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents:
2237
diff
changeset
|
59 #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
|
60 /* |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
61 * 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
|
62 * 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
|
63 */ |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
64 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
65 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
|
66 { |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
67 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
|
68 |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
69 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
|
70 return FALSE; |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
71 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
|
72 c = 'v'; |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
73 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
|
74 c = 'i'; |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
75 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
|
76 c = 'n'; |
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_CMDLINE) |
2382
3a5ededa240a
Add the 'c' flag to 'concealcursor'.
Bram Moolenaar <bram@vim.org>
parents:
2381
diff
changeset
|
78 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
|
79 else |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
80 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
|
81 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
|
82 } |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
83 |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
84 /* |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
85 * 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
|
86 * 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
|
87 * "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
|
88 * " |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
89 */ |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
90 void |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
91 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
|
92 { |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
93 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
|
94 { |
25074
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
95 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
|
96 |
2378
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
97 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
|
98 // 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
|
99 // 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
|
100 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
|
101 |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
102 // 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
|
103 // 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
|
104 if (!was_concealed) |
aa55d6d17625
patch 8.2.3074: popup_atcursor() uses wrong position with concealing
Bram Moolenaar <Bram@vim.org>
parents:
24768
diff
changeset
|
105 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
|
106 } |
85b7dc8da5eb
Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents:
2375
diff
changeset
|
107 } |
7 | 108 #endif |
109 | |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
110 /* |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
111 * 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
|
112 * 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
|
113 */ |
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
|
114 int |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
115 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
|
116 { |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
117 int wcr_attr = 0; |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
118 |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
119 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
|
120 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
|
121 #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
|
122 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
|
123 { |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
124 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
|
125 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
|
126 else |
4bd21046902b
patch 8.1.1882: cannot specify properties of the info popup window
Bram Moolenaar <Bram@vim.org>
parents:
17742
diff
changeset
|
127 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
|
128 } |
16817
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
129 #endif |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
130 return wcr_attr; |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
131 } |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
132 |
7 | 133 /* |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
134 * 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
|
135 * 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
|
136 */ |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
137 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
|
138 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
|
139 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
|
140 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
|
141 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
|
142 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
|
143 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
|
144 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
|
145 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
|
146 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
|
147 { |
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 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
|
149 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
150 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
|
151 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
|
152 #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
|
153 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
|
154 { |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
155 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
|
156 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
|
157 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
|
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 else |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
160 #endif |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
161 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
|
162 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
|
163 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
|
164 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
|
165 } |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
166 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
167 /* |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
168 * 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
|
169 * 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
|
170 * When "draw_margin" is TRUE then draw the sign, fold and number columns. |
7 | 171 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
172 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
173 win_draw_end( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
174 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
175 int c1, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
176 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
|
177 int draw_margin, |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
178 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
179 int endrow, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
180 hlf_T hl) |
7 | 181 { |
182 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
|
183 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
|
184 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
|
185 |
069ee8dc8c8d
patch 8.1.1410: popup_move() is not implemented yet
Bram Moolenaar <Bram@vim.org>
parents:
16813
diff
changeset
|
186 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
|
187 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
188 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
|
189 { |
6553 | 190 #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
|
191 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
|
192 |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
193 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
|
194 // 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
|
195 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
|
196 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
|
197 #endif |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
198 #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
|
199 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
|
200 // 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
|
201 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
|
202 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
|
203 #endif |
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
204 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
|
205 && 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
|
206 // 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
|
207 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
|
208 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
|
209 } |
7 | 210 |
211 #ifdef FEAT_RIGHTLEFT | |
212 if (wp->w_p_rl) | |
213 { | |
214 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
|
215 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
|
216 c2, c2, attr); |
7 | 217 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
|
218 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
|
219 c1, c2, attr); |
7 | 220 } |
221 else | |
222 #endif | |
223 { | |
224 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
|
225 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
|
226 c1, c2, attr); |
7 | 227 } |
16135
dc0801e374e0
patch 8.1.1072: extending sign and foldcolumn below the text is confusing
Bram Moolenaar <Bram@vim.org>
parents:
16054
diff
changeset
|
228 |
7 | 229 set_empty_rows(wp, row); |
230 } | |
231 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
232 #if defined(FEAT_FOLDING) || defined(PROTO) |
7 | 233 /* |
6553 | 234 * Compute the width of the foldcolumn. Based on 'foldcolumn' and how much |
235 * space is available for window "wp", minus "col". | |
236 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
237 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
238 compute_foldcolumn(win_T *wp, int col) |
6553 | 239 { |
240 int fdc = wp->w_p_fdc; | |
241 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
|
242 int wwidth = wp->w_width; |
6553 | 243 |
244 if (fdc > wwidth - (col + wmw)) | |
245 fdc = wwidth - (col + wmw); | |
246 return fdc; | |
247 } | |
248 | |
249 /* | |
7 | 250 * Fill the foldcolumn at "p" for window "wp". |
548 | 251 * 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
|
252 * 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
|
253 * 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
|
254 * this will be greater than 'fdc'. |
7 | 255 */ |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
256 size_t |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
257 fill_foldcolumn( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
258 char_u *p, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
259 win_T *wp, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
260 int closed, // TRUE of FALSE |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
261 linenr_T lnum) // current line number |
7 | 262 { |
263 int i = 0; | |
264 int level; | |
265 int first_level; | |
519 | 266 int empty; |
6553 | 267 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
|
268 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
|
269 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
|
270 int len = 0; |
7 | 271 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
272 // 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
|
273 vim_memset(p, ' ', MAX_MCO * fdc + 1); |
7 | 274 |
275 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
|
276 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
|
277 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
278 // 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
|
279 // 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
|
280 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
|
281 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
|
282 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
|
283 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
284 for (i = 0; i < MIN(fdc, level); i++) |
7 | 285 { |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
286 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
|
287 && first_level + i >= win_foldinfo.fi_low_level) |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
288 symbol = fill_foldopen; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
289 else 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
|
290 symbol = fill_foldsep; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
291 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
|
292 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
|
293 else |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
294 symbol = '>'; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
295 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
296 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
|
297 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
|
298 if (first_level + i >= level) |
7 | 299 { |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
300 i++; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
301 break; |
7 | 302 } |
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 |
7 | 305 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
|
306 { |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
307 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
|
308 { |
8ebf8b3dfc08
patch 8.2.2633: multi-byte 'fillchars' for folding do not show properly
Bram Moolenaar <Bram@vim.org>
parents:
24055
diff
changeset
|
309 // 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
|
310 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
|
311 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
|
312 // 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
|
313 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
|
314 } |
24043
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
315 symbol = fill_foldclosed; |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
316 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
|
317 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
|
318 } |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
319 |
15408ab5fed7
patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents:
23964
diff
changeset
|
320 return MAX(byte_counter + (fdc - i), (size_t)fdc); |
7 | 321 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
322 #endif // FEAT_FOLDING |
7 | 323 |
714 | 324 /* |
325 * 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
|
326 * Only to be used when ScreenLinesUC[off_from] != 0. |
714 | 327 */ |
328 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
329 comp_char_differs(int off_from, int off_to) |
714 | 330 { |
331 int i; | |
332 | |
333 for (i = 0; i < Screen_mco; ++i) | |
334 { | |
335 if (ScreenLinesC[i][off_from] != ScreenLinesC[i][off_to]) | |
336 return TRUE; | |
337 if (ScreenLinesC[i][off_from] == 0) | |
338 break; | |
339 } | |
340 return FALSE; | |
341 } | |
342 | |
7 | 343 /* |
344 * Check whether the given character needs redrawing: | |
345 * - the (first byte of the) character is different | |
346 * - the attributes are different | |
347 * - the character is multi-byte and the next byte is different | |
1616 | 348 * - the character is two cells wide and the second cell differs. |
7 | 349 */ |
350 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
351 char_needs_redraw(int off_from, int off_to, int cols) |
7 | 352 { |
353 if (cols > 0 | |
354 && ((ScreenLines[off_from] != ScreenLines[off_to] | |
355 || ScreenAttrs[off_from] != ScreenAttrs[off_to]) | |
356 || (enc_dbcs != 0 | |
357 && MB_BYTE2LEN(ScreenLines[off_from]) > 1 | |
358 && (enc_dbcs == DBCS_JPNU && ScreenLines[off_from] == 0x8e | |
359 ? ScreenLines2[off_from] != ScreenLines2[off_to] | |
360 : (cols > 1 && ScreenLines[off_from + 1] | |
361 != ScreenLines[off_to + 1]))) | |
362 || (enc_utf8 | |
363 && (ScreenLinesUC[off_from] != ScreenLinesUC[off_to] | |
364 || (ScreenLinesUC[off_from] != 0 | |
1616 | 365 && comp_char_differs(off_from, off_to)) |
3759 | 366 || ((*mb_off2cells)(off_from, off_from + cols) > 1 |
367 && ScreenLines[off_from + 1] | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
368 != ScreenLines[off_to + 1]))))) |
7 | 369 return TRUE; |
370 return FALSE; | |
371 } | |
372 | |
11670
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
373 #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
|
374 /* |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
375 * 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
|
376 */ |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
377 int |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
378 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
|
379 { |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
380 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
|
381 } |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
382 #endif |
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
383 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
384 #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
|
385 /* |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
386 * 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
|
387 * 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
|
388 */ |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
389 static int |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
390 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
|
391 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
392 int off; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
393 |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
394 if (!popup_visible) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
395 return FALSE; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
396 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
|
397 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
|
398 } |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
399 #endif |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
400 |
7 | 401 /* |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
402 * 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
|
403 */ |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
404 void |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
405 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
|
406 { |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
407 #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
|
408 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
|
409 // 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
|
410 // 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
|
411 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
|
412 else |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
413 #endif |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
414 // 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
|
415 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
|
416 } |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
417 |
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
418 /* |
7 | 419 * Move one "cooked" screen line to the screen, but only the characters that |
420 * have actually changed. Handle insert/delete character. | |
421 * "coloff" gives the first column on the screen for this line. | |
422 * "endcol" gives the columns where valid characters are. | |
423 * "clear_width" is the width of the window. It's > 0 if the rest of the line | |
424 * 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
|
425 * "flags" can have bits: |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
426 * SLF_POPUP popup window |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
427 * SLF_RIGHTLEFT rightleft window: |
7 | 428 * When TRUE and "clear_width" > 0, clear columns 0 to "endcol" |
429 * When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width" | |
430 */ | |
11670
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
431 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
432 screen_line( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
433 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
434 int coloff, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
435 int endcol, |
11670
3b2afa2b77b3
patch 8.0.0718: output of job in terminal is not displayed
Christian Brabandt <cb@256bit.org>
parents:
11657
diff
changeset
|
436 int clear_width, |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
437 int flags UNUSED) |
7 | 438 { |
439 unsigned off_from; | |
440 unsigned off_to; | |
1378 | 441 unsigned max_off_from; |
442 unsigned max_off_to; | |
7 | 443 int col = 0; |
444 int hl; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
445 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
|
446 int redraw_this // bool: does character need redraw? |
7 | 447 #ifdef FEAT_GUI |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
448 = TRUE // For GUI when while-loop empty |
7 | 449 #endif |
450 ; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
451 int redraw_next; // redraw_this for next character |
7 | 452 int clear_next = FALSE; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
453 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
|
454 // 2: occupies two display cells |
7 | 455 # define CHAR_CELLS char_cells |
456 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
457 // Check for illegal row and col, just in case. |
3413 | 458 if (row >= Rows) |
459 row = Rows - 1; | |
460 if (endcol > Columns) | |
461 endcol = Columns; | |
462 | |
7 | 463 # ifdef FEAT_CLIPBOARD |
464 clip_may_clear_selection(row, row); | |
465 # endif | |
466 | |
467 off_from = (unsigned)(current_ScreenLine - ScreenLines); | |
468 off_to = LineOffset[row] + coloff; | |
1378 | 469 max_off_from = off_from + screen_Columns; |
470 max_off_to = LineOffset[row] + screen_Columns; | |
7 | 471 |
472 #ifdef FEAT_RIGHTLEFT | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
473 if (flags & SLF_RIGHTLEFT) |
7 | 474 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
475 // Clear rest first, because it's left of the text. |
7 | 476 if (clear_width > 0) |
477 { | |
478 while (col <= endcol && ScreenLines[off_to] == ' ' | |
479 && ScreenAttrs[off_to] == 0 | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
480 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)) |
7 | 481 { |
482 ++off_to; | |
483 ++col; | |
484 } | |
485 if (col <= endcol) | |
486 screen_fill(row, row + 1, col + coloff, | |
487 endcol + coloff + 1, ' ', ' ', 0); | |
488 } | |
489 col = endcol + 1; | |
490 off_to = LineOffset[row] + col + coloff; | |
491 off_from += col; | |
492 endcol = (clear_width > 0 ? clear_width : -clear_width); | |
493 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
494 #endif // FEAT_RIGHTLEFT |
7 | 495 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
496 #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
|
497 // 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
|
498 // 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
|
499 // 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
|
500 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
|
501 && 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
|
502 && 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
|
503 && (*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
|
504 { |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
505 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
|
506 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
|
507 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
|
508 } |
7f066dff9d70
patch 8.1.2351: 'wincolor' not used for > for not fitting double width char
Bram Moolenaar <Bram@vim.org>
parents:
18671
diff
changeset
|
509 #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
|
510 |
7 | 511 redraw_next = char_needs_redraw(off_from, off_to, endcol - col); |
512 | |
513 while (col < endcol) | |
514 { | |
515 if (has_mbyte && (col + 1 < endcol)) | |
1378 | 516 char_cells = (*mb_off2cells)(off_from, max_off_from); |
7 | 517 else |
518 char_cells = 1; | |
519 | |
520 redraw_this = redraw_next; | |
521 redraw_next = force || char_needs_redraw(off_from + CHAR_CELLS, | |
522 off_to + CHAR_CELLS, endcol - col - CHAR_CELLS); | |
523 | |
524 #ifdef FEAT_GUI | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
525 // 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
|
526 // 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
|
527 // happens in the GUI. |
7 | 528 if (redraw_next && gui.in_use) |
529 { | |
530 hl = ScreenAttrs[off_to + CHAR_CELLS]; | |
743 | 531 if (hl > HL_ALL) |
532 hl = syn_attr2attr(hl); | |
533 if (hl & HL_BOLD) | |
7 | 534 redraw_this = TRUE; |
535 } | |
536 #endif | |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
537 #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
|
538 if (blocked_by_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
|
539 redraw_this = FALSE; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
540 #endif |
7 | 541 if (redraw_this) |
542 { | |
543 /* | |
544 * Special handling when 'xs' termcap flag set (hpterm): | |
545 * Attributes for characters are stored at the position where the | |
546 * cursor is when writing the highlighting code. The | |
547 * start-highlighting code must be written with the cursor on the | |
548 * first highlighted character. The stop-highlighting code must | |
549 * be written with the cursor just after the last highlighted | |
550 * character. | |
15034
6e4e0d43b20b
patch 8.1.0528: various typos in comments
Bram Moolenaar <Bram@vim.org>
parents:
14877
diff
changeset
|
551 * Overwriting a character doesn't remove its highlighting. Need |
7 | 552 * to clear the rest of the line, and force redrawing it |
553 * completely. | |
554 */ | |
555 if ( p_wiv | |
556 && !force | |
557 #ifdef FEAT_GUI | |
558 && !gui.in_use | |
559 #endif | |
560 && ScreenAttrs[off_to] != 0 | |
561 && ScreenAttrs[off_from] != ScreenAttrs[off_to]) | |
562 { | |
563 /* | |
564 * Need to remove highlighting attributes here. | |
565 */ | |
566 windgoto(row, col + coloff); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
567 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
|
568 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
|
569 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
|
570 redraw_next = TRUE; // or else next char would miss out |
7 | 571 |
572 /* | |
573 * If the previous character was highlighted, need to stop | |
574 * highlighting at this character. | |
575 */ | |
576 if (col + coloff > 0 && ScreenAttrs[off_to - 1] != 0) | |
577 { | |
578 screen_attr = ScreenAttrs[off_to - 1]; | |
579 term_windgoto(row, col + coloff); | |
580 screen_stop_highlight(); | |
581 } | |
582 else | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
583 screen_attr = 0; // highlighting has stopped |
7 | 584 } |
585 if (enc_dbcs != 0) | |
586 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
587 // 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
|
588 // 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
|
589 // 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
|
590 // ScreenLinesUC[] is sufficient. |
7 | 591 if (char_cells == 1 |
592 && col + 1 < endcol | |
1378 | 593 && (*mb_off2cells)(off_to, max_off_to) > 1) |
7 | 594 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
595 // 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
|
596 // character: need to redraw the next cell. |
7 | 597 ScreenLines[off_to + 1] = 0; |
598 redraw_next = TRUE; | |
599 } | |
600 else if (char_cells == 2 | |
601 && col + 2 < endcol | |
1378 | 602 && (*mb_off2cells)(off_to, max_off_to) == 1 |
603 && (*mb_off2cells)(off_to + 1, max_off_to) > 1) | |
7 | 604 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
605 // 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
|
606 // 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
|
607 // cell. |
7 | 608 ScreenLines[off_to + 2] = 0; |
609 redraw_next = TRUE; | |
610 } | |
611 | |
612 if (enc_dbcs == DBCS_JPNU) | |
613 ScreenLines2[off_to] = ScreenLines2[off_from]; | |
614 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
615 // 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
|
616 // 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
|
617 // 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
|
618 // 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
|
619 // char over the left half of an existing one. |
7 | 620 if (has_mbyte && col + char_cells == endcol |
621 && ((char_cells == 1 | |
1378 | 622 && (*mb_off2cells)(off_to, max_off_to) > 1) |
7 | 623 || (char_cells == 2 |
1378 | 624 && (*mb_off2cells)(off_to, max_off_to) == 1 |
625 && (*mb_off2cells)(off_to + 1, max_off_to) > 1))) | |
7 | 626 clear_next = TRUE; |
627 | |
628 ScreenLines[off_to] = ScreenLines[off_from]; | |
629 if (enc_utf8) | |
630 { | |
631 ScreenLinesUC[off_to] = ScreenLinesUC[off_from]; | |
632 if (ScreenLinesUC[off_from] != 0) | |
633 { | |
714 | 634 int i; |
635 | |
636 for (i = 0; i < Screen_mco; ++i) | |
637 ScreenLinesC[i][off_to] = ScreenLinesC[i][off_from]; | |
7 | 638 } |
639 } | |
640 if (char_cells == 2) | |
641 ScreenLines[off_to + 1] = ScreenLines[off_from + 1]; | |
642 | |
643 #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
|
644 // 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
|
645 // 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
|
646 // 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
|
647 // and for some xterms. |
7 | 648 if ( |
649 # ifdef FEAT_GUI | |
650 gui.in_use | |
651 # endif | |
652 # if defined(FEAT_GUI) && defined(UNIX) | |
653 || | |
654 # endif | |
655 # ifdef UNIX | |
656 term_is_xterm | |
657 # endif | |
658 ) | |
659 { | |
660 hl = ScreenAttrs[off_to]; | |
743 | 661 if (hl > HL_ALL) |
662 hl = syn_attr2attr(hl); | |
663 if (hl & HL_BOLD) | |
7 | 664 redraw_next = TRUE; |
665 } | |
666 #endif | |
667 ScreenAttrs[off_to] = ScreenAttrs[off_from]; | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
668 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
669 // 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
|
670 // double-wide character equal to the first half. |
819 | 671 if (char_cells == 2) |
672 ScreenAttrs[off_to + 1] = ScreenAttrs[off_from]; | |
673 | |
7 | 674 if (enc_dbcs != 0 && char_cells == 2) |
675 screen_char_2(off_to, row, col + coloff); | |
676 else | |
677 screen_char(off_to, row, col + coloff); | |
678 } | |
679 else if ( p_wiv | |
680 #ifdef FEAT_GUI | |
681 && !gui.in_use | |
682 #endif | |
683 && col + coloff > 0) | |
684 { | |
685 if (ScreenAttrs[off_to] == ScreenAttrs[off_to - 1]) | |
686 { | |
687 /* | |
688 * Don't output stop-highlight when moving the cursor, it will | |
689 * stop the highlighting when it should continue. | |
690 */ | |
691 screen_attr = 0; | |
692 } | |
693 else if (screen_attr != 0) | |
694 screen_stop_highlight(); | |
695 } | |
696 | |
697 off_to += CHAR_CELLS; | |
698 off_from += CHAR_CELLS; | |
699 col += CHAR_CELLS; | |
700 } | |
701 | |
702 if (clear_next) | |
703 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
704 // 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
|
705 // half was overwritten with a single-wide character. |
7 | 706 ScreenLines[off_to] = ' '; |
707 if (enc_utf8) | |
708 ScreenLinesUC[off_to] = 0; | |
709 screen_char(off_to, row, col + coloff); | |
710 } | |
711 | |
712 if (clear_width > 0 | |
713 #ifdef FEAT_RIGHTLEFT | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
714 && !(flags & SLF_RIGHTLEFT) |
7 | 715 #endif |
716 ) | |
717 { | |
718 #ifdef FEAT_GUI | |
719 int startCol = col; | |
720 #endif | |
721 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
722 // blank out the rest of the line |
7 | 723 while (col < clear_width && ScreenLines[off_to] == ' ' |
724 && ScreenAttrs[off_to] == 0 | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
725 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)) |
7 | 726 { |
727 ++off_to; | |
728 ++col; | |
729 } | |
730 if (col < clear_width) | |
731 { | |
732 #ifdef FEAT_GUI | |
733 /* | |
734 * In the GUI, clearing the rest of the line may leave pixels | |
735 * behind if the first character cleared was bold. Some bold | |
736 * fonts spill over the left. In this case we redraw the previous | |
737 * character too. If we didn't skip any blanks above, then we | |
738 * only redraw if the character wasn't already redrawn anyway. | |
739 */ | |
996 | 740 if (gui.in_use && (col > startCol || !redraw_this)) |
7 | 741 { |
742 hl = ScreenAttrs[off_to]; | |
743 if (hl > HL_ALL || (hl & HL_BOLD)) | |
996 | 744 { |
745 int prev_cells = 1; | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
746 |
996 | 747 if (enc_utf8) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
748 // 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
|
749 // that its width is 2. |
996 | 750 prev_cells = ScreenLines[off_to - 1] == 0 ? 2 : 1; |
751 else if (enc_dbcs != 0) | |
752 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
753 // 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
|
754 // column and get its width. |
996 | 755 unsigned off = LineOffset[row]; |
1378 | 756 unsigned max_off = LineOffset[row] + screen_Columns; |
996 | 757 |
758 while (off < off_to) | |
759 { | |
1378 | 760 prev_cells = (*mb_off2cells)(off, max_off); |
996 | 761 off += prev_cells; |
762 } | |
763 } | |
764 | |
765 if (enc_dbcs != 0 && prev_cells > 1) | |
766 screen_char_2(off_to - prev_cells, row, | |
767 col + coloff - prev_cells); | |
768 else | |
769 screen_char(off_to - prev_cells, row, | |
770 col + coloff - prev_cells); | |
771 } | |
7 | 772 } |
773 #endif | |
774 screen_fill(row, row + 1, col + coloff, clear_width + coloff, | |
775 ' ', ' ', 0); | |
776 off_to += clear_width - col; | |
777 col = clear_width; | |
778 } | |
779 } | |
780 | |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
781 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
|
782 #ifdef FEAT_PROP_POPUP |
16778
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
783 && !(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
|
784 #endif |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
785 ) |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
786 { |
eda4d65f232c
patch 8.1.1391: no popup window support
Bram Moolenaar <Bram@vim.org>
parents:
16768
diff
changeset
|
787 // 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
|
788 // 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
|
789 if (coloff + col < Columns) |
7 | 790 { |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
791 #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
|
792 if (!blocked_by_popup(row, col + coloff)) |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
793 #endif |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
794 { |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
795 int c; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
796 |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
797 c = fillchar_vsep(&hl); |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
798 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
|
799 || (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
|
800 != (c >= 0x80 ? c : 0)) |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
801 || ScreenAttrs[off_to] != hl) |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
802 { |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
803 ScreenLines[off_to] = c; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
804 ScreenAttrs[off_to] = hl; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
805 if (enc_utf8) |
7 | 806 { |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
807 if (c >= 0x80) |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
808 { |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
809 ScreenLinesUC[off_to] = c; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
810 ScreenLinesC[0][off_to] = 0; |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
811 } |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
812 else |
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
813 ScreenLinesUC[off_to] = 0; |
7 | 814 } |
16994
9c4cf27deb87
patch 8.1.1497: accessing memory beyond allocated space
Bram Moolenaar <Bram@vim.org>
parents:
16990
diff
changeset
|
815 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
|
816 } |
7 | 817 } |
818 } | |
819 else | |
820 LineWraps[row] = FALSE; | |
821 } | |
822 } | |
823 | |
474 | 824 #if defined(FEAT_RIGHTLEFT) || defined(PROTO) |
7 | 825 /* |
474 | 826 * Mirror text "str" for right-left displaying. |
827 * Only works for single-byte characters (e.g., numbers). | |
7 | 828 */ |
474 | 829 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
830 rl_mirror(char_u *str) |
7 | 831 { |
832 char_u *p1, *p2; | |
833 int t; | |
834 | |
835 for (p1 = str, p2 = str + STRLEN(str) - 1; p1 < p2; ++p1, --p2) | |
836 { | |
837 t = *p1; | |
838 *p1 = *p2; | |
839 *p2 = t; | |
840 } | |
841 } | |
842 #endif | |
843 | |
844 /* | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
845 * Draw the verticap separator right of window "wp" starting with line "row". |
7 | 846 */ |
847 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
848 draw_vsep_win(win_T *wp, int row) |
7 | 849 { |
850 int hl; | |
851 int c; | |
852 | |
853 if (wp->w_vsep_width) | |
854 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
855 // draw the vertical separator right of this window |
7 | 856 c = fillchar_vsep(&hl); |
857 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, | |
858 W_ENDCOL(wp), W_ENDCOL(wp) + 1, | |
859 c, ' ', hl); | |
860 } | |
861 } | |
862 | |
863 #ifdef FEAT_WILDMENU | |
7805
0b6c37dd858d
commit https://github.com/vim/vim/commit/baaa7e9ec7398a813e21285c272fa99792642077
Christian Brabandt <cb@256bit.org>
parents:
7697
diff
changeset
|
864 static int skip_status_match_char(expand_T *xp, char_u *s); |
7 | 865 |
866 /* | |
1378 | 867 * Get the length of an item as it will be shown in the status line. |
7 | 868 */ |
869 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
870 status_match_len(expand_T *xp, char_u *s) |
7 | 871 { |
872 int len = 0; | |
873 | |
874 #ifdef FEAT_MENU | |
875 int emenu = (xp->xp_context == EXPAND_MENUS | |
876 || xp->xp_context == EXPAND_MENUNAMES); | |
877 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
878 // Check for menu separators - replace with '|'. |
7 | 879 if (emenu && menu_is_separator(s)) |
880 return 1; | |
881 #endif | |
882 | |
883 while (*s != NUL) | |
884 { | |
1685 | 885 s += skip_status_match_char(xp, s); |
42 | 886 len += ptr2cells(s); |
11127
506f5d8b7d8b
patch 8.0.0451: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11121
diff
changeset
|
887 MB_PTR_ADV(s); |
7 | 888 } |
889 | |
890 return len; | |
891 } | |
892 | |
893 /* | |
1685 | 894 * Return the number of characters that should be skipped in a status match. |
277 | 895 * These are backslashes used for escaping. Do show backslashes in help tags. |
896 */ | |
897 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
898 skip_status_match_char(expand_T *xp, char_u *s) |
277 | 899 { |
1685 | 900 if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP) |
277 | 901 #ifdef FEAT_MENU |
902 || ((xp->xp_context == EXPAND_MENUS | |
903 || xp->xp_context == EXPAND_MENUNAMES) | |
904 && (s[0] == '\t' || (s[0] == '\\' && s[1] != NUL))) | |
905 #endif | |
1685 | 906 ) |
907 { | |
908 #ifndef BACKSLASH_IN_FILENAME | |
909 if (xp->xp_shell && csh_like_shell() && s[1] == '\\' && s[2] == '!') | |
910 return 2; | |
911 #endif | |
912 return 1; | |
913 } | |
914 return 0; | |
277 | 915 } |
916 | |
917 /* | |
7 | 918 * Show wildchar matches in the status line. |
919 * Show at least the "match" item. | |
920 * We start at item 'first_match' in the list and show all matches that fit. | |
921 * | |
922 * If inversion is possible we use it. Else '=' characters are used. | |
923 */ | |
924 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
925 win_redr_status_matches( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
926 expand_T *xp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
927 int num_matches, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
928 char_u **matches, // list of matches |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
929 int match, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
930 int showtail) |
7 | 931 { |
932 #define L_MATCH(m) (showtail ? sm_gettail(matches[m]) : matches[m]) | |
933 int row; | |
934 char_u *buf; | |
935 int len; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
936 int clen; // length in screen cells |
7 | 937 int fillchar; |
938 int attr; | |
939 int i; | |
940 int highlight = TRUE; | |
941 char_u *selstart = NULL; | |
942 int selstart_col = 0; | |
943 char_u *selend = NULL; | |
944 static int first_match = 0; | |
945 int add_left = FALSE; | |
946 char_u *s; | |
947 #ifdef FEAT_MENU | |
948 int emenu; | |
949 #endif | |
950 int l; | |
951 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
952 if (matches == NULL) // interrupted completion? |
7 | 953 return; |
954 | |
39 | 955 if (has_mbyte) |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16676
diff
changeset
|
956 buf = alloc(Columns * MB_MAXBYTES + 1); |
39 | 957 else |
16764
ef00b6bc186b
patch 8.1.1384: using "int" for alloc() often results in compiler warnings
Bram Moolenaar <Bram@vim.org>
parents:
16676
diff
changeset
|
958 buf = alloc(Columns + 1); |
7 | 959 if (buf == NULL) |
960 return; | |
961 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
962 if (match == -1) // don't show match but original text |
7 | 963 { |
964 match = 0; | |
965 highlight = FALSE; | |
966 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
967 // count 1 for the ending ">" |
7 | 968 clen = status_match_len(xp, L_MATCH(match)) + 3; |
969 if (match == 0) | |
970 first_match = 0; | |
971 else if (match < first_match) | |
972 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
973 // jumping left, as far as we can go |
7 | 974 first_match = match; |
975 add_left = TRUE; | |
976 } | |
977 else | |
978 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
979 // check if match fits on the screen |
7 | 980 for (i = first_match; i < match; ++i) |
981 clen += status_match_len(xp, L_MATCH(i)) + 2; | |
982 if (first_match > 0) | |
983 clen += 2; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
984 // jumping right, put match at the left |
7 | 985 if ((long)clen > Columns) |
986 { | |
987 first_match = match; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
988 // if showing the last match, we can add some on the left |
7 | 989 clen = 2; |
990 for (i = match; i < num_matches; ++i) | |
991 { | |
992 clen += status_match_len(xp, L_MATCH(i)) + 2; | |
993 if ((long)clen >= Columns) | |
994 break; | |
995 } | |
996 if (i == num_matches) | |
997 add_left = TRUE; | |
998 } | |
999 } | |
1000 if (add_left) | |
1001 while (first_match > 0) | |
1002 { | |
1003 clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2; | |
1004 if ((long)clen >= Columns) | |
1005 break; | |
1006 --first_match; | |
1007 } | |
1008 | |
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
|
1009 fillchar = fillchar_status(&attr, curwin); |
7 | 1010 |
1011 if (first_match == 0) | |
1012 { | |
1013 *buf = NUL; | |
1014 len = 0; | |
1015 } | |
1016 else | |
1017 { | |
1018 STRCPY(buf, "< "); | |
1019 len = 2; | |
1020 } | |
1021 clen = len; | |
1022 | |
1023 i = first_match; | |
1024 while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < Columns) | |
1025 { | |
1026 if (i == match) | |
1027 { | |
1028 selstart = buf + len; | |
1029 selstart_col = clen; | |
1030 } | |
1031 | |
1032 s = L_MATCH(i); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1033 // Check for menu separators - replace with '|' |
7 | 1034 #ifdef FEAT_MENU |
1035 emenu = (xp->xp_context == EXPAND_MENUS | |
1036 || xp->xp_context == EXPAND_MENUNAMES); | |
1037 if (emenu && menu_is_separator(s)) | |
1038 { | |
1039 STRCPY(buf + len, transchar('|')); | |
1040 l = (int)STRLEN(buf + len); | |
1041 len += l; | |
1042 clen += l; | |
1043 } | |
1044 else | |
1045 #endif | |
1046 for ( ; *s != NUL; ++s) | |
1047 { | |
1685 | 1048 s += skip_status_match_char(xp, s); |
7 | 1049 clen += ptr2cells(s); |
474 | 1050 if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1) |
7 | 1051 { |
1052 STRNCPY(buf + len, s, l); | |
1053 s += l - 1; | |
1054 len += l; | |
1055 } | |
1056 else | |
1057 { | |
1058 STRCPY(buf + len, transchar_byte(*s)); | |
1059 len += (int)STRLEN(buf + len); | |
1060 } | |
1061 } | |
1062 if (i == match) | |
1063 selend = buf + len; | |
1064 | |
1065 *(buf + len++) = ' '; | |
1066 *(buf + len++) = ' '; | |
1067 clen += 2; | |
1068 if (++i == num_matches) | |
1069 break; | |
1070 } | |
1071 | |
1072 if (i != num_matches) | |
1073 { | |
1074 *(buf + len++) = '>'; | |
1075 ++clen; | |
1076 } | |
1077 | |
1078 buf[len] = NUL; | |
1079 | |
1080 row = cmdline_row - 1; | |
1081 if (row >= 0) | |
1082 { | |
1083 if (wild_menu_showing == 0) | |
1084 { | |
1085 if (msg_scrolled > 0) | |
1086 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1087 // Put the wildmenu just above the command line. If there is |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1088 // no room, scroll the screen one line up. |
7 | 1089 if (cmdline_row == Rows - 1) |
1090 { | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
1091 screen_del_lines(0, 0, 1, (int)Rows, TRUE, 0, NULL); |
7 | 1092 ++msg_scrolled; |
1093 } | |
1094 else | |
1095 { | |
1096 ++cmdline_row; | |
1097 ++row; | |
1098 } | |
1099 wild_menu_showing = WM_SCROLLED; | |
1100 } | |
1101 else | |
1102 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1103 // Create status line if needed by setting 'laststatus' to 2. |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1104 // Set 'winminheight' to zero to avoid that the window is |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1105 // resized. |
7 | 1106 if (lastwin->w_status_height == 0) |
1107 { | |
1108 save_p_ls = p_ls; | |
1109 save_p_wmh = p_wmh; | |
1110 p_ls = 2; | |
1111 p_wmh = 0; | |
1112 last_status(FALSE); | |
1113 } | |
1114 wild_menu_showing = WM_SHOWN; | |
1115 } | |
1116 } | |
1117 | |
1118 screen_puts(buf, row, 0, attr); | |
1119 if (selstart != NULL && highlight) | |
1120 { | |
1121 *selend = NUL; | |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
1122 screen_puts(selstart, row, selstart_col, HL_ATTR(HLF_WM)); |
7 | 1123 } |
1124 | |
1125 screen_fill(row, row + 1, clen, (int)Columns, fillchar, fillchar, attr); | |
1126 } | |
1127 | |
1128 win_redraw_last_status(topframe); | |
1129 vim_free(buf); | |
1130 } | |
1131 #endif | |
1132 | |
1133 /* | |
1134 * Return TRUE if the status line of window "wp" is connected to the status | |
1135 * line of the window right of it. If not, then it's a vertical separator. | |
1136 * Only call if (wp->w_vsep_width != 0). | |
1137 */ | |
1138 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1139 stl_connected(win_T *wp) |
7 | 1140 { |
1141 frame_T *fr; | |
1142 | |
1143 fr = wp->w_frame; | |
1144 while (fr->fr_parent != NULL) | |
1145 { | |
1146 if (fr->fr_parent->fr_layout == FR_COL) | |
1147 { | |
1148 if (fr->fr_next != NULL) | |
1149 break; | |
1150 } | |
1151 else | |
1152 { | |
1153 if (fr->fr_next != NULL) | |
1154 return TRUE; | |
1155 } | |
1156 fr = fr->fr_parent; | |
1157 } | |
1158 return FALSE; | |
1159 } | |
1160 | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
1161 |
7 | 1162 /* |
1163 * Get the value to show for the language mappings, active 'keymap'. | |
1164 */ | |
1165 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1166 get_keymap_str( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1167 win_T *wp, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1168 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
|
1169 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
|
1170 int len) // length of buffer |
7 | 1171 { |
1172 char_u *p; | |
1173 | |
1174 if (wp->w_buffer->b_p_iminsert != B_IMODE_LMAP) | |
1175 return FALSE; | |
1176 | |
1177 { | |
1178 #ifdef FEAT_EVAL | |
1179 buf_T *old_curbuf = curbuf; | |
1180 win_T *old_curwin = curwin; | |
1181 char_u *s; | |
1182 | |
1183 curbuf = wp->w_buffer; | |
1184 curwin = wp; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1185 STRCPY(buf, "b:keymap_name"); // must be writable |
7 | 1186 ++emsg_skip; |
20996
3af71cbcfdbe
patch 8.2.1049: Vim9: leaking memory when using continuation line
Bram Moolenaar <Bram@vim.org>
parents:
20619
diff
changeset
|
1187 s = p = eval_to_string(buf, FALSE); |
7 | 1188 --emsg_skip; |
1189 curbuf = old_curbuf; | |
1190 curwin = old_curwin; | |
1191 if (p == NULL || *p == NUL) | |
1192 #endif | |
1193 { | |
1194 #ifdef FEAT_KEYMAP | |
1195 if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED) | |
1196 p = wp->w_buffer->b_p_keymap; | |
1197 else | |
1198 #endif | |
1199 p = (char_u *)"lang"; | |
1200 } | |
9645
123d3c102035
commit https://github.com/vim/vim/commit/73ac0c4281a3606651604a3cbcc334bfb3859a87
Christian Brabandt <cb@256bit.org>
parents:
9489
diff
changeset
|
1201 if (vim_snprintf((char *)buf, len, (char *)fmt, p) > len - 1) |
7 | 1202 buf[0] = NUL; |
1203 #ifdef FEAT_EVAL | |
1204 vim_free(s); | |
1205 #endif | |
1206 } | |
1207 return buf[0] != NUL; | |
1208 } | |
1209 | |
1210 #if defined(FEAT_STL_OPT) || defined(PROTO) | |
1211 /* | |
677 | 1212 * Redraw the status line or ruler of window "wp". |
1213 * When "wp" is NULL redraw the tab pages line from 'tabline'. | |
7 | 1214 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1215 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1216 win_redr_custom( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1217 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
|
1218 int draw_ruler) // TRUE or FALSE |
7 | 1219 { |
5539 | 1220 static int entered = FALSE; |
7 | 1221 int attr; |
1222 int curattr; | |
1223 int row; | |
1224 int col = 0; | |
1225 int maxwidth; | |
1226 int width; | |
1227 int n; | |
1228 int len; | |
1229 int fillchar; | |
1230 char_u buf[MAXPATHL]; | |
1983 | 1231 char_u *stl; |
7 | 1232 char_u *p; |
22721
92a100fc5e17
patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents:
21929
diff
changeset
|
1233 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
|
1234 stl_hlrec_T *tabtab; |
677 | 1235 int use_sandbox = FALSE; |
2693 | 1236 win_T *ewp; |
1237 int p_crb_save; | |
7 | 1238 |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1239 // 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
|
1240 // 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
|
1241 // Avoid trouble by not allowing recursion. |
5539 | 1242 if (entered) |
1243 return; | |
1244 entered = TRUE; | |
1245 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1246 // setup environment for the task at hand |
677 | 1247 if (wp == NULL) |
1248 { | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1249 // Use 'tabline'. Always at the first line of the screen. |
1983 | 1250 stl = p_tal; |
677 | 1251 row = 0; |
707 | 1252 fillchar = ' '; |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
1253 attr = HL_ATTR(HLF_TPF); |
677 | 1254 maxwidth = Columns; |
1255 # ifdef FEAT_EVAL | |
681 | 1256 use_sandbox = was_set_insecurely((char_u *)"tabline", 0); |
677 | 1257 # endif |
1258 } | |
40 | 1259 else |
677 | 1260 { |
24289
8938c0c98149
patch 8.2.2685: custom statusline not drawn correctly with WinBar
Bram Moolenaar <Bram@vim.org>
parents:
24184
diff
changeset
|
1261 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
|
1262 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
|
1263 maxwidth = wp->w_width; |
677 | 1264 |
1265 if (draw_ruler) | |
1266 { | |
1983 | 1267 stl = p_ruf; |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1268 // advance past any leading group spec - implicit in ru_col |
1983 | 1269 if (*stl == '%') |
1270 { | |
1271 if (*++stl == '-') | |
1272 stl++; | |
1273 if (atoi((char *)stl)) | |
1274 while (VIM_ISDIGIT(*stl)) | |
1275 stl++; | |
1276 if (*stl++ != '(') | |
1277 stl = p_ruf; | |
677 | 1278 } |
12515
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
1279 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
|
1280 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
|
1281 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
|
1282 maxwidth = wp->w_width - col; |
677 | 1283 if (!wp->w_status_height) |
1284 { | |
1285 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
|
1286 --maxwidth; // writing in last column may cause scrolling |
677 | 1287 fillchar = ' '; |
1288 attr = 0; | |
1289 } | |
1290 | |
1291 # ifdef FEAT_EVAL | |
681 | 1292 use_sandbox = was_set_insecurely((char_u *)"rulerformat", 0); |
677 | 1293 # endif |
1294 } | |
1295 else | |
1296 { | |
1297 if (*wp->w_p_stl != NUL) | |
1983 | 1298 stl = wp->w_p_stl; |
677 | 1299 else |
1983 | 1300 stl = p_stl; |
677 | 1301 # ifdef FEAT_EVAL |
681 | 1302 use_sandbox = was_set_insecurely((char_u *)"statusline", |
1303 *wp->w_p_stl == NUL ? 0 : OPT_LOCAL); | |
677 | 1304 # endif |
1305 } | |
1306 | |
12513
3ca08bf99396
patch 8.0.1135: W_WINCOL() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12510
diff
changeset
|
1307 col += wp->w_wincol; |
677 | 1308 } |
1309 | |
7 | 1310 if (maxwidth <= 0) |
5539 | 1311 goto theend; |
677 | 1312 |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1313 // 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
|
1314 // the cursor away and back. |
2693 | 1315 ewp = wp == NULL ? curwin : wp; |
1316 p_crb_save = ewp->w_p_crb; | |
1317 ewp->w_p_crb = FALSE; | |
1318 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1319 // 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
|
1320 // might change the option value and free the memory. |
1983 | 1321 stl = vim_strsave(stl); |
2693 | 1322 width = build_stl_str_hl(ewp, buf, sizeof(buf), |
1983 | 1323 stl, use_sandbox, |
22721
92a100fc5e17
patch 8.2.1909: number of status line items is limited to 80
Bram Moolenaar <Bram@vim.org>
parents:
21929
diff
changeset
|
1324 fillchar, maxwidth, &hltab, &tabtab); |
1983 | 1325 vim_free(stl); |
2693 | 1326 ewp->w_p_crb = p_crb_save; |
2661 | 1327 |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1328 // Make all characters printable. |
2661 | 1329 p = transstr(buf); |
1330 if (p != NULL) | |
1331 { | |
1332 vim_strncpy(buf, p, sizeof(buf) - 1); | |
1333 vim_free(p); | |
1334 } | |
1335 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1336 // fill up with "fillchar" |
835 | 1337 len = (int)STRLEN(buf); |
1883 | 1338 while (width < maxwidth && len < (int)sizeof(buf) - 1) |
7 | 1339 { |
1340 len += (*mb_char2bytes)(fillchar, buf + len); | |
1341 ++width; | |
1342 } | |
1343 buf[len] = NUL; | |
1344 | |
681 | 1345 /* |
1346 * Draw each snippet with the specified highlighting. | |
1347 */ | |
7 | 1348 curattr = attr; |
1349 p = buf; | |
681 | 1350 for (n = 0; hltab[n].start != NULL; n++) |
1351 { | |
1352 len = (int)(hltab[n].start - p); | |
7 | 1353 screen_puts_len(p, len, row, col, curattr); |
1354 col += vim_strnsize(p, len); | |
681 | 1355 p = hltab[n].start; |
1356 | |
1357 if (hltab[n].userhl == 0) | |
7 | 1358 curattr = attr; |
681 | 1359 else if (hltab[n].userhl < 0) |
1360 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
|
1361 #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
|
1362 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
|
1363 && 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
|
1364 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
|
1365 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
|
1366 && 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
|
1367 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
|
1368 #endif |
680 | 1369 else if (wp != NULL && wp != curwin && wp->w_status_height != 0) |
681 | 1370 curattr = highlight_stlnc[hltab[n].userhl - 1]; |
7 | 1371 else |
681 | 1372 curattr = highlight_user[hltab[n].userhl - 1]; |
7 | 1373 } |
1374 screen_puts(p, row, col, curattr); | |
681 | 1375 |
1376 if (wp == NULL) | |
1377 { | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1378 // Fill the TabPageIdxs[] array for clicking in the tab pagesline. |
681 | 1379 col = 0; |
1380 len = 0; | |
1381 p = buf; | |
1382 fillchar = 0; | |
1383 for (n = 0; tabtab[n].start != NULL; n++) | |
1384 { | |
1385 len += vim_strnsize(p, (int)(tabtab[n].start - p)); | |
1386 while (col < len) | |
1387 TabPageIdxs[col++] = fillchar; | |
1388 p = tabtab[n].start; | |
1389 fillchar = tabtab[n].userhl; | |
1390 } | |
1391 while (col < Columns) | |
1392 TabPageIdxs[col++] = fillchar; | |
1393 } | |
5539 | 1394 |
1395 theend: | |
1396 entered = FALSE; | |
7 | 1397 } |
1398 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1399 #endif // FEAT_STL_OPT |
7 | 1400 |
1401 /* | |
1402 * Output a single character directly to the screen and update ScreenLines. | |
1403 */ | |
1404 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1405 screen_putchar(int c, int row, int col, int attr) |
7 | 1406 { |
3549 | 1407 char_u buf[MB_MAXBYTES + 1]; |
1408 | |
1409 if (has_mbyte) | |
1410 buf[(*mb_char2bytes)(c, buf)] = NUL; | |
1411 else | |
1412 { | |
1413 buf[0] = c; | |
1414 buf[1] = NUL; | |
1415 } | |
7 | 1416 screen_puts(buf, row, col, attr); |
1417 } | |
1418 | |
1419 /* | |
1420 * Get a single character directly from ScreenLines into "bytes[]". | |
1421 * Also return its attribute in *attrp; | |
1422 */ | |
1423 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1424 screen_getbytes(int row, int col, char_u *bytes, int *attrp) |
7 | 1425 { |
1426 unsigned off; | |
1427 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1428 // safety check |
7 | 1429 if (ScreenLines != NULL && row < screen_Rows && col < screen_Columns) |
1430 { | |
1431 off = LineOffset[row] + col; | |
1432 *attrp = ScreenAttrs[off]; | |
1433 bytes[0] = ScreenLines[off]; | |
1434 bytes[1] = NUL; | |
1435 | |
1436 if (enc_utf8 && ScreenLinesUC[off] != 0) | |
1437 bytes[utfc_char2bytes(off, bytes)] = NUL; | |
1438 else if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e) | |
1439 { | |
1440 bytes[0] = ScreenLines[off]; | |
1441 bytes[1] = ScreenLines2[off]; | |
1442 bytes[2] = NUL; | |
1443 } | |
1444 else if (enc_dbcs && MB_BYTE2LEN(bytes[0]) > 1) | |
1445 { | |
1446 bytes[1] = ScreenLines[off + 1]; | |
1447 bytes[2] = NUL; | |
1448 } | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1449 } |
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1450 } |
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1451 |
714 | 1452 /* |
1453 * Return TRUE if composing characters for screen posn "off" differs from | |
1454 * composing characters in "u8cc". | |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1455 * Only to be used when ScreenLinesUC[off] != 0. |
714 | 1456 */ |
1457 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1458 screen_comp_differs(int off, int *u8cc) |
714 | 1459 { |
1460 int i; | |
1461 | |
1462 for (i = 0; i < Screen_mco; ++i) | |
1463 { | |
1464 if (ScreenLinesC[i][off] != (u8char_T)u8cc[i]) | |
1465 return TRUE; | |
1466 if (u8cc[i] == 0) | |
1467 break; | |
1468 } | |
1469 return FALSE; | |
1470 } | |
1471 | |
7 | 1472 /* |
1473 * Put string '*text' on the screen at position 'row' and 'col', with | |
1474 * attributes 'attr', and update ScreenLines[] and ScreenAttrs[]. | |
1475 * Note: only outputs within one row, message is truncated at screen boundary! | |
1476 * Note: if ScreenLines[], row and/or col is invalid, nothing is done. | |
1477 */ | |
1478 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1479 screen_puts( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1480 char_u *text, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1481 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1482 int col, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1483 int attr) |
7 | 1484 { |
1485 screen_puts_len(text, -1, row, col, attr); | |
1486 } | |
1487 | |
1488 /* | |
1489 * Like screen_puts(), but output "text[len]". When "len" is -1 output up to | |
1490 * a NUL. | |
1491 */ | |
1492 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1493 screen_puts_len( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1494 char_u *text, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1495 int textlen, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1496 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1497 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
|
1498 int attr_arg) |
7 | 1499 { |
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
|
1500 int attr = attr_arg; |
7 | 1501 unsigned off; |
1502 char_u *ptr = text; | |
5923 | 1503 int len = textlen; |
7 | 1504 int c; |
1378 | 1505 unsigned max_off; |
7 | 1506 int mbyte_blen = 1; |
1507 int mbyte_cells = 1; | |
1508 int u8c = 0; | |
714 | 1509 int u8cc[MAX_MCO]; |
7 | 1510 int clear_next_cell = FALSE; |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1511 #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
|
1512 int prev_c = 0; // previous Arabic character |
714 | 1513 int pc, nc, nc1; |
1514 int pcc[MAX_MCO]; | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1515 #endif |
1843 | 1516 int force_redraw_this; |
1517 int force_redraw_next = FALSE; | |
1518 int need_redraw; | |
7 | 1519 |
16914
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1520 // 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
|
1521 // #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
|
1522 if (ScreenLines == NULL |
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1523 || row >= screen_Rows || row < 0 |
66a94fd8e37d
patch 8.1.1458: crash when using gtags
Bram Moolenaar <Bram@vim.org>
parents:
16910
diff
changeset
|
1524 || col >= screen_Columns || col < 0) |
7 | 1525 return; |
1843 | 1526 off = LineOffset[row] + col; |
7 | 1527 |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
1528 // 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
|
1529 // left half. Only needed in a terminal. |
1685 | 1530 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
|
1531 #ifdef FEAT_GUI |
1668 | 1532 && !gui.in_use |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1533 #endif |
1668 | 1534 && mb_fix_col(col, row) != col) |
1843 | 1535 { |
1536 ScreenLines[off - 1] = ' '; | |
1537 ScreenAttrs[off - 1] = 0; | |
1538 if (enc_utf8) | |
1539 { | |
1540 ScreenLinesUC[off - 1] = 0; | |
1541 ScreenLinesC[0][off - 1] = 0; | |
1542 } | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1543 // redraw the previous cell, make it empty |
1843 | 1544 screen_char(off - 1, row, col - 1); |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1545 // force the cell at "col" to be redrawn |
1843 | 1546 force_redraw_next = TRUE; |
1547 } | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1548 |
1378 | 1549 max_off = LineOffset[row] + screen_Columns; |
1340 | 1550 while (col < screen_Columns |
1551 && (len < 0 || (int)(ptr - text) < len) | |
1552 && *ptr != NUL) | |
7 | 1553 { |
1554 c = *ptr; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1555 // check if this is the first byte of a multibyte |
7 | 1556 if (has_mbyte) |
1557 { | |
1558 if (enc_utf8 && len > 0) | |
474 | 1559 mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr)); |
7 | 1560 else |
474 | 1561 mbyte_blen = (*mb_ptr2len)(ptr); |
7 | 1562 if (enc_dbcs == DBCS_JPNU && c == 0x8e) |
1563 mbyte_cells = 1; | |
1564 else if (enc_dbcs != 0) | |
1565 mbyte_cells = mbyte_blen; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1566 else // enc_utf8 |
7 | 1567 { |
1568 if (len >= 0) | |
714 | 1569 u8c = utfc_ptr2char_len(ptr, u8cc, |
7 | 1570 (int)((text + len) - ptr)); |
1571 else | |
714 | 1572 u8c = utfc_ptr2char(ptr, u8cc); |
7 | 1573 mbyte_cells = utf_char2cells(u8c); |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1574 #ifdef FEAT_ARABIC |
7 | 1575 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c)) |
1576 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1577 // Do Arabic shaping. |
7 | 1578 if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len) |
1579 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1580 // Past end of string to be displayed. |
7 | 1581 nc = NUL; |
1582 nc1 = NUL; | |
1583 } | |
1584 else | |
714 | 1585 { |
1994 | 1586 nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc, |
1587 (int)((text + len) - ptr - mbyte_blen)); | |
714 | 1588 nc1 = pcc[0]; |
1589 } | |
7 | 1590 pc = prev_c; |
1591 prev_c = u8c; | |
714 | 1592 u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc); |
7 | 1593 } |
1594 else | |
1595 prev_c = u8c; | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1596 #endif |
2055
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1597 if (col + mbyte_cells > screen_Columns) |
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1598 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1599 // 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
|
1600 // 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
|
1601 c = '>'; |
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1602 mbyte_cells = 1; |
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
1603 } |
7 | 1604 } |
1605 } | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
1606 |
1843 | 1607 force_redraw_this = force_redraw_next; |
1608 force_redraw_next = FALSE; | |
1609 | |
1610 need_redraw = ScreenLines[off] != c | |
7 | 1611 || (mbyte_cells == 2 |
1612 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0)) | |
1613 || (enc_dbcs == DBCS_JPNU | |
1614 && c == 0x8e | |
1615 && ScreenLines2[off] != ptr[1]) | |
1616 || (enc_utf8 | |
2124
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1617 && (ScreenLinesUC[off] != |
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1618 (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
|
1619 || (ScreenLinesUC[off] != 0 |
dc8a5699253b
updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents:
2122
diff
changeset
|
1620 && screen_comp_differs(off, u8cc)))) |
7 | 1621 || ScreenAttrs[off] != attr |
1843 | 1622 || exmode_active; |
1623 | |
16998
2ec0f953ec3f
patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents:
16994
diff
changeset
|
1624 if ((need_redraw || force_redraw_this) |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
1625 #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
|
1626 && !blocked_by_popup(row, col) |
16998
2ec0f953ec3f
patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents:
16994
diff
changeset
|
1627 #endif |
2ec0f953ec3f
patch 8.1.1499: ruler not updated after popup window was removed
Bram Moolenaar <Bram@vim.org>
parents:
16994
diff
changeset
|
1628 ) |
7 | 1629 { |
1630 #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
|
1631 // 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
|
1632 // 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
|
1633 // 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
|
1634 // and for some xterms. |
1843 | 1635 if (need_redraw && ScreenLines[off] != ' ' && ( |
7 | 1636 # ifdef FEAT_GUI |
1637 gui.in_use | |
1638 # endif | |
1639 # if defined(FEAT_GUI) && defined(UNIX) | |
1640 || | |
1641 # endif | |
1642 # ifdef UNIX | |
1643 term_is_xterm | |
1644 # endif | |
1843 | 1645 )) |
1646 { | |
1647 int n = ScreenAttrs[off]; | |
1648 | |
1649 if (n > HL_ALL) | |
1650 n = syn_attr2attr(n); | |
1651 if (n & HL_BOLD) | |
1652 force_redraw_next = TRUE; | |
7 | 1653 } |
1654 #endif | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1655 // 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
|
1656 // 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
|
1657 // 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
|
1658 // 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
|
1659 // (mb_off2cells() may return 2 on the right half). |
7 | 1660 if (clear_next_cell) |
1661 clear_next_cell = FALSE; | |
1662 else if (has_mbyte | |
1663 && (len < 0 ? ptr[mbyte_blen] == NUL | |
1664 : ptr + mbyte_blen >= text + len) | |
1378 | 1665 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) |
7 | 1666 || (mbyte_cells == 2 |
1378 | 1667 && (*mb_off2cells)(off, max_off) == 1 |
1668 && (*mb_off2cells)(off + 1, max_off) > 1))) | |
7 | 1669 clear_next_cell = TRUE; |
1670 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1671 // 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
|
1672 // it confuses mb_off2cells(). |
7 | 1673 if (enc_dbcs |
1378 | 1674 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1) |
7 | 1675 || (mbyte_cells == 2 |
1378 | 1676 && (*mb_off2cells)(off, max_off) == 1 |
1677 && (*mb_off2cells)(off + 1, max_off) > 1))) | |
7 | 1678 ScreenLines[off + mbyte_blen] = 0; |
1679 ScreenLines[off] = c; | |
1680 ScreenAttrs[off] = attr; | |
1681 if (enc_utf8) | |
1682 { | |
714 | 1683 if (c < 0x80 && u8cc[0] == 0) |
7 | 1684 ScreenLinesUC[off] = 0; |
1685 else | |
1686 { | |
714 | 1687 int i; |
1688 | |
7 | 1689 ScreenLinesUC[off] = u8c; |
714 | 1690 for (i = 0; i < Screen_mco; ++i) |
1691 { | |
1692 ScreenLinesC[i][off] = u8cc[i]; | |
1693 if (u8cc[i] == 0) | |
1694 break; | |
1695 } | |
7 | 1696 } |
1697 if (mbyte_cells == 2) | |
1698 { | |
1699 ScreenLines[off + 1] = 0; | |
1700 ScreenAttrs[off + 1] = attr; | |
1701 } | |
1702 screen_char(off, row, col); | |
1703 } | |
1704 else if (mbyte_cells == 2) | |
1705 { | |
1706 ScreenLines[off + 1] = ptr[1]; | |
1707 ScreenAttrs[off + 1] = attr; | |
1708 screen_char_2(off, row, col); | |
1709 } | |
1710 else if (enc_dbcs == DBCS_JPNU && c == 0x8e) | |
1711 { | |
1712 ScreenLines2[off] = ptr[1]; | |
1713 screen_char(off, row, col); | |
1714 } | |
1715 else | |
1716 screen_char(off, row, col); | |
1717 } | |
1718 if (has_mbyte) | |
1719 { | |
1720 off += mbyte_cells; | |
1721 col += mbyte_cells; | |
1722 ptr += mbyte_blen; | |
1723 if (clear_next_cell) | |
5923 | 1724 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1725 // 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
|
1726 // Keep the attribute from before. |
7 | 1727 ptr = (char_u *)" "; |
5923 | 1728 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
|
1729 attr = ScreenAttrs[off]; |
5923 | 1730 } |
7 | 1731 } |
1732 else | |
1733 { | |
1734 ++off; | |
1735 ++col; | |
1736 ++ptr; | |
1737 } | |
1738 } | |
1843 | 1739 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1740 // 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
|
1741 // doesn't extend up to there, update the character here. |
1843 | 1742 if (force_redraw_next && col < screen_Columns) |
1743 { | |
1744 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1) | |
1745 screen_char_2(off, row, col); | |
1746 else | |
1747 screen_char(off, row, col); | |
1748 } | |
7 | 1749 } |
1750 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1751 #if defined(FEAT_SEARCH_EXTRA) || defined(PROTO) |
7 | 1752 /* |
1326 | 1753 * Prepare for 'hlsearch' highlighting. |
7 | 1754 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1755 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1756 start_search_hl(void) |
7 | 1757 { |
1758 if (p_hls && !no_hlsearch) | |
1759 { | |
20251
9620ab71f4f3
patch 8.2.0681: pattern for 'hlsearch' highlighting may leak
Bram Moolenaar <Bram@vim.org>
parents:
20227
diff
changeset
|
1760 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
|
1761 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
|
1762 screen_search_hl.attr = HL_ATTR(HLF_L); |
7 | 1763 } |
1764 } | |
1765 | |
1766 /* | |
1326 | 1767 * Clean up for 'hlsearch' highlighting. |
7 | 1768 */ |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1769 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1770 end_search_hl(void) |
7 | 1771 { |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1772 if (screen_search_hl.rm.regprog != NULL) |
7 | 1773 { |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
1774 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
|
1775 screen_search_hl.rm.regprog = NULL; |
7 | 1776 } |
1777 } | |
5985 | 1778 #endif |
5979 | 1779 |
7 | 1780 static void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1781 screen_start_highlight(int attr) |
7 | 1782 { |
1783 attrentry_T *aep = NULL; | |
1784 | |
1785 screen_attr = attr; | |
1786 if (full_screen | |
15868
7fad90423bd2
patch 8.1.0941: macros for MS-Windows are inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15850
diff
changeset
|
1787 #ifdef MSWIN |
7 | 1788 && termcap_active |
1789 #endif | |
1790 ) | |
1791 { | |
1792 #ifdef FEAT_GUI | |
1793 if (gui.in_use) | |
1794 { | |
1795 char buf[20]; | |
1796 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1797 // 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
|
1798 sprintf(buf, "\033|%dh", attr); |
7 | 1799 OUT_STR(buf); |
1800 } | |
1801 else | |
1802 #endif | |
1803 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1804 if (attr > HL_ALL) // special HL attr. |
7 | 1805 { |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1806 if (IS_CTERM) |
7 | 1807 aep = syn_cterm_attr2entry(attr); |
1808 else | |
1809 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
|
1810 if (aep == NULL) // did ":syntax clear" |
7 | 1811 attr = 0; |
1812 else | |
1813 attr = aep->ae_attr; | |
1814 } | |
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
|
1815 #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
|
1816 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
|
1817 { |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1818 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
|
1819 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
|
1820 |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1821 // 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
|
1822 // 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
|
1823 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
|
1824 &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
|
1825 |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1826 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
|
1827 { |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1828 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
|
1829 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
|
1830 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
|
1831 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
|
1832 } |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1833 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
|
1834 { |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1835 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
|
1836 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
|
1837 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
|
1838 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
|
1839 } |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1840 } |
1756fe125914
patch 8.1.2382: MS-Windows: When using VTP bold+inverse doesn't work
Bram Moolenaar <Bram@vim.org>
parents:
18763
diff
changeset
|
1841 #endif |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1842 if ((attr & HL_BOLD) && *T_MD != NUL) // bold |
7 | 1843 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
|
1844 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
|
1845 #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
|
1846 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
|
1847 ? 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
|
1848 : |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1849 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1850 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
|
1851 // 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
|
1852 // has a FG color defined, clear BOLD. |
681 | 1853 out_str(T_ME); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1854 if ((attr & HL_STANDOUT) && *T_SO != NUL) // standout |
7 | 1855 out_str(T_SO); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1856 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
|
1857 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
|
1858 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
|
1859 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
|
1860 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
|
1861 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
|
1862 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
|
1863 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
|
1864 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
|
1865 || ((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
|
1866 || ((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
|
1867 || ((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
|
1868 || ((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
|
1869 && *T_US != NUL) |
7 | 1870 out_str(T_US); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1871 if ((attr & HL_ITALIC) && *T_CZH != NUL) // italic |
7 | 1872 out_str(T_CZH); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1873 if ((attr & HL_INVERSE) && *T_MR != NUL) // inverse (reverse) |
7 | 1874 out_str(T_MR); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1875 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
|
1876 out_str(T_STS); |
7 | 1877 |
1878 /* | |
1879 * Output the color or start string after bold etc., in case the | |
1880 * bold etc. override the color setting. | |
1881 */ | |
1882 if (aep != NULL) | |
1883 { | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1884 #ifdef FEAT_TERMGUICOLORS |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1885 // 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
|
1886 // 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
|
1887 // 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
|
1888 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
|
1889 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1890 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
|
1891 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
|
1892 } |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1893 else |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1894 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1895 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
|
1896 { |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1897 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
|
1898 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
|
1899 } |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1900 #ifdef FEAT_TERMGUICOLORS |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1901 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
|
1902 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
1903 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
|
1904 term_bg_rgb_color(aep->ae_u.cterm.bg_rgb); |
7 | 1905 } |
1906 else | |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1907 #endif |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1908 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
|
1909 { |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1910 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
|
1911 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
|
1912 } |
20619
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1913 #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
|
1914 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
|
1915 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1916 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
|
1917 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
|
1918 } |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1919 else |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1920 #endif |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1921 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
|
1922 { |
68c206d3a251
patch 8.2.0863: cannot set a separate color for underline/undercurl
Bram Moolenaar <Bram@vim.org>
parents:
20591
diff
changeset
|
1923 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
|
1924 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
|
1925 } |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1926 |
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
|
1927 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
|
1928 { |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1929 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
|
1930 out_str(aep->ae_u.term.start); |
7 | 1931 } |
1932 } | |
1933 } | |
1934 } | |
1935 } | |
1936 | |
1937 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
1938 screen_stop_highlight(void) |
7 | 1939 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1940 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
|
1941 #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
|
1942 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
|
1943 #endif |
7 | 1944 |
1945 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
|
1946 #ifdef MSWIN |
7 | 1947 && termcap_active |
1948 #endif | |
1949 ) | |
1950 { | |
1951 #ifdef FEAT_GUI | |
1952 if (gui.in_use) | |
1953 { | |
1954 char buf[20]; | |
1955 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1956 // use internal GUI code |
27490
fb4c30606b4a
patch 8.2.4273: the EBCDIC support is outdated
Bram Moolenaar <Bram@vim.org>
parents:
26865
diff
changeset
|
1957 sprintf(buf, "\033|%dH", screen_attr); |
7 | 1958 OUT_STR(buf); |
1959 } | |
1960 else | |
1961 #endif | |
1962 { | |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
1963 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
|
1964 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
1965 if (screen_attr > HL_ALL) // special HL attr. |
7 | 1966 { |
1967 attrentry_T *aep; | |
1968 | |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
1969 if (IS_CTERM) |
7 | 1970 { |
1971 /* | |
1972 * Assume that t_me restores the original colors! | |
1973 */ | |
1974 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
|
1975 if (aep != NULL && (( |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
1976 #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
|
1977 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
|
1978 ? 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
|
1979 # 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
|
1980 ? !(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
|
1981 # endif |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1982 : |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1983 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1984 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
|
1985 #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
|
1986 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
|
1987 ? 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
|
1988 # 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
|
1989 ? !(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
|
1990 # endif |
13339
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1991 : |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1992 #endif |
da2a9e217200
patch 8.0.1544: when using 'termguicolors' SpellBad doesn't show
Christian Brabandt <cb@256bit.org>
parents:
13314
diff
changeset
|
1993 aep->ae_u.cterm.bg_color))) |
7 | 1994 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
|
1995 #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
|
1996 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
|
1997 { |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
1998 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
|
1999 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
|
2000 |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
2001 // 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
|
2002 // efficient. |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
2003 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
|
2004 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
|
2005 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
|
2006 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
|
2007 } |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
2008 else |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
2009 { |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
2010 // 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
|
2011 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
|
2012 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
|
2013 } |
f2e4c12b24b3
patch 8.2.0669: MS-Windows: display in VTP is a bit slow
Bram Moolenaar <Bram@vim.org>
parents:
20154
diff
changeset
|
2014 #endif |
7 | 2015 } |
2016 else | |
2017 { | |
2018 aep = syn_term_attr2entry(screen_attr); | |
2019 if (aep != NULL && aep->ae_u.term.stop != NULL) | |
2020 { | |
2021 if (STRCMP(aep->ae_u.term.stop, T_ME) == 0) | |
2022 do_ME = TRUE; | |
2023 else | |
2024 out_str(aep->ae_u.term.stop); | |
2025 } | |
2026 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2027 if (aep == NULL) // did ":syntax clear" |
7 | 2028 screen_attr = 0; |
2029 else | |
2030 screen_attr = aep->ae_attr; | |
2031 } | |
2032 | |
2033 /* | |
2034 * Often all ending-codes are equal to T_ME. Avoid outputting the | |
2035 * same sequence several times. | |
2036 */ | |
2037 if (screen_attr & HL_STANDOUT) | |
2038 { | |
2039 if (STRCMP(T_SE, T_ME) == 0) | |
2040 do_ME = TRUE; | |
2041 else | |
2042 out_str(T_SE); | |
2043 } | |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
2044 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
|
2045 | 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
|
2046 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
|
2047 { |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
2048 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
|
2049 do_ME = TRUE; |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
2050 else |
339681756948
patch 8.0.1358: undercurl is not used in the terminal
Christian Brabandt <cb@256bit.org>
parents:
12700
diff
changeset
|
2051 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
|
2052 } |
29328
60977de70684
patch 9.0.0007: no support for double, dotted and dashed underlines
Bram Moolenaar <Bram@vim.org>
parents:
29308
diff
changeset
|
2053 if ((screen_attr & HL_UNDERLINE) || (is_under && *T_UCE == NUL)) |
7 | 2054 { |
2055 if (STRCMP(T_UE, T_ME) == 0) | |
2056 do_ME = TRUE; | |
2057 else | |
2058 out_str(T_UE); | |
2059 } | |
2060 if (screen_attr & HL_ITALIC) | |
2061 { | |
2062 if (STRCMP(T_CZR, T_ME) == 0) | |
2063 do_ME = TRUE; | |
2064 else | |
2065 out_str(T_CZR); | |
2066 } | |
12317
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
2067 if (screen_attr & HL_STRIKETHROUGH) |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
2068 { |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
2069 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
|
2070 do_ME = TRUE; |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
2071 else |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
2072 out_str(T_STE); |
2a8890b80923
patch 8.0.1038: strike-through text not supported
Christian Brabandt <cb@256bit.org>
parents:
12293
diff
changeset
|
2073 } |
7 | 2074 if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE))) |
2075 out_str(T_ME); | |
2076 | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
2077 #ifdef FEAT_TERMGUICOLORS |
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
2078 if (p_tgc) |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2079 { |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
2080 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
|
2081 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
|
2082 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
|
2083 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
|
2084 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
|
2085 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
|
2086 } |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2087 else |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2088 #endif |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2089 { |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2090 if (t_colors > 1) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2091 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2092 // set Normal cterm colors |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2093 if (cterm_normal_fg_color != 0) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2094 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
|
2095 if (cterm_normal_bg_color != 0) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2096 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
|
2097 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
|
2098 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
|
2099 if (cterm_normal_fg_bold) |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2100 out_str(T_MD); |
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2101 } |
7 | 2102 } |
2103 } | |
2104 } | |
2105 screen_attr = 0; | |
2106 } | |
2107 | |
2108 /* | |
2109 * Reset the colors for a cterm. Used when leaving Vim. | |
2110 * The machine specific code may override this again. | |
2111 */ | |
2112 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2113 reset_cterm_colors(void) |
7 | 2114 { |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2115 if (IS_CTERM) |
7 | 2116 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2117 // set Normal cterm colors |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
2118 #ifdef FEAT_TERMGUICOLORS |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
2119 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
|
2120 || cterm_normal_bg_gui_color != INVALCOLOR) |
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
2121 : (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
|
2122 #else |
7 | 2123 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
|
2124 #endif |
7 | 2125 { |
2126 out_str(T_OP); | |
2127 screen_attr = -1; | |
2128 } | |
2129 if (cterm_normal_fg_bold) | |
2130 { | |
2131 out_str(T_ME); | |
2132 screen_attr = -1; | |
2133 } | |
2134 } | |
2135 } | |
2136 | |
2137 /* | |
2138 * Put character ScreenLines["off"] on the screen at position "row" and "col", | |
2139 * using the attributes from ScreenAttrs["off"]. | |
2140 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
2141 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2142 screen_char(unsigned off, int row, int col) |
7 | 2143 { |
2144 int attr; | |
2145 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2146 // 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
|
2147 // resizing). |
7 | 2148 if (row >= screen_Rows || col >= screen_Columns) |
2149 return; | |
2150 | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2151 // Skip if under the popup menu. |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2152 // Popup windows with zindex higher than POPUPMENU_ZINDEX go on top. |
26165
7b07f361b1d4
patch 8.2.3614: zindex of popup windows not used when redrawing popup menu
Bram Moolenaar <Bram@vim.org>
parents:
25978
diff
changeset
|
2153 if (pum_under_menu(row, col, TRUE) |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2154 #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
|
2155 && screen_zindex <= POPUPMENU_ZINDEX |
17809
59f8948b7590
patch 8.1.1901: the +insert_expand feature is not always available
Bram Moolenaar <Bram@vim.org>
parents:
17771
diff
changeset
|
2156 #endif |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2157 ) |
15521
6d949e552e99
patch 8.1.0768: updating completions may cause the popup menu to flicker
Bram Moolenaar <Bram@vim.org>
parents:
15502
diff
changeset
|
2158 return; |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2159 #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
|
2160 if (blocked_by_popup(row, col)) |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2161 return; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2162 #endif |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2163 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2164 // 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
|
2165 // 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
|
2166 // mark the character invalid (update it when scrolled up). |
6602 | 2167 if (*T_XN == NUL |
2168 && row == screen_Rows - 1 && col == screen_Columns - 1 | |
7 | 2169 #ifdef FEAT_RIGHTLEFT |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2170 // account for first command-line character in rightleft mode |
7 | 2171 && !cmdmsg_rl |
2172 #endif | |
2173 ) | |
2174 { | |
2175 ScreenAttrs[off] = (sattr_T)-1; | |
2176 return; | |
2177 } | |
2178 | |
2179 /* | |
2180 * Stop highlighting first, so it's easier to move the cursor. | |
2181 */ | |
2182 if (screen_char_attr != 0) | |
2183 attr = screen_char_attr; | |
2184 else | |
2185 attr = ScreenAttrs[off]; | |
2186 if (screen_attr != attr) | |
2187 screen_stop_highlight(); | |
2188 | |
2189 windgoto(row, col); | |
2190 | |
2191 if (screen_attr != attr) | |
2192 screen_start_highlight(attr); | |
2193 | |
2194 if (enc_utf8 && ScreenLinesUC[off] != 0) | |
2195 { | |
2196 char_u buf[MB_MAXBYTES + 1]; | |
2197 | |
8819
a1132255e3e1
commit https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30
Christian Brabandt <cb@256bit.org>
parents:
8817
diff
changeset
|
2198 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
|
2199 { |
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
2200 if (*p_ambw == 'd' |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2201 #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
|
2202 && !gui.in_use |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2203 #endif |
13024
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
2204 ) |
27934188d7b5
patch 8.0.1388: char not overwritten with ambiguous width char
Christian Brabandt <cb@256bit.org>
parents:
12998
diff
changeset
|
2205 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2206 // 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
|
2207 // 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
|
2208 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
|
2209 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
|
2210 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2211 // 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
|
2212 // character |
8819
a1132255e3e1
commit https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30
Christian Brabandt <cb@256bit.org>
parents:
8817
diff
changeset
|
2213 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
|
2214 } |
8819
a1132255e3e1
commit https://github.com/vim/vim/commit/cb0700844c1274fe8bc0ceaffaee0ad21c406f30
Christian Brabandt <cb@256bit.org>
parents:
8817
diff
changeset
|
2215 else if (utf_char2cells(ScreenLinesUC[off]) > 1) |
7 | 2216 ++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
|
2217 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2218 // 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
|
2219 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
|
2220 out_str(buf); |
7 | 2221 } |
2222 else | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2223 { |
7 | 2224 out_flush_check(); |
2225 out_char(ScreenLines[off]); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2226 // double-byte character in single-width cell |
7 | 2227 if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e) |
2228 out_char(ScreenLines2[off]); | |
2229 } | |
2230 | |
2231 screen_cur_col++; | |
2232 } | |
2233 | |
2234 /* | |
2235 * Used for enc_dbcs only: Put one double-wide character at ScreenLines["off"] | |
2236 * on the screen at position 'row' and 'col'. | |
2237 * The attributes of the first byte is used for all. This is required to | |
2238 * output the two bytes of a double-byte character with nothing in between. | |
2239 */ | |
2240 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2241 screen_char_2(unsigned off, int row, int col) |
7 | 2242 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2243 // Check for illegal values (could be wrong when screen was resized). |
7 | 2244 if (off + 1 >= (unsigned)(screen_Rows * screen_Columns)) |
2245 return; | |
2246 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2247 // Outputting the last character on the screen may scrollup the screen. |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2248 // Don't to it! Mark the character invalid (update it when scrolled up) |
7 | 2249 if (row == screen_Rows - 1 && col >= screen_Columns - 2) |
2250 { | |
2251 ScreenAttrs[off] = (sattr_T)-1; | |
2252 return; | |
2253 } | |
2254 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2255 // 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
|
2256 // second byte directly. |
7 | 2257 screen_char(off, row, col); |
2258 out_char(ScreenLines[off + 1]); | |
2259 ++screen_cur_col; | |
2260 } | |
2261 | |
2262 /* | |
2263 * Draw a rectangle of the screen, inverted when "invert" is TRUE. | |
2264 * This uses the contents of ScreenLines[] and doesn't change it. | |
2265 */ | |
2266 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2267 screen_draw_rectangle( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2268 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2269 int col, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2270 int height, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2271 int width, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2272 int invert) |
7 | 2273 { |
2274 int r, c; | |
2275 int off; | |
1378 | 2276 int max_off; |
7 | 2277 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2278 // Can't use ScreenLines unless initialized |
534 | 2279 if (ScreenLines == NULL) |
2280 return; | |
2281 | |
7 | 2282 if (invert) |
2283 screen_char_attr = HL_INVERSE; | |
2284 for (r = row; r < row + height; ++r) | |
2285 { | |
2286 off = LineOffset[r]; | |
1378 | 2287 max_off = off + screen_Columns; |
7 | 2288 for (c = col; c < col + width; ++c) |
2289 { | |
1378 | 2290 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1) |
7 | 2291 { |
2292 screen_char_2(off + c, r, c); | |
2293 ++c; | |
2294 } | |
2295 else | |
2296 { | |
2297 screen_char(off + c, r, c); | |
1378 | 2298 if (utf_off2cells(off + c, max_off) > 1) |
7 | 2299 ++c; |
2300 } | |
2301 } | |
2302 } | |
2303 screen_char_attr = 0; | |
2304 } | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
2305 |
7 | 2306 /* |
2307 * Redraw the characters for a vertically split window. | |
2308 */ | |
2309 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2310 redraw_block(int row, int end, win_T *wp) |
7 | 2311 { |
2312 int col; | |
2313 int width; | |
2314 | |
2315 # ifdef FEAT_CLIPBOARD | |
2316 clip_may_clear_selection(row, end - 1); | |
2317 # endif | |
2318 | |
2319 if (wp == NULL) | |
2320 { | |
2321 col = 0; | |
2322 width = Columns; | |
2323 } | |
2324 else | |
2325 { | |
2326 col = wp->w_wincol; | |
2327 width = wp->w_width; | |
2328 } | |
2329 screen_draw_rectangle(row, col, end - row, width, FALSE); | |
2330 } | |
2331 | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
2332 void |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2333 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
|
2334 { |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2335 ScreenLines[off] = ' '; |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2336 ScreenAttrs[off] = attr; |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2337 if (enc_utf8) |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2338 ScreenLinesUC[off] = 0; |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2339 } |
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2340 |
7 | 2341 /* |
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
|
2342 * 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
|
2343 * 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
|
2344 * "c2" in the other columns. Use attributes "attr". |
7 | 2345 */ |
2346 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2347 screen_fill( |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2348 int start_row, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2349 int end_row, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2350 int start_col, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2351 int end_col, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2352 int c1, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2353 int c2, |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2354 int attr) |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2355 { |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2356 int row; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2357 int col; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2358 int off; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2359 int end_off; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2360 int did_delete; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2361 int c; |
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2362 int norm_term; |
7 | 2363 #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
|
2364 int force_next = FALSE; |
7 | 2365 #endif |
2366 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2367 if (end_row > screen_Rows) // safety check |
7 | 2368 end_row = screen_Rows; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2369 if (end_col > screen_Columns) // safety check |
7 | 2370 end_col = screen_Columns; |
2371 if (ScreenLines == NULL | |
2372 || start_row >= end_row | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2373 || start_col >= end_col) // nothing to do |
7 | 2374 return; |
2375 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2376 // it's a "normal" terminal when not in a GUI or cterm |
7 | 2377 norm_term = ( |
2378 #ifdef FEAT_GUI | |
2379 !gui.in_use && | |
2380 #endif | |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
2381 !IS_CTERM); |
7 | 2382 for (row = start_row; row < end_row; ++row) |
2383 { | |
1668 | 2384 if (has_mbyte |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2385 #ifdef FEAT_GUI |
1668 | 2386 && !gui.in_use |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2387 #endif |
1668 | 2388 ) |
2389 { | |
26771
fc859aea8cec
patch 8.2.3914: various spelling mistakes in comments
Bram Moolenaar <Bram@vim.org>
parents:
26634
diff
changeset
|
2390 // 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
|
2391 // 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
|
2392 // 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
|
2393 // terminal. |
1685 | 2394 if (start_col > 0 && mb_fix_col(start_col, row) != start_col) |
1670 | 2395 screen_puts_len((char_u *)" ", 1, row, start_col - 1, 0); |
1677 | 2396 if (end_col < screen_Columns && mb_fix_col(end_col, row) != end_col) |
1670 | 2397 screen_puts_len((char_u *)" ", 1, row, end_col, 0); |
1668 | 2398 } |
7 | 2399 /* |
2400 * Try to use delete-line termcap code, when no attributes or in a | |
2401 * "normal" terminal, where a bold/italic space is just a | |
2402 * space. | |
2403 */ | |
2404 did_delete = FALSE; | |
2405 if (c2 == ' ' | |
2406 && end_col == Columns | |
2407 && can_clear(T_CE) | |
2408 && (attr == 0 | |
2409 || (norm_term | |
2410 && attr <= HL_ALL | |
2411 && ((attr & ~(HL_BOLD | HL_ITALIC)) == 0)))) | |
2412 { | |
2413 /* | |
2414 * check if we really need to clear something | |
2415 */ | |
2416 col = start_col; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2417 if (c1 != ' ') // don't clear first char |
7 | 2418 ++col; |
2419 | |
2420 off = LineOffset[row] + col; | |
2421 end_off = LineOffset[row] + end_col; | |
2422 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2423 // skip blanks (used often, keep it fast!) |
7 | 2424 if (enc_utf8) |
2425 while (off < end_off && ScreenLines[off] == ' ' | |
2426 && ScreenAttrs[off] == 0 && ScreenLinesUC[off] == 0) | |
2427 ++off; | |
2428 else | |
2429 while (off < end_off && ScreenLines[off] == ' ' | |
2430 && ScreenAttrs[off] == 0) | |
2431 ++off; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2432 if (off < end_off) // something to be cleared |
7 | 2433 { |
2434 col = off - LineOffset[row]; | |
2435 screen_stop_highlight(); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2436 term_windgoto(row, col);// clear rest of this screen line |
7 | 2437 out_str(T_CE); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2438 screen_start(); // don't know where cursor is now |
7 | 2439 col = end_col - col; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2440 while (col--) // clear chars in ScreenLines |
7 | 2441 { |
12487
3f16cf18386c
patch 8.0.1123: cannot define a toolbar for a window
Christian Brabandt <cb@256bit.org>
parents:
12477
diff
changeset
|
2442 space_to_screenline(off, 0); |
7 | 2443 ++off; |
2444 } | |
2445 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2446 did_delete = TRUE; // the chars are cleared now |
7 | 2447 } |
2448 | |
2449 off = LineOffset[row] + start_col; | |
2450 c = c1; | |
2451 for (col = start_col; col < end_col; ++col) | |
2452 { | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2453 if ((ScreenLines[off] != c |
714 | 2454 || (enc_utf8 && (int)ScreenLinesUC[off] |
2455 != (c >= 0x80 ? c : 0)) | |
7 | 2456 || ScreenAttrs[off] != attr |
2457 #if defined(FEAT_GUI) || defined(UNIX) | |
2458 || force_next | |
2459 #endif | |
2460 ) | |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2461 #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
|
2462 // Skip if under a(nother) popup. |
17162
f16cee6adf29
patch 8.1.1580: cannot make part of a popup transparent
Bram Moolenaar <Bram@vim.org>
parents:
17145
diff
changeset
|
2463 && !blocked_by_popup(row, col) |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2464 #endif |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2465 ) |
7 | 2466 { |
2467 #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
|
2468 // 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
|
2469 // 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
|
2470 // 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
|
2471 // own GUI and for some xterms. |
7 | 2472 if ( |
2473 # ifdef FEAT_GUI | |
2474 gui.in_use | |
2475 # endif | |
2476 # if defined(FEAT_GUI) && defined(UNIX) | |
2477 || | |
2478 # endif | |
2479 # ifdef UNIX | |
2480 term_is_xterm | |
2481 # endif | |
2482 ) | |
2483 { | |
2484 if (ScreenLines[off] != ' ' | |
2485 && (ScreenAttrs[off] > HL_ALL | |
2486 || ScreenAttrs[off] & HL_BOLD)) | |
2487 force_next = TRUE; | |
2488 else | |
2489 force_next = FALSE; | |
2490 } | |
2491 #endif | |
2492 ScreenLines[off] = c; | |
2493 if (enc_utf8) | |
2494 { | |
2495 if (c >= 0x80) | |
2496 { | |
2497 ScreenLinesUC[off] = c; | |
714 | 2498 ScreenLinesC[0][off] = 0; |
7 | 2499 } |
2500 else | |
2501 ScreenLinesUC[off] = 0; | |
2502 } | |
2503 ScreenAttrs[off] = attr; | |
2504 if (!did_delete || c != ' ') | |
2505 screen_char(off, row, col); | |
2506 } | |
2507 ++off; | |
2508 if (col == start_col) | |
2509 { | |
2510 if (did_delete) | |
2511 break; | |
2512 c = c2; | |
2513 } | |
2514 } | |
2515 if (end_col == Columns) | |
2516 LineWraps[row] = FALSE; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2517 if (row == Rows - 1) // overwritten the command line |
7 | 2518 { |
2519 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
|
2520 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
|
2521 && c1 == ' ' && c2 == ' ' && attr == 0) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2522 clear_cmdline = FALSE; // command line has been cleared |
644 | 2523 if (start_col == 0) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2524 mode_displayed = FALSE; // mode cleared or overwritten |
7 | 2525 } |
2526 } | |
2527 } | |
2528 | |
2529 /* | |
2530 * Check if there should be a delay. Used before clearing or redrawing the | |
2531 * screen or the command line. | |
2532 */ | |
2533 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2534 check_for_delay(int check_msg_scroll) |
7 | 2535 { |
2536 if ((emsg_on_display || (check_msg_scroll && msg_scroll)) | |
2537 && !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
|
2538 && 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
|
2539 && !in_assert_fails) |
7 | 2540 { |
2541 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
|
2542 ui_delay(1006L, TRUE); |
7 | 2543 emsg_on_display = FALSE; |
2544 if (check_msg_scroll) | |
2545 msg_scroll = FALSE; | |
2546 } | |
2547 } | |
2548 | |
2549 /* | |
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
|
2550 * 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
|
2551 */ |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2552 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
|
2553 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
|
2554 { |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2555 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
|
2556 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2557 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
|
2558 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
|
2559 } |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2560 |
57e0f6b4a87d
patch 8.1.1165: no test for mouse clicks in the terminal tabpage line
Bram Moolenaar <Bram@vim.org>
parents:
16211
diff
changeset
|
2561 /* |
7 | 2562 * screen_valid - allocate screen buffers if size changed |
3263 | 2563 * If "doclear" is TRUE: clear screen if it has been resized. |
7 | 2564 * Returns TRUE if there is a valid screen to write to. |
2565 * Returns FALSE when starting up and screen not initialized yet. | |
2566 */ | |
2567 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2568 screen_valid(int doclear) |
7 | 2569 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2570 screenalloc(doclear); // allocate screen buffers if size changed |
7 | 2571 return (ScreenLines != NULL); |
2572 } | |
2573 | |
2574 /* | |
2575 * Resize the shell to Rows and Columns. | |
2576 * Allocate ScreenLines[] and associated items. | |
2577 * | |
2578 * There may be some time between setting Rows and Columns and (re)allocating | |
2579 * ScreenLines[]. This happens when starting up and when (manually) changing | |
2580 * the shell size. Always use screen_Rows and screen_Columns to access items | |
2581 * in ScreenLines[]. Use Rows and Columns for positioning text etc. where the | |
2582 * final size of the shell is needed. | |
2583 */ | |
2584 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2585 screenalloc(int doclear) |
7 | 2586 { |
2587 int new_row, old_row; | |
2588 #ifdef FEAT_GUI | |
2589 int old_Rows; | |
2590 #endif | |
2591 win_T *wp; | |
2592 int outofmem = FALSE; | |
2593 int len; | |
2594 schar_T *new_ScreenLines; | |
2595 u8char_T *new_ScreenLinesUC = NULL; | |
714 | 2596 u8char_T *new_ScreenLinesC[MAX_MCO]; |
7 | 2597 schar_T *new_ScreenLines2 = NULL; |
714 | 2598 int i; |
7 | 2599 sattr_T *new_ScreenAttrs; |
2600 unsigned *new_LineOffset; | |
2601 char_u *new_LineWraps; | |
681 | 2602 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
|
2603 #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
|
2604 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
|
2605 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
|
2606 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
|
2607 #endif |
671 | 2608 tabpage_T *tp; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2609 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
|
2610 static int done_outofmem_msg = FALSE; // did outofmem message |
1824 | 2611 int retry_count = 0; |
2612 | |
2613 retry: | |
7 | 2614 /* |
2615 * Allocation of the screen buffers is done only when the size changes and | |
2616 * when Rows and Columns have been set and we have started doing full | |
2617 * screen stuff. | |
2618 */ | |
2619 if ((ScreenLines != NULL | |
2620 && Rows == screen_Rows | |
2621 && Columns == screen_Columns | |
2622 && enc_utf8 == (ScreenLinesUC != NULL) | |
2623 && (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL) | |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
2624 && p_mco == Screen_mco) |
7 | 2625 || Rows == 0 |
2626 || Columns == 0 | |
2627 || (!full_screen && ScreenLines == NULL)) | |
2628 return; | |
2629 | |
2630 /* | |
2631 * It's possible that we produce an out-of-memory message below, which | |
2632 * will cause this function to be called again. To break the loop, just | |
2633 * return here. | |
2634 */ | |
2635 if (entered) | |
2636 return; | |
2637 entered = TRUE; | |
2638 | |
911 | 2639 /* |
2640 * Note that the window sizes are updated before reallocating the arrays, | |
2641 * thus we must not redraw here! | |
2642 */ | |
2643 ++RedrawingDisabled; | |
2644 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2645 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
|
2646 |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2647 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2648 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
|
2649 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2650 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2651 comp_col(); // recompute columns for shown command and ruler |
7 | 2652 |
2653 /* | |
2654 * We're changing the size of the screen. | |
2655 * - Allocate new arrays for ScreenLines and ScreenAttrs. | |
2656 * - Move lines from the old arrays into the new arrays, clear extra | |
2657 * lines (unless the screen is going to be cleared). | |
2658 * - Free the old arrays. | |
2659 * | |
2660 * If anything fails, make ScreenLines NULL, so we don't do anything! | |
2661 * Continuing with the old ScreenLines may result in a crash, because the | |
2662 * size is wrong. | |
2663 */ | |
671 | 2664 FOR_ALL_TAB_WINDOWS(tp, wp) |
7 | 2665 win_free_lsize(wp); |
1946 | 2666 if (aucmd_win != NULL) |
2667 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
|
2668 #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
|
2669 // 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
|
2670 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
|
2671 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
|
2672 // 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
|
2673 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
|
2674 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
|
2675 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
|
2676 #endif |
7 | 2677 |
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
|
2678 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
|
2679 vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO); |
7 | 2680 if (enc_utf8) |
2681 { | |
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
|
2682 new_ScreenLinesUC = LALLOC_MULT(u8char_T, (Rows + 1) * Columns); |
714 | 2683 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
|
2684 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
|
2685 (Rows + 1) * Columns); |
7 | 2686 } |
2687 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
|
2688 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
|
2689 new_ScreenAttrs = LALLOC_MULT(sattr_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
|
2690 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
|
2691 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
|
2692 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
|
2693 #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
|
2694 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
|
2695 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
|
2696 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
|
2697 #endif |
7 | 2698 |
677 | 2699 FOR_ALL_TAB_WINDOWS(tp, wp) |
7 | 2700 { |
2701 if (win_alloc_lines(wp) == FAIL) | |
2702 { | |
2703 outofmem = TRUE; | |
1819 | 2704 goto give_up; |
2705 } | |
2706 } | |
1946 | 2707 if (aucmd_win != NULL && aucmd_win->w_lines == NULL |
2708 && win_alloc_lines(aucmd_win) == FAIL) | |
1906 | 2709 outofmem = TRUE; |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2710 #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
|
2711 // 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
|
2712 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
|
2713 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
|
2714 { |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2715 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
|
2716 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
|
2717 } |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2718 // 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
|
2719 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
|
2720 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
|
2721 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
|
2722 { |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2723 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
|
2724 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
|
2725 } |
473e76401434
patch 8.1.1442: popup windows not considered when the Vim window is resized
Bram Moolenaar <Bram@vim.org>
parents:
16880
diff
changeset
|
2726 #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
|
2727 |
1819 | 2728 give_up: |
7 | 2729 |
714 | 2730 for (i = 0; i < p_mco; ++i) |
2731 if (new_ScreenLinesC[i] == NULL) | |
2732 break; | |
7 | 2733 if (new_ScreenLines == NULL |
714 | 2734 || (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco)) |
7 | 2735 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL) |
2736 || new_ScreenAttrs == NULL | |
2737 || new_LineOffset == NULL | |
2738 || new_LineWraps == NULL | |
671 | 2739 || 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
|
2740 #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
|
2741 || 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
|
2742 || 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
|
2743 || 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
|
2744 #endif |
7 | 2745 || outofmem) |
2746 { | |
944 | 2747 if (ScreenLines != NULL || !done_outofmem_msg) |
534 | 2748 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2749 // guess the size |
534 | 2750 do_outofmem_msg((long_u)((Rows + 1) * Columns)); |
2751 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2752 // 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
|
2753 // and over again. |
944 | 2754 done_outofmem_msg = TRUE; |
534 | 2755 } |
13244
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2756 VIM_CLEAR(new_ScreenLines); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2757 VIM_CLEAR(new_ScreenLinesUC); |
714 | 2758 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
|
2759 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
|
2760 VIM_CLEAR(new_ScreenLines2); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2761 VIM_CLEAR(new_ScreenAttrs); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2762 VIM_CLEAR(new_LineOffset); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2763 VIM_CLEAR(new_LineWraps); |
ac42c4b11dbc
patch 8.0.1496: clearing a pointer takes two lines
Christian Brabandt <cb@256bit.org>
parents:
13204
diff
changeset
|
2764 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
|
2765 #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
|
2766 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
|
2767 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
|
2768 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
|
2769 #endif |
7 | 2770 } |
2771 else | |
2772 { | |
944 | 2773 done_outofmem_msg = FALSE; |
534 | 2774 |
7 | 2775 for (new_row = 0; new_row < Rows; ++new_row) |
2776 { | |
2777 new_LineOffset[new_row] = new_row * Columns; | |
2778 new_LineWraps[new_row] = FALSE; | |
2779 | |
2780 /* | |
2781 * If the screen is not going to be cleared, copy as much as | |
2782 * possible from the old screen to the new one and clear the rest | |
2783 * (used when resizing the window at the "--more--" prompt or when | |
2784 * executing an external command, for the GUI). | |
2785 */ | |
3263 | 2786 if (!doclear) |
7 | 2787 { |
2788 (void)vim_memset(new_ScreenLines + new_row * Columns, | |
2789 ' ', (size_t)Columns * sizeof(schar_T)); | |
2790 if (enc_utf8) | |
2791 { | |
2792 (void)vim_memset(new_ScreenLinesUC + new_row * Columns, | |
2793 0, (size_t)Columns * sizeof(u8char_T)); | |
714 | 2794 for (i = 0; i < p_mco; ++i) |
2795 (void)vim_memset(new_ScreenLinesC[i] | |
2796 + new_row * Columns, | |
7 | 2797 0, (size_t)Columns * sizeof(u8char_T)); |
2798 } | |
2799 if (enc_dbcs == DBCS_JPNU) | |
2800 (void)vim_memset(new_ScreenLines2 + new_row * Columns, | |
2801 0, (size_t)Columns * sizeof(schar_T)); | |
2802 (void)vim_memset(new_ScreenAttrs + new_row * Columns, | |
2803 0, (size_t)Columns * sizeof(sattr_T)); | |
2804 old_row = new_row + (screen_Rows - Rows); | |
534 | 2805 if (old_row >= 0 && ScreenLines != NULL) |
7 | 2806 { |
2807 if (screen_Columns < Columns) | |
2808 len = screen_Columns; | |
2809 else | |
2810 len = Columns; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2811 // 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
|
2812 // may be invalid now. Also when p_mco changes. |
714 | 2813 if (!(enc_utf8 && ScreenLinesUC == NULL) |
2814 && p_mco == Screen_mco) | |
26 | 2815 mch_memmove(new_ScreenLines + new_LineOffset[new_row], |
2816 ScreenLines + LineOffset[old_row], | |
2817 (size_t)len * sizeof(schar_T)); | |
714 | 2818 if (enc_utf8 && ScreenLinesUC != NULL |
2819 && p_mco == Screen_mco) | |
7 | 2820 { |
2821 mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row], | |
2822 ScreenLinesUC + LineOffset[old_row], | |
2823 (size_t)len * sizeof(u8char_T)); | |
714 | 2824 for (i = 0; i < p_mco; ++i) |
2825 mch_memmove(new_ScreenLinesC[i] | |
2826 + new_LineOffset[new_row], | |
2827 ScreenLinesC[i] + LineOffset[old_row], | |
7 | 2828 (size_t)len * sizeof(u8char_T)); |
2829 } | |
2830 if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL) | |
2831 mch_memmove(new_ScreenLines2 + new_LineOffset[new_row], | |
2832 ScreenLines2 + LineOffset[old_row], | |
2833 (size_t)len * sizeof(schar_T)); | |
2834 mch_memmove(new_ScreenAttrs + new_LineOffset[new_row], | |
2835 ScreenAttrs + LineOffset[old_row], | |
2836 (size_t)len * sizeof(sattr_T)); | |
2837 } | |
2838 } | |
2839 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2840 // Use the last line of the screen for the current line. |
7 | 2841 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
|
2842 |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
2843 #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
|
2844 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
|
2845 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
|
2846 #endif |
7 | 2847 } |
2848 | |
356 | 2849 free_screenlines(); |
2850 | |
17696
03dcb660c4e8
patch 8.1.1845: may use NULL pointer when running out of memory
Bram Moolenaar <Bram@vim.org>
parents:
17628
diff
changeset
|
2851 // NOTE: this may result in all pointers to become NULL. |
7 | 2852 ScreenLines = new_ScreenLines; |
2853 ScreenLinesUC = new_ScreenLinesUC; | |
714 | 2854 for (i = 0; i < p_mco; ++i) |
2855 ScreenLinesC[i] = new_ScreenLinesC[i]; | |
2856 Screen_mco = p_mco; | |
7 | 2857 ScreenLines2 = new_ScreenLines2; |
2858 ScreenAttrs = new_ScreenAttrs; | |
2859 LineOffset = new_LineOffset; | |
2860 LineWraps = new_LineWraps; | |
671 | 2861 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
|
2862 #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
|
2863 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
|
2864 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
|
2865 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
|
2866 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
|
2867 #endif |
7 | 2868 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2869 // 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
|
2870 // size of ScreenLines[]. Set them before calling anything. |
7 | 2871 #ifdef FEAT_GUI |
2872 old_Rows = screen_Rows; | |
2873 #endif | |
2874 screen_Rows = Rows; | |
2875 screen_Columns = Columns; | |
2876 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2877 must_redraw = CLEAR; // need to clear the screen later |
3263 | 2878 if (doclear) |
7 | 2879 screenclear2(); |
2880 #ifdef FEAT_GUI | |
2881 else if (gui.in_use | |
2882 && !gui.starting | |
2883 && ScreenLines != NULL | |
2884 && old_Rows != Rows) | |
2885 { | |
19824
09a621bdb0bc
patch 8.2.0468: GUI: pixel dust with some fonts and characters
Bram Moolenaar <Bram@vim.org>
parents:
19526
diff
changeset
|
2886 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
|
2887 |
09a621bdb0bc
patch 8.2.0468: GUI: pixel dust with some fonts and characters
Bram Moolenaar <Bram@vim.org>
parents:
19526
diff
changeset
|
2888 // 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
|
2889 // command. |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2890 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
|
2891 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
|
2892 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
|
2893 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
|
2894 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
|
2895 msg_col = Columns - 1; // put cursor at last column |
7 | 2896 } |
2897 #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
|
2898 clear_TabPageIdxs(); |
7 | 2899 |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2900 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2901 vim_unlock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2902 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
2903 |
7 | 2904 entered = FALSE; |
911 | 2905 --RedrawingDisabled; |
766 | 2906 |
1824 | 2907 /* |
2908 * Do not apply autocommands more than 3 times to avoid an endless loop | |
2909 * in case applying autocommands always changes Rows or Columns. | |
2910 */ | |
2911 if (starting == 0 && ++retry_count <= 3) | |
2912 { | |
766 | 2913 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
|
2914 // 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
|
2915 // jump back to check if we need to allocate the screen again. |
1824 | 2916 goto retry; |
2917 } | |
7 | 2918 } |
2919 | |
2920 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2921 free_screenlines(void) |
356 | 2922 { |
714 | 2923 int i; |
2924 | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2925 VIM_CLEAR(ScreenLinesUC); |
714 | 2926 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
|
2927 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
|
2928 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
|
2929 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
|
2930 VIM_CLEAR(ScreenAttrs); |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
2931 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
|
2932 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
|
2933 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
|
2934 #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
|
2935 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
|
2936 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
|
2937 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
|
2938 #endif |
356 | 2939 } |
2940 | |
2941 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2942 screenclear(void) |
7 | 2943 { |
2944 check_for_delay(FALSE); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2945 screenalloc(FALSE); // allocate screen buffers if size changed |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2946 screenclear2(); // clear the screen |
7 | 2947 } |
2948 | |
2949 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
2950 screenclear2(void) |
7 | 2951 { |
2952 int i; | |
2953 | |
2954 if (starting == NO_SCREEN || ScreenLines == NULL | |
2955 #ifdef FEAT_GUI | |
2956 || (gui.in_use && gui.starting) | |
2957 #endif | |
2958 ) | |
2959 return; | |
2960 | |
2961 #ifdef FEAT_GUI | |
2962 if (!gui.in_use) | |
2963 #endif | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2964 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
|
2965 screen_stop_highlight(); // don't want highlighting here |
7 | 2966 |
2967 #ifdef FEAT_CLIPBOARD | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2968 // disable selection without redrawing it |
7 | 2969 clip_scroll_selection(9999); |
2970 #endif | |
2971 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2972 // blank out ScreenLines |
7 | 2973 for (i = 0; i < Rows; ++i) |
2974 { | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
2975 lineclear(LineOffset[i], (int)Columns, 0); |
7 | 2976 LineWraps[i] = FALSE; |
2977 } | |
2978 | |
2979 if (can_clear(T_CL)) | |
2980 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2981 out_str(T_CL); // clear the display |
7 | 2982 clear_cmdline = FALSE; |
644 | 2983 mode_displayed = FALSE; |
7 | 2984 } |
2985 else | |
2986 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2987 // can't clear the screen, mark all chars with invalid attributes |
7 | 2988 for (i = 0; i < Rows; ++i) |
2989 lineinvalid(LineOffset[i], (int)Columns); | |
2990 clear_cmdline = TRUE; | |
2991 } | |
2992 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2993 screen_cleared = TRUE; // can use contents of ScreenLines now |
7 | 2994 |
2995 win_rest_invalid(firstwin); | |
2996 redraw_cmdline = TRUE; | |
673 | 2997 redraw_tabline = TRUE; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
2998 if (must_redraw == CLEAR) // no need to clear again |
7 | 2999 must_redraw = NOT_VALID; |
3000 compute_cmdrow(); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3001 msg_row = cmdline_row; // put cursor on last line for messages |
7 | 3002 msg_col = 0; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3003 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
|
3004 msg_scrolled = 0; // can't scroll back |
7 | 3005 msg_didany = FALSE; |
3006 msg_didout = FALSE; | |
3007 } | |
3008 | |
3009 /* | |
3010 * Clear one line in ScreenLines. | |
3011 */ | |
3012 static void | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3013 lineclear(unsigned off, int width, int attr) |
7 | 3014 { |
3015 (void)vim_memset(ScreenLines + off, ' ', (size_t)width * sizeof(schar_T)); | |
3016 if (enc_utf8) | |
3017 (void)vim_memset(ScreenLinesUC + off, 0, | |
3018 (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
|
3019 (void)vim_memset(ScreenAttrs + off, attr, (size_t)width * sizeof(sattr_T)); |
7 | 3020 } |
3021 | |
3022 /* | |
3023 * Mark one line in ScreenLines invalid by setting the attributes to an | |
3024 * invalid value. | |
3025 */ | |
3026 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3027 lineinvalid(unsigned off, int width) |
7 | 3028 { |
3029 (void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T)); | |
3030 } | |
3031 | |
3032 /* | |
21226
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
3033 * 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
|
3034 * 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
|
3035 */ |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
3036 void |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
3037 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
|
3038 { |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
3039 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
|
3040 } |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
3041 |
421c4ed6b949
patch 8.2.1164: text cleared by checking terminal properties not redrawn
Bram Moolenaar <Bram@vim.org>
parents:
20996
diff
changeset
|
3042 /* |
7 | 3043 * Copy part of a Screenline for vertically split window "wp". |
3044 */ | |
3045 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3046 linecopy(int to, int from, win_T *wp) |
7 | 3047 { |
3048 unsigned off_to = LineOffset[to] + wp->w_wincol; | |
3049 unsigned off_from = LineOffset[from] + wp->w_wincol; | |
3050 | |
3051 mch_memmove(ScreenLines + off_to, ScreenLines + off_from, | |
3052 wp->w_width * sizeof(schar_T)); | |
3053 if (enc_utf8) | |
3054 { | |
714 | 3055 int i; |
3056 | |
7 | 3057 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from, |
3058 wp->w_width * sizeof(u8char_T)); | |
714 | 3059 for (i = 0; i < p_mco; ++i) |
3060 mch_memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from, | |
3061 wp->w_width * sizeof(u8char_T)); | |
7 | 3062 } |
3063 if (enc_dbcs == DBCS_JPNU) | |
3064 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from, | |
3065 wp->w_width * sizeof(schar_T)); | |
3066 mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from, | |
3067 wp->w_width * sizeof(sattr_T)); | |
3068 } | |
3069 | |
3070 /* | |
3071 * Return TRUE if clearing with term string "p" would work. | |
3072 * 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
|
3073 * Don't clear to end-of-line when there are popups, it may cause flicker. |
7 | 3074 */ |
3075 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3076 can_clear(char_u *p) |
7 | 3077 { |
3078 return (*p != NUL && (t_colors <= 1 | |
3079 #ifdef FEAT_GUI | |
3080 || gui.in_use | |
3081 #endif | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
3082 #ifdef FEAT_TERMGUICOLORS |
9939
ccb6461b82df
commit https://github.com/vim/vim/commit/1b58cdd160c2e0ada0f638679a2aa27e4665fc48
Christian Brabandt <cb@256bit.org>
parents:
9885
diff
changeset
|
3083 || (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
|
3084 || (!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
|
3085 #else |
b6472fd9f5ba
commit https://github.com/vim/vim/commit/d18f672fc9477f3c0cb7cc4ce8d9237ed825c612
Christian Brabandt <cb@256bit.org>
parents:
9282
diff
changeset
|
3086 || cterm_normal_bg_color == 0 |
b6472fd9f5ba
commit https://github.com/vim/vim/commit/d18f672fc9477f3c0cb7cc4ce8d9237ed825c612
Christian Brabandt <cb@256bit.org>
parents:
9282
diff
changeset
|
3087 #endif |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3088 || *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
|
3089 #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
|
3090 && !(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
|
3091 #endif |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3092 ); |
7 | 3093 } |
3094 | |
3095 /* | |
3096 * Reset cursor position. Use whenever cursor was moved because of outputting | |
3097 * something directly to the screen (shell commands) or a terminal control | |
3098 * code. | |
3099 */ | |
3100 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3101 screen_start(void) |
7 | 3102 { |
3103 screen_cur_row = screen_cur_col = 9999; | |
3104 } | |
3105 | |
3106 /* | |
3107 * Move the cursor to position "row","col" in the screen. | |
3108 * This tries to find the most efficient way to move, minimizing the number of | |
3109 * characters sent to the terminal. | |
3110 */ | |
3111 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3112 windgoto(int row, int col) |
7 | 3113 { |
205 | 3114 sattr_T *p; |
7 | 3115 int i; |
3116 int plan; | |
3117 int cost; | |
3118 int wouldbe_col; | |
3119 int noinvcurs; | |
3120 char_u *bs; | |
3121 int goto_cost; | |
3122 int attr; | |
3123 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3124 #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
|
3125 #define HIGHL_COST 5 // assume unhighlight takes 5 chars |
7 | 3126 |
3127 #define PLAN_LE 1 | |
3128 #define PLAN_CR 2 | |
3129 #define PLAN_NL 3 | |
3130 #define PLAN_WRITE 4 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3131 // Can't use ScreenLines unless initialized |
7 | 3132 if (ScreenLines == NULL) |
3133 return; | |
3134 if (col != screen_cur_col || row != screen_cur_row) | |
3135 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3136 // Check for valid position. |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3137 if (row < 0) // window without text lines? |
7 | 3138 row = 0; |
3139 if (row >= screen_Rows) | |
3140 row = screen_Rows - 1; | |
3141 if (col >= screen_Columns) | |
3142 col = screen_Columns - 1; | |
3143 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3144 // check if no cursor movement is allowed in highlight mode |
7 | 3145 if (screen_attr && *T_MS == NUL) |
3146 noinvcurs = HIGHL_COST; | |
3147 else | |
3148 noinvcurs = 0; | |
3149 goto_cost = GOTO_COST + noinvcurs; | |
3150 | |
3151 /* | |
3152 * Plan how to do the positioning: | |
3153 * 1. Use CR to move it to column 0, same row. | |
3154 * 2. Use T_LE to move it a few columns to the left. | |
3155 * 3. Use NL to move a few lines down, column 0. | |
3156 * 4. Move a few columns to the right with T_ND or by writing chars. | |
3157 * | |
3158 * Don't do this if the cursor went beyond the last column, the cursor | |
3159 * position is unknown then (some terminals wrap, some don't ) | |
3160 * | |
1213 | 3161 * First check if the highlighting attributes allow us to write |
7 | 3162 * characters to move the cursor to the right. |
3163 */ | |
3164 if (row >= screen_cur_row && screen_cur_col < Columns) | |
3165 { | |
3166 /* | |
3167 * If the cursor is in the same row, bigger col, we can use CR | |
3168 * or T_LE. | |
3169 */ | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3170 bs = NULL; // init for GCC |
7 | 3171 attr = screen_attr; |
3172 if (row == screen_cur_row && col < screen_cur_col) | |
3173 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3174 // "le" is preferred over "bc", because "bc" is obsolete |
7 | 3175 if (*T_LE) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3176 bs = T_LE; // "cursor left" |
7 | 3177 else |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3178 bs = T_BC; // "backspace character (old) |
7 | 3179 if (*bs) |
3180 cost = (screen_cur_col - col) * (int)STRLEN(bs); | |
3181 else | |
3182 cost = 999; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3183 if (col + 1 < cost) // using CR is less characters |
7 | 3184 { |
3185 plan = PLAN_CR; | |
3186 wouldbe_col = 0; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3187 cost = 1; // CR is just one character |
7 | 3188 } |
3189 else | |
3190 { | |
3191 plan = PLAN_LE; | |
3192 wouldbe_col = col; | |
3193 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3194 if (noinvcurs) // will stop highlighting |
7 | 3195 { |
3196 cost += noinvcurs; | |
3197 attr = 0; | |
3198 } | |
3199 } | |
3200 | |
3201 /* | |
3202 * If the cursor is above where we want to be, we can use CR LF. | |
3203 */ | |
3204 else if (row > screen_cur_row) | |
3205 { | |
3206 plan = PLAN_NL; | |
3207 wouldbe_col = 0; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3208 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
|
3209 if (noinvcurs) // will stop highlighting |
7 | 3210 { |
3211 cost += noinvcurs; | |
3212 attr = 0; | |
3213 } | |
3214 } | |
3215 | |
3216 /* | |
3217 * If the cursor is in the same row, smaller col, just use write. | |
3218 */ | |
3219 else | |
3220 { | |
3221 plan = PLAN_WRITE; | |
3222 wouldbe_col = screen_cur_col; | |
3223 cost = 0; | |
3224 } | |
3225 | |
3226 /* | |
3227 * Check if any characters that need to be written have the | |
3228 * correct attributes. Also avoid UTF-8 characters. | |
3229 */ | |
3230 i = col - wouldbe_col; | |
3231 if (i > 0) | |
3232 cost += i; | |
3233 if (cost < goto_cost && i > 0) | |
3234 { | |
3235 /* | |
3236 * Check if the attributes are correct without additionally | |
3237 * stopping highlighting. | |
3238 */ | |
3239 p = ScreenAttrs + LineOffset[row] + wouldbe_col; | |
3240 while (i && *p++ == attr) | |
3241 --i; | |
3242 if (i != 0) | |
3243 { | |
3244 /* | |
3245 * Try if it works when highlighting is stopped here. | |
3246 */ | |
3247 if (*--p == 0) | |
3248 { | |
3249 cost += noinvcurs; | |
3250 while (i && *p++ == 0) | |
3251 --i; | |
3252 } | |
3253 if (i != 0) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3254 cost = 999; // different attributes, don't do it |
7 | 3255 } |
3256 if (enc_utf8) | |
3257 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3258 // Don't use an UTF-8 char for positioning, it's slow. |
7 | 3259 for (i = wouldbe_col; i < col; ++i) |
3260 if (ScreenLinesUC[LineOffset[row] + i] != 0) | |
3261 { | |
3262 cost = 999; | |
3263 break; | |
3264 } | |
3265 } | |
3266 } | |
3267 | |
3268 /* | |
3269 * We can do it without term_windgoto()! | |
3270 */ | |
3271 if (cost < goto_cost) | |
3272 { | |
3273 if (plan == PLAN_LE) | |
3274 { | |
3275 if (noinvcurs) | |
3276 screen_stop_highlight(); | |
3277 while (screen_cur_col > col) | |
3278 { | |
3279 out_str(bs); | |
3280 --screen_cur_col; | |
3281 } | |
3282 } | |
3283 else if (plan == PLAN_CR) | |
3284 { | |
3285 if (noinvcurs) | |
3286 screen_stop_highlight(); | |
3287 out_char('\r'); | |
3288 screen_cur_col = 0; | |
3289 } | |
3290 else if (plan == PLAN_NL) | |
3291 { | |
3292 if (noinvcurs) | |
3293 screen_stop_highlight(); | |
3294 while (screen_cur_row < row) | |
3295 { | |
3296 out_char('\n'); | |
3297 ++screen_cur_row; | |
3298 } | |
3299 screen_cur_col = 0; | |
3300 } | |
3301 | |
3302 i = col - screen_cur_col; | |
3303 if (i > 0) | |
3304 { | |
3305 /* | |
3306 * Use cursor-right if it's one character only. Avoids | |
3307 * removing a line of pixels from the last bold char, when | |
3308 * using the bold trick in the GUI. | |
3309 */ | |
3310 if (T_ND[0] != NUL && T_ND[1] == NUL) | |
3311 { | |
3312 while (i-- > 0) | |
3313 out_char(*T_ND); | |
3314 } | |
3315 else | |
3316 { | |
3317 int off; | |
3318 | |
3319 off = LineOffset[row] + screen_cur_col; | |
3320 while (i-- > 0) | |
3321 { | |
3322 if (ScreenAttrs[off] != screen_attr) | |
3323 screen_stop_highlight(); | |
3324 out_flush_check(); | |
3325 out_char(ScreenLines[off]); | |
3326 if (enc_dbcs == DBCS_JPNU | |
3327 && ScreenLines[off] == 0x8e) | |
3328 out_char(ScreenLines2[off]); | |
3329 ++off; | |
3330 } | |
3331 } | |
3332 } | |
3333 } | |
3334 } | |
3335 else | |
3336 cost = 999; | |
3337 | |
3338 if (cost >= goto_cost) | |
3339 { | |
3340 if (noinvcurs) | |
3341 screen_stop_highlight(); | |
5995 | 3342 if (row == screen_cur_row && (col > screen_cur_col) |
3343 && *T_CRI != NUL) | |
7 | 3344 term_cursor_right(col - screen_cur_col); |
3345 else | |
3346 term_windgoto(row, col); | |
3347 } | |
3348 screen_cur_row = row; | |
3349 screen_cur_col = col; | |
3350 } | |
3351 } | |
3352 | |
3353 /* | |
3354 * Set cursor to its position in the current window. | |
3355 */ | |
3356 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3357 setcursor(void) |
7 | 3358 { |
13400
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3359 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
|
3360 } |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3361 |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3362 /* |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3363 * 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
|
3364 * 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
|
3365 */ |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3366 void |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3367 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
|
3368 { |
c415cdd49ea4
patch 8.0.1574: show cursor in wrong place when using popup menu
Christian Brabandt <cb@256bit.org>
parents:
13380
diff
changeset
|
3369 if (force || redrawing()) |
7 | 3370 { |
3371 validate_cursor(); | |
3372 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
|
3373 curwin->w_wincol + ( |
7 | 3374 #ifdef FEAT_RIGHTLEFT |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3375 // 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
|
3376 // 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
|
3377 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
|
3378 - ((has_mbyte |
1545 | 3379 && (*mb_ptr2cells)(ml_get_cursor()) == 2 |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
3380 && vim_isprintc(gchar_cursor())) ? 2 : 1)) : |
7 | 3381 #endif |
3382 curwin->w_wcol)); | |
3383 } | |
3384 } | |
3385 | |
3386 | |
3387 /* | |
11655
8014350fe51a
patch 8.0.0710: a job that writes to a buffer clears completion
Christian Brabandt <cb@256bit.org>
parents:
11607
diff
changeset
|
3388 * 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
|
3389 * 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
|
3390 * If 'mayclear' is TRUE the screen will be cleared if it is faster than |
7 | 3391 * scrolling. |
3392 * Returns FAIL if the lines are not inserted, OK for success. | |
3393 */ | |
3394 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3395 win_ins_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3396 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3397 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3398 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3399 int invalid, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3400 int mayclear) |
7 | 3401 { |
3402 int did_delete; | |
3403 int nextrow; | |
3404 int lastrow; | |
3405 int retval; | |
3406 | |
3407 if (invalid) | |
3408 wp->w_lines_valid = 0; | |
3409 | |
29251
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3410 // with only a few lines it's not worth the effort |
7 | 3411 if (wp->w_height < 5) |
3412 return FAIL; | |
3413 | |
29251
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3414 // 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
|
3415 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
|
3416 return FAIL; |
aea330cb546f
patch 8.2.5144: with 'lazyredraw' set completion menu may be wrong
Bram Moolenaar <Bram@vim.org>
parents:
29098
diff
changeset
|
3417 |
7 | 3418 if (line_count > wp->w_height - row) |
3419 line_count = wp->w_height - row; | |
3420 | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3421 retval = win_do_lines(wp, row, line_count, mayclear, FALSE, 0); |
7 | 3422 if (retval != MAYBE) |
3423 return retval; | |
3424 | |
3425 /* | |
3426 * If there is a next window or a status line, we first try to delete the | |
3427 * 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
|
3428 * 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
|
3429 * avoid messing up those windows, better just redraw. |
7 | 3430 */ |
3431 did_delete = FALSE; | |
3432 if (wp->w_next != NULL || wp->w_status_height) | |
3433 { | |
3434 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
|
3435 line_count, (int)Rows, FALSE, 0, NULL) == OK) |
7 | 3436 did_delete = TRUE; |
3437 else if (wp->w_next) | |
3438 return FAIL; | |
3439 } | |
3440 /* | |
3441 * if no lines deleted, blank the lines that will end up below the window | |
3442 */ | |
3443 if (!did_delete) | |
3444 { | |
3445 wp->w_redr_status = TRUE; | |
3446 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
|
3447 nextrow = W_WINROW(wp) + wp->w_height + wp->w_status_height; |
7 | 3448 lastrow = nextrow + line_count; |
3449 if (lastrow > Rows) | |
3450 lastrow = Rows; | |
3451 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
|
3452 wp->w_wincol, (int)W_ENDCOL(wp), |
7 | 3453 ' ', ' ', 0); |
3454 } | |
3455 | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3456 if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, 0, NULL) |
7 | 3457 == FAIL) |
3458 { | |
17628
6146b10714de
patch 8.1.1811: popup window color cannot be set to "Normal"
Bram Moolenaar <Bram@vim.org>
parents:
17551
diff
changeset
|
3459 // deletion will have messed up other windows |
7 | 3460 if (did_delete) |
3461 { | |
3462 wp->w_redr_status = TRUE; | |
3463 win_rest_invalid(W_NEXT(wp)); | |
3464 } | |
3465 return FAIL; | |
3466 } | |
3467 | |
3468 return OK; | |
3469 } | |
3470 | |
3471 /* | |
11655
8014350fe51a
patch 8.0.0710: a job that writes to a buffer clears completion
Christian Brabandt <cb@256bit.org>
parents:
11607
diff
changeset
|
3472 * Delete "line_count" window lines at "row" in window "wp". |
7 | 3473 * If "invalid" is TRUE curwin->w_lines[] is invalidated. |
3474 * If "mayclear" is TRUE the screen will be cleared if it is faster than | |
3475 * scrolling | |
3476 * Return OK for success, FAIL if the lines are not deleted. | |
3477 */ | |
3478 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3479 win_del_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3480 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3481 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3482 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3483 int invalid, |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3484 int mayclear, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3485 int clear_attr) // for clearing lines |
7 | 3486 { |
3487 int retval; | |
3488 | |
3489 if (invalid) | |
3490 wp->w_lines_valid = 0; | |
3491 | |
3492 if (line_count > wp->w_height - row) | |
3493 line_count = wp->w_height - row; | |
3494 | |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3495 retval = win_do_lines(wp, row, line_count, mayclear, TRUE, clear_attr); |
7 | 3496 if (retval != MAYBE) |
3497 return retval; | |
3498 | |
3499 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
|
3500 (int)Rows, FALSE, clear_attr, NULL) == FAIL) |
7 | 3501 return FAIL; |
3502 | |
3503 /* | |
3504 * If there are windows or status lines below, try to put them at the | |
3505 * correct place. If we can't do that, they have to be redrawn. | |
3506 */ | |
3507 if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1) | |
3508 { | |
3509 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
|
3510 line_count, (int)Rows, clear_attr, NULL) == FAIL) |
7 | 3511 { |
3512 wp->w_redr_status = TRUE; | |
3513 win_rest_invalid(wp->w_next); | |
3514 } | |
3515 } | |
3516 /* | |
3517 * If this is the last window and there is no status line, redraw the | |
3518 * command line later. | |
3519 */ | |
3520 else | |
3521 redraw_cmdline = TRUE; | |
3522 return OK; | |
3523 } | |
3524 | |
3525 /* | |
3526 * Common code for win_ins_lines() and win_del_lines(). | |
3527 * Returns OK or FAIL when the work has been done. | |
3528 * Returns MAYBE when not finished yet. | |
3529 */ | |
3530 static int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3531 win_do_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3532 win_T *wp, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3533 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3534 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3535 int mayclear, |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3536 int del, |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3537 int clear_attr) |
7 | 3538 { |
3539 int retval; | |
3540 | |
3541 if (!redrawing() || line_count <= 0) | |
3542 return FAIL; | |
3543 | |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3544 // 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
|
3545 // 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
|
3546 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
|
3547 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
|
3548 |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3549 // 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
|
3550 if (mayclear && Rows - line_count < 5 && wp->w_width == Columns) |
7 | 3551 { |
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
|
3552 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
|
3553 screenclear(); // will set wp->w_lines_valid to 0 |
7 | 3554 return FAIL; |
3555 } | |
3556 | |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
3557 #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
|
3558 // 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
|
3559 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
|
3560 return FAIL; |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3561 #endif |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3562 |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3563 // Delete all remaining lines |
7 | 3564 if (row + line_count >= wp->w_height) |
3565 { | |
3566 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
|
3567 wp->w_wincol, (int)W_ENDCOL(wp), |
7 | 3568 ' ', ' ', 0); |
3569 return OK; | |
3570 } | |
3571 | |
3572 /* | |
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
|
3573 * When scrolling, the message on the command line should be cleared, |
7 | 3574 * 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
|
3575 * Don't do this when avoiding to insert lines. |
7 | 3576 */ |
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
|
3577 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
|
3578 clear_cmdline = TRUE; |
7 | 3579 |
3580 /* | |
3581 * If the terminal can set a scroll region, use that. | |
3582 * Always do this in a vertically split window. This will redraw from | |
3583 * ScreenLines[] when t_CV isn't defined. That's faster than using | |
3584 * win_line(). | |
3585 * 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
|
3586 * 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
|
3587 * scroll-up . |
7 | 3588 */ |
12515
972ea22c946f
patch 8.0.1136: W_WIDTH() is always the same
Christian Brabandt <cb@256bit.org>
parents:
12513
diff
changeset
|
3589 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
|
3590 { |
7 | 3591 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) |
3592 scroll_region_set(wp, row); | |
3593 if (del) | |
3594 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
|
3595 wp->w_height - row, FALSE, clear_attr, wp); |
7 | 3596 else |
3597 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
|
3598 wp->w_height - row, clear_attr, wp); |
7 | 3599 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) |
3600 scroll_region_reset(); | |
3601 return retval; | |
3602 } | |
3603 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3604 if (wp->w_next != NULL && p_tf) // don't delete/insert on fast terminal |
7 | 3605 return FAIL; |
3606 | |
3607 return MAYBE; | |
3608 } | |
3609 | |
3610 /* | |
3611 * window 'wp' and everything after it is messed up, mark it for redraw | |
3612 */ | |
3613 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3614 win_rest_invalid(win_T *wp) |
7 | 3615 { |
3616 while (wp != NULL) | |
3617 { | |
3618 redraw_win_later(wp, NOT_VALID); | |
3619 wp->w_redr_status = TRUE; | |
3620 wp = wp->w_next; | |
3621 } | |
3622 redraw_cmdline = TRUE; | |
3623 } | |
3624 | |
3625 /* | |
3626 * The rest of the routines in this file perform screen manipulations. The | |
3627 * given operation is performed physically on the screen. The corresponding | |
3628 * change is also made to the internal screen image. In this way, the editor | |
3629 * anticipates the effect of editing changes on the appearance of the screen. | |
3630 * That way, when we call screenupdate a complete redraw isn't usually | |
3631 * necessary. Another advantage is that we can keep adding code to anticipate | |
3632 * screen changes, and in the meantime, everything still works. | |
3633 */ | |
3634 | |
3635 /* | |
3636 * types for inserting or deleting lines | |
3637 */ | |
3638 #define USE_T_CAL 1 | |
3639 #define USE_T_CDL 2 | |
3640 #define USE_T_AL 3 | |
3641 #define USE_T_CE 4 | |
3642 #define USE_T_DL 5 | |
3643 #define USE_T_SR 6 | |
3644 #define USE_NL 7 | |
3645 #define USE_T_CD 8 | |
3646 #define USE_REDRAW 9 | |
3647 | |
3648 /* | |
3649 * 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
|
3650 * "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
|
3651 * 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
|
3652 * "row" and "end" are relative to the start of the region. |
7 | 3653 * |
3654 * return FAIL for failure, OK for success. | |
3655 */ | |
446 | 3656 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3657 screen_ins_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3658 int off, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3659 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3660 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3661 int end, |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
3662 int clear_attr, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3663 win_T *wp) // NULL or window to use width from |
7 | 3664 { |
3665 int i; | |
3666 int j; | |
3667 unsigned temp; | |
3668 int cursor_row; | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3669 int cursor_col = 0; |
7 | 3670 int type; |
3671 int result_empty; | |
3672 int can_ce = can_clear(T_CE); | |
3673 | |
3674 /* | |
3675 * FAIL if | |
3676 * - there is no valid screen | |
3677 * - the line count is less than one | |
3678 * - 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
|
3679 * - "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
|
3680 * - 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
|
3681 * - there is a popup window |
7 | 3682 */ |
16986
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3683 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
|
3684 || 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
|
3685 || 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
|
3686 #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
|
3687 || (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
|
3688 && 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
|
3689 #endif |
18763
49b78d6465e5
patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents:
18720
diff
changeset
|
3690 #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
|
3691 || popup_visible |
03f3a9ca2770
patch 8.1.1493: redrawing with popups is slow and causes flicker
Bram Moolenaar <Bram@vim.org>
parents:
16918
diff
changeset
|
3692 #endif |
11698
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3693 ) |
7 | 3694 return FAIL; |
3695 | |
3696 /* | |
3697 * There are seven ways to insert lines: | |
3698 * 0. When in a vertically split window and t_CV isn't set, redraw the | |
3699 * characters from ScreenLines[]. | |
3700 * 1. Use T_CD (clear to end of display) if it exists and the result of | |
3701 * the insert is just empty lines | |
3702 * 2. Use T_CAL (insert multiple lines) if it exists and T_AL is not | |
3703 * present or line_count > 1. It looks better if we do all the inserts | |
3704 * at once. | |
3705 * 3. Use T_CDL (delete multiple lines) if it exists and the result of the | |
3706 * insert is just empty lines and T_CE is not present or line_count > | |
3707 * 1. | |
3708 * 4. Use T_AL (insert line) if it exists. | |
3709 * 5. Use T_CE (erase line) if it exists and the result of the insert is | |
3710 * just empty lines. | |
3711 * 6. Use T_DL (delete line) if it exists and the result of the insert is | |
3712 * just empty lines. | |
3713 * 7. Use T_SR (scroll reverse) if it exists and inserting at row 0 and | |
3714 * the 'da' flag is not set or we have clear line capability. | |
3715 * 8. redraw the characters from ScreenLines[]. | |
3716 * | |
3717 * Careful: In a hpterm scroll reverse doesn't work as expected, it moves | |
3718 * the scrollbar for the window. It does have insert line, use that if it | |
3719 * exists. | |
3720 */ | |
3721 result_empty = (row + line_count >= end); | |
3722 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
|
3723 { |
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
|
3724 // 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
|
3725 // 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
|
3726 // 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
|
3727 // 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
|
3728 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
|
3729 return FAIL; |
7 | 3730 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
|
3731 } |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3732 else if (can_clear(T_CD) && result_empty) |
7 | 3733 type = USE_T_CD; |
3734 else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL)) | |
3735 type = USE_T_CAL; | |
3736 else if (*T_CDL != NUL && result_empty && (line_count > 1 || !can_ce)) | |
3737 type = USE_T_CDL; | |
3738 else if (*T_AL != NUL) | |
3739 type = USE_T_AL; | |
3740 else if (can_ce && result_empty) | |
3741 type = USE_T_CE; | |
3742 else if (*T_DL != NUL && result_empty) | |
3743 type = USE_T_DL; | |
3744 else if (*T_SR != NUL && row == 0 && (*T_DA == NUL || can_ce)) | |
3745 type = USE_T_SR; | |
3746 else | |
3747 return FAIL; | |
3748 | |
3749 /* | |
3750 * For clearing the lines screen_del_lines() is used. This will also take | |
3751 * care of t_db if necessary. | |
3752 */ | |
3753 if (type == USE_T_CD || type == USE_T_CDL || | |
3754 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
|
3755 return screen_del_lines(off, row, line_count, end, FALSE, 0, wp); |
7 | 3756 |
3757 /* | |
3758 * If text is retained below the screen, first clear or delete as many | |
3759 * lines at the bottom of the window as are about to be inserted so that | |
3760 * the deleted lines won't later surface during a screen_del_lines. | |
3761 */ | |
3762 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
|
3763 screen_del_lines(off, end - line_count, line_count, end, FALSE, 0, wp); |
7 | 3764 |
3765 #ifdef FEAT_CLIPBOARD | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3766 // 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
|
3767 // 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
|
3768 if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) |
3674 | 3769 clip_clear_selection(&clip_star); |
7 | 3770 else |
3771 clip_scroll_selection(-line_count); | |
3772 #endif | |
3773 | |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3774 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3775 vim_lock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3776 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3777 |
7 | 3778 #ifdef FEAT_GUI |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3779 // 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
|
3780 // scrolling is actually carried out. |
9848
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3781 gui_dont_update_cursor(row + off <= gui.cursor_row); |
7 | 3782 #endif |
3783 | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3784 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
|
3785 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
|
3786 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3787 if (*T_CCS != NUL) // cursor relative to region |
7 | 3788 cursor_row = row; |
3789 else | |
3790 cursor_row = row + off; | |
3791 | |
3792 /* | |
3793 * Shift LineOffset[] line_count down to reflect the inserted lines. | |
3794 * Clear the inserted lines in ScreenLines[]. | |
3795 */ | |
3796 row += off; | |
3797 end += off; | |
3798 for (i = 0; i < line_count; ++i) | |
3799 { | |
3800 if (wp != NULL && wp->w_width != Columns) | |
3801 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3802 // need to copy part of a line |
7 | 3803 j = end - 1 - i; |
3804 while ((j -= line_count) >= row) | |
3805 linecopy(j + line_count, j, wp); | |
3806 j += line_count; | |
3807 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
|
3808 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
|
3809 clear_attr); |
7 | 3810 else |
3811 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); | |
3812 LineWraps[j] = FALSE; | |
3813 } | |
3814 else | |
3815 { | |
3816 j = end - 1 - i; | |
3817 temp = LineOffset[j]; | |
3818 while ((j -= line_count) >= row) | |
3819 { | |
3820 LineOffset[j + line_count] = LineOffset[j]; | |
3821 LineWraps[j + line_count] = LineWraps[j]; | |
3822 } | |
3823 LineOffset[j + line_count] = temp; | |
3824 LineWraps[j + line_count] = FALSE; | |
3825 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
|
3826 lineclear(temp, (int)Columns, clear_attr); |
7 | 3827 else |
3828 lineinvalid(temp, (int)Columns); | |
3829 } | |
3830 } | |
3831 | |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3832 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3833 vim_unlock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3834 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
3835 |
7 | 3836 screen_stop_highlight(); |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3837 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
|
3838 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
|
3839 screen_start_highlight(clear_attr); |
7 | 3840 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3841 // redraw the characters |
7 | 3842 if (type == USE_REDRAW) |
3843 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
|
3844 else if (type == USE_T_CAL) |
7 | 3845 { |
3846 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
|
3847 screen_start(); // don't know where cursor is now |
7 | 3848 } |
3849 else | |
3850 { | |
3851 for (i = 0; i < line_count; i++) | |
3852 { | |
3853 if (type == USE_T_AL) | |
3854 { | |
3855 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
|
3856 windgoto(cursor_row, cursor_col); |
7 | 3857 out_str(T_AL); |
3858 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3859 else // type == USE_T_SR |
7 | 3860 out_str(T_SR); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3861 screen_start(); // don't know where cursor is now |
7 | 3862 } |
3863 } | |
3864 | |
3865 /* | |
3866 * With scroll-reverse and 'da' flag set we need to clear the lines that | |
3867 * have been scrolled down into the region. | |
3868 */ | |
3869 if (type == USE_T_SR && *T_DA) | |
3870 { | |
3871 for (i = 0; i < line_count; ++i) | |
3872 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3873 windgoto(off + i, cursor_col); |
7 | 3874 out_str(T_CE); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3875 screen_start(); // don't know where cursor is now |
7 | 3876 } |
3877 } | |
3878 | |
3879 #ifdef FEAT_GUI | |
3880 gui_can_update_cursor(); | |
3881 if (gui.in_use) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3882 out_flush(); // always flush after a scroll |
7 | 3883 #endif |
3884 return OK; | |
3885 } | |
3886 | |
3887 /* | |
9848
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
3888 * 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
|
3889 * "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
|
3890 * 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
|
3891 * "row" and "end" are relative to the start of the region. |
7 | 3892 * |
3893 * Return OK for success, FAIL if the lines are not deleted. | |
3894 */ | |
3895 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3896 screen_del_lines( |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3897 int off, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3898 int row, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3899 int line_count, |
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
3900 int end, |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3901 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
|
3902 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
|
3903 win_T *wp) // NULL or window to use width from |
7 | 3904 { |
3905 int j; | |
3906 int i; | |
3907 unsigned temp; | |
3908 int cursor_row; | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
3909 int cursor_col = 0; |
7 | 3910 int cursor_end; |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3911 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
|
3912 int can_delete; // deleting line codes can be used |
7 | 3913 int type; |
3914 | |
3915 /* | |
3916 * FAIL if | |
3917 * - there is no valid screen | |
3918 * - the screen has to be redrawn completely | |
3919 * - the line count is less than one | |
3920 * - 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
|
3921 * - "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
|
3922 * - redrawing for a callback and there is a modeless selection |
7 | 3923 */ |
28275
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3924 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
|
3925 || line_count <= 0 |
f0e46f5bb2e7
patch 8.2.4663: occasional crash when running the GUI tests
Bram Moolenaar <Bram@vim.org>
parents:
27944
diff
changeset
|
3926 || (!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
|
3927 || 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
|
3928 #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
|
3929 || (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
|
3930 #endif |
4f59d2a66bf7
patch 8.0.0732: when updating a buffer modeless selection is lost
Christian Brabandt <cb@256bit.org>
parents:
11672
diff
changeset
|
3931 ) |
7 | 3932 return FAIL; |
3933 | |
3934 /* | |
3935 * Check if the rest of the current region will become empty. | |
3936 */ | |
3937 result_empty = row + line_count >= end; | |
3938 | |
3939 /* | |
3940 * We can delete lines only when 'db' flag not set or when 'ce' option | |
3941 * available. | |
3942 */ | |
3943 can_delete = (*T_DB == NUL || can_clear(T_CE)); | |
3944 | |
3945 /* | |
3946 * There are six ways to delete lines: | |
3947 * 0. When in a vertically split window and t_CV isn't set, redraw the | |
3948 * characters from ScreenLines[]. | |
3949 * 1. Use T_CD if it exists and the result is empty. | |
3950 * 2. Use newlines if row == 0 and count == 1 or T_CDL does not exist. | |
3951 * 3. Use T_CDL (delete multiple lines) if it exists and line_count > 1 or | |
3952 * none of the other ways work. | |
3953 * 4. Use T_CE (erase line) if the result is empty. | |
3954 * 5. Use T_DL (delete line) if it exists. | |
3955 * 6. redraw the characters from ScreenLines[]. | |
3956 */ | |
3957 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
|
3958 { |
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
|
3959 // 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
|
3960 // 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
|
3961 // 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
|
3962 // 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
|
3963 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
|
3964 return FAIL; |
7 | 3965 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
|
3966 } |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
3967 else if (can_clear(T_CD) && result_empty) |
7 | 3968 type = USE_T_CD; |
3969 else if (row == 0 && ( | |
3970 #ifndef AMIGA | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3971 // 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
|
3972 // up, so use delete-line command |
7 | 3973 line_count == 1 || |
3974 #endif | |
3975 *T_CDL == NUL)) | |
3976 type = USE_NL; | |
3977 else if (*T_CDL != NUL && line_count > 1 && can_delete) | |
3978 type = USE_T_CDL; | |
3979 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
|
3980 && (wp == NULL || wp->w_width == Columns)) |
7 | 3981 type = USE_T_CE; |
3982 else if (*T_DL != NUL && can_delete) | |
3983 type = USE_T_DL; | |
3984 else if (*T_CDL != NUL && can_delete) | |
3985 type = USE_T_CDL; | |
3986 else | |
3987 return FAIL; | |
3988 | |
3989 #ifdef FEAT_CLIPBOARD | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
3990 // 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
|
3991 // 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
|
3992 if (off + row > 0 || (wp != NULL && wp->w_width != Columns)) |
3674 | 3993 clip_clear_selection(&clip_star); |
7 | 3994 else |
3995 clip_scroll_selection(line_count); | |
3996 #endif | |
3997 | |
20154
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
3998 #ifdef FEAT_GUI_HAIKU |
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
3999 vim_lock_screen(); |
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
4000 #endif |
5dc9b96e3c5a
patch 8.2.0632: crash when using Haiku
Bram Moolenaar <Bram@vim.org>
parents:
19888
diff
changeset
|
4001 |
7 | 4002 #ifdef FEAT_GUI |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4003 // 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
|
4004 // scrolling is actually carried out. |
9848
664276833670
commit https://github.com/vim/vim/commit/107abd2ca53c31fd3bb40d77ff296e98eaae2975
Christian Brabandt <cb@256bit.org>
parents:
9754
diff
changeset
|
4005 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
|
4006 && gui.cursor_row < end + off); |
7 | 4007 #endif |
4008 | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
4009 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
|
4010 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
|
4011 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4012 if (*T_CCS != NUL) // cursor relative to region |
7 | 4013 { |
4014 cursor_row = row; | |
4015 cursor_end = end; | |
4016 } | |
4017 else | |
4018 { | |
4019 cursor_row = row + off; | |
4020 cursor_end = end + off; | |
4021 } | |
4022 | |
4023 /* | |
4024 * Now shift LineOffset[] line_count up to reflect the deleted lines. | |
4025 * Clear the inserted lines in ScreenLines[]. | |
4026 */ | |
4027 row += off; | |
4028 end += off; | |
4029 for (i = 0; i < line_count; ++i) | |
4030 { | |
4031 if (wp != NULL && wp->w_width != Columns) | |
4032 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4033 // need to copy part of a line |
7 | 4034 j = row + i; |
4035 while ((j += line_count) <= end - 1) | |
4036 linecopy(j - line_count, j, wp); | |
4037 j -= line_count; | |
4038 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
|
4039 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
|
4040 clear_attr); |
7 | 4041 else |
4042 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width); | |
4043 LineWraps[j] = FALSE; | |
4044 } | |
4045 else | |
4046 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4047 // whole width, moving the line pointers is faster |
7 | 4048 j = row + i; |
4049 temp = LineOffset[j]; | |
4050 while ((j += line_count) <= end - 1) | |
4051 { | |
4052 LineOffset[j - line_count] = LineOffset[j]; | |
4053 LineWraps[j - line_count] = LineWraps[j]; | |
4054 } | |
4055 LineOffset[j - line_count] = temp; | |
4056 LineWraps[j - line_count] = FALSE; | |
4057 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
|
4058 lineclear(temp, (int)Columns, clear_attr); |
7 | 4059 else |
4060 lineinvalid(temp, (int)Columns); | |
4061 } | |
4062 } | |
4063 | |
19526
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
4064 #ifdef FEAT_GUI_HAIKU |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
4065 vim_unlock_screen(); |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
4066 #endif |
22f0dda71638
patch 8.2.0320: no Haiku support
Bram Moolenaar <Bram@vim.org>
parents:
18812
diff
changeset
|
4067 |
12152
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
4068 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
|
4069 screen_stop_highlight(); |
69af108df70e
patch 8.0.0956: scrolling in a terminal window has flicker
Christian Brabandt <cb@256bit.org>
parents:
12122
diff
changeset
|
4070 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
|
4071 screen_start_highlight(clear_attr); |
7 | 4072 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4073 // redraw the characters |
7 | 4074 if (type == USE_REDRAW) |
4075 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
|
4076 else if (type == USE_T_CD) // delete the lines |
7 | 4077 { |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
4078 windgoto(cursor_row, cursor_col); |
7 | 4079 out_str(T_CD); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4080 screen_start(); // don't know where cursor is now |
7 | 4081 } |
4082 else if (type == USE_T_CDL) | |
4083 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
4084 windgoto(cursor_row, cursor_col); |
7 | 4085 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
|
4086 screen_start(); // don't know where cursor is now |
7 | 4087 } |
4088 /* | |
4089 * Deleting lines at top of the screen or scroll region: Just scroll | |
4090 * the whole screen (scroll region) up by outputting newlines on the | |
4091 * last line. | |
4092 */ | |
4093 else if (type == USE_NL) | |
4094 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
4095 windgoto(cursor_end - 1, cursor_col); |
7 | 4096 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
|
4097 out_char('\n'); // cursor will remain on same line |
7 | 4098 } |
4099 else | |
4100 { | |
4101 for (i = line_count; --i >= 0; ) | |
4102 { | |
4103 if (type == USE_T_DL) | |
4104 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
4105 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
|
4106 out_str(T_DL); // delete a line |
7 | 4107 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4108 else // type == USE_T_CE |
7 | 4109 { |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
4110 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
|
4111 out_str(T_CE); // erase a line |
7 | 4112 } |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4113 screen_start(); // don't know where cursor is now |
7 | 4114 } |
4115 } | |
4116 | |
4117 /* | |
4118 * If the 'db' flag is set, we need to clear the lines that have been | |
4119 * scrolled up at the bottom of the region. | |
4120 */ | |
4121 if (*T_DB && (type == USE_T_DL || type == USE_T_CDL)) | |
4122 { | |
4123 for (i = line_count; i > 0; --i) | |
4124 { | |
14081
45c595c0ddaf
patch 8.1.0058: display problem with margins and scrolling
Christian Brabandt <cb@256bit.org>
parents:
14079
diff
changeset
|
4125 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
|
4126 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
|
4127 screen_start(); // don't know where cursor is now |
7 | 4128 } |
4129 } | |
4130 | |
4131 #ifdef FEAT_GUI | |
4132 gui_can_update_cursor(); | |
4133 if (gui.in_use) | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4134 out_flush(); // always flush after a scroll |
7 | 4135 #endif |
4136 | |
4137 return OK; | |
4138 } | |
4139 | |
4140 /* | |
15629
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4141 * 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
|
4142 * 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
|
4143 */ |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4144 int |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4145 skip_showmode() |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4146 { |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4147 // 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
|
4148 // 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
|
4149 if (global_busy |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4150 || msg_silent != 0 |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4151 || !redrawing() |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4152 || (char_avail() && !KeyTyped)) |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4153 { |
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
|
4154 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
|
4155 return TRUE; |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4156 } |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4157 return FALSE; |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4158 } |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4159 |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4160 /* |
13308
ae312df8d0ab
patch 8.0.1528: dead code found
Christian Brabandt <cb@256bit.org>
parents:
13292
diff
changeset
|
4161 * Show the current mode and ruler. |
7 | 4162 * |
4163 * If clear_cmdline is TRUE, clear the rest of the cmdline. | |
4164 * If clear_cmdline is FALSE there may be a message there that needs to be | |
4165 * 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
|
4166 * If redraw_mode is TRUE show or clear the mode. |
7 | 4167 * Return the length of the message (0 if no message). |
4168 */ | |
4169 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4170 showmode(void) |
7 | 4171 { |
4172 int need_clear; | |
4173 int length = 0; | |
4174 int do_mode; | |
4175 int attr; | |
4176 int nwr_save; | |
4177 int sub_attr; | |
4178 | |
642 | 4179 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
|
4180 && ((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
|
4181 || restart_edit != NUL |
5735 | 4182 || 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
|
4183 if (do_mode || reg_recording != 0) |
7 | 4184 { |
15629
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4185 if (skip_showmode()) |
dd2e0b83a660
patch 8.1.0822: peeking and flushing output slows down execution
Bram Moolenaar <Bram@vim.org>
parents:
15609
diff
changeset
|
4186 return 0; // show mode later |
7 | 4187 |
4188 nwr_save = need_wait_return; | |
4189 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4190 // wait a bit before overwriting an important message |
7 | 4191 check_for_delay(FALSE); |
4192 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4193 // if the cmdline is more than one line high, erase top lines |
7 | 4194 need_clear = clear_cmdline; |
4195 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
|
4196 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
|
4197 |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4198 // Position on the last line in the window, column 0 |
7 | 4199 msg_pos_mode(); |
4200 cursor_off(); | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4201 attr = HL_ATTR(HLF_CM); // Highlight mode |
7 | 4202 if (do_mode) |
4203 { | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4204 msg_puts_attr("--", attr); |
7 | 4205 #if defined(FEAT_XIM) |
2520 | 4206 if ( |
4207 # ifdef FEAT_GUI_GTK | |
4208 preedit_get_status() | |
1668 | 4209 # else |
4210 im_get_status() | |
2520 | 4211 # endif |
1668 | 4212 ) |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4213 # 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
|
4214 msg_puts_attr(" IM", attr); |
7 | 4215 # else |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4216 msg_puts_attr(" XIM", attr); |
7 | 4217 # endif |
4218 #endif | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4219 // CTRL-X in Insert mode |
5946 | 4220 if (edit_submode != NULL && !shortmess(SHM_COMPLETIONMENU)) |
7 | 4221 { |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4222 // 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
|
4223 // window. Prefer showing edit_submode_extra. |
7 | 4224 length = (Rows - msg_row) * Columns - 3; |
4225 if (edit_submode_extra != NULL) | |
4226 length -= vim_strsize(edit_submode_extra); | |
4227 if (length > 0) | |
4228 { | |
4229 if (edit_submode_pre != NULL) | |
4230 length -= vim_strsize(edit_submode_pre); | |
4231 if (length - vim_strsize(edit_submode) > 0) | |
4232 { | |
4233 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
|
4234 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
|
4235 msg_puts_attr((char *)edit_submode, attr); |
7 | 4236 } |
4237 if (edit_submode_extra != NULL) | |
4238 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4239 msg_puts_attr(" ", attr); // add a space in between |
7 | 4240 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
|
4241 sub_attr = HL_ATTR(edit_submode_highl); |
7 | 4242 else |
4243 sub_attr = attr; | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4244 msg_puts_attr((char *)edit_submode_extra, sub_attr); |
7 | 4245 } |
4246 } | |
4247 } | |
4248 else | |
4249 { | |
4250 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
|
4251 msg_puts_attr(_(" VREPLACE"), attr); |
14424
0a69e6e708f9
patch 8.1.0226: too many #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
14218
diff
changeset
|
4252 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
|
4253 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
|
4254 else if (State & MODE_INSERT) |
7 | 4255 { |
4256 #ifdef FEAT_RIGHTLEFT | |
4257 if (p_ri) | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4258 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
|
4259 #endif |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4260 msg_puts_attr(_(" INSERT"), attr); |
7 | 4261 } |
22862
6d50182e7e24
patch 8.2.1978: making a mapping work in all modes is complicated
Bram Moolenaar <Bram@vim.org>
parents:
22832
diff
changeset
|
4262 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
|
4263 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
|
4264 msg_puts_attr(_(" (insert)"), attr); |
7 | 4265 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
|
4266 msg_puts_attr(_(" (replace)"), attr); |
7 | 4267 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
|
4268 msg_puts_attr(_(" (vreplace)"), attr); |
7 | 4269 #ifdef FEAT_RIGHTLEFT |
4270 if (p_hkmap) | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4271 msg_puts_attr(_(" Hebrew"), attr); |
7 | 4272 #endif |
4273 #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
|
4274 if (State & MODE_LANGMAP) |
7 | 4275 { |
4276 # ifdef FEAT_ARABIC | |
4277 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
|
4278 msg_puts_attr(_(" Arabic"), attr); |
7 | 4279 else |
4280 # endif | |
9645
123d3c102035
commit https://github.com/vim/vim/commit/73ac0c4281a3606651604a3cbcc334bfb3859a87
Christian Brabandt <cb@256bit.org>
parents:
9489
diff
changeset
|
4281 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
|
4282 NameBuff, MAXPATHL)) |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4283 msg_puts_attr((char *)NameBuff, attr); |
7 | 4284 } |
4285 #endif | |
28773
d770568e6c98
patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents:
28386
diff
changeset
|
4286 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
|
4287 msg_puts_attr(_(" (paste)"), attr); |
7 | 4288 |
4289 if (VIsual_active) | |
4290 { | |
4291 char *p; | |
4292 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4293 // 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
|
4294 // problems. |
7 | 4295 switch ((VIsual_select ? 4 : 0) |
4296 + (VIsual_mode == Ctrl_V) * 2 | |
4297 + (VIsual_mode == 'V')) | |
4298 { | |
4299 case 0: p = N_(" VISUAL"); break; | |
4300 case 1: p = N_(" VISUAL LINE"); break; | |
4301 case 2: p = N_(" VISUAL BLOCK"); break; | |
4302 case 4: p = N_(" SELECT"); break; | |
4303 case 5: p = N_(" SELECT LINE"); break; | |
4304 default: p = N_(" SELECT BLOCK"); break; | |
4305 } | |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4306 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
|
4307 } |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4308 msg_puts_attr(" --", attr); |
7 | 4309 } |
644 | 4310 |
7 | 4311 need_clear = TRUE; |
4312 } | |
14004
e124262d435e
patch 8.1.0020: cannot tell whether a register is executing or recording
Christian Brabandt <cb@256bit.org>
parents:
13968
diff
changeset
|
4313 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
|
4314 && edit_submode == NULL) // otherwise it gets too long |
7 | 4315 { |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4316 recording_mode(attr); |
7 | 4317 need_clear = TRUE; |
4318 } | |
644 | 4319 |
4320 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
|
4321 if (need_clear || clear_cmdline || redraw_mode) |
7 | 4322 msg_clr_eos(); |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4323 msg_didout = FALSE; // overwrite this message |
7 | 4324 length = msg_col; |
4325 msg_col = 0; | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4326 need_wait_return = nwr_save; // never ask for hit-return for this |
7 | 4327 } |
4328 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
|
4329 // Clear the whole command line. Will reset "clear_cmdline". |
7 | 4330 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
|
4331 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
|
4332 { |
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
|
4333 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
|
4334 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
|
4335 } |
7 | 4336 |
4337 #ifdef FEAT_CMDL_INFO | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4338 // In Visual mode the size of the selected area must be redrawn. |
7 | 4339 if (VIsual_active) |
4340 clear_showcmd(); | |
4341 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4342 // 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
|
4343 // 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
|
4344 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
|
4345 win_redr_ruler(lastwin, TRUE, FALSE); |
7 | 4346 #endif |
4347 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
|
4348 redraw_mode = FALSE; |
7 | 4349 clear_cmdline = FALSE; |
4350 | |
4351 return length; | |
4352 } | |
4353 | |
4354 /* | |
4355 * Position for a mode message. | |
4356 */ | |
4357 static void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4358 msg_pos_mode(void) |
7 | 4359 { |
4360 msg_col = 0; | |
4361 msg_row = Rows - 1; | |
4362 } | |
4363 | |
4364 /* | |
4365 * Delete mode message. Used when ESC is typed which is expected to end | |
4366 * Insert mode (but Insert mode didn't end yet!). | |
644 | 4367 * Caller should check "mode_displayed". |
7 | 4368 */ |
4369 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4370 unshowmode(int force) |
7 | 4371 { |
4372 /* | |
2055
4aa4510d548c
updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents:
2008
diff
changeset
|
4373 * Don't delete it right now, when not redrawing or inside a mapping. |
7 | 4374 */ |
4375 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
|
4376 redraw_cmdline = TRUE; // delete mode later |
7 | 4377 else |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4378 clearmode(); |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4379 } |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4380 |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4381 /* |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4382 * Clear the mode message. |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4383 */ |
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4384 void |
9282
9f97a6290c63
commit https://github.com/vim/vim/commit/cf089463492fab53b2a5d81517829d22f882f82e
Christian Brabandt <cb@256bit.org>
parents:
9213
diff
changeset
|
4385 clearmode(void) |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4386 { |
13968
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4387 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
|
4388 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
|
4389 |
8817
b7eb7bbd71d0
commit https://github.com/vim/vim/commit/fd773e9e88add7d1ffef890fb9f3a00d613b4326
Christian Brabandt <cb@256bit.org>
parents:
8643
diff
changeset
|
4390 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
|
4391 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
|
4392 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
|
4393 msg_clr_eos(); |
13968
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4394 |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4395 msg_col = save_msg_col; |
d111462e0173
patch 8.1.0002: :stopinsert changes the message position
Christian Brabandt <cb@256bit.org>
parents:
13888
diff
changeset
|
4396 msg_row = save_msg_row; |
7 | 4397 } |
4398 | |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4399 static void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4400 recording_mode(int attr) |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4401 { |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4402 msg_puts_attr(_("recording"), attr); |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4403 if (!shortmess(SHM_RECORDING)) |
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4404 { |
15543
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4405 char s[4]; |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4406 |
dd725a8ab112
patch 8.1.0779: argument for message functions is inconsistent
Bram Moolenaar <Bram@vim.org>
parents:
15521
diff
changeset
|
4407 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
|
4408 msg_puts_attr(s, attr); |
7233
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4409 } |
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4410 } |
9487ea110214
commit https://github.com/vim/vim/commit/a0ed84a26897c994512873a895b9fc54e90c6845
Christian Brabandt <cb@256bit.org>
parents:
7208
diff
changeset
|
4411 |
667 | 4412 /* |
4413 * Draw the tab pages line at the top of the Vim window. | |
4414 */ | |
15396
325e4a8ba1b6
patch 8.1.0706: tabline is not always redrawn
Bram Moolenaar <Bram@vim.org>
parents:
15384
diff
changeset
|
4415 void |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4416 draw_tabline(void) |
667 | 4417 { |
4418 int tabcount = 0; | |
4419 tabpage_T *tp; | |
4420 int tabwidth; | |
4421 int col = 0; | |
673 | 4422 int scol = 0; |
667 | 4423 int attr; |
4424 win_T *wp; | |
671 | 4425 win_T *cwp; |
4426 int wincount; | |
4427 int modified; | |
667 | 4428 int c; |
4429 int len; | |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4430 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
|
4431 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
|
4432 int attr_fill = HL_ATTR(HLF_TPF); |
673 | 4433 char_u *p; |
677 | 4434 int room; |
4435 int use_sep_chars = (t_colors < 8 | |
4436 #ifdef FEAT_GUI | |
4437 && !gui.in_use | |
4438 #endif | |
9027
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
4439 #ifdef FEAT_TERMGUICOLORS |
773d627cac0b
commit https://github.com/vim/vim/commit/61be73bb0f965a895bfb064ea3e55476ac175162
Christian Brabandt <cb@256bit.org>
parents:
8977
diff
changeset
|
4440 && !p_tgc |
8969
c83e2c1e7f2b
commit https://github.com/vim/vim/commit/8a633e3427b47286869aa4b96f2bfc1fe65b25cd
Christian Brabandt <cb@256bit.org>
parents:
8907
diff
changeset
|
4441 #endif |
677 | 4442 ); |
673 | 4443 |
10538
c7f671dfd735
patch 8.0.0159: crash on startup when updating tabline
Christian Brabandt <cb@256bit.org>
parents:
10466
diff
changeset
|
4444 if (ScreenLines == NULL) |
c7f671dfd735
patch 8.0.0159: crash on startup when updating tabline
Christian Brabandt <cb@256bit.org>
parents:
10466
diff
changeset
|
4445 return; |
673 | 4446 redraw_tabline = FALSE; |
667 | 4447 |
685 | 4448 #ifdef FEAT_GUI_TABLINE |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4449 // Take care of a GUI tabline. |
685 | 4450 if (gui_use_tabline()) |
4451 { | |
4452 gui_update_tabline(); | |
4453 return; | |
4454 } | |
4455 #endif | |
4456 | |
4457 if (tabline_height() < 1) | |
667 | 4458 return; |
4459 | |
677 | 4460 #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
|
4461 clear_TabPageIdxs(); |
681 | 4462 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4463 // Use the 'tabline' option if it's set. |
677 | 4464 if (*p_tal != NUL) |
4465 { | |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
8847
diff
changeset
|
4466 int saved_did_emsg = did_emsg; |
680 | 4467 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4468 // Check for an error. If there is one we would loop in redrawing the |
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4469 // screen. Avoid that by making 'tabline' empty. |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
8847
diff
changeset
|
4470 did_emsg = FALSE; |
677 | 4471 win_redr_custom(NULL, FALSE); |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
8847
diff
changeset
|
4472 if (did_emsg) |
680 | 4473 set_string_option_direct((char_u *)"tabline", -1, |
694 | 4474 (char_u *)"", OPT_FREE, SID_ERROR); |
8872
4d4de770f970
commit https://github.com/vim/vim/commit/f73d3bc253fa79ad220f52f04b93e782e95a9d43
Christian Brabandt <cb@256bit.org>
parents:
8847
diff
changeset
|
4475 did_emsg |= saved_did_emsg; |
680 | 4476 } |
4477 else | |
4478 #endif | |
4479 { | |
9649
fd9727ae3c49
commit https://github.com/vim/vim/commit/2932359000b2f918d5fade79ea4d124d5943cd07
Christian Brabandt <cb@256bit.org>
parents:
9645
diff
changeset
|
4480 FOR_ALL_TABPAGES(tp) |
680 | 4481 ++tabcount; |
4482 | |
4483 tabwidth = (Columns - 1 + tabcount / 2) / tabcount; | |
4484 if (tabwidth < 6) | |
4485 tabwidth = 6; | |
4486 | |
4487 attr = attr_nosel; | |
4488 tabcount = 0; | |
699 | 4489 for (tp = first_tabpage; tp != NULL && col < Columns - 4; |
4490 tp = tp->tp_next) | |
680 | 4491 { |
4492 scol = col; | |
4493 | |
4494 if (tp->tp_topframe == topframe) | |
4495 attr = attr_sel; | |
4496 if (use_sep_chars && col > 0) | |
4497 screen_putchar('|', 0, col++, attr); | |
4498 | |
4499 if (tp->tp_topframe != topframe) | |
4500 attr = attr_nosel; | |
4501 | |
4502 screen_putchar(' ', 0, col++, attr); | |
4503 | |
4504 if (tp == curtab) | |
4505 { | |
4506 cwp = curwin; | |
4507 wp = firstwin; | |
4508 } | |
4509 else | |
4510 { | |
4511 cwp = tp->tp_curwin; | |
4512 wp = tp->tp_firstwin; | |
4513 } | |
4514 | |
4515 modified = FALSE; | |
4516 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount) | |
4517 if (bufIsChanged(wp->w_buffer)) | |
4518 modified = TRUE; | |
4519 if (modified || wincount > 1) | |
4520 { | |
4521 if (wincount > 1) | |
4522 { | |
4523 vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount); | |
835 | 4524 len = (int)STRLEN(NameBuff); |
699 | 4525 if (col + len >= Columns - 3) |
4526 break; | |
680 | 4527 screen_puts_len(NameBuff, len, 0, col, |
677 | 4528 #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
|
4529 hl_combine_attr(attr, HL_ATTR(HLF_T)) |
677 | 4530 #else |
6106 | 4531 attr |
680 | 4532 #endif |
4533 ); | |
4534 col += len; | |
4535 } | |
4536 if (modified) | |
4537 screen_puts_len((char_u *)"+", 1, 0, col++, attr); | |
4538 screen_putchar(' ', 0, col++, attr); | |
4539 } | |
4540 | |
4541 room = scol - col + tabwidth - 1; | |
4542 if (room > 0) | |
4543 { | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4544 // Get buffer name in NameBuff[] |
685 | 4545 get_trans_bufname(cwp->w_buffer); |
819 | 4546 shorten_dir(NameBuff); |
680 | 4547 len = vim_strsize(NameBuff); |
4548 p = NameBuff; | |
4549 if (has_mbyte) | |
4550 while (len > room) | |
4551 { | |
4552 len -= ptr2cells(p); | |
11127
506f5d8b7d8b
patch 8.0.0451: some macros are in lower case
Christian Brabandt <cb@256bit.org>
parents:
11121
diff
changeset
|
4553 MB_PTR_ADV(p); |
680 | 4554 } |
15603
639b8318472c
patch 8.1.0809: too many #ifdefs
Bram Moolenaar <Bram@vim.org>
parents:
15555
diff
changeset
|
4555 else if (len > room) |
677 | 4556 { |
680 | 4557 p += len - room; |
4558 len = room; | |
677 | 4559 } |
699 | 4560 if (len > Columns - col - 1) |
4561 len = Columns - col - 1; | |
680 | 4562 |
835 | 4563 screen_puts_len(p, (int)STRLEN(p), 0, col, attr); |
680 | 4564 col += len; |
4565 } | |
4566 screen_putchar(' ', 0, col++, attr); | |
4567 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4568 // 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
|
4569 // jump_to_mouse() knows where each one is. |
680 | 4570 ++tabcount; |
4571 while (scol < col) | |
4572 TabPageIdxs[scol++] = tabcount; | |
4573 } | |
4574 | |
4575 if (use_sep_chars) | |
4576 c = '_'; | |
4577 else | |
4578 c = ' '; | |
4579 screen_fill(0, 1, col, (int)Columns, c, c, attr_fill); | |
681 | 4580 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4581 // Put an "X" for closing the current tab if there are several. |
681 | 4582 if (first_tabpage->tp_next != NULL) |
4583 { | |
4584 screen_putchar('X', 0, (int)Columns - 1, attr_nosel); | |
4585 TabPageIdxs[Columns - 1] = -999; | |
4586 } | |
4587 } | |
834 | 4588 |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4589 // 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
|
4590 // set. |
834 | 4591 redraw_tabline = FALSE; |
667 | 4592 } |
685 | 4593 |
4594 /* | |
4595 * Get buffer name for "buf" into NameBuff[]. | |
4596 * Takes care of special buffer names and translates special characters. | |
4597 */ | |
4598 void | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4599 get_trans_bufname(buf_T *buf) |
685 | 4600 { |
4601 if (buf_spname(buf) != NULL) | |
3839 | 4602 vim_strncpy(NameBuff, buf_spname(buf), MAXPATHL - 1); |
685 | 4603 else |
4604 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE); | |
4605 trans_characters(NameBuff, MAXPATHL); | |
4606 } | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
4607 |
7 | 4608 /* |
4609 * Get the character to use in a status line. Get its attributes in "*attr". | |
4610 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
4611 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
|
4612 fillchar_status(int *attr, win_T *wp) |
7 | 4613 { |
4614 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
|
4615 |
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
|
4616 #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
|
4617 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
|
4618 { |
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
|
4619 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
|
4620 { |
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4621 *attr = HL_ATTR(HLF_ST); |
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
|
4622 fill = fill_stl; |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4623 } |
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
|
4624 else |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4625 { |
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4626 *attr = HL_ATTR(HLF_STNC); |
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
|
4627 fill = fill_stlnc; |
12122
68c593f649d1
patch 8.0.0941: existing color schemes don't like StatusLineTerm
Christian Brabandt <cb@256bit.org>
parents:
12114
diff
changeset
|
4628 } |
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
|
4629 } |
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
|
4630 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
|
4631 #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
|
4632 if (wp == curwin) |
7 | 4633 { |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4634 *attr = HL_ATTR(HLF_S); |
7 | 4635 fill = fill_stl; |
4636 } | |
4637 else | |
4638 { | |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4639 *attr = HL_ATTR(HLF_SNC); |
7 | 4640 fill = fill_stlnc; |
4641 } | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4642 // 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
|
4643 // 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
|
4644 // current window |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4645 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
|
4646 || wp != curwin || ONE_WINDOW) |
7 | 4647 || (fill_stl != fill_stlnc))) |
4648 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
|
4649 if (wp == curwin) |
7 | 4650 return '^'; |
4651 return '='; | |
4652 } | |
12477
68d7bc045dbe
patch 8.0.1118: FEAT_WINDOWS adds a lot of #ifdefs
Christian Brabandt <cb@256bit.org>
parents:
12441
diff
changeset
|
4653 |
7 | 4654 /* |
4655 * Get the character to use in a separator between vertically split windows. | |
4656 * Get its attributes in "*attr". | |
4657 */ | |
18124
2a806e3c39f6
patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
18090
diff
changeset
|
4658 int |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4659 fillchar_vsep(int *attr) |
7 | 4660 { |
11158
501f46f7644c
patch 8.0.0466: still macros that should be all-caps
Christian Brabandt <cb@256bit.org>
parents:
11133
diff
changeset
|
4661 *attr = HL_ATTR(HLF_C); |
7 | 4662 if (*attr == 0 && fill_vert == ' ') |
4663 return '|'; | |
4664 else | |
4665 return fill_vert; | |
4666 } | |
4667 | |
4668 /* | |
4669 * Return TRUE if redrawing should currently be done. | |
4670 */ | |
4671 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4672 redrawing(void) |
7 | 4673 { |
11105
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4674 #ifdef FEAT_EVAL |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4675 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
|
4676 return 0; |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4677 else |
7c7e496e625d
patch 8.0.0440: not enough test coverage in Insert mode
Christian Brabandt <cb@256bit.org>
parents:
11010
diff
changeset
|
4678 #endif |
14673
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4679 return ((!RedrawingDisabled |
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4680 #ifdef FEAT_EVAL |
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4681 || 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
|
4682 #endif |
f1b7d308de2f
patch 8.1.0349: crash when wiping buffer in a callback
Christian Brabandt <cb@256bit.org>
parents:
14662
diff
changeset
|
4683 ) && !(p_lz && char_avail() && !KeyTyped && !do_redraw)); |
7 | 4684 } |
4685 | |
4686 /* | |
4687 * Return TRUE if printing messages should currently be done. | |
4688 */ | |
4689 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4690 messaging(void) |
7 | 4691 { |
4692 return (!(p_lz && char_avail() && !KeyTyped)); | |
4693 } | |
4694 | |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4695 /* |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4696 * 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
|
4697 * 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
|
4698 * 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
|
4699 * 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
|
4700 */ |
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 #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
|
4703 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4704 void |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4705 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
|
4706 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4707 #if defined(FEAT_CMDL_INFO) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4708 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
|
4709 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4710 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
|
4711 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
|
4712 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
|
4713 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4714 # ifdef FEAT_STL_OPT |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4715 ru_col = (ru_wid ? ru_wid : COL_RULER) + 1; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4716 # else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4717 ru_col = COL_RULER + 1; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4718 # endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4719 // 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
|
4720 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
|
4721 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
|
4722 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4723 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
|
4724 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4725 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
|
4726 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
|
4727 ++sc_col; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4728 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4729 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
|
4730 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
|
4731 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
|
4732 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
|
4733 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
|
4734 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
|
4735 #else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4736 sc_col = Columns; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4737 ru_col = Columns; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4738 #endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4739 #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
|
4740 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
|
4741 #endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4742 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4743 |
13 | 4744 #if defined(FEAT_LINEBREAK) || defined(PROTO) |
4745 /* | |
2178
c6f1aa1e9f32
Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents:
2124
diff
changeset
|
4746 * 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
|
4747 * Caller may need to check if 'number' or 'relativenumber' is set. |
13 | 4748 * Otherwise it depends on 'numberwidth' and the line count. |
4749 */ | |
4750 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4751 number_width(win_T *wp) |
13 | 4752 { |
4753 int n; | |
4754 linenr_T lnum; | |
4755 | |
4736
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4756 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
|
4757 // cursor line shows "0" |
4736
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4758 lnum = wp->w_height; |
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4759 else |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4760 // cursor line shows absolute line number |
4736
3f2319a953b3
updated for version 7.3.1115
Bram Moolenaar <bram@vim.org>
parents:
4352
diff
changeset
|
4761 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
|
4762 |
6679 | 4763 if (lnum == wp->w_nrwidth_line_count && wp->w_nuw_cached == wp->w_p_nuw) |
13 | 4764 return wp->w_nrwidth_width; |
4765 wp->w_nrwidth_line_count = lnum; | |
4766 | |
4767 n = 0; | |
4768 do | |
4769 { | |
856 | 4770 lnum /= 10; |
4771 ++n; | |
13 | 4772 } while (lnum > 0); |
4773 | |
18812
d34ec6fe207d
patch 8.1.2394: using old C style comments
Bram Moolenaar <Bram@vim.org>
parents:
18786
diff
changeset
|
4774 // 'numberwidth' gives the minimal width plus one |
13 | 4775 if (n < wp->w_p_nuw - 1) |
4776 n = wp->w_p_nuw - 1; | |
4777 | |
17247
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4778 # 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
|
4779 // 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
|
4780 // 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
|
4781 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
|
4782 && (*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
|
4783 n = 2; |
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4784 # endif |
cbd0432cf8ff
patch 8.1.1623: display wrong with signs in narrow number column
Bram Moolenaar <Bram@vim.org>
parents:
17229
diff
changeset
|
4785 |
13 | 4786 wp->w_nrwidth_width = n; |
6679 | 4787 wp->w_nuw_cached = wp->w_p_nuw; |
13 | 4788 return n; |
4789 } | |
4790 #endif | |
3986 | 4791 |
15555
d89c5b339c2a
patch 8.1.0785: depending on the configuration some functions are unused
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
4792 #if defined(FEAT_EVAL) || defined(PROTO) |
3986 | 4793 /* |
4794 * Return the current cursor column. This is the actual position on the | |
4795 * screen. First column is 0. | |
4796 */ | |
4797 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4798 screen_screencol(void) |
3986 | 4799 { |
4800 return screen_cur_col; | |
4801 } | |
4802 | |
4803 /* | |
4804 * Return the current cursor row. This is the actual position on the screen. | |
4805 * First row is 0. | |
4806 */ | |
4807 int | |
7833
c079097365f3
commit https://github.com/vim/vim/commit/055409764ca5f7978d4c399d2c440af0ce971c4f
Christian Brabandt <cb@256bit.org>
parents:
7805
diff
changeset
|
4808 screen_screenrow(void) |
3986 | 4809 { |
4810 return screen_cur_row; | |
4811 } | |
15555
d89c5b339c2a
patch 8.1.0785: depending on the configuration some functions are unused
Bram Moolenaar <Bram@vim.org>
parents:
15543
diff
changeset
|
4812 #endif |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4813 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4814 /* |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4815 * 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
|
4816 * 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
|
4817 */ |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4818 static int |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4819 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
|
4820 { |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4821 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
|
4822 |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4823 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
|
4824 { |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4825 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
|
4826 int bytes; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4827 int n; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4828 |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4829 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
|
4830 { |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4831 *p += 2; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4832 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
|
4833 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
|
4834 return 0; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4835 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
|
4836 } |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4837 *p += 2; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4838 return num; |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4839 } |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4840 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
|
4841 } |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4842 |
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4843 /* |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4844 * Handle setting 'listchars' or 'fillchars'. |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4845 * 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
|
4846 * 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
|
4847 */ |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4848 char * |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4849 set_chars_option(win_T *wp, char_u **varp) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4850 { |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4851 int round, i, len, len2, entries; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4852 char_u *p, *s; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4853 int c1 = 0, c2 = 0, c3 = 0; |
25780
3ca409d4daa2
patch 8.2.3425: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
25778
diff
changeset
|
4854 char_u *last_multispace = NULL; // Last occurrence of "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
|
4855 char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:" |
25780
3ca409d4daa2
patch 8.2.3425: warning for using uninitialized variable
Bram Moolenaar <Bram@vim.org>
parents:
25778
diff
changeset
|
4856 int multispace_len = 0; // Length of lcs-multispace 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
|
4857 int lead_multispace_len = 0; // Length of lcs-leadmultispace string |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4858 struct charstab |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4859 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4860 int *cp; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4861 char *name; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4862 }; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4863 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
|
4864 { |
23964
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4865 {&fill_stl, "stl"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4866 {&fill_stlnc, "stlnc"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4867 {&fill_vert, "vert"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4868 {&fill_fold, "fold"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4869 {&fill_foldopen, "foldopen"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4870 {&fill_foldclosed, "foldclose"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4871 {&fill_foldsep, "foldsep"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4872 {&fill_diff, "diff"}, |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4873 {&fill_eob, "eob"}, |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4874 }; |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4875 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
|
4876 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
|
4877 { |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4878 {&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
|
4879 {&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
|
4880 {&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
|
4881 {&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
|
4882 {&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
|
4883 {&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
|
4884 {&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
|
4885 {&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
|
4886 #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
|
4887 {&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
|
4888 #else |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4889 {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
|
4890 #endif |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4891 }; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4892 struct charstab *tab; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4893 |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4894 if (varp == &p_lcs || varp == &wp->w_p_lcs) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4895 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4896 tab = lcstab; |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4897 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
|
4898 entries = ARRAY_LENGTH(lcstab); |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4899 if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL) |
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4900 varp = &p_lcs; |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4901 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4902 else |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4903 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4904 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
|
4905 entries = ARRAY_LENGTH(filltab); |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4906 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4907 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4908 // 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
|
4909 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
|
4910 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4911 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
|
4912 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4913 // After checking that the value is valid: set defaults: space for |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4914 // 'fillchars', NUL for 'listchars' |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4915 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
|
4916 if (tab[i].cp != NULL) |
23952
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4917 *(tab[i].cp) = |
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4918 ((varp == &p_lcs || varp == &wp->w_p_lcs) ? NUL : ' '); |
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4919 |
44be09b25619
patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents:
23932
diff
changeset
|
4920 if (varp == &p_lcs || varp == &wp->w_p_lcs) |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4921 { |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4922 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
|
4923 lcs_chars.tab3 = NUL; |
29098
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
4924 |
25804
bf09d07f098e
patch 8.2.3437: compiler warnings for 32/64 bit usage
Bram Moolenaar <Bram@vim.org>
parents:
25780
diff
changeset
|
4925 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
|
4926 { |
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
|
4927 lcs_chars.multispace = ALLOC_MULT(int, multispace_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
|
4928 lcs_chars.multispace[multispace_len] = 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
|
4929 } |
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
|
4930 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
|
4931 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
|
4932 |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4933 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
|
4934 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4935 lcs_chars.leadmultispace = ALLOC_MULT(int, lead_multispace_len + 1); |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4936 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
|
4937 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4938 else |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
4939 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
|
4940 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4941 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
|
4942 { |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4943 fill_diff = '-'; |
23964
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4944 fill_foldopen = '-'; |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4945 fill_foldclosed = '+'; |
17697c4e5d48
patch 8.2.2524: cannot change the characters displayed in the foldcolumn
Bram Moolenaar <Bram@vim.org>
parents:
23958
diff
changeset
|
4946 fill_foldsep = '|'; |
23932
4549133c1e77
patch 8.2.2508: cannot change the character displayed in non existing lines
Bram Moolenaar <Bram@vim.org>
parents:
23825
diff
changeset
|
4947 fill_eob = '~'; |
4549133c1e77
patch 8.2.2508: cannot change the character displayed in non existing lines
Bram Moolenaar <Bram@vim.org>
parents:
23825
diff
changeset
|
4948 } |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4949 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4950 p = *varp; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4951 while (*p) |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4952 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4953 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
|
4954 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4955 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
|
4956 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
|
4957 && p[len] == ':' |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4958 && 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
|
4959 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4960 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
|
4961 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
|
4962 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
|
4963 if (char2cells(c1) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4964 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
|
4965 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
|
4966 { |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4967 if (*s == NUL) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4968 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
|
4969 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
|
4970 if (char2cells(c2) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4971 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
|
4972 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
|
4973 { |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
4974 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
|
4975 if (char2cells(c3) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
4976 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
|
4977 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4978 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4979 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4980 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
|
4981 { |
25804
bf09d07f098e
patch 8.2.3437: compiler warnings for 32/64 bit usage
Bram Moolenaar <Bram@vim.org>
parents:
25780
diff
changeset
|
4982 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
|
4983 { |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4984 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
|
4985 { |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
4986 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
|
4987 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
|
4988 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
|
4989 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4990 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
|
4991 *(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
|
4992 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4993 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4994 p = s; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4995 break; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4996 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4997 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4998 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
4999 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
5000 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
|
5001 { |
25804
bf09d07f098e
patch 8.2.3437: compiler warnings for 32/64 bit usage
Bram Moolenaar <Bram@vim.org>
parents:
25780
diff
changeset
|
5002 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
|
5003 len2 = (int)STRLEN("leadmultispace"); |
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
|
5004 if ((varp == &p_lcs || varp == &wp->w_p_lcs) |
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
|
5005 && 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
|
5006 && 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
|
5007 && 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
|
5008 { |
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
|
5009 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
|
5010 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
|
5011 { |
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
|
5012 // 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
|
5013 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
|
5014 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
|
5015 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
|
5016 { |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
5017 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
|
5018 if (char2cells(c1) > 1) |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
5019 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
|
5020 ++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
|
5021 } |
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
|
5022 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
|
5023 // 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
|
5024 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
|
5025 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
|
5026 } |
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
|
5027 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
|
5028 { |
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
|
5029 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
|
5030 |
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
|
5031 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
|
5032 { |
25978
40b17deb294f
patch 8.2.3522: cannot use x and u when setting 'listchars'
Bram Moolenaar <Bram@vim.org>
parents:
25804
diff
changeset
|
5033 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
|
5034 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
|
5035 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
|
5036 } |
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
|
5037 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
|
5038 } |
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
|
5039 } |
29090
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5040 |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5041 else if ((varp == &p_lcs || varp == &wp->w_p_lcs) |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5042 && 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
|
5043 && 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
|
5044 && 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
|
5045 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5046 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
|
5047 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
|
5048 { |
29098
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
5049 // get length of lcs-leadmultispace string in first |
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
5050 // 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
|
5051 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
|
5052 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
|
5053 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
|
5054 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5055 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
|
5056 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
|
5057 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
|
5058 ++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
|
5059 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5060 if (lead_multispace_len == 0) |
29098
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
5061 // 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
|
5062 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
|
5063 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
|
5064 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5065 else |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5066 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5067 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
|
5068 |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5069 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
|
5070 { |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5071 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
|
5072 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
|
5073 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
|
5074 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5075 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
|
5076 } |
9b292596a332
patch 8.2.5066: timer_create is not available on every Mac system
Bram Moolenaar <Bram@vim.org>
parents:
29071
diff
changeset
|
5077 } |
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
|
5078 else |
26865
bce848ec8b1b
patch 8.2.3961: error messages are spread out
Bram Moolenaar <Bram@vim.org>
parents:
26771
diff
changeset
|
5079 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
|
5080 } |
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
|
5081 |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
5082 if (*p == ',') |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
5083 ++p; |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
5084 } |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
5085 } |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
5086 if (tab == lcstab) |
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
|
5087 { |
29098
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
5088 vim_free(wp->w_lcs_chars.multispace); |
cff23287478f
patch 8.2.5070: unnecessary code
Bram Moolenaar <Bram@vim.org>
parents:
29090
diff
changeset
|
5089 vim_free(wp->w_lcs_chars.leadmultispace); |
23958
41cf615ab57f
patch 8.2.2521: some compilers can't handle pointer initialization
Bram Moolenaar <Bram@vim.org>
parents:
23952
diff
changeset
|
5090 wp->w_lcs_chars = lcs_chars; |
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
|
5091 } |
17940
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
5092 |
079e10a49ea1
patch 8.1.1966: some code in options.c fits better elsewhere
Bram Moolenaar <Bram@vim.org>
parents:
17851
diff
changeset
|
5093 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
|
5094 } |