annotate src/screen.c @ 24988:494112d2aa93 v8.2.3031

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