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