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