annotate src/screen.c @ 2595:bf9579ab26e5 v7.3.019

updated for version 7.3.019 Problem: ":nbstart" can fail silently. Solution: Give an error when netbeans is not supported by the GUI. (Xavier de Gaye)
author Bram Moolenaar <bram@vim.org>
date Thu, 30 Sep 2010 21:03:26 +0200
parents 37d3f90f5203
children a03f7551bacc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4:
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 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 * screen.c: code for displaying on the screen
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 * update_screen() is the function that updates all windows and status lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 * It is called form the main loop when must_redraw is non-zero. It may be
1213
8906c10ecbb0 updated for version 7.1b
vimboss
parents: 1112
diff changeset
41 * called from other places when an immediate screen update is needed.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 * The part of the buffer that is displayed in a window is set with:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 * - w_topline (first buffer line in window)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 * - w_topfill (filler line above the first line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 * - w_leftcol (leftmost window cell in window),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 * - w_skipcol (skipped window cells of first line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 * Commands that only move the cursor around in a window, do not need to take
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 * action to update the display. The main loop will check if w_topline is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 * valid and update it (scroll the window) when needed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 * Commands that scroll a window change w_topline and must call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 * check_cursor() to move the cursor into the visible part of the window, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 * call redraw_later(VALID) to have the window displayed by update_screen()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 * later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 * Commands that change text in the buffer must call changed_bytes() or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 * changed_lines() to mark the area that changed and will require updating
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 * later. The main loop will call update_screen(), which will update each
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 * window that shows the changed buffer. This assumes text above the change
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 * can remain displayed as it is. Text after the change may need updating for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 * scrolling, folding and syntax highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 * Commands that change how a window is displayed (e.g., setting 'list') or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 * invalidate the contents of a window in another way (e.g., change fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 * settings), must call redraw_later(NOT_VALID) to have the whole window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 * redisplayed by update_screen() later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 * Commands that change how a buffer is displayed (e.g., setting 'tabstop')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 * must call redraw_curbuf_later(NOT_VALID) to have all the windows for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 * buffer redisplayed by update_screen() later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 *
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
74 * Commands that change highlighting and possibly cause a scroll too must call
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
75 * redraw_later(SOME_VALID) to update the whole window but still use scrolling
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
76 * to avoid redrawing everything. But the length of displayed lines must not
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
77 * change, use NOT_VALID then.
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
78 *
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 * Commands that move the window position must call redraw_later(NOT_VALID).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 * TODO: should minimize redrawing by scrolling when possible.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 * Commands that change everything (e.g., resizing the screen) must call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 * redraw_all_later(NOT_VALID) or redraw_all_later(CLEAR).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 * Things that are handled indirectly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 * - When messages scroll the screen up, msg_scrolled will be set and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 * update_screen() called to redraw.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 * The attributes that are actually active for writing to the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95 static int screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 * Positioning the cursor is reduced by remembering the last position.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 * Mostly used by windgoto() and screen_char().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101 static int screen_cur_row, screen_cur_col; /* last known cursor position */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 static match_T search_hl; /* used for 'hlsearch' highlight matching */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 static foldinfo_T win_foldinfo; /* info for 'foldcolumn' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 * Buffer for one screen line (characters and attributes).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114 static schar_T *current_ScreenLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
116 static void win_update __ARGS((win_T *wp));
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
117 static void win_draw_end __ARGS((win_T *wp, int c1, int c2, int row, int endrow, hlf_T hl));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
119 static void fold_line __ARGS((win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T lnum, int row));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
120 static void fill_foldcolumn __ARGS((char_u *p, win_T *wp, int closed, linenr_T lnum));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
121 static void copy_text_attr __ARGS((int off, char_u *buf, int len, int attr));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
122 #endif
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
123 static int win_line __ARGS((win_T *, linenr_T, int, int, int nochange));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 static int char_needs_redraw __ARGS((int off_from, int off_to, int cols));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
126 static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width, int rlflag));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
127 # define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c), (rl))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 # define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 static void draw_vsep_win __ARGS((win_T *wp, int row));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
134 #endif
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
135 #ifdef FEAT_STL_OPT
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
136 static void redraw_custom_statusline __ARGS((win_T *wp));
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
137 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
138 #ifdef FEAT_SEARCH_EXTRA
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
139 #define SEARCH_HL_PRIORITY 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 static void start_search_hl __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 static void end_search_hl __ARGS((void));
2284
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
142 static void init_search_hl __ARGS((win_T *wp));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
143 static void prepare_search_hl __ARGS((win_T *wp, linenr_T lnum));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 static void next_search_hl __ARGS((win_T *win, match_T *shl, linenr_T lnum, colnr_T mincol));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 static void screen_start_highlight __ARGS((int attr));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 static void screen_char __ARGS((unsigned off, int row, int col));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 static void screen_char_2 __ARGS((unsigned off, int row, int col));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 static void screenclear2 __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 static void lineclear __ARGS((unsigned off, int width));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 static void lineinvalid __ARGS((unsigned off, int width));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 static void linecopy __ARGS((int to, int from, win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 static void redraw_block __ARGS((int row, int end, win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
157 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 static int win_do_lines __ARGS((win_T *wp, int row, int line_count, int mayclear, int del));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
159 static void win_rest_invalid __ARGS((win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
160 static void msg_pos_mode __ARGS((void));
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
161 #if defined(FEAT_WINDOWS)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
162 static void draw_tabline __ARGS((void));
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
163 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 static int fillchar_status __ARGS((int *attr, int is_curwin));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 static int fillchar_vsep __ARGS((int *attr));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
169 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 #ifdef FEAT_STL_OPT
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
171 static void win_redr_custom __ARGS((win_T *wp, int draw_ruler));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174 static void win_redr_ruler __ARGS((win_T *wp, int always));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 #if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 /* Ugly global: overrule attribute used by screen_char() */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179 static int screen_char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 * Redraw the current window later, with update_screen(type).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 * Set must_redraw only if not already set to a higher value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 * e.g. if must_redraw is CLEAR, type NOT_VALID will do nothing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 redraw_later(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191 redraw_win_later(curwin, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 redraw_win_later(wp, type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 if (wp->w_redr_type < type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 wp->w_redr_type = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 if (type >= NOT_VALID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 if (must_redraw < type) /* must_redraw is the maximum of all windows */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 must_redraw = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
206 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 * Force a complete redraw later. Also resets the highlighting. To be used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 * after executing a shell command that messes up the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 redraw_later_clear()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
215 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
216 redraw_all_later(CLEAR);
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
217 #ifdef FEAT_GUI
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
218 if (gui.in_use)
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
219 /* Use a code that will reset gui.highlight_mask in
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
220 * gui_stop_highlight(). */
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
221 screen_attr = HL_ALL + 1;
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
222 else
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
223 #endif
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
224 /* Use attributes that is very unlikely to appear in text. */
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
225 screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 * Mark all windows to be redrawn later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 redraw_all_later(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 redraw_win_later(wp, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 /*
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
244 * Mark all windows that are editing the current buffer to be updated later.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 redraw_curbuf_later(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250 redraw_buf_later(curbuf, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 redraw_buf_later(buf, type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 buf_T *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 if (wp->w_buffer == buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 redraw_win_later(wp, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
264 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
265 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
266
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 * Changed something in the current window, at buffer line "lnum", that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 * requires that line and possibly other lines to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 * Used when entering/leaving Insert mode with the cursor on a folded line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 * Used to remove the "$" from a change command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 * Note that when also inserting/deleting lines w_redraw_top and w_redraw_bot
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 * may become invalid and the whole window will have to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
276 redrawWinline(lnum, invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 linenr_T lnum;
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
278 int invalid UNUSED; /* window line height is invalid now */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 if (curwin->w_redraw_top == 0 || curwin->w_redraw_top > lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 curwin->w_redraw_top = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 if (curwin->w_redraw_bot == 0 || curwin->w_redraw_bot < lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287 curwin->w_redraw_bot = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 redraw_later(VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 if (invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 /* A w_lines[] entry for this lnum has become invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 i = find_wl_entry(curwin, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 if (i >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 curwin->w_lines[i].wl_valid = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300
2255
e5265e4d4725 Avoid compiler warnings.
Bram Moolenaar <bram@vim.org>
parents: 2250
diff changeset
301 #if defined(FEAT_RUBY) || defined(FEAT_PERL) || defined(FEAT_VISUAL) || \
2237
770485470e59 Add a few #ifdefs to exclude functions that are not used. (Domnique Pelle)
Bram Moolenaar <bram@vim.org>
parents: 2210
diff changeset
302 (defined(FEAT_CLIPBOARD) && defined(FEAT_X11)) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 * update all windows that are editing the current buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 update_curbuf(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 redraw_curbuf_later(type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 update_screen(type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 }
2237
770485470e59 Add a few #ifdefs to exclude functions that are not used. (Domnique Pelle)
Bram Moolenaar <bram@vim.org>
parents: 2210
diff changeset
313 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 * update_screen()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 * Based on the current value of curwin->w_topline, transfer a screenfull
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 * of stuff from Filemem to ScreenLines[], and update curwin->w_botline.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 update_screen(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
326 static int did_intro = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 int did_one;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
331 /* Don't do anything if the screen structures are (not yet) valid. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 if (!screen_valid(TRUE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
334
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
335 if (must_redraw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
336 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
337 if (type < must_redraw) /* use maximal type */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
338 type = must_redraw;
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
339
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
340 /* must_redraw is reset here, so that when we run into some weird
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
341 * reason to redraw while busy redrawing (e.g., asynchronous
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
342 * scrolling), or update_topline() in win_update() will cause a
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
343 * scroll, the screen will be redrawn later or in win_update(). */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 must_redraw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
346
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
347 /* Need to update w_lines[]. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
348 if (curwin->w_lines_valid == 0 && type < NOT_VALID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
351 /* Postpone the redrawing when it's not needed and when being called
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
352 * recursively. */
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
353 if (!redrawing() || updating_screen)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 redraw_later(type); /* remember type for next time */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356 must_redraw = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 if (type > INVERTED_ALL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362 updating_screen = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 ++display_tick; /* let syntax code know we're in a next round of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 * display updating */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 * if the screen was scrolled up when displaying a message, scroll it down
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 if (msg_scrolled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 clear_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 if (msg_scrolled > Rows - 5) /* clearing is faster */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 type = CLEAR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 else if (type != CLEAR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, NULL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 type = CLEAR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 if (W_WINROW(wp) < msg_scrolled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 if (W_WINROW(wp) + wp->w_height > msg_scrolled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
386 && wp->w_redr_type < REDRAW_TOP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
387 && wp->w_lines_valid > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 && wp->w_topline == wp->w_lines[0].wl_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 wp->w_upd_rows = msg_scrolled - W_WINROW(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 wp->w_redr_type = REDRAW_TOP;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 wp->w_redr_type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 if (W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 <= msg_scrolled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
400 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
401 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
402 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 redraw_cmdline = TRUE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
405 #ifdef FEAT_WINDOWS
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
406 redraw_tabline = TRUE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
407 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 msg_scrolled = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410 need_wait_return = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 /* reset cmdline_row now (may have been changed temporarily) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414 compute_cmdrow();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 /* Check for changed highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 if (need_highlight_changed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 highlight_changed();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420 if (type == CLEAR) /* first clear screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 screenclear(); /* will reset clear_cmdline */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
424 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
426 if (clear_cmdline) /* going to clear cmdline (done below) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
427 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
428
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
429 #ifdef FEAT_LINEBREAK
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
430 /* Force redraw when width of 'number' or 'relativenumber' column
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
431 * changes. */
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
432 if (curwin->w_redr_type < NOT_VALID
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
433 && curwin->w_nrwidth != ((curwin->w_p_nu || curwin->w_p_rnu)
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
434 ? number_width(curwin) : 0))
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
435 curwin->w_redr_type = NOT_VALID;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
436 #endif
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
437
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 * Only start redrawing if there is really something to do.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 if (type == INVERTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 update_curswant();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 if (curwin->w_redr_type < type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 && !((type == VALID
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 && curwin->w_lines[0].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
446 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 && curwin->w_topfill == curwin->w_old_topfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 && curwin->w_botfill == curwin->w_old_botfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 && curwin->w_topline == curwin->w_lines[0].wl_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 || (type == INVERTED
1043
10d7ebdbe8a3 updated for version 7.0-169
vimboss
parents: 996
diff changeset
453 && VIsual_active
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454 && curwin->w_old_cursor_lnum == curwin->w_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
455 && curwin->w_old_visual_mode == VIsual_mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
456 && (curwin->w_valid & VALID_VIRTCOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
457 && curwin->w_old_curswant == curwin->w_curswant)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
458 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
459 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
460 curwin->w_redr_type = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
462 #ifdef FEAT_WINDOWS
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
463 /* Redraw the tab pages line if needed. */
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
464 if (redraw_tabline || type >= NOT_VALID)
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
465 draw_tabline();
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
466 #endif
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
467
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 * Correct stored syntax highlighting info for changes in each displayed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 * buffer. Each buffer must only be done once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 if (wp->w_buffer->b_mod_set)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 win_T *wwp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 /* Check if we already did this buffer. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 for (wwp = firstwin; wwp != wp; wwp = wwp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 if (wwp->w_buffer == wp->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487 wwp == wp &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 # endif
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
489 syntax_present(wp))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 syn_stack_apply_changes(wp->w_buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 * Go from top to bottom through the windows, redrawing the ones that need
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 * it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 did_one = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 search_hl.rm.regprog = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 if (wp->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 if (!did_one)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 did_one = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 # ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 start_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 # ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 /* When Visual area changed, may have to update selection. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 if (clip_star.available && clip_isautosel())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 clip_update_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 /* Remove the cursor before starting to do anything, because
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 * scrolling may make it difficult to redraw the text under
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 * it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 gui_undraw_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 win_update(wp);
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 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 /* redraw status line after the window to minimize cursor movement */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 if (wp->w_redr_status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539 win_redr_status(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 #if defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 end_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548 /* Reset b_mod_set flags. Going through all windows is probably faster
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 * than going through all buffers (there could be many buffers). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 for (wp = firstwin; wp != NULL; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 wp->w_buffer->b_mod_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553 curbuf->b_mod_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 updating_screen = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558 gui_may_resize_shell();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 /* Clear or redraw the command line. Done last, because scrolling may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 * mess up the command line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 if (clear_cmdline || redraw_cmdline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 showmode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 /* May put up an introductory message when not editing a file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 if (!did_intro && bufempty()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568 && curbuf->b_fname == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 && firstwin->w_next == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 && vim_strchr(p_shm, SHM_INTRO) == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 intro_message(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 did_intro = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 /* Redraw the cursor and update the scrollbars when all screen updating is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 * done. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581 out_flush(); /* required before updating the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 if (did_one)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 gui_update_cursor(FALSE, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 gui_update_scrollbars(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
588
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
589 #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
590 /*
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
591 * 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
592 * 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
593 */
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
594 int
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
595 conceal_cursor_line(wp)
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
596 win_T *wp;
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
597 {
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
598 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
599
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
600 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
601 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
602 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
603 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
604 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
605 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
606 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
607 c = 'n';
2382
3a5ededa240a Add the 'c' flag to 'concealcursor'.
Bram Moolenaar <bram@vim.org>
parents: 2381
diff changeset
608 else if (State & CMDLINE)
3a5ededa240a Add the 'c' flag to 'concealcursor'.
Bram Moolenaar <bram@vim.org>
parents: 2381
diff changeset
609 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
610 else
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
611 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
612 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
613 }
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
614
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
615 /*
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
616 * 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
617 */
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
618 void
2428
33148c37f3c9 Changes for VMS. Mostly by Zoltan Arpadffy.
Bram Moolenaar <bram@vim.org>
parents: 2409
diff changeset
619 conceal_check_cursur_line()
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
620 {
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
621 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
622 {
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
623 need_cursor_line_redraw = TRUE;
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
624 /* Need to recompute cursor column, e.g., when starting Visual mode
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
625 * without concealing. */
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
626 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
627 }
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
628 }
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
629
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
630 void
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
631 update_single_line(wp, lnum)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
632 win_T *wp;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
633 linenr_T lnum;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
634 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
635 int row;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
636 int j;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
637
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
638 if (lnum >= wp->w_topline && lnum < wp->w_botline
2269
fb627e94e6c6 Couple of small fixes for conceal feature. (Dominique Pelle)
Bram Moolenaar <bram@vim.org>
parents: 2255
diff changeset
639 && foldedCount(wp, lnum, &win_foldinfo) == 0)
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
640 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
641 # ifdef FEAT_GUI
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
642 /* Remove the cursor before starting to do anything, because scrolling
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
643 * may make it difficult to redraw the text under it. */
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
644 if (gui.in_use)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
645 gui_undraw_cursor();
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
646 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
647 row = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
648 for (j = 0; j < wp->w_lines_valid; ++j)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
649 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
650 if (lnum == wp->w_lines[j].wl_lnum)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
651 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
652 screen_start(); /* not sure of screen cursor */
2284
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
653 # ifdef FEAT_SEARCH_EXTRA
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
654 init_search_hl(wp);
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
655 start_search_hl();
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
656 prepare_search_hl(wp, lnum);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
657 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
658 win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
659 # if defined(FEAT_SEARCH_EXTRA)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
660 end_search_hl();
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
661 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
662 break;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
663 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
664 row += wp->w_lines[j].wl_size;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
665 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
666 # ifdef FEAT_GUI
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
667 /* Redraw the cursor */
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
668 if (gui.in_use)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
669 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
670 out_flush(); /* required before updating the cursor */
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
671 gui_update_cursor(FALSE, FALSE);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
672 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
673 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
674 }
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
675 need_cursor_line_redraw = FALSE;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
676 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
677 #endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
678
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 #if defined(FEAT_SIGNS) || defined(FEAT_GUI)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 static void update_prepare __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 static void update_finish __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 * Prepare for updating one or more windows.
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
685 * Caller must check for "updating_screen" already set to avoid recursiveness.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 update_prepare()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 updating_screen = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 /* Remove the cursor before starting to do anything, because scrolling may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694 * make it difficult to redraw the text under it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 gui_undraw_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 start_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 * Finish updating one or more windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
705 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
706 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
707 update_finish()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
708 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 if (redraw_cmdline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710 showmode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 # ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 end_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
716 updating_screen = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
718 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 gui_may_resize_shell();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
720
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
721 /* Redraw the cursor and update the scrollbars when all screen updating is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
722 * done. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
723 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 out_flush(); /* required before updating the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 gui_update_cursor(FALSE, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 gui_update_scrollbars(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
729 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 #if defined(FEAT_SIGNS) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 update_debug_sign(buf, lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 buf_T *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 int doit = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 win_foldinfo.fi_level = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 /* update/delete a specific mark */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
748 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 if (buf != NULL && lnum > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 if (wp->w_buffer == buf && lnum >= wp->w_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 && lnum < wp->w_botline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
755 wp->w_redraw_top = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 wp->w_redraw_bot = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 redraw_win_later(wp, VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 redraw_win_later(wp, VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 if (wp->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 doit = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
767 /* Return when there is nothing to do or screen updating already
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
768 * happening. */
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
769 if (!doit || updating_screen)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 /* update all windows that need updating */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 update_prepare();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 if (wp->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 win_update(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 if (wp->w_redr_status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 win_redr_status(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 if (curwin->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
785 win_update(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788 update_finish();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793 #if defined(FEAT_GUI) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 * Update a single window, its status line and maybe the command line msg.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 * Used for the GUI scrollbar.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 updateWindow(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 {
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
802 /* return if already busy updating */
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
803 if (updating_screen)
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
804 return;
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
805
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 update_prepare();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 /* When Visual area changed, may have to update selection. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 if (clip_star.available && clip_isautosel())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 clip_update_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812 #endif
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
813
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 win_update(wp);
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
815
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 #ifdef FEAT_WINDOWS
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
817 /* When the screen was cleared redraw the tab pages line. */
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
818 if (redraw_tabline)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
819 draw_tabline();
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
820
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 if (wp->w_redr_status
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 # ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 || p_ru
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 # ifdef FEAT_STL_OPT
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
826 || *p_stl != NUL || *wp->w_p_stl != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 win_redr_status(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 update_finish();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 * Update a single window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 * This may cause the windows below it also to be redrawn (when clearing the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 * screen or scrolling lines).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 * How the window is redrawn depends on wp->w_redr_type. Each type also
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 * implies the one below it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 * NOT_VALID redraw the whole window
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
845 * SOME_VALID redraw the whole window but do scroll when possible
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 * REDRAW_TOP redraw the top w_upd_rows window lines, otherwise like VALID
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
847 * INVERTED redraw the changed part of the Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
848 * INVERTED_ALL redraw the whole Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
849 * VALID 1. scroll up/down to adjust for a changed w_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
850 * 2. update lines at the top when scrolled down
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
851 * 3. redraw changed text:
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
852 * - if wp->w_buffer->b_mod_set set, update lines between
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
853 * b_mod_top and b_mod_bot.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
854 * - if wp->w_redraw_top non-zero, redraw lines between
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
855 * wp->w_redraw_top and wp->w_redr_bot.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
856 * - continue redrawing when syntax status is invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
857 * 4. if scrolled up, update lines at the bottom.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
858 * This results in three areas that may need updating:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
859 * top: from first row to top_end (when scrolled down)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
860 * mid: from mid_start to mid_end (update inversion or changed text)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
861 * bot: from bot_start to last row (when scrolled up)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
862 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
863 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
864 win_update(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
865 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 buf_T *buf = wp->w_buffer;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
869 int top_end = 0; /* Below last row of the top area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 updating. 0 when no top area updating. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871 int mid_start = 999;/* first row of the mid area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
872 updating. 999 when no mid area updating. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
873 int mid_end = 0; /* Below last row of the mid area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
874 updating. 0 when no mid area updating. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
875 int bot_start = 999;/* first row of the bot area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
876 updating. 999 when no bot area updating */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
877 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
878 int scrolled_down = FALSE; /* TRUE when scrolled down when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
879 w_topline got smaller a bit */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
880 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
881 #ifdef FEAT_SEARCH_EXTRA
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
882 matchitem_T *cur; /* points to the match list */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 int top_to_mod = FALSE; /* redraw above mod_top */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
884 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 int row; /* current window row to display */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 linenr_T lnum; /* current buffer lnum to display */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 int idx; /* current index in w_lines[] */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 int srow; /* starting row of the current line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 int eof = FALSE; /* if TRUE, we hit the end of the file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 int didline = FALSE; /* if TRUE, we finished the last line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 long j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 static int recursive = FALSE; /* being called recursively */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 int old_botline = wp->w_botline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 long fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 /* remember what happened to the previous line, to know if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 * check_visual_highlight() can be used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 #define DID_NONE 1 /* didn't update a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 #define DID_LINE 2 /* updated a normal line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 #define DID_FOLD 3 /* updated a folded line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 int did_update = DID_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 linenr_T syntax_last_parsed = 0; /* last parsed text line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 linenr_T mod_top = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 linenr_T mod_bot = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 int save_got_int;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 type = wp->w_redr_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 if (type == NOT_VALID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 /* Window is zero-height: nothing to draw. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 if (wp->w_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 wp->w_redr_type = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
929 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
931
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
932 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 /* Window is zero-width: Only need to draw the separator. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
934 if (wp->w_width == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
935 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
936 /* draw the vertical separator right of this window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
937 draw_vsep_win(wp, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
938 wp->w_redr_type = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
939 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
940 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
941 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
942
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
943 #ifdef FEAT_SEARCH_EXTRA
2284
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
944 init_search_hl(wp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
945 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
946
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
947 #ifdef FEAT_LINEBREAK
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
948 /* Force redraw when width of 'number' or 'relativenumber' column
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
949 * changes. */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
950 i = (wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) : 0;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
951 if (wp->w_nrwidth != i)
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
952 {
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
953 type = NOT_VALID;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
954 wp->w_nrwidth = i;
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
955 }
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
956 else
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
957 #endif
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
958
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962 * When there are both inserted/deleted lines and specific lines to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 * redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 * everything (only happens when redrawing is off for while).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 * Set mod_top to the first line that needs displaying because of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 * changes. Set mod_bot to the first line after the changes.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 mod_top = wp->w_redraw_top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 if (wp->w_redraw_bot != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 mod_bot = wp->w_redraw_bot + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 mod_bot = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 wp->w_redraw_top = 0; /* reset for next time */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 wp->w_redraw_bot = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 if (buf->b_mod_set)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983 if (mod_top == 0 || mod_top > buf->b_mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 mod_top = buf->b_mod_top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987 /* Need to redraw lines above the change that may be included
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 * in a pattern match. */
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
989 if (syntax_present(wp))
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
990 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
991 mod_top -= buf->b_s.b_syn_sync_linebreaks;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 if (mod_top < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 mod_top = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
994 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
995 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
996 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
997 if (mod_bot == 0 || mod_bot < buf->b_mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 mod_bot = buf->b_mod_bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
999
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1000 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 /* When 'hlsearch' is on and using a multi-line search pattern, a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 * change in one line may make the Search highlighting in a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 * previous line invalid. Simple solution: redraw all visible
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 * lines above the change.
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1005 * Same for a match pattern.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 */
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
1007 if (search_hl.rm.regprog != NULL
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
1008 && re_multiline(search_hl.rm.regprog))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 top_to_mod = TRUE;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
1010 else
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1011 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1012 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1013 while (cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1014 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1015 if (cur->match.regprog != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1016 && re_multiline(cur->match.regprog))
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
1017 {
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
1018 top_to_mod = TRUE;
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
1019 break;
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
1020 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1021 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1022 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
1023 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 if (mod_top != 0 && hasAnyFolding(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 linenr_T lnumt, lnumb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 * A change in a line can cause lines above it to become folded or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 * unfolded. Find the top most buffer line that may be affected.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 * If the line was previously folded and displayed, get the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 * line of that fold. If the line is folded now, get the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 * folded line. Use the minimum of these two.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 /* Find last valid w_lines[] entry above mod_top. Set lnumt to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040 * the line below it. If there is no valid entry, use w_topline.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1041 * Find the first valid w_lines[] entry below mod_bot. Set lnumb
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1042 * to this line. If there is no valid entry, use MAXLNUM. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1043 lnumt = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1044 lnumb = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1045 for (i = 0; i < wp->w_lines_valid; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1046 if (wp->w_lines[i].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1047 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 if (wp->w_lines[i].wl_lastlnum < mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 lnumt = wp->w_lines[i].wl_lastlnum + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 if (lnumb == MAXLNUM && wp->w_lines[i].wl_lnum >= mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1052 lnumb = wp->w_lines[i].wl_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1053 /* When there is a fold column it might need updating
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1054 * in the next line ("J" just above an open fold). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 if (wp->w_p_fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1056 ++lnumb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1057 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 (void)hasFoldingWin(wp, mod_top, &mod_top, NULL, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 if (mod_top > lnumt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 mod_top = lnumt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 /* Now do the same for the bottom line (one above mod_bot). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 --mod_bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 (void)hasFoldingWin(wp, mod_bot, NULL, &mod_bot, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 ++mod_bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 if (mod_bot < lnumb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 mod_bot = lnumb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 /* When a change starts above w_topline and the end is below
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 * w_topline, start redrawing at w_topline.
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1075 * If the end of the change is above w_topline: do like no change was
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1076 * made, but redraw the first line to find changes in syntax. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 if (mod_top != 0 && mod_top < wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 if (mod_bot > wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 mod_top = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 #ifdef FEAT_SYN_HL
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
1082 else if (syntax_present(wp))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 top_end = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1086
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1087 /* When line numbers are displayed need to redraw all lines below
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1088 * inserted/deleted lines. */
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1089 if (mod_top != 0 && buf->b_mod_xlines != 0 && wp->w_p_nu)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1090 mod_bot = MAXLNUM;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 * When only displaying the lines at the top, set top_end. Used when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 * window has scrolled down for msg_scrolled.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 if (type == REDRAW_TOP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 j = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 for (i = 0; i < wp->w_lines_valid; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 j += wp->w_lines[i].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1103 if (j >= wp->w_upd_rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 top_end = j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 if (top_end == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 /* not found (cannot happen?): redraw everything */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 /* top area defined, the rest is VALID */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 type = VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
1117 /* Trick: we want to avoid clearing the screen twice. screenclear() will
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1118 * set "screen_cleared" to TRUE. The special value MAYBE (which is still
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1119 * non-zero and thus not FALSE) will indicate that screenclear() was not
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1120 * called. */
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1121 if (screen_cleared)
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1122 screen_cleared = MAYBE;
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1123
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 * If there are no changes on the screen that require a complete redraw,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 * handle three cases:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 * 1: we are off the top of the screen by a few lines: scroll down
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128 * 2: wp->w_topline is below wp->w_lines[0].wl_lnum: may scroll up
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 * 3: wp->w_topline is wp->w_lines[0].wl_lnum: find first entry in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 * w_lines[] that needs updating.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 */
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1132 if ((type == VALID || type == SOME_VALID
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1133 || type == INVERTED || type == INVERTED_ALL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 && !wp->w_botfill && !wp->w_old_botfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1137 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1138 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1139 if (mod_top != 0 && wp->w_topline == mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 * w_topline is the first changed line, the scrolling will be done
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 * further down.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 else if (wp->w_lines[0].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 && (wp->w_topline < wp->w_lines[0].wl_lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 || (wp->w_topline == wp->w_lines[0].wl_lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 && wp->w_topfill > wp->w_old_topfill)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155 * New topline is above old topline: May scroll down.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 if (hasAnyFolding(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 linenr_T ln;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 /* count the number of lines we are off, counting a sequence
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 * of folded lines as one */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 j = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 for (ln = wp->w_topline; ln < wp->w_lines[0].wl_lnum; ++ln)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 ++j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 if (j >= wp->w_height - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 (void)hasFoldingWin(wp, ln, NULL, &ln, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 j = wp->w_lines[0].wl_lnum - wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 if (j < wp->w_height - 2) /* not too far off */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 i = plines_m_win(wp, wp->w_topline, wp->w_lines[0].wl_lnum - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 /* insert extra lines for previously invisible filler lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 if (wp->w_lines[0].wl_lnum != wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 i += diff_check_fill(wp, wp->w_lines[0].wl_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 - wp->w_old_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 if (i < wp->w_height - 2) /* less than a screen off */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 * Try to insert the correct number of lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 * If not the last window, delete the lines at the bottom.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 * win_ins_lines may fail when the terminal can't do it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1193 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1194 if (win_ins_lines(wp, 0, i, FALSE, wp == firstwin) == OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 if (wp->w_lines_valid != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 /* Need to update rows that are new, stop at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 * first one that scrolled down. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 top_end = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 scrolled_down = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 /* Move the entries that were scrolled, disable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 * the entries for the lines to be redrawn. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 if ((wp->w_lines_valid += j) > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 wp->w_lines_valid = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 for (idx = wp->w_lines_valid; idx - j >= 0; idx--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 wp->w_lines[idx] = wp->w_lines[idx - j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 while (idx >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 wp->w_lines[idx--].wl_valid = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 * New topline is at or below old topline: May scroll up.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 * When topline didn't change, find first entry in w_lines[] that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 * needs updating.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 /* try to find wp->w_topline in wp->w_lines[].wl_lnum */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233 j = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 for (i = 0; i < wp->w_lines_valid; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 if (wp->w_lines[i].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 && wp->w_lines[i].wl_lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240 j = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 row += wp->w_lines[i].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 if (j == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 /* if wp->w_topline is not in wp->w_lines[].wl_lnum redraw all
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1248 * lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1249 mid_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1250 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1251 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1252 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1253 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1254 * Try to delete the correct number of lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1255 * wp->w_topline is at wp->w_lines[i].wl_lnum.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1256 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1257 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1258 /* If the topline didn't change, delete old filler lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1259 * otherwise delete filler lines of the new topline... */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 if (wp->w_lines[0].wl_lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1261 row += wp->w_old_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1262 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1263 row += diff_check_fill(wp, wp->w_topline);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1264 /* ... but don't delete new filler lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1265 row -= wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1266 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1267 if (row > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 if (win_del_lines(wp, 0, row, FALSE, wp == firstwin) == OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 bot_start = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275 if ((row == 0 || bot_start < 999) && wp->w_lines_valid != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1276 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1277 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1278 * Skip the lines (below the deleted lines) that are still
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1279 * valid and don't need redrawing. Copy their info
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1280 * upwards, to compensate for the deleted lines. Set
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1281 * bot_start to the first row that needs redrawing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1282 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1283 bot_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 wp->w_lines[idx] = wp->w_lines[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 /* stop at line that didn't fit, unless it is still
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 * valid (no lines deleted) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290 if (row > 0 && bot_start + row
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 + (int)wp->w_lines[j].wl_size > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 wp->w_lines_valid = idx + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 bot_start += wp->w_lines[idx++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 /* stop at the last valid entry in w_lines[].wl_size */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299 if (++j >= wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301 wp->w_lines_valid = idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 /* Correct the first entry for filler lines at the top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 * when it won't get updated below. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 if (wp->w_p_diff && bot_start > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 wp->w_lines[0].wl_size =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 plines_win_nofill(wp, wp->w_topline, TRUE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311 + wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 /* When starting redraw in the first line, redraw all lines. When
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 * there is only one window it's probably faster to clear the screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319 * first. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320 if (mid_start == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322 mid_end = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 if (lastwin == firstwin)
981
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1324 {
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1325 /* Clear the screen when it was not done by win_del_lines() or
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1326 * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1327 * then. */
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1328 if (screen_cleared != TRUE)
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1329 screenclear();
981
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1330 #ifdef FEAT_WINDOWS
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1331 /* The screen was cleared, redraw the tab pages line. */
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1332 if (redraw_tabline)
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1333 draw_tabline();
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1334 #endif
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1335 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 }
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1337
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1338 /* When win_del_lines() or win_ins_lines() caused the screen to be
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1339 * cleared (only happens for the first window) or when screenclear()
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1340 * was called directly above, "must_redraw" will have been set to
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1341 * NOT_VALID, need to reset it here to avoid redrawing twice. */
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1342 if (screen_cleared == TRUE)
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1343 must_redraw = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 /* Not VALID or INVERTED: redraw all lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 mid_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 mid_end = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1352 if (type == SOME_VALID)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1353 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1354 /* SOME_VALID: redraw all lines. */
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1355 mid_start = 0;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1356 mid_end = wp->w_height;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1357 type = NOT_VALID;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1358 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1359
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 /* check if we are updating or removing the inverted part */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 if ((VIsual_active && buf == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 || (wp->w_old_cursor_lnum != 0 && type != NOT_VALID))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365 linenr_T from, to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 if (VIsual_active)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 if (VIsual_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370 && (VIsual_mode != wp->w_old_visual_mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 || type == INVERTED_ALL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 * If the type of Visual selection changed, redraw the whole
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 * selection. Also when the ownership of the X selection is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 * gained or lost.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 if (curwin->w_cursor.lnum < VIsual.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 from = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 to = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1382 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1383 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1385 from = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 to = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 /* redraw more when the cursor moved as well */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389 if (wp->w_old_cursor_lnum < from)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 from = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 if (wp->w_old_cursor_lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 to = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 if (wp->w_old_visual_lnum < from)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 from = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 if (wp->w_old_visual_lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 to = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 * Find the line numbers that need to be updated: The lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 * between the old cursor position and the current cursor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403 * position. Also check if the Visual position changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 if (curwin->w_cursor.lnum < wp->w_old_cursor_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1406 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 from = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 to = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 from = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 to = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414 if (from == 0) /* Visual mode just started */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415 from = to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417
422
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1418 if (VIsual.lnum != wp->w_old_visual_lnum
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1419 || VIsual.col != wp->w_old_visual_col)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1421 if (wp->w_old_visual_lnum < from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 && wp->w_old_visual_lnum != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423 from = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424 if (wp->w_old_visual_lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 to = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 if (VIsual.lnum < from)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 from = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 if (VIsual.lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 to = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 * If in block mode and changed column or curwin->w_curswant:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 * update all lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 * First compute the actual start and end column.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 if (VIsual_mode == Ctrl_V)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 colnr_T fromc, toc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 ++toc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 if (curwin->w_curswant == MAXCOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 toc = MAXCOL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 if (fromc != wp->w_old_cursor_fcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 || toc != wp->w_old_cursor_lcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450 if (from > VIsual.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 from = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 if (to < VIsual.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 to = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 wp->w_old_cursor_fcol = fromc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 wp->w_old_cursor_lcol = toc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 /* Use the line numbers of the old Visual area. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 if (wp->w_old_cursor_lnum < wp->w_old_visual_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 from = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 to = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1469 from = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 to = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475 * There is no need to update lines above the top of the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1477 if (from < wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 from = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 * If we know the value of w_botline, use it to restrict the update to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 * the lines that are visible in the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 if (wp->w_valid & VALID_BOTLINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 if (from >= wp->w_botline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 from = wp->w_botline - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 if (to >= wp->w_botline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489 to = wp->w_botline - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 * Find the minimal part to be updated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 * Watch out for scrolling that made entries in w_lines[] invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 * E.g., CTRL-U makes the first half of w_lines[] invalid and sets
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 * top_end; need to redraw from top_end to the "to" line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497 * A middle mouse click with a Visual selection may change the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 * above the Visual area and reset wl_valid, do count these for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 * mid_end (in srow).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 if (mid_start > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 lnum = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 srow = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506 if (scrolled_down)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 mid_start = top_end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 mid_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 while (lnum < from && idx < wp->w_lines_valid) /* find start */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 if (wp->w_lines[idx].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513 mid_start += wp->w_lines[idx].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 else if (!scrolled_down)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 srow += wp->w_lines[idx].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 if (idx < wp->w_lines_valid && wp->w_lines[idx].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 lnum = wp->w_lines[idx].wl_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 ++lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524 srow += mid_start;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 mid_end = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 for ( ; idx < wp->w_lines_valid; ++idx) /* find end */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528 if (wp->w_lines[idx].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 && wp->w_lines[idx].wl_lnum >= to + 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531 /* Only update until first row of this line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 mid_end = srow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 srow += wp->w_lines[idx].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 if (VIsual_active && buf == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 wp->w_old_visual_mode = VIsual_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543 wp->w_old_cursor_lnum = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 wp->w_old_visual_lnum = VIsual.lnum;
422
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1545 wp->w_old_visual_col = VIsual.col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 wp->w_old_curswant = curwin->w_curswant;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 wp->w_old_visual_mode = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 wp->w_old_cursor_lnum = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552 wp->w_old_visual_lnum = 0;
422
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1553 wp->w_old_visual_col = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555 #endif /* FEAT_VISUAL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558 /* reset got_int, otherwise regexp won't work */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 save_got_int = got_int;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 got_int = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 win_foldinfo.fi_level = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567 * Update all the window rows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 idx = 0; /* first entry in w_lines[].wl_size */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570 row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 srow = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 lnum = wp->w_topline; /* first line shown in window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575 /* stop updating when reached the end of the window (check for _past_
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 * the end of the window is at the end of the loop) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 if (row == wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579 didline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1583 /* stop updating when hit the end of the file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584 if (lnum > buf->b_ml.ml_line_count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 eof = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590 /* Remember the starting row of the line that is going to be dealt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 * with. It is used further down when the line doesn't fit. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 srow = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595 * Update a line when it is in an area that needs updating, when it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596 * has changes or w_lines[idx] is invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 * bot_start may be halfway a wrapped line after using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 * win_del_lines(), check if the current line includes it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 * When syntax folding is being used, the saved syntax states will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 * already have been updated, we can't see where the syntax state is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 * the same again, just update until the end of the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 if (row < top_end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 || (row >= mid_start && row < mid_end)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 || top_to_mod
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 || idx >= wp->w_lines_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609 || (row + wp->w_lines[idx].wl_size > bot_start)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610 || (mod_top != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 && (lnum == mod_top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 || (lnum >= mod_top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613 && (lnum < mod_bot
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 || did_update == DID_FOLD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 || (did_update == DID_LINE
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
1617 && syntax_present(wp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620 (foldmethodIsSyntax(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1621 && hasAnyFolding(wp)) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623 syntax_check_changed(lnum)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 )))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 if (lnum == mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 top_to_mod = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 * When at start of changed lines: May scroll following lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 * up or down to minimize redrawing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635 * Don't do this when the change continues until the end.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 * Don't scroll when dollar_vcol is non-zero, keep the "$".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 if (lnum == mod_top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1639 && mod_bot != MAXLNUM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1640 && !(dollar_vcol != 0 && mod_bot == mod_top + 1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 int old_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 int new_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644 int xtra_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 linenr_T l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 /* Count the old number of window rows, using w_lines[], which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 * should still contain the sizes for the lines as they are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 * currently displayed. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 for (i = idx; i < wp->w_lines_valid; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 /* Only valid lines have a meaningful wl_lnum. Invalid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 * lines are part of the changed area. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 if (wp->w_lines[i].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 && wp->w_lines[i].wl_lnum == mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 old_rows += wp->w_lines[i].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 if (wp->w_lines[i].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 && wp->w_lines[i].wl_lastlnum + 1 == mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 /* Must have found the last valid entry above mod_bot.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 * Add following invalid entries. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 ++i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 while (i < wp->w_lines_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 && !wp->w_lines[i].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 old_rows += wp->w_lines[i++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673 if (i >= wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 /* We can't find a valid line below the changed lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 * need to redraw until the end of the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677 * Inserting/deleting lines has no use. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 bot_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 /* Able to count old number of rows: Count new window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 * rows, and may insert/delete lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 j = idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 for (l = lnum; l < mod_bot; ++l)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 if (hasFoldingWin(wp, l, NULL, &l, TRUE, NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 ++new_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 if (l == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 new_rows += plines_win_nofill(wp, l, TRUE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 + wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698 new_rows += plines_win(wp, l, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699 ++j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 if (new_rows > wp->w_height - row - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702 /* it's getting too much, must redraw the rest */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703 new_rows = 9999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 xtra_rows = new_rows - old_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708 if (xtra_rows < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710 /* May scroll text up. If there is not enough
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 * remaining text or scrolling fails, must redraw the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 * rest. If scrolling works, must redraw the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713 * below the scrolled text. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 if (row - xtra_rows >= wp->w_height - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 mod_bot = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719 if (win_del_lines(wp, row,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720 -xtra_rows, FALSE, FALSE) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721 mod_bot = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723 bot_start = wp->w_height + xtra_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 else if (xtra_rows > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 /* May scroll text down. If there is not enough
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 * remaining text of scrolling fails, must redraw the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 * rest. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731 if (row + xtra_rows >= wp->w_height - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 mod_bot = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 if (win_ins_lines(wp, row + old_rows,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 xtra_rows, FALSE, FALSE) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 mod_bot = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 else if (top_end > row + old_rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740 /* Scrolled the part at the top that requires
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 * updating down. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 top_end += xtra_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 /* When not updating the rest, may need to move w_lines[]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 * entries. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 if (mod_bot != MAXLNUM && i != j)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 if (j < i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 int x = row + new_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 /* move entries in w_lines[] upwards */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 /* stop at last valid entry in w_lines[] */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758 if (i >= wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 wp->w_lines_valid = j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 wp->w_lines[j] = wp->w_lines[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 /* stop at a line that won't fit */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 if (x + (int)wp->w_lines[j].wl_size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 wp->w_lines_valid = j + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 x += wp->w_lines[j++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 ++i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1774 if (bot_start > x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775 bot_start = x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 else /* j > i */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 /* move entries in w_lines[] downwards */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 j -= i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 wp->w_lines_valid += j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782 if (wp->w_lines_valid > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783 wp->w_lines_valid = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 for (i = wp->w_lines_valid; i - j >= idx; --i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785 wp->w_lines[i] = wp->w_lines[i - j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 /* The w_lines[] entries for inserted lines are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 * now invalid, but wl_size may be used above.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 * Reset to zero. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 while (i >= idx)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 wp->w_lines[i].wl_size = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 wp->w_lines[i--].wl_valid = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 * When lines are folded, display one line for all of them.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 * Otherwise, display normally (can be several display lines when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 * 'wrap' is on).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806 fold_count = foldedCount(wp, lnum, &win_foldinfo);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 if (fold_count != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 fold_line(wp, fold_count, &win_foldinfo, lnum, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 --fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 wp->w_lines[idx].wl_folded = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 wp->w_lines[idx].wl_lastlnum = lnum + fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 # ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 did_update = DID_FOLD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820 if (idx < wp->w_lines_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 && wp->w_lines[idx].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 && wp->w_lines[idx].wl_lnum == lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 && lnum > wp->w_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 && !(dy_flags & DY_LASTLINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 && srow + wp->w_lines[idx].wl_size > wp->w_height
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 && diff_check_fill(wp, lnum) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1829 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1830 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1831 /* This line is not going to fit. Don't draw anything here,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 * will draw "@ " lines below. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 row = wp->w_height + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 prepare_search_hl(wp, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 /* Let the syntax stuff know we skipped a few lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842 if (syntax_last_parsed != 0 && syntax_last_parsed + 1 < lnum
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
1843 && syntax_present(wp))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 syntax_end_parsing(syntax_last_parsed + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1845 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848 * Display one line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 */
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
1850 row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 wp->w_lines[idx].wl_folded = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 wp->w_lines[idx].wl_lastlnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 did_update = DID_LINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 syntax_last_parsed = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862 wp->w_lines[idx].wl_lnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863 wp->w_lines[idx].wl_valid = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 if (row > wp->w_height) /* past end of screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 /* we may need the size of that too long line later on */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867 if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 wp->w_lines[idx].wl_size = plines_win(wp, lnum, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1872 if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873 wp->w_lines[idx].wl_size = row - srow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876 lnum += fold_count + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 ++lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1880 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1881 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1882 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1883 /* This line does not need updating, advance to the next one */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 row += wp->w_lines[idx++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1885 if (row > wp->w_height) /* past end of screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888 lnum = wp->w_lines[idx - 1].wl_lastlnum + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890 ++lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893 did_update = DID_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897 if (lnum > buf->b_ml.ml_line_count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 eof = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904 * End of loop over all window lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908 if (idx > wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 wp->w_lines_valid = idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1910
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913 * Let the syntax stuff know we stop parsing here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1914 */
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
1915 if (syntax_last_parsed != 0 && syntax_present(wp))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916 syntax_end_parsing(syntax_last_parsed + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920 * If we didn't hit the end of the file, and we didn't finish the last
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1921 * line we were working on, then the line didn't fit.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1922 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1923 wp->w_empty_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1924 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1925 wp->w_filler_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1927 if (!eof && !didline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1928 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1929 if (lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1930 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1931 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1932 * Single line that does not fit!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1933 * Don't overwrite it, it can be edited.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1934 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935 wp->w_botline = lnum + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1936 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1937 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1938 else if (diff_check_fill(wp, lnum) >= wp->w_height - srow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1939 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1940 /* Window ends in filler lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1941 wp->w_botline = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1942 wp->w_filler_rows = wp->w_height - srow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1943 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1944 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1945 else if (dy_flags & DY_LASTLINE) /* 'display' has "lastline" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1946 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1947 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1948 * Last line isn't finished: Display "@@@" at the end.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1949 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1950 screen_fill(W_WINROW(wp) + wp->w_height - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1951 W_WINROW(wp) + wp->w_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1952 (int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1953 '@', '@', hl_attr(HLF_AT));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1954 set_empty_rows(wp, srow);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1955 wp->w_botline = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1956 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1959 win_draw_end(wp, '@', ' ', srow, wp->w_height, HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1960 wp->w_botline = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1961 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1962 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1963 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1964 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1965 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1966 draw_vsep_win(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1967 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968 if (eof) /* we hit the end of the file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970 wp->w_botline = buf->b_ml.ml_line_count + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1972 j = diff_check_fill(wp, wp->w_botline);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1973 if (j > 0 && !wp->w_botfill)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1974 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 * Display filler lines at the end of the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1977 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1978 if (char2cells(fill_diff) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1979 i = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1980 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1981 i = fill_diff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1982 if (row + j > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1983 j = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1984 win_draw_end(wp, i, i, row, row + (int)j, HLF_DED);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1985 row += j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1986 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1987 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1988 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1989 else if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990 wp->w_botline = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992 /* make sure the rest of the screen is blank */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993 /* put '~'s on rows that aren't part of the file. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1994 win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1995 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1997 /* Reset the type of redrawing required, the window has been updated. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1998 wp->w_redr_type = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 wp->w_old_topfill = wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001 wp->w_old_botfill = wp->w_botfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2005 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2007 * There is a trick with w_botline. If we invalidate it on each
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2008 * change that might modify it, this will cause a lot of expensive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2009 * calls to plines() in update_topline() each time. Therefore the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2010 * value of w_botline is often approximated, and this value is used to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2011 * compute the value of w_topline. If the value of w_botline was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2012 * wrong, check that the value of w_topline is correct (cursor is on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2013 * the visible part of the text). If it's not, we need to redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014 * again. Mostly this just means scrolling up a few lines, so it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2015 * doesn't look too bad. Only do this for the current window (where
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2016 * changes are relevant).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2017 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018 wp->w_valid |= VALID_BOTLINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019 if (wp == curwin && wp->w_botline != old_botline && !recursive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021 recursive = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 curwin->w_valid &= ~VALID_TOPLINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023 update_topline(); /* may invalidate w_botline again */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 if (must_redraw != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2025 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026 /* Don't update for changes in buffer again. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027 i = curbuf->b_mod_set;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2028 curbuf->b_mod_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2029 win_update(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2030 must_redraw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 curbuf->b_mod_set = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2032 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033 recursive = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2034 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2035 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2037 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 /* restore got_int, unless CTRL-C was hit while redrawing */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2039 if (!got_int)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2040 got_int = save_got_int;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2041 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2042 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2044 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2045 static int draw_signcolumn __ARGS((win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2047 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2048 * Return TRUE when window "wp" has a column to draw signs in.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2049 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2050 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051 draw_signcolumn(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2052 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2054 return (wp->w_buffer->b_signlist != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2055 # ifdef FEAT_NETBEANS_INTG
2210
8c6a66e2b3cc Add :nbstart and :nbclose.
Bram Moolenaar <bram@vim.org>
parents: 2178
diff changeset
2056 || netbeans_active()
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2060 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2062 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063 * Clear the rest of the window and mark the unused lines with "c1". use "c2"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064 * as the filler character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067 win_draw_end(wp, c1, c2, row, endrow, hl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069 int c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070 int c2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2072 int endrow;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
2073 hlf_T hl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2074 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075 #if defined(FEAT_FOLDING) || defined(FEAT_SIGNS) || defined(FEAT_CMDWIN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077 # define FDC_OFF n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 # define FDC_OFF 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2085 /* No check for cmdline window: should never be right-left. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2086 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 n = wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089 if (n > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091 /* draw the fold column at the right */
119
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2092 if (n > W_WIDTH(wp))
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2093 n = W_WIDTH(wp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095 W_ENDCOL(wp) - n, (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096 ' ', ' ', hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2098 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099 # ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 if (draw_signcolumn(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102 int nn = n + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 /* draw the sign column left of the fold column */
119
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2105 if (nn > W_WIDTH(wp))
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2106 nn = W_WIDTH(wp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109 ' ', ' ', hl_attr(HLF_SC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2110 n = nn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2112 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2114 W_WINCOL(wp), W_ENDCOL(wp) - 1 - FDC_OFF,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2115 c2, c2, hl_attr(hl));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118 c1, c2, hl_attr(hl));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 if (cmdwin_type != 0 && wp == curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2126 /* draw the cmdline character in the leftmost column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2127 n = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 if (n > wp->w_width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2129 n = wp->w_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2130 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2131 W_WINCOL(wp), (int)W_WINCOL(wp) + n,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2132 cmdwin_type, ' ', hl_attr(HLF_AT));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136 if (wp->w_p_fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138 int nn = n + wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2139
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2140 /* draw the fold column at the left */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141 if (nn > W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142 nn = W_WIDTH(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2144 W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2145 ' ', ' ', hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2146 n = nn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2147 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2150 if (draw_signcolumn(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152 int nn = n + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2153
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2154 /* draw the sign column after the fold column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155 if (nn > W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 nn = W_WIDTH(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2158 W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 ' ', ' ', hl_attr(HLF_SC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 n = nn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2163 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2164 W_WINCOL(wp) + FDC_OFF, (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 c1, c2, hl_attr(hl));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167 set_empty_rows(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2170 #ifdef FEAT_SYN_HL
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2171 static int advance_color_col __ARGS((int vcol, int **color_cols));
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2172
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2173 /*
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2174 * Advance **color_cols and return TRUE when there are columns to draw.
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2175 */
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2176 static int
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2177 advance_color_col(vcol, color_cols)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2178 int vcol;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2179 int **color_cols;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2180 {
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2181 while (**color_cols >= 0 && vcol > **color_cols)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2182 ++*color_cols;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2183 return (**color_cols >= 0);
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2184 }
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2185 #endif
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2186
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2188 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2189 * Display one folded line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 fold_line(wp, fold_count, foldinfo, lnum, row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 long fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 foldinfo_T *foldinfo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199 char_u buf[51];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 pos_T *top, *bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2201 linenr_T lnume = lnum + fold_count - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202 int len;
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 26
diff changeset
2203 char_u *text;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2204 int fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206 int txtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 int off = (int)(current_ScreenLine - ScreenLines);
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2208 int ri;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210 /* Build the fold line:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 * 1. Add the cmdwin_type for the command-line window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 * 2. Add the 'foldcolumn'
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2213 * 3. Add the 'number' or 'relativenumber' column
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 * 4. Compose the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2215 * 5. Add the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2216 * 6. set highlighting for the Visual area an other text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2217 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2218 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 * 1. Add the cmdwin_type for the command-line window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222 * Ignores 'rightleft', this window is never right-left.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 if (cmdwin_type != 0 && wp == curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 ScreenLines[off] = cmdwin_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 ScreenAttrs[off] = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2235 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238 * 2. Add the 'foldcolumn'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 fdc = wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241 if (fdc > W_WIDTH(wp) - col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 fdc = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243 if (fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245 fill_foldcolumn(buf, wp, TRUE, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2248 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2249 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 copy_text_attr(off + W_WIDTH(wp) - fdc - col, buf, fdc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2252 hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 /* reverse the fold column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 for (i = 0; i < fdc; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 ScreenLines[off + W_WIDTH(wp) - i - 1 - col] = buf[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 copy_text_attr(off + col, buf, fdc, hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260 col += fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263 #ifdef FEAT_RIGHTLEFT
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2264 # define RL_MEMSET(p, v, l) if (wp->w_p_rl) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2265 for (ri = 0; ri < l; ++ri) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2266 ScreenAttrs[off + (W_WIDTH(wp) - (p) - (l)) + ri] = v; \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2267 else \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2268 for (ri = 0; ri < l; ++ri) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2269 ScreenAttrs[off + (p) + ri] = v
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2270 #else
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2271 # define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2272 ScreenAttrs[off + (p) + ri] = v
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2275 /* Set all attributes of the 'number' or 'relativenumber' column and the
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2276 * text */
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2277 RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2279 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2280 /* If signs are being displayed, add two spaces. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 if (draw_signcolumn(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 len = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284 if (len > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 if (len > 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 len = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290 /* the line number isn't reversed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 copy_text_attr(off + W_WIDTH(wp) - len - col,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292 (char_u *)" ", len, hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2293 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2294 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296 col += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 /*
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2302 * 3. Add the 'number' or 'relativenumber' column
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 */
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2304 if (wp->w_p_nu || wp->w_p_rnu)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306 len = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 if (len > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2308 {
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2309 int w = number_width(wp);
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2310 long num;
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2311
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2312 if (len > w + 1)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2313 len = w + 1;
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2314
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2315 if (wp->w_p_nu)
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2316 /* 'number' */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2317 num = (long)lnum;
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2318 else
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2319 /* 'relativenumber', don't use negative numbers */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2320 num = (long)abs((int)get_cursor_rel_lnum(wp, lnum));
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2321
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
2322 sprintf((char *)buf, "%*ld ", w, num);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2324 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 /* the line number isn't reversed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2326 copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2327 hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2328 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2329 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2330 copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2331 col += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2332 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2333 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 * 4. Compose the folded-line string with 'foldtext', if set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 */
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 26
diff changeset
2338 text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2339
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2340 txtcol = col; /* remember where text starts */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2342 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2343 * 5. move the text to current_ScreenLine. Fill up with "fill_fold".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2344 * Right-left text is put in columns 0 - number-col, normal text is put
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345 * in columns number-col - window-width.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2348 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 int cells;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2351 int u8c, u8cc[MAX_MCO];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2352 int i;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354 int c_len;
33
f6033dcbaf31 updated for version 7.0020
vimboss
parents: 29
diff changeset
2355 char_u *p;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 int prev_c = 0; /* previous Arabic character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358 int prev_c1 = 0; /* first composing char for prev_c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2359 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2361 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2362 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2363 idx = off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2364 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2365 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2366 idx = off + col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2367
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2368 /* Store multibyte characters in ScreenLines[] et al. correctly. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369 for (p = text; *p != NUL; )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371 cells = (*mb_ptr2cells)(p);
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
2372 c_len = (*mb_ptr2len)(p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2373 if (col + cells > W_WIDTH(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375 - (wp->w_p_rl ? col : 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379 ScreenLines[idx] = *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2381 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2382 u8c = utfc_ptr2char(p, u8cc);
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2383 if (*p < 0x80 && u8cc[0] == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2385 ScreenLinesUC[idx] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2386 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2387 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2388 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2389 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2390 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2392 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2393 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2394 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2395 /* Do Arabic shaping. */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2396 int pc, pc1, nc;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2397 int pcc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2398 int firstbyte = *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2400 /* The idea of what is the previous and next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2401 * character depends on 'rightleft'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2402 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2403 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2404 pc = prev_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2405 pc1 = prev_c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2406 nc = utf_ptr2char(p + c_len);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2407 prev_c1 = u8cc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2408 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2409 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2410 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2411 pc = utfc_ptr2char(p + c_len, pcc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2412 nc = prev_c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2413 pc1 = pcc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2414 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2415 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2416
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2417 u8c = arabic_shape(u8c, &firstbyte, &u8cc[0],
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2418 pc, pc1, nc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2419 ScreenLines[idx] = firstbyte;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2420 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2421 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2422 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2423 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2424 /* Non-BMP character: display as ? or fullwidth ?. */
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
2425 #ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2426 if (u8c >= 0x10000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2427 ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2428 else
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
2429 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2430 ScreenLinesUC[idx] = u8c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2431 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2432 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2433 ScreenLinesC[i][idx] = u8cc[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2434 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2435 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2436 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2437 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2438 if (cells > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2439 ScreenLines[idx + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2440 }
2069
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2441 else if (enc_dbcs == DBCS_JPNU && *p == 0x8e)
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2442 /* double-byte single width character */
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2443 ScreenLines2[idx] = p[1];
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2444 else if (cells > 1)
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2445 /* double-width character */
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2446 ScreenLines[idx + 1] = p[1];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2447 col += cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2448 idx += cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2449 p += c_len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2450 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2451 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2452 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2453 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2454 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2455 len = (int)STRLEN(text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2456 if (len > W_WIDTH(wp) - col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2457 len = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2458 if (len > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2459 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2460 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2461 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2462 STRNCPY(current_ScreenLine, text, len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2463 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2464 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2465 STRNCPY(current_ScreenLine + col, text, len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2466 col += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2467 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2468 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2470 /* Fill the rest of the line with the fold filler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2471 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2472 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2473 col -= txtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2474 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2475 while (col < W_WIDTH(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2476 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2477 - (wp->w_p_rl ? txtcol : 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2478 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2479 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2480 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2481 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2482 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2483 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2484 if (fill_fold >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2485 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2486 ScreenLinesUC[off + col] = fill_fold;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2487 ScreenLinesC[0][off + col] = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2488 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2489 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2490 ScreenLinesUC[off + col] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2491 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2492 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2493 ScreenLines[off + col++] = fill_fold;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2494 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2495
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 if (text != buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2497 vim_free(text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2499 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2500 * 6. set highlighting for the Visual area an other text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501 * If all folded lines are in the Visual area, highlight the line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2502 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2503 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2504 if (VIsual_active && wp->w_buffer == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2506 if (ltoreq(curwin->w_cursor, VIsual))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2508 /* Visual is after curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 top = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510 bot = &VIsual;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2511 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 /* Visual is before curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2515 top = &VIsual;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2516 bot = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2518 if (lnum >= top->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2519 && lnume <= bot->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2520 && (VIsual_mode != 'v'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2521 || ((lnum > top->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2522 || (lnum == top->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2523 && top->col == 0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2524 && (lnume < bot->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2525 || (lnume == bot->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2526 && (bot->col - (*p_sel == 'e'))
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
2527 >= (colnr_T)STRLEN(ml_get_buf(wp->w_buffer, lnume, FALSE)))))))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2529 if (VIsual_mode == Ctrl_V)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2530 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2531 /* Visual block mode: highlight the chars part of the block */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2532 if (wp->w_old_cursor_fcol + txtcol < (colnr_T)W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2533 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2534 if (wp->w_old_cursor_lcol + txtcol < (colnr_T)W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2535 len = wp->w_old_cursor_lcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2536 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2537 len = W_WIDTH(wp) - txtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2538 RL_MEMSET(wp->w_old_cursor_fcol + txtcol, hl_attr(HLF_V),
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 227
diff changeset
2539 len - (int)wp->w_old_cursor_fcol);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2540 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2541 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2542 else
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2543 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2544 /* Set all attributes of the text */
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2545 RL_MEMSET(txtcol, hl_attr(HLF_V), W_WIDTH(wp) - txtcol);
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2546 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2548 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2549 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2550
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2551 #ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2552 /* Show 'cursorcolumn' in the fold line. */
1725
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2553 if (wp->w_p_cuc)
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2554 {
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2555 txtcol += wp->w_virtcol;
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2556 if (wp->w_p_wrap)
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2557 txtcol -= wp->w_skipcol;
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2558 else
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2559 txtcol -= wp->w_leftcol;
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2560 if (txtcol >= 0 && txtcol < W_WIDTH(wp))
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2561 ScreenAttrs[off + txtcol] = hl_combine_attr(
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2562 ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2563 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2564 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2566 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2567 (int)W_WIDTH(wp), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2569 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2570 * Update w_cline_height and w_cline_folded if the cursor line was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 * updated (saves a call to plines() later).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2572 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2573 if (wp == curwin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2574 && lnum <= curwin->w_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2575 && lnume >= curwin->w_cursor.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2576 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2577 curwin->w_cline_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2578 curwin->w_cline_height = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579 curwin->w_cline_folded = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2580 curwin->w_valid |= (VALID_CHEIGHT|VALID_CROW);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2581 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2583
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585 * Copy "buf[len]" to ScreenLines["off"] and set attributes to "attr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2587 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2588 copy_text_attr(off, buf, len, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2589 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2590 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2591 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2592 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2593 {
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2594 int i;
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2595
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2596 mch_memmove(ScreenLines + off, buf, (size_t)len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2597 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2598 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2599 vim_memset(ScreenLinesUC + off, 0, sizeof(u8char_T) * (size_t)len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2600 # endif
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2601 for (i = 0; i < len; ++i)
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2602 ScreenAttrs[off + i] = attr;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2603 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2605 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2606 * Fill the foldcolumn at "p" for window "wp".
548
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2607 * Only to be called when 'foldcolumn' > 0.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2608 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2609 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2610 fill_foldcolumn(p, wp, closed, lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2611 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2612 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2613 int closed; /* TRUE of FALSE */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2614 linenr_T lnum; /* current line number */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2615 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2616 int i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2617 int level;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2618 int first_level;
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2619 int empty;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2620
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2621 /* Init to all spaces. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2622 copy_spaces(p, (size_t)wp->w_p_fdc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2624 level = win_foldinfo.fi_level;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2625 if (level > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2626 {
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2627 /* If there is only one column put more info in it. */
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2628 empty = (wp->w_p_fdc == 1) ? 0 : 1;
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2629
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2630 /* If the column is too narrow, we start at the lowest level that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2631 * fits and use numbers to indicated the depth. */
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2632 first_level = level - wp->w_p_fdc - closed + 1 + empty;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2633 if (first_level < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2634 first_level = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2635
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2636 for (i = 0; i + empty < wp->w_p_fdc; ++i)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2637 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2638 if (win_foldinfo.fi_lnum == lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2639 && first_level + i >= win_foldinfo.fi_low_level)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2640 p[i] = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2641 else if (first_level == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 p[i] = '|';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 else if (first_level + i <= 9)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 p[i] = '0' + first_level + i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2645 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2646 p[i] = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2647 if (first_level + i == level)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2648 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2649 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2650 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 if (closed)
548
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2652 p[i >= wp->w_p_fdc ? i - 1 : i] = '+';
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2653 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2654 #endif /* FEAT_FOLDING */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2655
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 * Display line "lnum" of window 'wp' on the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 * Start at row "startrow", stop when "endrow" is reached.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659 * wp->w_virtcol needs to be valid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2660 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2661 * Return the number of last row the line occupies.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2663 static int
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
2664 win_line(wp, lnum, startrow, endrow, nochange)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2665 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2666 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2667 int startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2668 int endrow;
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
2669 int nochange UNUSED; /* not updating for changed text */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2670 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2671 int col; /* visual column on screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2672 unsigned off; /* offset in ScreenLines/ScreenAttrs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2673 int c = 0; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 long vcol = 0; /* virtual column (for tabs) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2675 long vcol_prev = -1; /* "vcol" of previous character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676 char_u *line; /* current line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2677 char_u *ptr; /* current position in "line" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2678 int row; /* row in the window, excl w_winrow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2679 int screen_row; /* row on the screen, incl w_winrow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2680
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2681 char_u extra[18]; /* "%ld" and 'fdc' must fit in here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2682 int n_extra = 0; /* number of extra chars */
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
2683 char_u *p_extra = NULL; /* string of extra chars, plus NUL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684 int c_extra = NUL; /* extra chars, all the same */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685 int extra_attr = 0; /* attributes when n_extra != 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 static char_u *at_end_str = (char_u *)""; /* used for p_extra when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2687 displaying lcs_eol at end-of-line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 int lcs_eol_one = lcs_eol; /* lcs_eol until it's been used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 int lcs_prec_todo = lcs_prec; /* lcs_prec until it's been used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691 /* saved "extra" items for when draw_state becomes WL_LINE (again) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2692 int saved_n_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693 char_u *saved_p_extra = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 int saved_c_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695 int saved_char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2697 int n_attr = 0; /* chars with special attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2698 int saved_attr2 = 0; /* char_attr saved for n_attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2699 int n_attr3 = 0; /* chars with overruling special attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2700 int saved_attr3 = 0; /* char_attr saved for n_attr3 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2701
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2702 int n_skip = 0; /* nr of chars to skip for 'nowrap' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2703
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2704 int fromcol, tocol; /* start/end of inverting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2705 int fromcol_prev = -2; /* start of inverting after cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2706 int noinvcur = FALSE; /* don't invert the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2707 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2708 pos_T *top, *bot;
1813
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
2709 int lnum_in_visual_area = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2710 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2711 pos_T pos;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2712 long v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2713
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2714 int char_attr = 0; /* attributes for next character */
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
2715 int attr_pri = FALSE; /* char_attr has priority */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2716 int area_highlighting = FALSE; /* Visual or incsearch highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2717 in this line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2718 int attr = 0; /* attributes for area highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2719 int area_attr = 0; /* attributes desired by highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2720 int search_attr = 0; /* attributes desired by 'hlsearch' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2721 #ifdef FEAT_SYN_HL
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2722 int vcol_save_attr = 0; /* saved attr for 'cursorcolumn' */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2723 int syntax_attr = 0; /* attributes desired by syntax */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2724 int has_syntax = FALSE; /* this buffer has syntax highl. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2725 int save_did_emsg;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
2726 int eol_hl_off = 0; /* 1 if highlighted char after EOL */
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2727 int draw_color_col = FALSE; /* highlight colorcolumn */
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2728 int *color_cols = NULL; /* pointer to according columns array */
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2729 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2730 #ifdef FEAT_SPELL
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2731 int has_spell = FALSE; /* this buffer has spell checking */
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2732 # define SPWORDLEN 150
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2733 char_u nextline[SPWORDLEN * 2];/* text with start of the next line */
353
3161473d6462 updated for version 7.0091
vimboss
parents: 348
diff changeset
2734 int nextlinecol = 0; /* column where nextline[] starts */
3161473d6462 updated for version 7.0091
vimboss
parents: 348
diff changeset
2735 int nextline_idx = 0; /* index in nextline[] where next line
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2736 starts */
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2737 int spell_attr = 0; /* attributes desired by spelling */
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2738 int word_end = 0; /* last byte with same spell_attr */
378
6b49757d378c updated for version 7.0098
vimboss
parents: 356
diff changeset
2739 static linenr_T checked_lnum = 0; /* line number for "checked_col" */
6b49757d378c updated for version 7.0098
vimboss
parents: 356
diff changeset
2740 static int checked_col = 0; /* column in "checked_lnum" up to which
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2741 * there are no spell errors */
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2742 static int cap_col = -1; /* column to check for Cap word */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2743 static linenr_T capcol_lnum = 0; /* line number where "cap_col" used */
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2744 int cur_checked_col = 0; /* checked column for current line */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2745 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2746 int extra_check; /* has syntax or linebreak */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2747 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2748 int multi_attr = 0; /* attributes desired by multibyte */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2749 int mb_l = 1; /* multi-byte byte length */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2750 int mb_c = 0; /* decoded multi-byte character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2751 int mb_utf8 = FALSE; /* screen char is UTF-8 char */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2752 int u8cc[MAX_MCO]; /* composing UTF-8 chars */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2753 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2754 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2755 int filler_lines; /* nr of filler lines to be drawn */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2756 int filler_todo; /* nr of filler lines still to do + 1 */
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
2757 hlf_T diff_hlf = (hlf_T)0; /* type of diff highlighting */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2758 int change_start = MAXCOL; /* first col of changed area */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2759 int change_end = -1; /* last col of changed area */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2760 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2761 colnr_T trailcol = MAXCOL; /* start of trailing spaces */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2762 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2763 int need_showbreak = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2764 #endif
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
2765 #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
2766 || defined(FEAT_SYN_HL) || defined(FEAT_DIFF)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2767 # define LINE_ATTR
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
2768 int line_attr = 0; /* attribute for the whole line */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2769 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2770 #ifdef FEAT_SEARCH_EXTRA
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2771 matchitem_T *cur; /* points to the match list */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2772 match_T *shl; /* points to search_hl or a match */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2773 int shl_flag; /* flag to indicate whether search_hl
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2774 has been processed or not */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2775 int prevcol_hl_flag; /* flag to indicate whether prevcol
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2776 equals startcol of search_hl or one
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2777 of the matches */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2778 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2779 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2780 int prev_c = 0; /* previous Arabic character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2781 int prev_c1 = 0; /* first composing char for prev_c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782 #endif
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
2783 #if defined(LINE_ATTR)
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
2784 int did_line_attr = 0;
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
2785 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2786
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2787 /* draw_state: items that are drawn in sequence: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2788 #define WL_START 0 /* nothing done yet */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2789 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2790 # define WL_CMDLINE WL_START + 1 /* cmdline window column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2791 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2792 # define WL_CMDLINE WL_START
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2793 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2794 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2795 # define WL_FOLD WL_CMDLINE + 1 /* 'foldcolumn' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797 # define WL_FOLD WL_CMDLINE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2798 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 # define WL_SIGN WL_FOLD + 1 /* column for signs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 # define WL_SIGN WL_FOLD /* column for signs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2803 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804 #define WL_NR WL_SIGN + 1 /* line number */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2806 # define WL_SBR WL_NR + 1 /* 'showbreak' or 'diff' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808 # define WL_SBR WL_NR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810 #define WL_LINE WL_SBR + 1 /* text in the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 int draw_state = WL_START; /* what to draw next */
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
2812 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813 int feedback_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 int feedback_old_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2815 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2816
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2817 #ifdef FEAT_CONCEAL
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2818 int syntax_flags = 0;
2392
0371401d9d33 Give each syntax item a sequence number, so that we know when it starts and
Bram Moolenaar <bram@vim.org>
parents: 2382
diff changeset
2819 int syntax_seqnr = 0;
2375
a96dd77ce213 For conceal mode: when two different syntax items follow each other, show the
Bram Moolenaar <bram@vim.org>
parents: 2364
diff changeset
2820 int prev_syntax_id = 0;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2821 int conceal_attr = hl_attr(HLF_CONCEAL);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2822 int is_concealing = FALSE;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2823 int boguscols = 0; /* nonexistent columns added to force
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2824 wrapping */
2409
0ca06a92adfb Add support for horizontal scroll wheel. (Bjorn Winckler)
Bram Moolenaar <bram@vim.org>
parents: 2400
diff changeset
2825 int vcol_off = 0; /* offset for concealed characters */
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
2826 int did_wcol = FALSE;
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
2827 # define VCOL_HLC (vcol - vcol_off)
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
2828 #else
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
2829 # define VCOL_HLC (vcol)
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2830 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 if (startrow > endrow) /* past the end already! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 return startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 row = startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836 screen_row = row + W_WINROW(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2837
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2838 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2839 * To speed up the loop below, set extra_check when there is linebreak,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840 * trailing white space and/or syntax processing to be done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2841 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843 extra_check = wp->w_p_lbr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2844 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845 extra_check = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847 #ifdef FEAT_SYN_HL
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2848 if (syntax_present(wp) && !wp->w_s->b_syn_error)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850 /* Prepare for syntax highlighting in this line. When there is an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 * error, stop syntax highlighting. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852 save_did_emsg = did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853 did_emsg = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854 syntax_start(wp, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855 if (did_emsg)
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2856 wp->w_s->b_syn_error = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2858 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2859 did_emsg = save_did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2860 has_syntax = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 extra_check = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2862 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2863 }
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2864
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2865 /* Check for columns to display for 'colorcolumn'. */
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2866 color_cols = wp->w_p_cc_cols;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
2867 if (color_cols != NULL)
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
2868 draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2869 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2870
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2871 #ifdef FEAT_SPELL
258
f93df7322443 updated for version 7.0070
vimboss
parents: 236
diff changeset
2872 if (wp->w_p_spell
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2873 && *wp->w_s->b_p_spl != NUL
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2874 && wp->w_s->b_langp.ga_len > 0
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
2875 && *(char **)(wp->w_s->b_langp.ga_data) != NULL)
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2876 {
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2877 /* Prepare for spell checking. */
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2878 has_spell = TRUE;
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2879 extra_check = TRUE;
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2880
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2881 /* Get the start of the next line, so that words that wrap to the next
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2882 * line are found too: "et<line-break>al.".
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2883 * Trick: skip a few chars for C/shell/Vim comments */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2884 nextline[SPWORDLEN] = NUL;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2885 if (lnum < wp->w_buffer->b_ml.ml_line_count)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2886 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2887 line = ml_get_buf(wp->w_buffer, lnum + 1, FALSE);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2888 spell_cat_line(nextline + SPWORDLEN, line, SPWORDLEN);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2889 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2890
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2891 /* When a word wrapped from the previous line the start of the current
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2892 * line is valid. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2893 if (lnum == checked_lnum)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2894 cur_checked_col = checked_col;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2895 checked_lnum = 0;
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2896
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2897 /* When there was a sentence end in the previous line may require a
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2898 * word starting with capital in this line. In line 1 always check
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2899 * the first word. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2900 if (lnum != capcol_lnum)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2901 cap_col = -1;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2902 if (lnum == 1)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2903 cap_col = 0;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2904 capcol_lnum = 0;
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2905 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2906 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2907
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2908 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2909 * handle visual active in this window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2910 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2911 fromcol = -10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2912 tocol = MAXCOL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2913 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2914 if (VIsual_active && wp->w_buffer == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2915 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2916 /* Visual is after curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2917 if (ltoreq(curwin->w_cursor, VIsual))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2918 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2919 top = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2920 bot = &VIsual;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2921 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2922 else /* Visual is before curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2923 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2924 top = &VIsual;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2925 bot = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2926 }
1813
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
2927 lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2928 if (VIsual_mode == Ctrl_V) /* block mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2929 {
1813
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
2930 if (lnum_in_visual_area)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2931 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2932 fromcol = wp->w_old_cursor_fcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2933 tocol = wp->w_old_cursor_lcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2934 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2935 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2936 else /* non-block mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2937 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2938 if (lnum > top->lnum && lnum <= bot->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2939 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2940 else if (lnum == top->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2941 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2942 if (VIsual_mode == 'V') /* linewise */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2943 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2944 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2945 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2946 getvvcol(wp, top, (colnr_T *)&fromcol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2947 if (gchar_pos(top) == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2948 tocol = fromcol + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2949 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2950 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2951 if (VIsual_mode != 'V' && lnum == bot->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2952 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2953 if (*p_sel == 'e' && bot->col == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2954 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2955 && bot->coladd == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2956 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2957 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2958 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2959 fromcol = -10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2960 tocol = MAXCOL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2961 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
2962 else if (bot->col == MAXCOL)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
2963 tocol = MAXCOL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2964 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2965 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2966 pos = *bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2967 if (*p_sel == 'e')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2968 getvvcol(wp, &pos, (colnr_T *)&tocol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2969 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2970 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2971 getvvcol(wp, &pos, NULL, NULL, (colnr_T *)&tocol);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2972 ++tocol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2973 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2974 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2975 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2976 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2977
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2978 #ifndef MSDOS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2979 /* Check if the character under the cursor should not be inverted */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2980 if (!highlight_match && lnum == curwin->w_cursor.lnum && wp == curwin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2981 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2982 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2983 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2984 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2985 noinvcur = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2986 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2987
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2988 /* if inverting in this line set area_highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2989 if (fromcol >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2990 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2991 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2992 attr = hl_attr(HLF_V);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2993 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2994 if (clip_star.available && !clip_star.owned && clip_isautosel())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2995 attr = hl_attr(HLF_VNC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2996 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2997 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2998 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2999
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3000 /*
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3001 * handle 'incsearch' and ":s///c" highlighting
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3002 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3003 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3004 #endif /* FEAT_VISUAL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3005 if (highlight_match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3006 && wp == curwin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3007 && lnum >= curwin->w_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3008 && lnum <= curwin->w_cursor.lnum + search_match_lines)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3009 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3010 if (lnum == curwin->w_cursor.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3011 getvcol(curwin, &(curwin->w_cursor),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3012 (colnr_T *)&fromcol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3013 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3014 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3015 if (lnum == curwin->w_cursor.lnum + search_match_lines)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3016 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3017 pos.lnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3018 pos.col = search_match_endcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3019 getvcol(curwin, &pos, (colnr_T *)&tocol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3020 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3021 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3022 tocol = MAXCOL;
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
3023 /* do at least one character; happens when past end of line */
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
3024 if (fromcol == tocol)
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
3025 tocol = fromcol + 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3026 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3027 attr = hl_attr(HLF_I);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3028 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3029
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3030 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3031 filler_lines = diff_check(wp, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3032 if (filler_lines < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3033 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3034 if (filler_lines == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3035 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3036 if (diff_find_change(wp, lnum, &change_start, &change_end))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3037 diff_hlf = HLF_ADD; /* added line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3038 else if (change_start == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3039 diff_hlf = HLF_TXD; /* changed text */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3040 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3041 diff_hlf = HLF_CHD; /* changed line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3042 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3043 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3044 diff_hlf = HLF_ADD; /* added line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3045 filler_lines = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3046 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3047 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3048 if (lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3049 filler_lines = wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3050 filler_todo = filler_lines;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3051 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3052
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3053 #ifdef LINE_ATTR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3054 # ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3055 /* If this line has a sign with line highlighting set line_attr. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3056 v = buf_getsigntype(wp->w_buffer, lnum, SIGN_LINEHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3057 if (v != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3058 line_attr = sign_get_attr((int)v, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3059 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3060 # if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3061 /* Highlight the current line in the quickfix window. */
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
3062 if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3063 line_attr = hl_attr(HLF_L);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3064 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3065 if (line_attr != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3066 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3067 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3068
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3069 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3070 ptr = line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3071
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3072 #ifdef FEAT_SPELL
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3073 if (has_spell)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3074 {
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
3075 /* For checking first word with a capital skip white space. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
3076 if (cap_col == 0)
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
3077 cap_col = (int)(skipwhite(line) - line);
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
3078
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3079 /* To be able to spell-check over line boundaries copy the end of the
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3080 * current line into nextline[]. Above the start of the next line was
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3081 * copied to nextline[SPWORDLEN]. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3082 if (nextline[SPWORDLEN] == NUL)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3083 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3084 /* No next line or it is empty. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3085 nextlinecol = MAXCOL;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3086 nextline_idx = 0;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3087 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3088 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3089 {
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
3090 v = (long)STRLEN(line);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3091 if (v < SPWORDLEN)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3092 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3093 /* Short line, use it completely and append the start of the
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3094 * next line. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3095 nextlinecol = 0;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3096 mch_memmove(nextline, line, (size_t)v);
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1616
diff changeset
3097 STRMOVE(nextline + v, nextline + SPWORDLEN);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3098 nextline_idx = v + 1;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3099 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3100 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3101 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3102 /* Long line, use only the last SPWORDLEN bytes. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3103 nextlinecol = v - SPWORDLEN;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3104 mch_memmove(nextline, line + nextlinecol, SPWORDLEN);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3105 nextline_idx = SPWORDLEN + 1;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3106 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3107 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3108 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3109 #endif
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3110
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3111 /* find start of trailing whitespace */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3112 if (wp->w_p_list && lcs_trail)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3113 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3114 trailcol = (colnr_T)STRLEN(ptr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3115 while (trailcol > (colnr_T)0 && vim_iswhite(ptr[trailcol - 1]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3116 --trailcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3117 trailcol += (colnr_T) (ptr - line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3118 extra_check = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3119 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3120
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3121 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3122 * 'nowrap' or 'wrap' and a single line that doesn't fit: Advance to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3123 * first character to be displayed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3124 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3125 if (wp->w_p_wrap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3126 v = wp->w_skipcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3127 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3128 v = wp->w_leftcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3129 if (v > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3130 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3131 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3132 char_u *prev_ptr = ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3133 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3134 while (vcol < v && *ptr != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3135 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3136 c = win_lbr_chartabsize(wp, ptr, (colnr_T)vcol, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3137 vcol += c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3138 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3139 prev_ptr = ptr;
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
3140 #endif
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
3141 mb_ptr_adv(ptr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3142 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3143
1984
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3144 #if defined(FEAT_SYN_HL) || defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL)
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3145 /* When:
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3146 * - 'cuc' is set, or
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
3147 * - 'colorcolumn' is set, or
1984
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3148 * - 'virtualedit' is set, or
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3149 * - the visual mode is active,
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3150 * the end of the line may be before the start of the displayed part.
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3151 */
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3152 if (vcol < v && (
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3153 # ifdef FEAT_SYN_HL
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3154 wp->w_p_cuc
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
3155 || draw_color_col
1984
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3156 # if defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL)
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3157 ||
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3158 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3159 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3160 # ifdef FEAT_VIRTUALEDIT
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3161 virtual_active()
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3162 # ifdef FEAT_VISUAL
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3163 ||
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3164 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3165 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3166 # ifdef FEAT_VISUAL
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3167 (VIsual_active && wp->w_buffer == curwin->w_buffer)
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3168 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3169 ))
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3170 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3171 vcol = v;
1984
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3172 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3173 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3175 /* Handle a character that's not completely on the screen: Put ptr at
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3176 * that character but skip the first few screen characters. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3177 if (vcol > v)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3178 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3179 vcol -= c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3180 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3181 ptr = prev_ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3182 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3183 --ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3184 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3185 n_skip = v - vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3186 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3188 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3189 * Adjust for when the inverted text is before the screen,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3190 * and when the start of the inverted text is before the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3191 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3192 if (tocol <= vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3193 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3194 else if (fromcol >= 0 && fromcol < vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3195 fromcol = vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3196
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3197 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3198 /* When w_skipcol is non-zero, first line needs 'showbreak' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3199 if (wp->w_p_wrap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3200 need_showbreak = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3201 #endif
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3202 #ifdef FEAT_SPELL
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3203 /* When spell checking a word we need to figure out the start of the
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3204 * word and if it's badly spelled or not. */
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3205 if (has_spell)
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3206 {
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3207 int len;
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3208 colnr_T linecol = (colnr_T)(ptr - line);
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3209 hlf_T spell_hlf = HLF_COUNT;
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3210
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3211 pos = wp->w_cursor;
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3212 wp->w_cursor.lnum = lnum;
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3213 wp->w_cursor.col = linecol;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3214 len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf);
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3215
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3216 /* spell_move_to() may call ml_get() and make "line" invalid */
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3217 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3218 ptr = line + linecol;
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3219
530
339999b511a0 updated for version 7.0148
vimboss
parents: 519
diff changeset
3220 if (len == 0 || (int)wp->w_cursor.col > ptr - line)
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3221 {
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3222 /* no bad word found at line start, don't check until end of a
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3223 * word */
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3224 spell_hlf = HLF_COUNT;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
3225 word_end = (int)(spell_to_word_end(ptr, wp)
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3226 - line + 1);
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3227 }
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3228 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3229 {
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3230 /* bad word found, use attributes until end of word */
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3231 word_end = wp->w_cursor.col + len + 1;
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3232
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3233 /* Turn index into actual attributes. */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3234 if (spell_hlf != HLF_COUNT)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3235 spell_attr = highlight_attr[spell_hlf];
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3236 }
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3237 wp->w_cursor = pos;
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3238
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3239 # ifdef FEAT_SYN_HL
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3240 /* Need to restart syntax highlighting for this line. */
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3241 if (has_syntax)
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3242 syntax_start(wp, lnum);
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3243 # endif
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3244 }
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3245 #endif
7
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 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3249 * Correct highlighting for cursor that can't be disabled.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3250 * Avoids having to check this for each character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3251 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3252 if (fromcol >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3253 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3254 if (noinvcur)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3255 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3256 if ((colnr_T)fromcol == wp->w_virtcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3257 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3258 /* highlighting starts at cursor, let it start just after the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3259 * cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3260 fromcol_prev = fromcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3261 fromcol = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3262 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3263 else if ((colnr_T)fromcol < wp->w_virtcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3264 /* restart highlighting after the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3265 fromcol_prev = wp->w_virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3266 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3267 if (fromcol >= tocol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3268 fromcol = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3269 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3271 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3272 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3273 * Handle highlighting the last used search pattern and matches.
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3274 * Do this for both search_hl and the match list.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3275 */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3276 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3277 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3278 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3279 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3280 if (shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3281 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3282 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3283 shl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3284 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3285 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3286 shl = &cur->hl;
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3287 shl->startcol = MAXCOL;
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3288 shl->endcol = MAXCOL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3289 shl->attr_cur = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3290 if (shl->rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3291 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3292 v = (long)(ptr - line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3293 next_search_hl(wp, shl, lnum, (colnr_T)v);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3294
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3295 /* Need to get the line again, a multi-line regexp may have made it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3296 * invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3297 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3298 ptr = line + v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3300 if (shl->lnum != 0 && shl->lnum <= lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3301 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3302 if (shl->lnum == lnum)
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3303 shl->startcol = shl->rm.startpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3304 else
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3305 shl->startcol = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3306 if (lnum == shl->lnum + shl->rm.endpos[0].lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3307 - shl->rm.startpos[0].lnum)
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3308 shl->endcol = shl->rm.endpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3309 else
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3310 shl->endcol = MAXCOL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3311 /* Highlight one character for an empty match. */
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3312 if (shl->startcol == shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3314 #ifdef FEAT_MBYTE
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3315 if (has_mbyte && line[shl->endcol] != NUL)
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3316 shl->endcol += (*mb_ptr2len)(line + shl->endcol);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3317 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3318 #endif
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3319 ++shl->endcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3320 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3321 if ((long)shl->startcol < v) /* match at leftcol */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3322 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3323 shl->attr_cur = shl->attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3324 search_attr = shl->attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3325 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3326 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3327 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3328 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3329 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3330 cur = cur->next;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3331 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3332 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3333
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3334 #ifdef FEAT_SYN_HL
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 809
diff changeset
3335 /* Cursor line highlighting for 'cursorline'. Not when Visual mode is
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 809
diff changeset
3336 * active, because it's not clear what is selected then. */
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 809
diff changeset
3337 if (wp->w_p_cul && lnum == wp->w_cursor.lnum && !VIsual_active)
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3338 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3339 line_attr = hl_attr(HLF_CUL);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3340 area_highlighting = TRUE;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3341 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3342 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3343
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3344 off = (unsigned)(current_ScreenLine - ScreenLines);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3345 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3346 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3347 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3348 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3349 /* Rightleft window: process the text in the normal direction, but put
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3350 * it in current_ScreenLine[] from right to left. Start at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3351 * rightmost column of the window. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3352 col = W_WIDTH(wp) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3353 off += col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3354 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3355 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3357 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3358 * Repeat for the whole displayed line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3359 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3360 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3361 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3362 /* Skip this quickly when working on the text. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3363 if (draw_state != WL_LINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3364 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3365 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3366 if (draw_state == WL_CMDLINE - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3367 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3368 draw_state = WL_CMDLINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3369 if (cmdwin_type != 0 && wp == curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3370 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3371 /* Draw the cmdline character. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3372 n_extra = 1;
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3373 c_extra = cmdwin_type;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3374 char_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3375 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3376 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3377 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3378
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3379 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3380 if (draw_state == WL_FOLD - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3381 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3382 draw_state = WL_FOLD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3383 if (wp->w_p_fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3385 /* Draw the 'foldcolumn'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3386 fill_foldcolumn(extra, wp, FALSE, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3387 n_extra = wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3388 p_extra = extra;
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3389 p_extra[n_extra] = NUL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3390 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3391 char_attr = hl_attr(HLF_FC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3392 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3393 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3394 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3396 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3397 if (draw_state == WL_SIGN - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3398 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3399 draw_state = WL_SIGN;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3400 /* Show the sign column when there are any signs in this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3401 * buffer or when using Netbeans. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3402 if (draw_signcolumn(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3403 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3404 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3405 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3406 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3407 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3408 int_u text_sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3409 # ifdef FEAT_SIGN_ICONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3410 int_u icon_sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3411 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3412
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3413 /* Draw two cells with the sign value or blank. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3414 c_extra = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3415 char_attr = hl_attr(HLF_SC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3416 n_extra = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3418 if (row == startrow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3419 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3420 text_sign = buf_getsigntype(wp->w_buffer, lnum,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3421 SIGN_TEXT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3422 # ifdef FEAT_SIGN_ICONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3423 icon_sign = buf_getsigntype(wp->w_buffer, lnum,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3424 SIGN_ICON);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3425 if (gui.in_use && icon_sign != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3426 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3427 /* Use the image in this position. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3428 c_extra = SIGN_BYTE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3429 # ifdef FEAT_NETBEANS_INTG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3430 if (buf_signcount(wp->w_buffer, lnum) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3431 c_extra = MULTISIGN_BYTE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3432 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3433 char_attr = icon_sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3434 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3435 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3436 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3437 if (text_sign != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3438 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3439 p_extra = sign_get_text(text_sign);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3440 if (p_extra != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3441 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3442 c_extra = NUL;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
3443 n_extra = (int)STRLEN(p_extra);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3444 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3445 char_attr = sign_get_attr(text_sign, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3446 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3447 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3448 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3449 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3450 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3451
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3452 if (draw_state == WL_NR - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3453 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3454 draw_state = WL_NR;
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3455 /* Display the absolute or relative line number. After the
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3456 * first fill with blanks when the 'n' flag isn't in 'cpo' */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3457 if ((wp->w_p_nu || wp->w_p_rnu)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3458 && (row == startrow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3459 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3460 + filler_lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3461 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3462 || vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3463 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3464 /* Draw the line number (empty space after wrapping). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3465 if (row == startrow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3466 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3467 + filler_lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3468 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3469 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3470 {
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3471 long num;
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3472
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3473 if (wp->w_p_nu)
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3474 /* 'number' */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3475 num = (long)lnum;
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3476 else
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3477 /* 'relativenumber', don't use negative numbers */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3478 num = (long)abs((int)get_cursor_rel_lnum(wp,
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3479 lnum));
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3480
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3481 sprintf((char *)extra, "%*ld ",
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
3482 number_width(wp), num);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3483 if (wp->w_skipcol > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3484 for (p_extra = extra; *p_extra == ' '; ++p_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3485 *p_extra = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3486 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3487 if (wp->w_p_rl) /* reverse line numbers */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3488 rl_mirror(extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3489 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3490 p_extra = extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3491 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3492 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3493 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3494 c_extra = ' ';
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3495 n_extra = number_width(wp) + 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3496 char_attr = hl_attr(HLF_N);
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3497 #ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3498 /* When 'cursorline' is set highlight the line number of
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3499 * the current line differently. */
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3500 if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3501 char_attr = hl_combine_attr(hl_attr(HLF_CUL), char_attr);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3502 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3503 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3504 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3505
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3506 #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3507 if (draw_state == WL_SBR - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3508 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3509 draw_state = WL_SBR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3510 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3511 if (filler_todo > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3512 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3513 /* Draw "deleted" diff line(s). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3514 if (char2cells(fill_diff) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3515 c_extra = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3516 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3517 c_extra = fill_diff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3518 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3519 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3520 n_extra = col + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3521 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3522 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3523 n_extra = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3524 char_attr = hl_attr(HLF_DED);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3525 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3526 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3527 # ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3528 if (*p_sbr != NUL && need_showbreak)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3529 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3530 /* Draw 'showbreak' at the start of each broken line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3531 p_extra = p_sbr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3532 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3533 n_extra = (int)STRLEN(p_sbr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3534 char_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3535 need_showbreak = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3536 /* Correct end of highlighted area for 'showbreak',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3537 * required when 'linebreak' is also set. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3538 if (tocol == vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3539 tocol += n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3540 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3541 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3542 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3543 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3544
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3545 if (draw_state == WL_LINE - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3546 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3547 draw_state = WL_LINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3548 if (saved_n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3549 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3550 /* Continue item from end of wrapped line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3551 n_extra = saved_n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3552 c_extra = saved_c_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3553 p_extra = saved_p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3554 char_attr = saved_char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3555 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3556 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3557 char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3558 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3559 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3560
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3561 /* When still displaying '$' of change command, stop at cursor */
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3562 if (dollar_vcol != 0 && wp == curwin
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3563 && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3564 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3565 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3566 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3567 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3568 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3569 SCREEN_LINE(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3570 wp->w_p_rl);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3571 /* Pretend we have finished updating the window. Except when
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3572 * 'cursorcolumn' is set. */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3573 #ifdef FEAT_SYN_HL
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3574 if (wp->w_p_cuc)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3575 row = wp->w_cline_row + wp->w_cline_height;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3576 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3577 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3578 row = wp->w_height;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3579 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3580 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3581
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3582 if (draw_state == WL_LINE && area_highlighting)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3583 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3584 /* handle Visual or match highlighting in this line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3585 if (vcol == fromcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3586 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3587 || (has_mbyte && vcol + 1 == fromcol && n_extra == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3588 && (*mb_ptr2cells)(ptr) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3589 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3590 || ((int)vcol_prev == fromcol_prev
1814
febddd8d11b0 updated for version 7.2-112
vimboss
parents: 1813
diff changeset
3591 && vcol_prev < vcol /* not at margin */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3592 && vcol < tocol))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3593 area_attr = attr; /* start highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3594 else if (area_attr != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3595 && (vcol == tocol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3596 || (noinvcur && (colnr_T)vcol == wp->w_virtcol)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3597 area_attr = 0; /* stop highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3599 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3600 if (!n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3601 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3602 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3603 * Check for start/end of search pattern match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3604 * After end, check for start/end of next match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3605 * When another match, have to check for start again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3606 * Watch out for matching an empty string!
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3607 * Do this for 'search_hl' and the match list (ordered by
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3608 * priority).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3609 */
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3610 v = (long)(ptr - line);
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3611 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3612 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3613 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3614 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3615 if (shl_flag == FALSE
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3616 && ((cur != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3617 && cur->priority > SEARCH_HL_PRIORITY)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3618 || cur == NULL))
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3619 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3620 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3621 shl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3622 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3623 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3624 shl = &cur->hl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3625 while (shl->rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3626 {
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3627 if (shl->startcol != MAXCOL
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3628 && v >= (long)shl->startcol
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3629 && v < (long)shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3630 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3631 shl->attr_cur = shl->attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3632 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3633 else if (v == (long)shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3634 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3635 shl->attr_cur = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3637 next_search_hl(wp, shl, lnum, (colnr_T)v);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3638
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3639 /* Need to get the line again, a multi-line regexp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3640 * may have made it invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3641 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3642 ptr = line + v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3643
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3644 if (shl->lnum == lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3645 {
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3646 shl->startcol = shl->rm.startpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3647 if (shl->rm.endpos[0].lnum == 0)
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3648 shl->endcol = shl->rm.endpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3649 else
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3650 shl->endcol = MAXCOL;
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3651
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3652 if (shl->startcol == shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3653 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3654 /* highlight empty match, try again after
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3655 * it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3656 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3657 if (has_mbyte)
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3658 shl->endcol += (*mb_ptr2len)(line
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3659 + shl->endcol);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3660 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3661 #endif
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3662 ++shl->endcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3663 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3664
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3665 /* Loop to check if the match starts at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3666 * current position */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3667 continue;
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 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3671 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3672 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3673 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3674 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3675
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3676 /* Use attributes from match with highest priority among
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3677 * 'search_hl' and the match list. */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3678 search_attr = search_hl.attr_cur;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3679 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3680 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3681 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3682 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3683 if (shl_flag == FALSE
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3684 && ((cur != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3685 && cur->priority > SEARCH_HL_PRIORITY)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3686 || cur == NULL))
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
3687 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3688 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3689 shl_flag = TRUE;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
3690 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3691 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3692 shl = &cur->hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3693 if (shl->attr_cur != 0)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3694 search_attr = shl->attr_cur;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3695 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3696 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3697 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3698 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3699 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3700
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3701 #ifdef FEAT_DIFF
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3702 if (diff_hlf != (hlf_T)0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3703 {
1295
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3704 if (diff_hlf == HLF_CHD && ptr - line >= change_start
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3705 && n_extra == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3706 diff_hlf = HLF_TXD; /* changed text */
1295
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3707 if (diff_hlf == HLF_TXD && ptr - line > change_end
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3708 && n_extra == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3709 diff_hlf = HLF_CHD; /* changed line */
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3710 line_attr = hl_attr(diff_hlf);
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3711 }
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3712 #endif
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3713
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3714 /* Decide which of the highlight attributes to use. */
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3715 attr_pri = TRUE;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3716 if (area_attr != 0)
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3717 char_attr = area_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3718 else if (search_attr != 0)
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3719 char_attr = search_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3720 #ifdef LINE_ATTR
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3721 /* Use line_attr when not in the Visual or 'incsearch' area
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3722 * (area_attr may be 0 when "noinvcur" is set). */
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3723 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
1842
c1709e3f8536 updated for version 7.2-140
vimboss
parents: 1824
diff changeset
3724 || vcol < fromcol || vcol_prev < fromcol_prev
c1709e3f8536 updated for version 7.2-140
vimboss
parents: 1824
diff changeset
3725 || vcol >= tocol))
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3726 char_attr = line_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3727 #endif
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3728 else
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3729 {
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3730 attr_pri = FALSE;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3731 #ifdef FEAT_SYN_HL
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3732 if (has_syntax)
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3733 char_attr = syntax_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3734 else
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3735 #endif
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3736 char_attr = 0;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3737 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3738 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3739
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3740 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3741 * Get the next character to put on the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3742 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3743 /*
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3744 * The "p_extra" points to the extra stuff that is inserted to
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3745 * represent special characters (non-printable stuff) and other
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3746 * things. When all characters are the same, c_extra is used.
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3747 * "p_extra" must end in a NUL to avoid mb_ptr2len() reads past
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3748 * "p_extra[n_extra]".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3749 * For the '$' of the 'list' option, n_extra == 1, p_extra == "".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3750 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3751 if (n_extra > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3752 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3753 if (c_extra != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3754 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3755 c = c_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3756 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3757 mb_c = c; /* doesn't handle non-utf-8 multi-byte! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3758 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3759 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3760 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3761 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3762 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3763 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3764 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3765 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3766 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3767 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3768 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3769 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3770 c = *p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3771 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3772 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3773 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3774 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3775 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3776 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3777 /* If the UTF-8 character is more than one byte:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3778 * Decode it into "mb_c". */
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3779 mb_l = (*mb_ptr2len)(p_extra);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3780 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3781 if (mb_l > n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3782 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3783 else if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3784 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3785 mb_c = utfc_ptr2char(p_extra, u8cc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3786 mb_utf8 = TRUE;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3787 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3788 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3789 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3790 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3791 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3792 /* if this is a DBCS character, put it in "mb_c" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3793 mb_l = MB_BYTE2LEN(c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3794 if (mb_l >= n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3795 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3796 else if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3797 mb_c = (c << 8) + p_extra[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3798 }
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3799 if (mb_l == 0) /* at the NUL at end-of-line */
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3800 mb_l = 1;
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3801
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3802 /* If a double-width char doesn't fit display a '>' in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3803 * last column. */
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3804 if ((
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3805 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3806 wp->w_p_rl ? (col <= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3807 # endif
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3808 (col >= W_WIDTH(wp) - 1))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3809 && (*mb_char2cells)(mb_c) == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3810 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3811 c = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3812 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3813 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3814 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3815 multi_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3816 /* put the pointer back to output the double-width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3817 * character at the start of the next line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3818 ++n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3819 --p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3820 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3821 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3822 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3823 n_extra -= mb_l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3824 p_extra += mb_l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3825 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3826 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3827 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3828 ++p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3829 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3830 --n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3831 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3832 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3833 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3834 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3835 * Get a character from the line itself.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3836 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3837 c = *ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3838 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3839 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3840 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3841 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3842 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3843 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3844 /* If the UTF-8 character is more than one byte: Decode it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3845 * into "mb_c". */
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3846 mb_l = (*mb_ptr2len)(ptr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3847 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3848 if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3849 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3850 mb_c = utfc_ptr2char(ptr, u8cc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3851 /* Overlong encoded ASCII or ASCII with composing char
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3852 * is displayed normally, except a NUL. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3853 if (mb_c < 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3854 c = mb_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3855 mb_utf8 = TRUE;
507
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3856
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3857 /* At start of the line we can have a composing char.
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3858 * Draw it as a space with a composing char. */
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3859 if (utf_iscomposing(mb_c))
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3860 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3861 int i;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3862
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3863 for (i = Screen_mco - 1; i > 0; --i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3864 u8cc[i] = u8cc[i - 1];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3865 u8cc[0] = mb_c;
507
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3866 mb_c = ' ';
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3867 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3868 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3869
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3870 if ((mb_l == 1 && c >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3871 || (mb_l >= 1 && mb_c == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3872 || (mb_l > 1 && (!vim_isprintc(mb_c)
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3873 # ifdef UNICODE16
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3874 || mb_c >= 0x10000
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3875 # endif
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3876 )))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3877 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3878 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3879 * Illegal UTF-8 byte: display as <xx>.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3880 * Non-BMP character : display as ? or fullwidth ?.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3881 */
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3882 # ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3883 if (mb_c < 0x10000)
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3884 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3885 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3886 transchar_hex(extra, mb_c);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3887 # ifdef FEAT_RIGHTLEFT
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3888 if (wp->w_p_rl) /* reverse */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3889 rl_mirror(extra);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3890 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3891 }
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3892 # ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3893 else if (utf_char2cells(mb_c) != 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3894 STRCPY(extra, "?");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3895 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3896 /* 0xff1f in UTF-8: full-width '?' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3897 STRCPY(extra, "\357\274\237");
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3898 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3899
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3900 p_extra = extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3901 c = *p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3902 mb_c = mb_ptr2char_adv(&p_extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3903 mb_utf8 = (c >= 0x80);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3904 n_extra = (int)STRLEN(p_extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3905 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3906 if (area_attr == 0 && search_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3907 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3908 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3909 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3910 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3911 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3912 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3913 else if (mb_l == 0) /* at the NUL at end-of-line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3914 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3915 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3916 else if (p_arshape && !p_tbidi && ARABIC_CHAR(mb_c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3917 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3918 /* Do Arabic shaping. */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3919 int pc, pc1, nc;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3920 int pcc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3921
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3922 /* The idea of what is the previous and next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3923 * character depends on 'rightleft'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3924 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3925 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3926 pc = prev_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3927 pc1 = prev_c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3928 nc = utf_ptr2char(ptr + mb_l);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3929 prev_c1 = u8cc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3930 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3931 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3932 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3933 pc = utfc_ptr2char(ptr + mb_l, pcc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3934 nc = prev_c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3935 pc1 = pcc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3936 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3937 prev_c = mb_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3938
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3939 mb_c = arabic_shape(mb_c, &c, &u8cc[0], pc, pc1, nc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3940 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3941 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3942 prev_c = mb_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3943 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3944 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3945 else /* enc_dbcs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3946 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3947 mb_l = MB_BYTE2LEN(c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3948 if (mb_l == 0) /* at the NUL at end-of-line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3949 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3950 else if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3951 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3952 /* We assume a second byte below 32 is illegal.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3953 * Hopefully this is OK for all double-byte encodings!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3954 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3955 if (ptr[1] >= 32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3956 mb_c = (c << 8) + ptr[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3957 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3958 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3959 if (ptr[1] == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3960 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3961 /* head byte at end of line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3962 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3963 transchar_nonprint(extra, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3964 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3965 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3966 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3967 /* illegal tail byte */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3968 mb_l = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3969 STRCPY(extra, "XX");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3970 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3971 p_extra = extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3972 n_extra = (int)STRLEN(extra) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3973 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3974 c = *p_extra++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3975 if (area_attr == 0 && search_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3976 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3977 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3978 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3979 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3980 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3981 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3982 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3983 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3984 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3985 /* If a double-width char doesn't fit display a '>' in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3986 * last column; the character is displayed at the start of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3987 * next line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3988 if ((
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3989 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3990 wp->w_p_rl ? (col <= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3991 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3992 (col >= W_WIDTH(wp) - 1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3993 && (*mb_char2cells)(mb_c) == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3994 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3995 c = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3996 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3997 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3998 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3999 multi_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4000 /* Put pointer back so that the character will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4001 * displayed at the start of the next line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4002 --ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4003 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4004 else if (*ptr != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4005 ptr += mb_l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4006
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4007 /* If a double-width char doesn't fit at the left side display
2509
6d6378ba18cb Fix: An unprintable multi-byte character at the start of the screen line
Bram Moolenaar <bram@vim.org>
parents: 2428
diff changeset
4008 * a '<' in the first column. Don't do this for unprintable
6d6378ba18cb Fix: An unprintable multi-byte character at the start of the screen line
Bram Moolenaar <bram@vim.org>
parents: 2428
diff changeset
4009 * charactes. */
6d6378ba18cb Fix: An unprintable multi-byte character at the start of the screen line
Bram Moolenaar <bram@vim.org>
parents: 2428
diff changeset
4010 if (n_skip > 0 && mb_l > 1 && n_extra == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4011 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4012 n_extra = 1;
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
4013 c_extra = '<';
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4014 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4015 if (area_attr == 0 && search_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4016 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4017 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4018 extra_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4019 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4020 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4021 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4022 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4023 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4024 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4025
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4026 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4027 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4028 ++ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4029
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4030 /* 'list' : change char 160 to lcs_nbsp. */
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4031 if (wp->w_p_list && (c == 160
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4032 #ifdef FEAT_MBYTE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4033 || (mb_utf8 && mb_c == 160)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4034 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4035 ) && lcs_nbsp)
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4036 {
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4037 c = lcs_nbsp;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4038 if (area_attr == 0 && search_attr == 0)
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4039 {
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4040 n_attr = 1;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4041 extra_attr = hl_attr(HLF_8);
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4042 saved_attr2 = char_attr; /* save current attr */
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4043 }
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4044 #ifdef FEAT_MBYTE
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4045 mb_c = c;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4046 if (enc_utf8 && (*mb_char2len)(c) > 1)
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4047 {
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4048 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4049 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4050 c = 0xc0;
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4051 }
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4052 else
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4053 mb_utf8 = FALSE;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4054 #endif
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4055 }
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
4056
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4057 if (extra_check)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4058 {
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4059 #ifdef FEAT_SPELL
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4060 int can_spell = TRUE;
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4061 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4062
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4063 #ifdef FEAT_SYN_HL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4064 /* Get syntax attribute, unless still at the start of the line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4065 * (double-wide char that doesn't fit). */
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4066 v = (long)(ptr - line);
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4067 if (has_syntax && v > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4068 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4069 /* Get the syntax attribute for the character. If there
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4070 * is an error, disable syntax highlighting. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4071 save_did_emsg = did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4072 did_emsg = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4073
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4074 syntax_attr = get_syntax_attr((colnr_T)v - 1,
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4075 # ifdef FEAT_SPELL
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4076 has_spell ? &can_spell :
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4077 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4078 NULL, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4080 if (did_emsg)
482
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
4081 {
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4082 wp->w_s->b_syn_error = TRUE;
482
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
4083 has_syntax = FALSE;
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
4084 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4085 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4086 did_emsg = save_did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4087
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4088 /* Need to get the line again, a multi-line regexp may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4089 * have made it invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4090 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4091 ptr = line + v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4092
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4093 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4094 char_attr = syntax_attr;
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4095 else
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 301
diff changeset
4096 char_attr = hl_combine_attr(syntax_attr, char_attr);
2364
151b037b7e74 Fix hang when resizing in diff mode and there are concealed items.
Bram Moolenaar <bram@vim.org>
parents: 2359
diff changeset
4097 # ifdef FEAT_CONCEAL
151b037b7e74 Fix hang when resizing in diff mode and there are concealed items.
Bram Moolenaar <bram@vim.org>
parents: 2359
diff changeset
4098 /* no concealing past the end of the line, it interferes
151b037b7e74 Fix hang when resizing in diff mode and there are concealed items.
Bram Moolenaar <bram@vim.org>
parents: 2359
diff changeset
4099 * with line highlighting */
151b037b7e74 Fix hang when resizing in diff mode and there are concealed items.
Bram Moolenaar <bram@vim.org>
parents: 2359
diff changeset
4100 if (c == NUL)
151b037b7e74 Fix hang when resizing in diff mode and there are concealed items.
Bram Moolenaar <bram@vim.org>
parents: 2359
diff changeset
4101 syntax_flags = 0;
2375
a96dd77ce213 For conceal mode: when two different syntax items follow each other, show the
Bram Moolenaar <bram@vim.org>
parents: 2364
diff changeset
4102 else
2392
0371401d9d33 Give each syntax item a sequence number, so that we know when it starts and
Bram Moolenaar <bram@vim.org>
parents: 2382
diff changeset
4103 syntax_flags = get_syntax_info(&syntax_seqnr);
2364
151b037b7e74 Fix hang when resizing in diff mode and there are concealed items.
Bram Moolenaar <bram@vim.org>
parents: 2359
diff changeset
4104 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4105 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4106 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4107
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4108 #ifdef FEAT_SPELL
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4109 /* Check spelling (unless at the end of the line).
319
0ee579e01743 updated for version 7.0083
vimboss
parents: 303
diff changeset
4110 * Only do this when there is no syntax highlighting, the
0ee579e01743 updated for version 7.0083
vimboss
parents: 303
diff changeset
4111 * @Spell cluster is not used or the current syntax item
0ee579e01743 updated for version 7.0083
vimboss
parents: 303
diff changeset
4112 * contains the @Spell cluster. */
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4113 if (has_spell && v >= word_end && v > cur_checked_col)
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4114 {
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 227
diff changeset
4115 spell_attr = 0;
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4116 # ifdef FEAT_SYN_HL
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4117 if (!attr_pri)
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 227
diff changeset
4118 char_attr = syntax_attr;
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4119 # endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4120 if (c != 0 && (
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4121 # ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4122 !has_syntax ||
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4123 # endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4124 can_spell))
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4125 {
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4126 char_u *prev_ptr, *p;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4127 int len;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4128 hlf_T spell_hlf = HLF_COUNT;
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4129 # ifdef FEAT_MBYTE
336
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
4130 if (has_mbyte)
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
4131 {
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
4132 prev_ptr = ptr - mb_l;
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
4133 v -= mb_l - 1;
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
4134 }
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
4135 else
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4136 # endif
336
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
4137 prev_ptr = ptr - 1;
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4138
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4139 /* Use nextline[] if possible, it has the start of the
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4140 * next line concatenated. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4141 if ((prev_ptr - line) - nextlinecol >= 0)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4142 p = nextline + (prev_ptr - line) - nextlinecol;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4143 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4144 p = prev_ptr;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4145 cap_col -= (int)(prev_ptr - line);
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
4146 len = spell_check(wp, p, &spell_hlf, &cap_col,
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
4147 nochange);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4148 word_end = v + len;
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4149
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4150 /* In Insert mode only highlight a word that
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4151 * doesn't touch the cursor. */
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4152 if (spell_hlf != HLF_COUNT
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4153 && (State & INSERT) != 0
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4154 && wp->w_cursor.lnum == lnum
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4155 && wp->w_cursor.col >=
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4156 (colnr_T)(prev_ptr - line)
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4157 && wp->w_cursor.col < (colnr_T)word_end)
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4158 {
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4159 spell_hlf = HLF_COUNT;
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4160 spell_redraw_lnum = lnum;
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4161 }
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4162
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4163 if (spell_hlf == HLF_COUNT && p != prev_ptr
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4164 && (p - nextline) + len > nextline_idx)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4165 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4166 /* Remember that the good word continues at the
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4167 * start of the next line. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4168 checked_lnum = lnum + 1;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4169 checked_col = (int)((p - nextline) + len - nextline_idx);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4170 }
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4171
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4172 /* Turn index into actual attributes. */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4173 if (spell_hlf != HLF_COUNT)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4174 spell_attr = highlight_attr[spell_hlf];
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4175
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4176 if (cap_col > 0)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4177 {
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4178 if (p != prev_ptr
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4179 && (p - nextline) + cap_col >= nextline_idx)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4180 {
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4181 /* Remember that the word in the next line
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4182 * must start with a capital. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4183 capcol_lnum = lnum + 1;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4184 cap_col = (int)((p - nextline) + cap_col
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4185 - nextline_idx);
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4186 }
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4187 else
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4188 /* Compute the actual column. */
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4189 cap_col += (int)(prev_ptr - line);
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4190 }
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4191 }
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4192 }
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4193 if (spell_attr != 0)
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4194 {
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4195 if (!attr_pri)
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4196 char_attr = hl_combine_attr(char_attr, spell_attr);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4197 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4198 char_attr = hl_combine_attr(spell_attr, char_attr);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4199 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4200 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4201 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4202 /*
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4203 * Found last space before word: check for line break.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4204 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4205 if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4206 && !wp->w_p_list)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4207 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4208 n_extra = win_lbr_chartabsize(wp, ptr - (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4209 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4210 has_mbyte ? mb_l :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4211 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4212 1), (colnr_T)vcol, NULL) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4213 c_extra = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4214 if (vim_iswhite(c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4215 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4216 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4217 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4218
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4219 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4220 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4221 c = lcs_trail;
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4222 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4223 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4224 n_attr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4225 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4226 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4227 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4228 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4229 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4230 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4231 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4232 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4233 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4234 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4235 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4236 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4237 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4238 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4240 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4241
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4242 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4243 * Handling of non-printable characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4244 */
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4245 if (!(chartab[c & 0xff] & CT_PRINT_CHAR))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4246 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4247 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4248 * when getting a character from the file, we may have to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4249 * turn it into something else on the way to putting it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4250 * into "ScreenLines".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4251 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4252 if (c == TAB && (!wp->w_p_list || lcs_tab1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4253 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4254 /* tab amount depends on current column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4255 n_extra = (int)wp->w_buffer->b_p_ts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4256 - vcol % (int)wp->w_buffer->b_p_ts - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4257 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4258 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4259 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4260 if (wp->w_p_list)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4261 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4262 c = lcs_tab1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4263 c_extra = lcs_tab2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4264 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4265 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4266 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4267 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4268 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4269 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4270 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4271 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4272 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4273 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4274 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4275 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4276 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4277 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4278 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4279 c_extra = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4280 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4281 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4282 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4283 else if (c == NUL
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4284 && ((wp->w_p_list && lcs_eol > 0)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4285 || ((fromcol >= 0 || fromcol_prev >= 0)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4286 && tocol > vcol
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4287 #ifdef FEAT_VISUAL
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4288 && VIsual_mode != Ctrl_V
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4289 #endif
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4290 && (
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4291 # ifdef FEAT_RIGHTLEFT
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4292 wp->w_p_rl ? (col >= 0) :
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4293 # endif
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4294 (col < W_WIDTH(wp)))
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4295 && !(noinvcur
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4296 && lnum == wp->w_cursor.lnum
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4297 && (colnr_T)vcol == wp->w_virtcol)))
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4298 && lcs_eol_one >= 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4299 {
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4300 /* Display a '$' after the line or highlight an extra
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4301 * character if the line break is included. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4302 #if defined(FEAT_DIFF) || defined(LINE_ATTR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4303 /* For a diff line the highlighting continues after the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4304 * "$". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4305 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4306 # ifdef FEAT_DIFF
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4307 diff_hlf == (hlf_T)0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4308 # ifdef LINE_ATTR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4309 &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4310 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4311 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4312 # ifdef LINE_ATTR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4313 line_attr == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4314 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4315 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4316 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4317 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4318 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4319 /* In virtualedit, visual selections may extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4320 * beyond end of line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4321 if (area_highlighting && virtual_active()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4322 && tocol != MAXCOL && vcol < tocol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4323 n_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4324 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4325 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4326 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4327 p_extra = at_end_str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4328 n_extra = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4329 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4330 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4331 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4332 if (wp->w_p_list)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4333 c = lcs_eol;
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4334 else
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4335 c = ' ';
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4336 lcs_eol_one = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4337 --ptr; /* put it back at the NUL */
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4338 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4339 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4340 extra_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4341 n_attr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4342 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4343 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4344 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4345 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4346 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4347 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4348 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4349 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4350 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4351 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4352 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4353 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4354 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4355 else if (c != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4356 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4357 p_extra = transchar(c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4358 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4359 if ((dy_flags & DY_UHEX) && wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4360 rl_mirror(p_extra); /* reverse "<12>" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4361 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4362 n_extra = byte2cells(c) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4363 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4364 c = *p_extra++;
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4365 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4366 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4367 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4368 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4369 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4370 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4371 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4372 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4373 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4374 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4375 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4376 else if (VIsual_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4377 && (VIsual_mode == Ctrl_V
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4378 || VIsual_mode == 'v')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4379 && virtual_active()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4380 && tocol != MAXCOL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4381 && vcol < tocol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4382 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4383 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4384 wp->w_p_rl ? (col >= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4385 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4386 (col < W_WIDTH(wp))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4387 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4388 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4389 --ptr; /* put it back at the NUL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4390 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4391 #endif
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4392 #if defined(LINE_ATTR)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4393 else if ((
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4394 # ifdef FEAT_DIFF
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4395 diff_hlf != (hlf_T)0 ||
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4396 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4397 line_attr != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4398 ) && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4399 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4400 wp->w_p_rl ? (col >= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4401 # endif
2553
37d3f90f5203 Conceal feature caused the 'cursorline' highlighting to stop early.
Bram Moolenaar <bram@vim.org>
parents: 2520
diff changeset
4402 (col
37d3f90f5203 Conceal feature caused the 'cursorline' highlighting to stop early.
Bram Moolenaar <bram@vim.org>
parents: 2520
diff changeset
4403 # ifdef FEAT_CONCEAL
37d3f90f5203 Conceal feature caused the 'cursorline' highlighting to stop early.
Bram Moolenaar <bram@vim.org>
parents: 2520
diff changeset
4404 - boguscols
37d3f90f5203 Conceal feature caused the 'cursorline' highlighting to stop early.
Bram Moolenaar <bram@vim.org>
parents: 2520
diff changeset
4405 # endif
37d3f90f5203 Conceal feature caused the 'cursorline' highlighting to stop early.
Bram Moolenaar <bram@vim.org>
parents: 2520
diff changeset
4406 < W_WIDTH(wp))))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4407 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4408 /* Highlight until the right side of the window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4409 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4410 --ptr; /* put it back at the NUL */
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4411
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4412 /* Remember we do the char for line highlighting. */
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4413 ++did_line_attr;
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4414
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4415 /* don't do search HL for the rest of the line */
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4416 if (line_attr != 0 && char_attr == search_attr && col > 0)
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4417 char_attr = line_attr;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4418 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4419 if (diff_hlf == HLF_TXD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4420 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4421 diff_hlf = HLF_CHD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4422 if (attr == 0 || char_attr != attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4423 char_attr = hl_attr(diff_hlf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4424 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4425 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4426 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4427 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4428 }
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4429
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4430 #ifdef FEAT_CONCEAL
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4431 if ( wp->w_p_cole > 0
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4432 && (wp != curwin || lnum != wp->w_cursor.lnum ||
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4433 conceal_cursor_line(wp))
2380
b47748aa3236 Don't conceal text in lines inside the Visual area.
Bram Moolenaar <bram@vim.org>
parents: 2378
diff changeset
4434 && (syntax_flags & HL_CONCEAL) != 0
2400
e6f1424dd66a Let 'v' flag in 'concealcursor' apply to all lines in the Visual area.
Bram Moolenaar <bram@vim.org>
parents: 2393
diff changeset
4435 && !(lnum_in_visual_area
e6f1424dd66a Let 'v' flag in 'concealcursor' apply to all lines in the Visual area.
Bram Moolenaar <bram@vim.org>
parents: 2393
diff changeset
4436 && vim_strchr(wp->w_p_cocu, 'v') == NULL))
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4437 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4438 char_attr = conceal_attr;
2392
0371401d9d33 Give each syntax item a sequence number, so that we know when it starts and
Bram Moolenaar <bram@vim.org>
parents: 2382
diff changeset
4439 if (prev_syntax_id != syntax_seqnr
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4440 && (syn_get_sub_char() != NUL || wp->w_p_cole == 1)
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4441 && wp->w_p_cole != 3)
2375
a96dd77ce213 For conceal mode: when two different syntax items follow each other, show the
Bram Moolenaar <bram@vim.org>
parents: 2364
diff changeset
4442 {
a96dd77ce213 For conceal mode: when two different syntax items follow each other, show the
Bram Moolenaar <bram@vim.org>
parents: 2364
diff changeset
4443 /* First time at this concealed item: display one
a96dd77ce213 For conceal mode: when two different syntax items follow each other, show the
Bram Moolenaar <bram@vim.org>
parents: 2364
diff changeset
4444 * character. */
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4445 if (syn_get_sub_char() != NUL)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4446 c = syn_get_sub_char();
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4447 else if (lcs_conceal != NUL)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4448 c = lcs_conceal;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4449 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4450 c = ' ';
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4451
2392
0371401d9d33 Give each syntax item a sequence number, so that we know when it starts and
Bram Moolenaar <bram@vim.org>
parents: 2382
diff changeset
4452 prev_syntax_id = syntax_seqnr;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4453
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4454 if (n_extra > 0)
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4455 vcol_off += n_extra;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4456 vcol += n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4457 if (wp->w_p_wrap && n_extra > 0)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4458 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4459 # ifdef FEAT_RIGHTLEFT
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4460 if (wp->w_p_rl)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4461 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4462 col -= n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4463 boguscols -= n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4464 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4465 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4466 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4467 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4468 boguscols += n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4469 col += n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4470 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4471 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4472 n_extra = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4473 n_attr = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4474 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4475 else if (n_skip == 0)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4476 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4477 is_concealing = TRUE;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4478 n_skip = 1;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4479 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4480 # ifdef FEAT_MBYTE
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4481 mb_c = c;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4482 if (enc_utf8 && (*mb_char2len)(c) > 1)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4483 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4484 mb_utf8 = TRUE;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4485 u8cc[0] = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4486 c = 0xc0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4487 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4488 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4489 mb_utf8 = FALSE; /* don't draw as UTF-8 */
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4490 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4491 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4492 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4493 {
2375
a96dd77ce213 For conceal mode: when two different syntax items follow each other, show the
Bram Moolenaar <bram@vim.org>
parents: 2364
diff changeset
4494 prev_syntax_id = 0;
2348
8878a9f8db87 Rename w_p_conceal to w_p_conc for consistency.
Bram Moolenaar <bram@vim.org>
parents: 2346
diff changeset
4495 is_concealing = FALSE;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4496 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4497 #endif /* FEAT_CONCEAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4498 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4499
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4500 #ifdef FEAT_CONCEAL
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4501 /* In the cursor line and we may be concealing characters: correct
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4502 * the cursor column when we reach its position. */
2381
17bbb52ae218 Another conceal fix: cursor in wrong column when 'number' set.
Bram Moolenaar <bram@vim.org>
parents: 2380
diff changeset
4503 if (!did_wcol && draw_state == WL_LINE
17bbb52ae218 Another conceal fix: cursor in wrong column when 'number' set.
Bram Moolenaar <bram@vim.org>
parents: 2380
diff changeset
4504 && wp == curwin && lnum == wp->w_cursor.lnum
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4505 && conceal_cursor_line(wp)
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4506 && (int)wp->w_virtcol <= vcol + n_skip)
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4507 {
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4508 wp->w_wcol = col - boguscols;
2393
210a5605e126 Fix for cursor position in wrapped line with concealed text.
Bram Moolenaar <bram@vim.org>
parents: 2392
diff changeset
4509 wp->w_wrow = row;
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4510 did_wcol = TRUE;
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4511 }
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4512 #endif
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4513
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4514 /* Don't override visual selection highlighting. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4515 if (n_attr > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4516 && draw_state == WL_LINE
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4517 && !attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4518 char_attr = extra_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4519
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 40
diff changeset
4520 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4521 /* XIM don't send preedit_start and preedit_end, but they send
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4522 * preedit_changed and commit. Thus Vim can't set "im_is_active", use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4523 * im_is_preediting() here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4524 if (xic != NULL
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4525 && lnum == wp->w_cursor.lnum
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4526 && (State & INSERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4527 && !p_imdisable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4528 && im_is_preediting()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4529 && draw_state == WL_LINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4530 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4531 colnr_T tcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4532
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4533 if (preedit_end_col == MAXCOL)
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4534 getvcol(curwin, &(wp->w_cursor), &tcol, NULL, NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4535 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4536 tcol = preedit_end_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4537 if ((long)preedit_start_col <= vcol && vcol < (long)tcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4538 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4539 if (feedback_old_attr < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4540 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4541 feedback_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4542 feedback_old_attr = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4543 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4544 char_attr = im_get_feedback_attr(feedback_col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4545 if (char_attr < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4546 char_attr = feedback_old_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4547 feedback_col++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4548 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4549 else if (feedback_old_attr >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4550 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4551 char_attr = feedback_old_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4552 feedback_old_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4553 feedback_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4554 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4555 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4556 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4557 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4558 * Handle the case where we are in column 0 but not on the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4559 * character of the line and the user wants us to show us a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4560 * special character (via 'listchars' option "precedes:<char>".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4561 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4562 if (lcs_prec_todo != NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4563 && (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4564 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4565 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4566 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4567 && draw_state > WL_NR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4568 && c != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4569 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4570 c = lcs_prec;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4571 lcs_prec_todo = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4572 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4573 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4574 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4575 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4576 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4577 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4578 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4579 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4580 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4581 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4582 #endif
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4583 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4584 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4585 saved_attr3 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4586 char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4587 n_attr3 = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4588 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4589 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4590
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4591 /*
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4592 * At end of the text line or just after the last character.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4593 */
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4594 if (c == NUL
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4595 #if defined(LINE_ATTR)
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4596 || did_line_attr == 1
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4597 #endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4598 )
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4599 {
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4600 #ifdef FEAT_SEARCH_EXTRA
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4601 long prevcol = (long)(ptr - line) - (c == NUL);
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4602
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4603 /* we're not really at that column when skipping some text */
1439
a5b3a7fb6a5a updated for version 7.1-154
vimboss
parents: 1437
diff changeset
4604 if ((long)(wp->w_p_wrap ? wp->w_skipcol : wp->w_leftcol) > prevcol)
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4605 ++prevcol;
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4606 #endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4607
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4608 /* Invert at least one char, used for Visual and empty line or
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4609 * highlight match at end of line. If it's beyond the last
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4610 * char on the screen, just overwrite that one (tricky!) Not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4611 * needed when a '$' was displayed for 'list'. */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4612 #ifdef FEAT_SEARCH_EXTRA
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4613 prevcol_hl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4614 if (prevcol == (long)search_hl.startcol)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4615 prevcol_hl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4616 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4617 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4618 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4619 while (cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4620 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4621 if (prevcol == (long)cur->hl.startcol)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4622 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4623 prevcol_hl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4624 break;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4625 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4626 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4627 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4628 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4629 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4630 if (lcs_eol == lcs_eol_one
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4631 && ((area_attr != 0 && vcol == fromcol
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4632 #ifdef FEAT_VISUAL
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4633 && (VIsual_mode != Ctrl_V
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4634 || lnum == VIsual.lnum
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4635 || lnum == curwin->w_cursor.lnum)
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4636 #endif
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4637 && c == NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4638 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4639 /* highlight 'hlsearch' match at end of line */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4640 || (prevcol_hl_flag == TRUE
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4641 # if defined(LINE_ATTR)
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4642 && did_line_attr <= 1
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4643 # endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4644 )
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4645 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4646 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4647 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4648 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4649
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4650 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4651 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4652 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4653 if (col < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4654 n = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4655 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4656 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4657 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4658 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4659 if (col >= W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4660 n = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4661 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4662 if (n != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4663 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4664 /* At the window boundary, highlight the last character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4665 * instead (better than nothing). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4666 off += n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4667 col += n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4668 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4669 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4670 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4671 /* Add a blank character to highlight. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4672 ScreenLines[off] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4673 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4674 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4675 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4676 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4677 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4678 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4679 if (area_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4680 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4681 /* Use attributes from match with highest priority among
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4682 * 'search_hl' and the match list. */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4683 char_attr = search_hl.attr;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4684 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4685 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4686 while (cur != NULL || shl_flag == FALSE)
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4687 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4688 if (shl_flag == FALSE
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4689 && ((cur != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4690 && cur->priority > SEARCH_HL_PRIORITY)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4691 || cur == NULL))
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4692 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4693 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4694 shl_flag = TRUE;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4695 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4696 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4697 shl = &cur->hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4698 if ((ptr - line) - 1 == (long)shl->startcol)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4699 char_attr = shl->attr;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4700 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4701 cur = cur->next;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4702 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4703 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4704 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4705 ScreenAttrs[off] = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4706 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4707 if (wp->w_p_rl)
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4708 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4709 --col;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4710 --off;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4711 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4712 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4713 #endif
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4714 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4715 ++col;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4716 ++off;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4717 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4718 ++vcol;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4719 #ifdef FEAT_SYN_HL
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4720 eol_hl_off = 1;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4721 #endif
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4722 }
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4723 }
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4724
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4725 /*
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4726 * At end of the text line.
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4727 */
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4728 if (c == NUL)
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4729 {
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4730 #ifdef FEAT_SYN_HL
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4731 if (eol_hl_off > 0 && vcol - eol_hl_off == (long)wp->w_virtcol
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4732 && lnum == wp->w_cursor.lnum)
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4733 {
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4734 /* highlight last char after line */
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4735 --col;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4736 --off;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4737 --vcol;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4738 }
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4739
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4740 /* Highlight 'cursorcolumn' & 'colorcolumn' past end of the line. */
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4741 if (wp->w_p_wrap)
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4742 v = wp->w_skipcol;
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4743 else
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4744 v = wp->w_leftcol;
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4745
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4746 /* check if line ends before left margin */
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4747 if (vcol < v + col - win_col_off(wp))
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4748 vcol = v + col - win_col_off(wp);
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4749 #ifdef FEAT_CONCEAL
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4750 /* Get rid of the boguscols now, we want to draw until the right
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4751 * edge for 'cursorcolumn'. */
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4752 col -= boguscols;
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4753 boguscols = 0;
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4754 #endif
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4755
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4756 if (draw_color_col)
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4757 draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4758
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4759 if (((wp->w_p_cuc
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4760 && (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4761 && (int)wp->w_virtcol <
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4762 W_WIDTH(wp) * (row - startrow + 1) + v
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4763 && lnum != wp->w_cursor.lnum)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4764 || draw_color_col)
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4765 # ifdef FEAT_RIGHTLEFT
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4766 && !wp->w_p_rl
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4767 # endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4768 )
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4769 {
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4770 int rightmost_vcol = 0;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4771 int i;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4772
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4773 if (wp->w_p_cuc)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4774 rightmost_vcol = wp->w_virtcol;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4775 if (draw_color_col)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4776 /* determine rightmost colorcolumn to possibly draw */
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4777 for (i = 0; color_cols[i] >= 0; ++i)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4778 if (rightmost_vcol < color_cols[i])
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4779 rightmost_vcol = color_cols[i];
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4780
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4781 while (col < W_WIDTH(wp))
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4782 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4783 ScreenLines[off] = ' ';
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4784 #ifdef FEAT_MBYTE
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4785 if (enc_utf8)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4786 ScreenLinesUC[off] = 0;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4787 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4788 ++col;
2356
eb1f2554cac5 Fix 'colorcolumn' adjecent columns not highlighted after end of line.
Bram Moolenaar <bram@vim.org>
parents: 2349
diff changeset
4789 if (draw_color_col)
eb1f2554cac5 Fix 'colorcolumn' adjecent columns not highlighted after end of line.
Bram Moolenaar <bram@vim.org>
parents: 2349
diff changeset
4790 draw_color_col = advance_color_col(VCOL_HLC,
eb1f2554cac5 Fix 'colorcolumn' adjecent columns not highlighted after end of line.
Bram Moolenaar <bram@vim.org>
parents: 2349
diff changeset
4791 &color_cols);
eb1f2554cac5 Fix 'colorcolumn' adjecent columns not highlighted after end of line.
Bram Moolenaar <bram@vim.org>
parents: 2349
diff changeset
4792
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4793 if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol)
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4794 ScreenAttrs[off++] = hl_attr(HLF_CUC);
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4795 else if (draw_color_col && VCOL_HLC == *color_cols)
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4796 ScreenAttrs[off++] = hl_attr(HLF_MC);
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4797 else
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4798 ScreenAttrs[off++] = 0;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4799
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4800 if (VCOL_HLC >= rightmost_vcol)
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4801 break;
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4802
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4803 ++vcol;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4804 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4805 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4806 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4807
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4808 SCREEN_LINE(screen_row, W_WINCOL(wp), col,
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4809 (int)W_WIDTH(wp), wp->w_p_rl);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4810 row++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4811
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4812 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4813 * Update w_cline_height and w_cline_folded if the cursor line was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4814 * updated (saves a call to plines() later).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4815 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4816 if (wp == curwin && lnum == curwin->w_cursor.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4817 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4818 curwin->w_cline_row = startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4819 curwin->w_cline_height = row - startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4820 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4821 curwin->w_cline_folded = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4822 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4823 curwin->w_valid |= (VALID_CHEIGHT|VALID_CROW);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4824 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4825
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4826 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4827 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4828
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4829 /* line continues beyond line end */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4830 if (lcs_ext
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4831 && !wp->w_p_wrap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4832 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4833 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4834 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4835 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4836 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4837 wp->w_p_rl ? col == 0 :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4838 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4839 col == W_WIDTH(wp) - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4840 && (*ptr != NUL
1555
71db8539b8c4 updated for version 7.1-268
vimboss
parents: 1545
diff changeset
4841 || (wp->w_p_list && lcs_eol_one > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4842 || (n_extra && (c_extra != NUL || *p_extra != NUL))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4843 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4844 c = lcs_ext;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4845 char_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4846 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4847 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4848 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4849 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4850 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4851 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4852 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4853 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4854 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4855 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4856 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4857 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4858
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4859 #ifdef FEAT_SYN_HL
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4860 /* advance to the next 'colorcolumn' */
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4861 if (draw_color_col)
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4862 draw_color_col = advance_color_col(VCOL_HLC, &color_cols);
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4863
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4864 /* Highlight the cursor column if 'cursorcolumn' is set. But don't
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4865 * highlight the cursor position itself.
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4866 * Also highlight the 'colorcolumn' if it is different than
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4867 * 'cursorcolumn' */
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4868 vcol_save_attr = -1;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4869 if (draw_state == WL_LINE && !lnum_in_visual_area)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4870 {
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4871 if (wp->w_p_cuc && VCOL_HLC == (long)wp->w_virtcol
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4872 && lnum != wp->w_cursor.lnum)
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4873 {
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4874 vcol_save_attr = char_attr;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4875 char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC));
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4876 }
2346
b38c324bdc36 Fix: 'colorcolumn' interfered with concealed text.
Bram Moolenaar <bram@vim.org>
parents: 2338
diff changeset
4877 else if (draw_color_col && VCOL_HLC == *color_cols)
2314
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4878 {
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4879 vcol_save_attr = char_attr;
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4880 char_attr = hl_combine_attr(char_attr, hl_attr(HLF_MC));
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4881 }
233eb4412f5d Added 'colorcolumn' option. Partly by Gregor Uhlenheuer.
Bram Moolenaar <bram@vim.org>
parents: 2285
diff changeset
4882 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4883 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4884
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4885 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4886 * Store character to be displayed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4887 * Skip characters that are left of the screen for 'nowrap'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4888 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4889 vcol_prev = vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4890 if (draw_state < WL_LINE || n_skip <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4891 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4892 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4893 * Store the character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4894 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4895 #if defined(FEAT_RIGHTLEFT) && defined(FEAT_MBYTE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4896 if (has_mbyte && wp->w_p_rl && (*mb_char2cells)(mb_c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4897 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4898 /* A double-wide character is: put first halve in left cell. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4899 --off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4900 --col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4901 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4902 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4903 ScreenLines[off] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4904 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4905 if (enc_dbcs == DBCS_JPNU)
2069
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4906 {
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4907 if ((mb_c & 0xff00) == 0x8e00)
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4908 ScreenLines[off] = 0x8e;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4909 ScreenLines2[off] = mb_c & 0xff;
2069
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4910 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4911 else if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4912 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4913 if (mb_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4914 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4915 int i;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4916
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4917 ScreenLinesUC[off] = mb_c;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4918 if ((c & 0xff) == 0)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4919 ScreenLines[off] = 0x80; /* avoid storing zero */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4920 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4921 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4922 ScreenLinesC[i][off] = u8cc[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4923 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4924 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4925 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4926 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4927 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4928 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4929 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4930 if (multi_attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4931 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4932 ScreenAttrs[off] = multi_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4933 multi_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4934 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4935 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4936 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4937 ScreenAttrs[off] = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4938
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4939 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4940 if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4941 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4942 /* Need to fill two screen columns. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4943 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4944 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4945 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4946 /* UTF-8: Put a 0 in the second screen char. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4947 ScreenLines[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4948 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4949 /* DBCS: Put second byte in the second screen char. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4950 ScreenLines[off] = mb_c & 0xff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4951 ++vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4952 /* When "tocol" is halfway a character, set it to the end of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4953 * the character, otherwise highlighting won't stop. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4954 if (tocol == vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4955 ++tocol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4956 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4957 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4958 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4959 /* now it's time to backup one cell */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4960 --off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4961 --col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4962 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4963 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4964 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4965 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4966 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4967 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4968 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4969 --off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4970 --col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4971 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4972 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4973 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4974 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4975 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4976 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4977 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4978 }
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4979 #ifdef FEAT_CONCEAL
2378
85b7dc8da5eb Add the 'concealcursor' option to decide when the cursor line is to be
Bram Moolenaar <bram@vim.org>
parents: 2375
diff changeset
4980 else if (wp->w_p_cole > 0 && is_concealing)
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4981 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4982 --n_skip;
2332
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4983 ++vcol_off;
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4984 if (n_extra > 0)
b13079093ae1 Make 'cursorcolumn' work together with the conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2314
diff changeset
4985 vcol_off += n_extra;
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4986 if (wp->w_p_wrap)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4987 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4988 /*
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4989 * Special voodoo required if 'wrap' is on.
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4990 *
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4991 * Advance the column indicator to force the line
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4992 * drawing to wrap early. This will make the line
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4993 * take up the same screen space when parts are concealed,
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4994 * so that cursor line computations aren't messed up.
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4995 *
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4996 * To avoid the fictitious advance of 'col' causing
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4997 * trailing junk to be written out of the screen line
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4998 * we are building, 'boguscols' keeps track of the number
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
4999 * of bad columns we have advanced.
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5000 */
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5001 if (n_extra > 0)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5002 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5003 vcol += n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5004 # ifdef FEAT_RIGHTLEFT
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5005 if (wp->w_p_rl)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5006 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5007 col -= n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5008 boguscols -= n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5009 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5010 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5011 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5012 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5013 col += n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5014 boguscols += n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5015 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5016 n_extra = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5017 n_attr = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5018 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5019
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5020
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5021 # ifdef FEAT_MBYTE
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5022 if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5023 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5024 /* Need to fill two screen columns. */
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5025 # ifdef FEAT_RIGHTLEFT
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5026 if (wp->w_p_rl)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5027 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5028 --boguscols;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5029 --col;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5030 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5031 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5032 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5033 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5034 ++boguscols;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5035 ++col;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5036 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5037 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5038 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5039
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5040 # ifdef FEAT_RIGHTLEFT
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5041 if (wp->w_p_rl)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5042 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5043 --boguscols;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5044 --col;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5045 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5046 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5047 # endif
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5048 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5049 ++boguscols;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5050 ++col;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5051 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5052 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5053 else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5054 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5055 if (n_extra > 0)
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5056 {
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5057 vcol += n_extra;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5058 n_extra = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5059 n_attr = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5060 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5061 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5062
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5063 }
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5064 #endif /* FEAT_CONCEAL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5065 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5066 --n_skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5067
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
5068 /* Only advance the "vcol" when after the 'number' or 'relativenumber'
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
5069 * column. */
1849
11a74d2cab9d updated for version 7.2-147
vimboss
parents: 1843
diff changeset
5070 if (draw_state > WL_NR
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5071 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5072 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5073 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5074 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5075 ++vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5076
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5077 #ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5078 if (vcol_save_attr >= 0)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5079 char_attr = vcol_save_attr;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5080 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5081
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5082 /* restore attributes after "predeces" in 'listchars' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5083 if (draw_state > WL_NR && n_attr3 > 0 && --n_attr3 == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5084 char_attr = saved_attr3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5085
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5086 /* restore attributes after last 'listchars' or 'number' char */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5087 if (n_attr > 0 && draw_state == WL_LINE && --n_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5088 char_attr = saved_attr2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5089
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5090 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5091 * At end of screen line and there is more to come: Display the line
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5092 * so far. If there is no more to display it is caught above.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5093 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5094 if ((
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5095 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5096 wp->w_p_rl ? (col < 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5097 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5098 (col >= W_WIDTH(wp)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5099 && (*ptr != NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5100 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5101 || filler_todo > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5102 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5103 || (wp->w_p_list && lcs_eol != NUL && p_extra != at_end_str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5104 || (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5105 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5106 {
2250
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5107 #ifdef FEAT_CONCEAL
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5108 SCREEN_LINE(screen_row, W_WINCOL(wp), col - boguscols,
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5109 (int)W_WIDTH(wp), wp->w_p_rl);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5110 boguscols = 0;
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5111 #else
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5112 SCREEN_LINE(screen_row, W_WINCOL(wp), col,
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5113 (int)W_WIDTH(wp), wp->w_p_rl);
1bac28a53fae Add the conceal patch from Vince Negri.
Bram Moolenaar <bram@vim.org>
parents: 2237
diff changeset
5114 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5115 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5116 ++screen_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5117
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5118 /* When not wrapping and finished diff lines, or when displayed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5119 * '$' and highlighting until last column, break here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5120 if ((!wp->w_p_wrap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5121 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5122 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5123 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5124 ) || lcs_eol_one == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5125 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5127 /* When the window is too narrow draw all "@" lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5128 if (draw_state != WL_LINE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5129 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5130 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5131 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5132 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5133 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5134 win_draw_end(wp, '@', ' ', row, wp->w_height, HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5135 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5136 draw_vsep_win(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5137 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5138 row = endrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5139 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5140
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5141 /* When line got too long for screen break here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5142 if (row == endrow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5143 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5144 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5145 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5146 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5147
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5148 if (screen_cur_row == screen_row - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5149 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5150 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5151 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5152 && W_WIDTH(wp) == Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5153 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5154 /* Remember that the line wraps, used for modeless copy. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5155 LineWraps[screen_row - 1] = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5156
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5157 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5158 * Special trick to make copy/paste of wrapped lines work with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5159 * xterm/screen: write an extra character beyond the end of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5160 * the line. This will work with all terminal types
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5161 * (regardless of the xn,am settings).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5162 * Only do this on a fast tty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5163 * Only do this if the cursor is on the current line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5164 * (something has been written in it).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5165 * Don't do this for the GUI.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5166 * Don't do this for double-width characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5167 * Don't do this for a window not at the right screen border.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5168 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5169 if (p_tf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5170 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5171 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5172 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5173 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5174 && !(has_mbyte
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5175 && ((*mb_off2cells)(LineOffset[screen_row],
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5176 LineOffset[screen_row] + screen_Columns)
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5177 == 2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5178 || (*mb_off2cells)(LineOffset[screen_row - 1]
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5179 + (int)Columns - 2,
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5180 LineOffset[screen_row] + screen_Columns)
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5181 == 2))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5182 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5183 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5184 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5185 /* First make sure we are at the end of the screen line,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5186 * then output the same character again to let the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5187 * terminal know about the wrap. If the terminal doesn't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5188 * auto-wrap, we overwrite the character. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5189 if (screen_cur_col != W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5190 screen_char(LineOffset[screen_row - 1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5191 + (unsigned)Columns - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5192 screen_row - 1, (int)(Columns - 1));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5194 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5195 /* When there is a multi-byte character, just output a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5196 * space to keep it simple. */
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 119
diff changeset
5197 if (has_mbyte && MB_BYTE2LEN(ScreenLines[LineOffset[
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 119
diff changeset
5198 screen_row - 1] + (Columns - 1)]) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5199 out_char(' ');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5200 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5201 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5202 out_char(ScreenLines[LineOffset[screen_row - 1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5203 + (Columns - 1)]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5204 /* force a redraw of the first char on the next line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5205 ScreenAttrs[LineOffset[screen_row]] = (sattr_T)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5206 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5208 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5209
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5210 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5211 off = (unsigned)(current_ScreenLine - ScreenLines);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5212 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5213 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5214 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5215 col = W_WIDTH(wp) - 1; /* col is not used if breaking! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5216 off += col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5217 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5218 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5219
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5220 /* reset the drawing state for the start of a wrapped line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5221 draw_state = WL_START;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5222 saved_n_extra = n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5223 saved_p_extra = p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5224 saved_c_extra = c_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5225 saved_char_attr = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5226 n_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5227 lcs_prec_todo = lcs_prec;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5228 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5229 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5230 if (filler_todo <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5231 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5232 need_showbreak = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5233 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5234 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5235 --filler_todo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5236 /* When the filler lines are actually below the last line of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5237 * file, don't draw the line itself, break here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5238 if (filler_todo == 0 && wp->w_botfill)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5239 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5240 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5241 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5242
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5243 } /* for every character in the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5244
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5245 #ifdef FEAT_SPELL
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5246 /* After an empty line check first word for capital. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5247 if (*skipwhite(line) == NUL)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5248 {
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5249 capcol_lnum = lnum + 1;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5250 cap_col = 0;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5251 }
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5252 #endif
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
5253
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5254 return row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5255 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5256
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5257 #ifdef FEAT_MBYTE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5258 static int comp_char_differs __ARGS((int, int));
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5259
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5260 /*
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5261 * 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
5262 * Only to be used when ScreenLinesUC[off_from] != 0.
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5263 */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5264 static int
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5265 comp_char_differs(off_from, off_to)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5266 int off_from;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5267 int off_to;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5268 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5269 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5270
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5271 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5272 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5273 if (ScreenLinesC[i][off_from] != ScreenLinesC[i][off_to])
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5274 return TRUE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5275 if (ScreenLinesC[i][off_from] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5276 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5277 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5278 return FALSE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5279 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5280 #endif
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5281
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5282 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5283 * Check whether the given character needs redrawing:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5284 * - the (first byte of the) character is different
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5285 * - the attributes are different
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5286 * - the character is multi-byte and the next byte is different
1616
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
5287 * - the character is two cells wide and the second cell differs.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5288 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5289 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5290 char_needs_redraw(off_from, off_to, cols)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5291 int off_from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5292 int off_to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5293 int cols;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5294 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5295 if (cols > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5296 && ((ScreenLines[off_from] != ScreenLines[off_to]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5297 || ScreenAttrs[off_from] != ScreenAttrs[off_to])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5299 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5300 || (enc_dbcs != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5301 && MB_BYTE2LEN(ScreenLines[off_from]) > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5302 && (enc_dbcs == DBCS_JPNU && ScreenLines[off_from] == 0x8e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5303 ? ScreenLines2[off_from] != ScreenLines2[off_to]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5304 : (cols > 1 && ScreenLines[off_from + 1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5305 != ScreenLines[off_to + 1])))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5306 || (enc_utf8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5307 && (ScreenLinesUC[off_from] != ScreenLinesUC[off_to]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5308 || (ScreenLinesUC[off_from] != 0
1616
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
5309 && comp_char_differs(off_from, off_to))
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
5310 || (cols > 1 && ScreenLines[off_from + 1]
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
5311 != ScreenLines[off_to + 1])))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5312 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5313 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5314 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5315 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5316 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5317
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5318 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5319 * Move one "cooked" screen line to the screen, but only the characters that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5320 * have actually changed. Handle insert/delete character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5321 * "coloff" gives the first column on the screen for this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5322 * "endcol" gives the columns where valid characters are.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5323 * "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
5324 * needs to be cleared, negative otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5325 * "rlflag" is TRUE in a rightleft window:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5326 * When TRUE and "clear_width" > 0, clear columns 0 to "endcol"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5327 * When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5328 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5329 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5330 screen_line(row, coloff, endcol, clear_width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5331 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5332 , rlflag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5333 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5334 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5335 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5336 int coloff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5337 int endcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5338 int clear_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5339 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5340 int rlflag;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5341 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5342 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5343 unsigned off_from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5344 unsigned off_to;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5345 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5346 unsigned max_off_from;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5347 unsigned max_off_to;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5348 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5349 int col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5350 #if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_VERTSPLIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5351 int hl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5352 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5353 int force = FALSE; /* force update rest of the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5354 int redraw_this /* bool: does character need redraw? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5355 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5356 = TRUE /* For GUI when while-loop empty */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5357 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5358 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5359 int redraw_next; /* redraw_this for next character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5360 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5361 int clear_next = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5362 int char_cells; /* 1: normal char */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5363 /* 2: occupies two display cells */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5364 # define CHAR_CELLS char_cells
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5365 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5366 # define CHAR_CELLS 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5367 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5369 # ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5370 clip_may_clear_selection(row, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5371 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5372
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5373 off_from = (unsigned)(current_ScreenLine - ScreenLines);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5374 off_to = LineOffset[row] + coloff;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5375 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5376 max_off_from = off_from + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5377 max_off_to = LineOffset[row] + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5378 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5379
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5380 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5381 if (rlflag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5382 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5383 /* Clear rest first, because it's left of the text. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5384 if (clear_width > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5385 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5386 while (col <= endcol && ScreenLines[off_to] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5387 && ScreenAttrs[off_to] == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5388 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5389 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5390 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5391 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5392 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5393 ++off_to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5394 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5395 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5396 if (col <= endcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5397 screen_fill(row, row + 1, col + coloff,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5398 endcol + coloff + 1, ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5399 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5400 col = endcol + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5401 off_to = LineOffset[row] + col + coloff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5402 off_from += col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5403 endcol = (clear_width > 0 ? clear_width : -clear_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5404 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5405 #endif /* FEAT_RIGHTLEFT */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5406
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5407 redraw_next = char_needs_redraw(off_from, off_to, endcol - col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5409 while (col < endcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5410 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5411 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5412 if (has_mbyte && (col + 1 < endcol))
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5413 char_cells = (*mb_off2cells)(off_from, max_off_from);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5414 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5415 char_cells = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5416 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5418 redraw_this = redraw_next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5419 redraw_next = force || char_needs_redraw(off_from + CHAR_CELLS,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5420 off_to + CHAR_CELLS, endcol - col - CHAR_CELLS);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5421
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5422 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5423 /* If the next character was bold, then redraw the current character to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5424 * remove any pixels that might have spilt over into us. This only
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5425 * happens in the GUI.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5426 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5427 if (redraw_next && gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5428 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5429 hl = ScreenAttrs[off_to + CHAR_CELLS];
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5430 if (hl > HL_ALL)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5431 hl = syn_attr2attr(hl);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5432 if (hl & HL_BOLD)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5433 redraw_this = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5434 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5435 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5436
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5437 if (redraw_this)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5438 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5439 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5440 * Special handling when 'xs' termcap flag set (hpterm):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5441 * Attributes for characters are stored at the position where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5442 * cursor is when writing the highlighting code. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5443 * start-highlighting code must be written with the cursor on the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5444 * first highlighted character. The stop-highlighting code must
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5445 * be written with the cursor just after the last highlighted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5446 * character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5447 * Overwriting a character doesn't remove it's highlighting. Need
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5448 * to clear the rest of the line, and force redrawing it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5449 * completely.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5450 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5451 if ( p_wiv
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5452 && !force
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5453 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5454 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5455 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5456 && ScreenAttrs[off_to] != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5457 && ScreenAttrs[off_from] != ScreenAttrs[off_to])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5458 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5459 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5460 * Need to remove highlighting attributes here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5461 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5462 windgoto(row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5463 out_str(T_CE); /* clear rest of this screen line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5464 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5465 force = TRUE; /* force redraw of rest of the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5466 redraw_next = TRUE; /* or else next char would miss out */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5467
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5468 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5469 * If the previous character was highlighted, need to stop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5470 * highlighting at this character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5471 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5472 if (col + coloff > 0 && ScreenAttrs[off_to - 1] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5473 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5474 screen_attr = ScreenAttrs[off_to - 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5475 term_windgoto(row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5476 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5477 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5478 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5479 screen_attr = 0; /* highlighting has stopped */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5480 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5481 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5482 if (enc_dbcs != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5483 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5484 /* Check if overwriting a double-byte with a single-byte or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5485 * the other way around requires another character to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5486 * redrawn. For UTF-8 this isn't needed, because comparing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5487 * ScreenLinesUC[] is sufficient. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5488 if (char_cells == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5489 && col + 1 < endcol
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5490 && (*mb_off2cells)(off_to, max_off_to) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5491 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5492 /* Writing a single-cell character over a double-cell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5493 * character: need to redraw the next cell. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5494 ScreenLines[off_to + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5495 redraw_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5496 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5497 else if (char_cells == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5498 && col + 2 < endcol
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5499 && (*mb_off2cells)(off_to, max_off_to) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5500 && (*mb_off2cells)(off_to + 1, max_off_to) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5501 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5502 /* Writing the second half of a double-cell character over
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5503 * a double-cell character: need to redraw the second
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5504 * cell. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5505 ScreenLines[off_to + 2] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5506 redraw_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5507 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5508
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5509 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5510 ScreenLines2[off_to] = ScreenLines2[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5511 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5512 /* When writing a single-width character over a double-width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5513 * character and at the end of the redrawn text, need to clear out
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5514 * the right halve of the old character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5515 * Also required when writing the right halve of a double-width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5516 * char over the left halve of an existing one. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5517 if (has_mbyte && col + char_cells == endcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5518 && ((char_cells == 1
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5519 && (*mb_off2cells)(off_to, max_off_to) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5520 || (char_cells == 2
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5521 && (*mb_off2cells)(off_to, max_off_to) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5522 && (*mb_off2cells)(off_to + 1, max_off_to) > 1)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5523 clear_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5524 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5525
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5526 ScreenLines[off_to] = ScreenLines[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5527 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5528 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5529 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5530 ScreenLinesUC[off_to] = ScreenLinesUC[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5531 if (ScreenLinesUC[off_from] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5532 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5533 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5534
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5535 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5536 ScreenLinesC[i][off_to] = ScreenLinesC[i][off_from];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5537 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5538 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5539 if (char_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5540 ScreenLines[off_to + 1] = ScreenLines[off_from + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5541 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5542
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5543 #if defined(FEAT_GUI) || defined(UNIX)
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
5544 /* The bold trick makes a single column of pixels appear in the
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
5545 * next character. When a bold character is removed, the next
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5546 * character should be redrawn too. This happens for our own GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5547 * and for some xterms. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5548 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5549 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5550 gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5551 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5552 # if defined(FEAT_GUI) && defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5553 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5554 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5555 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5556 term_is_xterm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5557 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5558 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5559 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5560 hl = ScreenAttrs[off_to];
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5561 if (hl > HL_ALL)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5562 hl = syn_attr2attr(hl);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5563 if (hl & HL_BOLD)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5564 redraw_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5565 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5566 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5567 ScreenAttrs[off_to] = ScreenAttrs[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5568 #ifdef FEAT_MBYTE
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5569 /* For simplicity set the attributes of second half of a
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5570 * double-wide character equal to the first half. */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5571 if (char_cells == 2)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5572 ScreenAttrs[off_to + 1] = ScreenAttrs[off_from];
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5573
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5574 if (enc_dbcs != 0 && char_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5575 screen_char_2(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5576 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5577 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5578 screen_char(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5579 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5580 else if ( p_wiv
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5581 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5582 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5583 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5584 && col + coloff > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5585 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5586 if (ScreenAttrs[off_to] == ScreenAttrs[off_to - 1])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5587 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5588 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5589 * Don't output stop-highlight when moving the cursor, it will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5590 * stop the highlighting when it should continue.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5591 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5592 screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5593 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5594 else if (screen_attr != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5595 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5596 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5598 off_to += CHAR_CELLS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5599 off_from += CHAR_CELLS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5600 col += CHAR_CELLS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5601 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5602
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5603 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5604 if (clear_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5605 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5606 /* Clear the second half of a double-wide character of which the left
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5607 * half was overwritten with a single-wide character. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5608 ScreenLines[off_to] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5609 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5610 ScreenLinesUC[off_to] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5611 screen_char(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5612 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5613 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5615 if (clear_width > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5616 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5617 && !rlflag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5618 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5619 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5620 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5621 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5622 int startCol = col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5623 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5624
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5625 /* blank out the rest of the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5626 while (col < clear_width && ScreenLines[off_to] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5627 && ScreenAttrs[off_to] == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5628 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5629 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5630 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5631 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5632 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5633 ++off_to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5634 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5635 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5636 if (col < clear_width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5637 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5638 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5639 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5640 * In the GUI, clearing the rest of the line may leave pixels
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5641 * behind if the first character cleared was bold. Some bold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5642 * fonts spill over the left. In this case we redraw the previous
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5643 * character too. If we didn't skip any blanks above, then we
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5644 * only redraw if the character wasn't already redrawn anyway.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5645 */
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5646 if (gui.in_use && (col > startCol || !redraw_this))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5647 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5648 hl = ScreenAttrs[off_to];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5649 if (hl > HL_ALL || (hl & HL_BOLD))
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5650 {
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5651 int prev_cells = 1;
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5652 # ifdef FEAT_MBYTE
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5653 if (enc_utf8)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5654 /* for utf-8, ScreenLines[char_offset + 1] == 0 means
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5655 * that its width is 2. */
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5656 prev_cells = ScreenLines[off_to - 1] == 0 ? 2 : 1;
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5657 else if (enc_dbcs != 0)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5658 {
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5659 /* find previous character by counting from first
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5660 * column and get its width. */
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5661 unsigned off = LineOffset[row];
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5662 unsigned max_off = LineOffset[row] + screen_Columns;
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5663
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5664 while (off < off_to)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5665 {
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5666 prev_cells = (*mb_off2cells)(off, max_off);
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5667 off += prev_cells;
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5668 }
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5669 }
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5670
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5671 if (enc_dbcs != 0 && prev_cells > 1)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5672 screen_char_2(off_to - prev_cells, row,
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5673 col + coloff - prev_cells);
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5674 else
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5675 # endif
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5676 screen_char(off_to - prev_cells, row,
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5677 col + coloff - prev_cells);
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5678 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5679 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5680 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5681 screen_fill(row, row + 1, col + coloff, clear_width + coloff,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5682 ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5683 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5684 off_to += clear_width - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5685 col = clear_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5686 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5687 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5688 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5689
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5690 if (clear_width > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5691 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5692 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5693 /* For a window that's left of another, draw the separator char. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5694 if (col + coloff < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5695 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5696 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5697
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5698 c = fillchar_vsep(&hl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5699 if (ScreenLines[off_to] != c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5700 # ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5701 || (enc_utf8 && (int)ScreenLinesUC[off_to]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5702 != (c >= 0x80 ? c : 0))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5703 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5704 || ScreenAttrs[off_to] != hl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5705 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5706 ScreenLines[off_to] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5707 ScreenAttrs[off_to] = hl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5708 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5709 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5710 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5711 if (c >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5712 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5713 ScreenLinesUC[off_to] = c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5714 ScreenLinesC[0][off_to] = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5715 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5716 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5717 ScreenLinesUC[off_to] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5718 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5719 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5720 screen_char(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5721 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5722 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5723 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5724 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5725 LineWraps[row] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5726 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5727 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5728
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5729 #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5730 /*
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5731 * Mirror text "str" for right-left displaying.
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5732 * Only works for single-byte characters (e.g., numbers).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5733 */
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5734 void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5735 rl_mirror(str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5736 char_u *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5737 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5738 char_u *p1, *p2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5739 int t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5740
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5741 for (p1 = str, p2 = str + STRLEN(str) - 1; p1 < p2; ++p1, --p2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5742 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5743 t = *p1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5744 *p1 = *p2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5745 *p2 = t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5746 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5747 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5748 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5749
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5750 #if defined(FEAT_WINDOWS) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5751 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5752 * mark all status lines for redraw; used after first :cd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5753 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5754 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5755 status_redraw_all()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5756 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5757 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5758
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5759 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5760 if (wp->w_status_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5761 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5762 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5763 redraw_later(VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5764 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5765 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5766
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5767 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5768 * mark all status lines of the current buffer for redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5769 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5770 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5771 status_redraw_curbuf()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5772 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5773 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5775 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5776 if (wp->w_status_height != 0 && wp->w_buffer == curbuf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5777 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5778 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5779 redraw_later(VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5780 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5781 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5782
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5783 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5784 * Redraw all status lines that need to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5785 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5786 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5787 redraw_statuslines()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5788 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5789 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5790
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5791 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5792 if (wp->w_redr_status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5793 win_redr_status(wp);
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
5794 if (redraw_tabline)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
5795 draw_tabline();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5796 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5797 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5798
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5799 #if (defined(FEAT_WILDMENU) && defined(FEAT_VERTSPLIT)) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5800 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5801 * Redraw all status lines at the bottom of frame "frp".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5802 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5803 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5804 win_redraw_last_status(frp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5805 frame_T *frp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5806 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5807 if (frp->fr_layout == FR_LEAF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5808 frp->fr_win->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5809 else if (frp->fr_layout == FR_ROW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5810 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5811 for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5812 win_redraw_last_status(frp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5813 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5814 else /* frp->fr_layout == FR_COL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5815 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5816 frp = frp->fr_child;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5817 while (frp->fr_next != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5818 frp = frp->fr_next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5819 win_redraw_last_status(frp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5820 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5821 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5822 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5823
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5824 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5825 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5826 * Draw the verticap separator right of window "wp" starting with line "row".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5827 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5828 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5829 draw_vsep_win(wp, row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5830 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5831 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5832 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5833 int hl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5834 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5835
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5836 if (wp->w_vsep_width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5837 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5838 /* draw the vertical separator right of this window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5839 c = fillchar_vsep(&hl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5840 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5841 W_ENDCOL(wp), W_ENDCOL(wp) + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5842 c, ' ', hl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5843 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5844 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5845 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5846
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5847 #ifdef FEAT_WILDMENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5848 static int status_match_len __ARGS((expand_T *xp, char_u *s));
277
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5849 static int skip_status_match_char __ARGS((expand_T *xp, char_u *s));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5850
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5851 /*
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5852 * 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
5853 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5854 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5855 status_match_len(xp, s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5856 expand_T *xp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5857 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5858 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5859 int len = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5860
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5861 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5862 int emenu = (xp->xp_context == EXPAND_MENUS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5863 || xp->xp_context == EXPAND_MENUNAMES);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5864
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5865 /* Check for menu separators - replace with '|'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5866 if (emenu && menu_is_separator(s))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5867 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5868 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5869
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5870 while (*s != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5871 {
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5872 s += skip_status_match_char(xp, s);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 40
diff changeset
5873 len += ptr2cells(s);
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5874 mb_ptr_adv(s);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5875 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5876
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5877 return len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5878 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5879
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5880 /*
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5881 * 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
5882 * These are backslashes used for escaping. Do show backslashes in help tags.
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5883 */
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5884 static int
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5885 skip_status_match_char(xp, s)
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5886 expand_T *xp;
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5887 char_u *s;
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5888 {
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5889 if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP)
277
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5890 #ifdef FEAT_MENU
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5891 || ((xp->xp_context == EXPAND_MENUS
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5892 || xp->xp_context == EXPAND_MENUNAMES)
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5893 && (s[0] == '\t' || (s[0] == '\\' && s[1] != NUL)))
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5894 #endif
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5895 )
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5896 {
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5897 #ifndef BACKSLASH_IN_FILENAME
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5898 if (xp->xp_shell && csh_like_shell() && s[1] == '\\' && s[2] == '!')
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5899 return 2;
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5900 #endif
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5901 return 1;
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5902 }
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5903 return 0;
277
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5904 }
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5905
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5906 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5907 * Show wildchar matches in the status line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5908 * Show at least the "match" item.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5909 * 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
5910 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5911 * If inversion is possible we use it. Else '=' characters are used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5912 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5913 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5914 win_redr_status_matches(xp, num_matches, matches, match, showtail)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5915 expand_T *xp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5916 int num_matches;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5917 char_u **matches; /* list of matches */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5918 int match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5919 int showtail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5920 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5921 #define L_MATCH(m) (showtail ? sm_gettail(matches[m]) : matches[m])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5922 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5923 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5924 int len;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5925 int clen; /* length in screen cells */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5926 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5927 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5928 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5929 int highlight = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5930 char_u *selstart = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5931 int selstart_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5932 char_u *selend = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5933 static int first_match = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5934 int add_left = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5935 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5936 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5937 int emenu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5938 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5939 #if defined(FEAT_MBYTE) || defined(FEAT_MENU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5940 int l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5941 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5942
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5943 if (matches == NULL) /* interrupted completion? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5944 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5945
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5946 #ifdef FEAT_MBYTE
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5947 if (has_mbyte)
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5948 buf = alloc((unsigned)Columns * MB_MAXBYTES + 1);
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5949 else
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5950 #endif
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5951 buf = alloc((unsigned)Columns + 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5952 if (buf == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5953 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5954
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5955 if (match == -1) /* don't show match but original text */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5956 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5957 match = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5958 highlight = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5959 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5960 /* count 1 for the ending ">" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5961 clen = status_match_len(xp, L_MATCH(match)) + 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5962 if (match == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5963 first_match = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5964 else if (match < first_match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5965 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5966 /* jumping left, as far as we can go */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5967 first_match = match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5968 add_left = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5969 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5970 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5971 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5972 /* check if match fits on the screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5973 for (i = first_match; i < match; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5974 clen += status_match_len(xp, L_MATCH(i)) + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5975 if (first_match > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5976 clen += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5977 /* jumping right, put match at the left */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5978 if ((long)clen > Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5979 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5980 first_match = match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5981 /* if showing the last match, we can add some on the left */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5982 clen = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5983 for (i = match; i < num_matches; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5984 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5985 clen += status_match_len(xp, L_MATCH(i)) + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5986 if ((long)clen >= Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5987 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5988 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5989 if (i == num_matches)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5990 add_left = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5991 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5992 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5993 if (add_left)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5994 while (first_match > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5995 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5996 clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5997 if ((long)clen >= Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5998 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5999 --first_match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6000 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6002 fillchar = fillchar_status(&attr, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6004 if (first_match == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6005 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6006 *buf = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6007 len = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6008 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6009 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6010 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6011 STRCPY(buf, "< ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6012 len = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6013 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6014 clen = len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6015
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6016 i = first_match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6017 while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6018 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6019 if (i == match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6020 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6021 selstart = buf + len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6022 selstart_col = clen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6023 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6024
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6025 s = L_MATCH(i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6026 /* Check for menu separators - replace with '|' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6027 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6028 emenu = (xp->xp_context == EXPAND_MENUS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6029 || xp->xp_context == EXPAND_MENUNAMES);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6030 if (emenu && menu_is_separator(s))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6031 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6032 STRCPY(buf + len, transchar('|'));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6033 l = (int)STRLEN(buf + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6034 len += l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6035 clen += l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6036 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6037 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6038 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6039 for ( ; *s != NUL; ++s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6040 {
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
6041 s += skip_status_match_char(xp, s);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6042 clen += ptr2cells(s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6043 #ifdef FEAT_MBYTE
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
6044 if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6045 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6046 STRNCPY(buf + len, s, l);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6047 s += l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6048 len += l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6049 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6050 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6051 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6052 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6053 STRCPY(buf + len, transchar_byte(*s));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6054 len += (int)STRLEN(buf + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6055 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6056 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6057 if (i == match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6058 selend = buf + len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6059
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6060 *(buf + len++) = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6061 *(buf + len++) = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6062 clen += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6063 if (++i == num_matches)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6064 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6065 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6066
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6067 if (i != num_matches)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6068 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6069 *(buf + len++) = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6070 ++clen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6071 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6073 buf[len] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6074
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6075 row = cmdline_row - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6076 if (row >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6077 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6078 if (wild_menu_showing == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6079 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6080 if (msg_scrolled > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6081 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6082 /* Put the wildmenu just above the command line. If there is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6083 * no room, scroll the screen one line up. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6084 if (cmdline_row == Rows - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6085 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6086 screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6087 ++msg_scrolled;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6088 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6089 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6090 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6091 ++cmdline_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6092 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6093 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6094 wild_menu_showing = WM_SCROLLED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6095 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6096 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6097 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6098 /* Create status line if needed by setting 'laststatus' to 2.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6099 * Set 'winminheight' to zero to avoid that the window is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6100 * resized. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6101 if (lastwin->w_status_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6102 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6103 save_p_ls = p_ls;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6104 save_p_wmh = p_wmh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6105 p_ls = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6106 p_wmh = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6107 last_status(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6108 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6109 wild_menu_showing = WM_SHOWN;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6110 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6111 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6112
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6113 screen_puts(buf, row, 0, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6114 if (selstart != NULL && highlight)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6115 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6116 *selend = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6117 screen_puts(selstart, row, selstart_col, hl_attr(HLF_WM));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6118 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6119
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6120 screen_fill(row, row + 1, clen, (int)Columns, fillchar, fillchar, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6121 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6122
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6123 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6124 win_redraw_last_status(topframe);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6125 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6126 lastwin->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6127 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6128 vim_free(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6129 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6130 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6131
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6132 #if defined(FEAT_WINDOWS) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6133 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6134 * Redraw the status line of window wp.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6135 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6136 * If inversion is possible we use it. Else '=' characters are used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6137 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6138 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6139 win_redr_status(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6140 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6141 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6142 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6143 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6144 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6145 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6146 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6147 int this_ru_col;
1910
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6148 static int busy = FALSE;
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6149
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6150 /* It's possible to get here recursively when 'statusline' (indirectly)
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6151 * invokes ":redrawstatus". Simply ignore the call then. */
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6152 if (busy)
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6153 return;
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6154 busy = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6156 wp->w_redr_status = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6157 if (wp->w_status_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6158 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6159 /* no status line, can only be last window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6160 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6161 }
540
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
6162 else if (!redrawing()
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
6163 #ifdef FEAT_INS_EXPAND
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
6164 /* don't update status line when popup menu is visible and may be
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
6165 * drawn over it */
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
6166 || pum_visible()
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
6167 #endif
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
6168 )
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6169 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6170 /* Don't redraw right now, do it later. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6171 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6172 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6173 #ifdef FEAT_STL_OPT
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
6174 else if (*p_stl != NUL || *wp->w_p_stl != NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6175 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6176 /* redraw custom status line */
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6177 redraw_custom_statusline(wp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6178 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6179 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6180 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6181 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6182 fillchar = fillchar_status(&attr, wp == curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6183
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6184 get_trans_bufname(wp->w_buffer);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6185 p = NameBuff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6186 len = (int)STRLEN(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6188 if (wp->w_buffer->b_help
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6189 #ifdef FEAT_QUICKFIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6190 || wp->w_p_pvw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6191 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6192 || bufIsChanged(wp->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6193 || wp->w_buffer->b_p_ro)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6194 *(p + len++) = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6195 if (wp->w_buffer->b_help)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6196 {
809
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 798
diff changeset
6197 STRCPY(p + len, _("[Help]"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6198 len += (int)STRLEN(p + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6199 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6200 #ifdef FEAT_QUICKFIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6201 if (wp->w_p_pvw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6202 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6203 STRCPY(p + len, _("[Preview]"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6204 len += (int)STRLEN(p + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6205 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6206 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6207 if (bufIsChanged(wp->w_buffer))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6208 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6209 STRCPY(p + len, "[+]");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6210 len += 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6211 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6212 if (wp->w_buffer->b_p_ro)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6213 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6214 STRCPY(p + len, "[RO]");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6215 len += 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6216 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6218 #ifndef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6219 this_ru_col = ru_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6220 if (this_ru_col < (Columns + 1) / 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6221 this_ru_col = (Columns + 1) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6222 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6223 this_ru_col = ru_col - (Columns - W_WIDTH(wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6224 if (this_ru_col < (W_WIDTH(wp) + 1) / 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6225 this_ru_col = (W_WIDTH(wp) + 1) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6226 if (this_ru_col <= 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6227 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6228 p = (char_u *)"<"; /* No room for file name! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6229 len = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6231 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6232 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6233 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6234 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6235 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6236 int clen = 0, i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6237
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6238 /* Count total number of display cells. */
2338
da6ec32d8d8f Added strwidth() and strchars() functions.
Bram Moolenaar <bram@vim.org>
parents: 2332
diff changeset
6239 clen = mb_string2cells(p, -1);
da6ec32d8d8f Added strwidth() and strchars() functions.
Bram Moolenaar <bram@vim.org>
parents: 2332
diff changeset
6240
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6241 /* Find first character that will fit.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6242 * Going from start to end is much faster for DBCS. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6243 for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
6244 i += (*mb_ptr2len)(p + i))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6245 clen -= (*mb_ptr2cells)(p + i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6246 len = clen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6247 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6248 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6249 p = p + i - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6250 *p = '<';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6251 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6252 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6253
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6254 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6255 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6256 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6257 if (len > this_ru_col - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6258 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6259 p += len - (this_ru_col - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6260 *p = '<';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6261 len = this_ru_col - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6262 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6264 row = W_WINROW(wp) + wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6265 screen_puts(p, row, W_WINCOL(wp), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6266 screen_fill(row, row + 1, len + W_WINCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6267 this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6268
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6269 if (get_keymap_str(wp, NameBuff, MAXPATHL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6270 && (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6271 screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6272 - 1 + W_WINCOL(wp)), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6273
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6274 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6275 win_redr_ruler(wp, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6276 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6277 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6278
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6279 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6280 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6281 * May need to draw the character below the vertical separator.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6282 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6283 if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6284 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6285 if (stl_connected(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6286 fillchar = fillchar_status(&attr, wp == curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6287 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6288 fillchar = fillchar_vsep(&attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6289 screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6290 attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6291 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6292 #endif
1910
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
6293 busy = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6294 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6295
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6296 #ifdef FEAT_STL_OPT
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6297 /*
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6298 * Redraw the status line according to 'statusline' and take care of any
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6299 * errors encountered.
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6300 */
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6301 static void
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6302 redraw_custom_statusline(wp)
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6303 win_T *wp;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6304 {
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6305 static int entered = FALSE;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6306 int save_called_emsg = called_emsg;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6307
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6308 /* When called recursively return. This can happen when the statusline
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6309 * contains an expression that triggers a redraw. */
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6310 if (entered)
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6311 return;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6312 entered = TRUE;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6313
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6314 called_emsg = FALSE;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6315 win_redr_custom(wp, FALSE);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6316 if (called_emsg)
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6317 {
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6318 /* When there is an error disable the statusline, otherwise the
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6319 * display is messed up with errors and a redraw triggers the problem
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6320 * again and again. */
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6321 set_string_option_direct((char_u *)"statusline", -1,
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6322 (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 688
diff changeset
6323 ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6324 }
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6325 called_emsg |= save_called_emsg;
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6326 entered = FALSE;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6327 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6328 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6329
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6330 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6331 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6332 * Return TRUE if the status line of window "wp" is connected to the status
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6333 * 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
6334 * Only call if (wp->w_vsep_width != 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6335 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6336 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6337 stl_connected(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6338 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6339 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6340 frame_T *fr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6342 fr = wp->w_frame;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6343 while (fr->fr_parent != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6344 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6345 if (fr->fr_parent->fr_layout == FR_COL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6346 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6347 if (fr->fr_next != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6348 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6349 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6350 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6351 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6352 if (fr->fr_next != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6353 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6354 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6355 fr = fr->fr_parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6356 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6357 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6358 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6359 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6361 #endif /* FEAT_WINDOWS */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6363 #if defined(FEAT_WINDOWS) || defined(FEAT_STL_OPT) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6364 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6365 * Get the value to show for the language mappings, active 'keymap'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6366 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6367 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6368 get_keymap_str(wp, buf, len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6369 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6370 char_u *buf; /* buffer for the result */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6371 int len; /* length of buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6373 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6374
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6375 if (wp->w_buffer->b_p_iminsert != B_IMODE_LMAP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6376 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6377
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6378 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6379 #ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6380 buf_T *old_curbuf = curbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6381 win_T *old_curwin = curwin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6382 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6383
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6384 curbuf = wp->w_buffer;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6385 curwin = wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6386 STRCPY(buf, "b:keymap_name"); /* must be writable */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6387 ++emsg_skip;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6388 s = p = eval_to_string(buf, NULL, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6389 --emsg_skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6390 curbuf = old_curbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6391 curwin = old_curwin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6392 if (p == NULL || *p == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6393 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6394 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6395 #ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6396 if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6397 p = wp->w_buffer->b_p_keymap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6398 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6399 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6400 p = (char_u *)"lang";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6401 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6402 if ((int)(STRLEN(p) + 3) < len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6403 sprintf((char *)buf, "<%s>", p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6404 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6405 buf[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6406 #ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6407 vim_free(s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6408 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6409 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6410 return buf[0] != NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6411 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6412 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6413
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6414 #if defined(FEAT_STL_OPT) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6415 /*
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6416 * Redraw the status line or ruler of window "wp".
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6417 * When "wp" is NULL redraw the tab pages line from 'tabline'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6418 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6419 static void
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
6420 win_redr_custom(wp, draw_ruler)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6421 win_T *wp;
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
6422 int draw_ruler; /* TRUE or FALSE */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6423 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6424 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6425 int curattr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6426 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6427 int col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6428 int maxwidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6429 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6430 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6431 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6432 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6433 char_u buf[MAXPATHL];
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6434 char_u *stl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6435 char_u *p;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6436 struct stl_hlrec hltab[STL_MAX_ITEM];
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6437 struct stl_hlrec tabtab[STL_MAX_ITEM];
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6438 int use_sandbox = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6439
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6440 /* setup environment for the task at hand */
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6441 if (wp == NULL)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6442 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6443 /* Use 'tabline'. Always at the first line of the screen. */
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6444 stl = p_tal;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6445 row = 0;
707
111b7dcc8a17 updated for version 7.0213
vimboss
parents: 699
diff changeset
6446 fillchar = ' ';
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6447 attr = hl_attr(HLF_TPF);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6448 maxwidth = Columns;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6449 # ifdef FEAT_EVAL
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6450 use_sandbox = was_set_insecurely((char_u *)"tabline", 0);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6451 # endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6452 }
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
6453 else
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6454 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6455 row = W_WINROW(wp) + wp->w_height;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6456 fillchar = fillchar_status(&attr, wp == curwin);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6457 maxwidth = W_WIDTH(wp);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6458
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6459 if (draw_ruler)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6460 {
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6461 stl = p_ruf;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6462 /* advance past any leading group spec - implicit in ru_col */
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6463 if (*stl == '%')
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6464 {
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6465 if (*++stl == '-')
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6466 stl++;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6467 if (atoi((char *)stl))
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6468 while (VIM_ISDIGIT(*stl))
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6469 stl++;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6470 if (*stl++ != '(')
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6471 stl = p_ruf;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6472 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6473 #ifdef FEAT_VERTSPLIT
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6474 col = ru_col - (Columns - W_WIDTH(wp));
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6475 if (col < (W_WIDTH(wp) + 1) / 2)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6476 col = (W_WIDTH(wp) + 1) / 2;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6477 #else
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6478 col = ru_col;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6479 if (col > (Columns + 1) / 2)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6480 col = (Columns + 1) / 2;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6481 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6482 maxwidth = W_WIDTH(wp) - col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6483 #ifdef FEAT_WINDOWS
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6484 if (!wp->w_status_height)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6485 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6486 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6487 row = Rows - 1;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6488 --maxwidth; /* writing in last column may cause scrolling */
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6489 fillchar = ' ';
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6490 attr = 0;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6491 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6492
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6493 # ifdef FEAT_EVAL
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6494 use_sandbox = was_set_insecurely((char_u *)"rulerformat", 0);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6495 # endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6496 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6497 else
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6498 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6499 if (*wp->w_p_stl != NUL)
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6500 stl = wp->w_p_stl;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6501 else
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6502 stl = p_stl;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6503 # ifdef FEAT_EVAL
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6504 use_sandbox = was_set_insecurely((char_u *)"statusline",
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6505 *wp->w_p_stl == NUL ? 0 : OPT_LOCAL);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6506 # endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6507 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6508
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6509 #ifdef FEAT_VERTSPLIT
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6510 col += W_WINCOL(wp);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6511 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6512 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6513
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6514 if (maxwidth <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6515 return;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6516
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6517 /* Make a copy, because the statusline may include a function call that
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6518 * might change the option value and free the memory. */
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6519 stl = vim_strsave(stl);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6520 width = build_stl_str_hl(wp == NULL ? curwin : wp,
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6521 buf, sizeof(buf),
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6522 stl, use_sandbox,
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6523 fillchar, maxwidth, hltab, tabtab);
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6524 vim_free(stl);
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
6525 len = (int)STRLEN(buf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6526
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
6527 while (width < maxwidth && len < (int)sizeof(buf) - 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6528 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6529 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6530 len += (*mb_char2bytes)(fillchar, buf + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6531 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6532 buf[len++] = fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6533 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6534 ++width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6535 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6536 buf[len] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6537
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6538 /*
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6539 * Draw each snippet with the specified highlighting.
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6540 */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6541 curattr = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6542 p = buf;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6543 for (n = 0; hltab[n].start != NULL; n++)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6544 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6545 len = (int)(hltab[n].start - p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6546 screen_puts_len(p, len, row, col, curattr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6547 col += vim_strnsize(p, len);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6548 p = hltab[n].start;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6549
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6550 if (hltab[n].userhl == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6551 curattr = attr;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6552 else if (hltab[n].userhl < 0)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6553 curattr = syn_id2attr(-hltab[n].userhl);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6554 #ifdef FEAT_WINDOWS
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6555 else if (wp != NULL && wp != curwin && wp->w_status_height != 0)
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6556 curattr = highlight_stlnc[hltab[n].userhl - 1];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6557 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6558 else
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6559 curattr = highlight_user[hltab[n].userhl - 1];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6560 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6561 screen_puts(p, row, col, curattr);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6562
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6563 if (wp == NULL)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6564 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6565 /* Fill the TabPageIdxs[] array for clicking in the tab pagesline. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6566 col = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6567 len = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6568 p = buf;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6569 fillchar = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6570 for (n = 0; tabtab[n].start != NULL; n++)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6571 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6572 len += vim_strnsize(p, (int)(tabtab[n].start - p));
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6573 while (col < len)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6574 TabPageIdxs[col++] = fillchar;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6575 p = tabtab[n].start;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6576 fillchar = tabtab[n].userhl;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6577 }
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6578 while (col < Columns)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6579 TabPageIdxs[col++] = fillchar;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6580 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6581 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6582
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6583 #endif /* FEAT_STL_OPT */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6584
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6585 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6586 * Output a single character directly to the screen and update ScreenLines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6587 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6588 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6589 screen_putchar(c, row, col, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6590 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6591 int row, col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6592 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6593 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6594 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6595 char_u buf[MB_MAXBYTES + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6596
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6597 buf[(*mb_char2bytes)(c, buf)] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6598 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6599 char_u buf[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6601 buf[0] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6602 buf[1] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6603 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6604 screen_puts(buf, row, col, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6605 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6606
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6607 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6608 * Get a single character directly from ScreenLines into "bytes[]".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6609 * Also return its attribute in *attrp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6610 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6611 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6612 screen_getbytes(row, col, bytes, attrp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6613 int row, col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6614 char_u *bytes;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6615 int *attrp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6616 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6617 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6618
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6619 /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6620 if (ScreenLines != NULL && row < screen_Rows && col < screen_Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6621 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6622 off = LineOffset[row] + col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6623 *attrp = ScreenAttrs[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6624 bytes[0] = ScreenLines[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6625 bytes[1] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6626
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6627 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6628 if (enc_utf8 && ScreenLinesUC[off] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6629 bytes[utfc_char2bytes(off, bytes)] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6630 else if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6631 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6632 bytes[0] = ScreenLines[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6633 bytes[1] = ScreenLines2[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6634 bytes[2] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6635 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6636 else if (enc_dbcs && MB_BYTE2LEN(bytes[0]) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6637 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6638 bytes[1] = ScreenLines[off + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6639 bytes[2] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6640 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6641 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6642 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6643 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6644
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6645 #ifdef FEAT_MBYTE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6646 static int screen_comp_differs __ARGS((int, int*));
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6647
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6648 /*
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6649 * Return TRUE if composing characters for screen posn "off" differs from
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6650 * composing characters in "u8cc".
2124
dc8a5699253b updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents: 2122
diff changeset
6651 * Only to be used when ScreenLinesUC[off] != 0.
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6652 */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6653 static int
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6654 screen_comp_differs(off, u8cc)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6655 int off;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6656 int *u8cc;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6657 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6658 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6659
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6660 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6661 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6662 if (ScreenLinesC[i][off] != (u8char_T)u8cc[i])
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6663 return TRUE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6664 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6665 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6666 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6667 return FALSE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6668 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6669 #endif
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6670
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6671 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6672 * Put string '*text' on the screen at position 'row' and 'col', with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6673 * attributes 'attr', and update ScreenLines[] and ScreenAttrs[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6674 * Note: only outputs within one row, message is truncated at screen boundary!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6675 * Note: if ScreenLines[], row and/or col is invalid, nothing is done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6676 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6677 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6678 screen_puts(text, row, col, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6679 char_u *text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6680 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6681 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6682 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6683 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6684 screen_puts_len(text, -1, row, col, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6685 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6686
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6687 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6688 * Like screen_puts(), but output "text[len]". When "len" is -1 output up to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6689 * a NUL.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6690 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6691 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6692 screen_puts_len(text, len, row, col, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6693 char_u *text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6694 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6695 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6696 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6697 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6698 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6699 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6700 char_u *ptr = text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6701 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6702 #ifdef FEAT_MBYTE
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6703 unsigned max_off;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6704 int mbyte_blen = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6705 int mbyte_cells = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6706 int u8c = 0;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6707 int u8cc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6708 int clear_next_cell = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6709 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6710 int prev_c = 0; /* previous Arabic character */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6711 int pc, nc, nc1;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6712 int pcc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6713 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6714 #endif
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6715 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6716 int force_redraw_this;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6717 int force_redraw_next = FALSE;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6718 #endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6719 int need_redraw;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6720
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6721 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6722 return;
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6723 off = LineOffset[row] + col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6724
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6725 #ifdef FEAT_MBYTE
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6726 /* When drawing over the right halve of a double-wide char clear out the
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6727 * left halve. Only needed in a terminal. */
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
6728 if (has_mbyte && col > 0 && col < screen_Columns
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6729 # ifdef FEAT_GUI
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6730 && !gui.in_use
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6731 # endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6732 && mb_fix_col(col, row) != col)
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6733 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6734 ScreenLines[off - 1] = ' ';
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6735 ScreenAttrs[off - 1] = 0;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6736 if (enc_utf8)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6737 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6738 ScreenLinesUC[off - 1] = 0;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6739 ScreenLinesC[0][off - 1] = 0;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6740 }
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6741 /* redraw the previous cell, make it empty */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6742 screen_char(off - 1, row, col - 1);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6743 /* force the cell at "col" to be redrawn */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6744 force_redraw_next = TRUE;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6745 }
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6746 #endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6747
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6748 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6749 max_off = LineOffset[row] + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6750 #endif
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
6751 while (col < screen_Columns
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
6752 && (len < 0 || (int)(ptr - text) < len)
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
6753 && *ptr != NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6754 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6755 c = *ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6756 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6757 /* check if this is the first byte of a multibyte */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6758 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6759 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6760 if (enc_utf8 && len > 0)
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
6761 mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6762 else
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
6763 mbyte_blen = (*mb_ptr2len)(ptr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6764 if (enc_dbcs == DBCS_JPNU && c == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6765 mbyte_cells = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6766 else if (enc_dbcs != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6767 mbyte_cells = mbyte_blen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6768 else /* enc_utf8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6769 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6770 if (len >= 0)
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6771 u8c = utfc_ptr2char_len(ptr, u8cc,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6772 (int)((text + len) - ptr));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6773 else
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6774 u8c = utfc_ptr2char(ptr, u8cc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6775 mbyte_cells = utf_char2cells(u8c);
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
6776 # ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6777 /* Non-BMP character: display as ? or fullwidth ?. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6778 if (u8c >= 0x10000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6779 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6780 u8c = (mbyte_cells == 2) ? 0xff1f : (int)'?';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6781 if (attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6782 attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6783 }
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
6784 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6785 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6786 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6787 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6788 /* Do Arabic shaping. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6789 if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6790 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6791 /* Past end of string to be displayed. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6792 nc = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6793 nc1 = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6794 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6795 else
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6796 {
1994
439f44b874a7 updated for version 7.2-291
vimboss
parents: 1984
diff changeset
6797 nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc,
439f44b874a7 updated for version 7.2-291
vimboss
parents: 1984
diff changeset
6798 (int)((text + len) - ptr - mbyte_blen));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6799 nc1 = pcc[0];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6800 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6801 pc = prev_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6802 prev_c = u8c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6803 u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6804 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6805 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6806 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6807 # endif
2055
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6808 if (col + mbyte_cells > screen_Columns)
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6809 {
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6810 /* Only 1 cell left, but character requires 2 cells:
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6811 * display a '>' in the last column to avoid wrapping. */
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6812 c = '>';
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6813 mbyte_cells = 1;
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6814 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6815 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6816 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6817 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6818
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6819 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6820 force_redraw_this = force_redraw_next;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6821 force_redraw_next = FALSE;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6822 #endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6823
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6824 need_redraw = ScreenLines[off] != c
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6825 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6826 || (mbyte_cells == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6827 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6828 || (enc_dbcs == DBCS_JPNU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6829 && c == 0x8e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6830 && ScreenLines2[off] != ptr[1])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6831 || (enc_utf8
2124
dc8a5699253b updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents: 2122
diff changeset
6832 && (ScreenLinesUC[off] !=
dc8a5699253b updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents: 2122
diff changeset
6833 (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
6834 || (ScreenLinesUC[off] != 0
dc8a5699253b updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents: 2122
diff changeset
6835 && screen_comp_differs(off, u8cc))))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6836 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6837 || ScreenAttrs[off] != attr
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6838 || exmode_active;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6839
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6840 if (need_redraw
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6841 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6842 || force_redraw_this
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6843 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6844 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6845 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6846 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6847 /* The bold trick makes a single row of pixels appear in the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6848 * character. When a bold character is removed, the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6849 * character should be redrawn too. This happens for our own GUI
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6850 * and for some xterms. */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6851 if (need_redraw && ScreenLines[off] != ' ' && (
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6852 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6853 gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6854 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6855 # if defined(FEAT_GUI) && defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6856 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6857 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6858 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6859 term_is_xterm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6860 # endif
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6861 ))
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6862 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6863 int n = ScreenAttrs[off];
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6864
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6865 if (n > HL_ALL)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6866 n = syn_attr2attr(n);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6867 if (n & HL_BOLD)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6868 force_redraw_next = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6869 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6870 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6871 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6872 /* When at the end of the text and overwriting a two-cell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6873 * character with a one-cell character, need to clear the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6874 * cell. Also when overwriting the left halve of a two-cell char
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6875 * with the right halve of a two-cell char. Do this only once
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6876 * (mb_off2cells() may return 2 on the right halve). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6877 if (clear_next_cell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6878 clear_next_cell = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6879 else if (has_mbyte
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6880 && (len < 0 ? ptr[mbyte_blen] == NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6881 : ptr + mbyte_blen >= text + len)
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6882 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6883 || (mbyte_cells == 2
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6884 && (*mb_off2cells)(off, max_off) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6885 && (*mb_off2cells)(off + 1, max_off) > 1)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6886 clear_next_cell = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6887
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6888 /* Make sure we never leave a second byte of a double-byte behind,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6889 * it confuses mb_off2cells(). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6890 if (enc_dbcs
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6891 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6892 || (mbyte_cells == 2
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6893 && (*mb_off2cells)(off, max_off) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6894 && (*mb_off2cells)(off + 1, max_off) > 1)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6895 ScreenLines[off + mbyte_blen] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6896 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6897 ScreenLines[off] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6898 ScreenAttrs[off] = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6899 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6900 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6901 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6902 if (c < 0x80 && u8cc[0] == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6903 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6904 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6905 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6906 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6907
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6908 ScreenLinesUC[off] = u8c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6909 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6910 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6911 ScreenLinesC[i][off] = u8cc[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6912 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6913 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6914 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6915 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6916 if (mbyte_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6917 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6918 ScreenLines[off + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6919 ScreenAttrs[off + 1] = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6920 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6921 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6922 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6923 else if (mbyte_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6924 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6925 ScreenLines[off + 1] = ptr[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6926 ScreenAttrs[off + 1] = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6927 screen_char_2(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6928 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6929 else if (enc_dbcs == DBCS_JPNU && c == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6930 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6931 ScreenLines2[off] = ptr[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6932 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6933 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6934 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6935 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6936 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6937 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6938 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6939 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6940 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6941 off += mbyte_cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6942 col += mbyte_cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6943 ptr += mbyte_blen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6944 if (clear_next_cell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6945 ptr = (char_u *)" ";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6946 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6947 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6948 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6949 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6950 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6951 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6952 ++ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6953 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6954 }
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6955
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6956 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6957 /* If we detected the next character needs to be redrawn, but the text
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6958 * doesn't extend up to there, update the character here. */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6959 if (force_redraw_next && col < screen_Columns)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6960 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6961 # ifdef FEAT_MBYTE
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6962 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6963 screen_char_2(off, row, col);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6964 else
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6965 # endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6966 screen_char(off, row, col);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6967 }
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6968 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6969 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6970
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6971 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6972 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6973 * Prepare for 'hlsearch' highlighting.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6974 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6975 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6976 start_search_hl()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6977 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6978 if (p_hls && !no_hlsearch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6979 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6980 last_pat_prog(&search_hl.rm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6981 search_hl.attr = hl_attr(HLF_L);
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6982 # ifdef FEAT_RELTIME
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6983 /* Set the time limit to 'redrawtime'. */
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6984 profile_setlimit(p_rdt, &search_hl.tm);
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6985 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6986 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6987 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6988
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6989 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6990 * Clean up for 'hlsearch' highlighting.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6991 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6992 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6993 end_search_hl()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6994 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6995 if (search_hl.rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6996 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6997 vim_free(search_hl.rm.regprog);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6998 search_hl.rm.regprog = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6999 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7000 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7002 /*
2284
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7003 * Init for calling prepare_search_hl().
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7004 */
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7005 static void
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7006 init_search_hl(wp)
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7007 win_T *wp;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7008 {
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7009 matchitem_T *cur;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7010
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7011 /* Setup for match and 'hlsearch' highlighting. Disable any previous
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7012 * match */
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7013 cur = wp->w_match_head;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7014 while (cur != NULL)
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7015 {
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7016 cur->hl.rm = cur->match;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7017 if (cur->hlg_id == 0)
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7018 cur->hl.attr = 0;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7019 else
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7020 cur->hl.attr = syn_id2attr(cur->hlg_id);
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7021 cur->hl.buf = wp->w_buffer;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7022 cur->hl.lnum = 0;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7023 cur->hl.first_lnum = 0;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7024 # ifdef FEAT_RELTIME
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7025 /* Set the time limit to 'redrawtime'. */
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7026 profile_setlimit(p_rdt, &(cur->hl.tm));
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7027 # endif
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7028 cur = cur->next;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7029 }
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7030 search_hl.buf = wp->w_buffer;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7031 search_hl.lnum = 0;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7032 search_hl.first_lnum = 0;
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7033 /* time limit is set at the toplevel, for all windows */
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7034 }
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7035
cca510a8b85b Better init for match highlighting when using conceal feature.
Bram Moolenaar <bram@vim.org>
parents: 2277
diff changeset
7036 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7037 * Advance to the match in window "wp" line "lnum" or past it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7038 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7039 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7040 prepare_search_hl(wp, lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7041 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7042 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7043 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7044 matchitem_T *cur; /* points to the match list */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7045 match_T *shl; /* points to search_hl or a match */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7046 int shl_flag; /* flag to indicate whether search_hl
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7047 has been processed or not */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7048 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7049
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7050 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7051 * When using a multi-line pattern, start searching at the top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7052 * of the window or just after a closed fold.
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7053 * Do this both for search_hl and the match list.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7054 */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7055 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7056 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7057 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7058 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7059 if (shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7060 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7061 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7062 shl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7063 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7064 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7065 shl = &cur->hl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7066 if (shl->rm.regprog != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7067 && shl->lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7068 && re_multiline(shl->rm.regprog))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7069 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7070 if (shl->first_lnum == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7071 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7072 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7073 for (shl->first_lnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7074 shl->first_lnum > wp->w_topline; --shl->first_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7075 if (hasFoldingWin(wp, shl->first_lnum - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7076 NULL, NULL, TRUE, NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7077 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7078 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7079 shl->first_lnum = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7080 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7081 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7082 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7083 while (shl->first_lnum < lnum && shl->rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7084 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7085 next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7086 if (shl->lnum != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7087 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7088 shl->first_lnum = shl->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7089 + shl->rm.endpos[0].lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7090 - shl->rm.startpos[0].lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7091 n = shl->rm.endpos[0].col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7092 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7093 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7094 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7095 ++shl->first_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7096 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7097 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7098 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7099 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7100 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7101 cur = cur->next;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7102 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7103 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7104
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7105 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7106 * Search for a next 'hlsearch' or match.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7107 * Uses shl->buf.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7108 * Sets shl->lnum and shl->rm contents.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7109 * Note: Assumes a previous match is always before "lnum", unless
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7110 * shl->lnum is zero.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7111 * Careful: Any pointers for buffer lines will become invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7112 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7113 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7114 next_search_hl(win, shl, lnum, mincol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7115 win_T *win;
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7116 match_T *shl; /* points to search_hl or a match */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7117 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7118 colnr_T mincol; /* minimal column for a match */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7119 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7120 linenr_T l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7121 colnr_T matchcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7122 long nmatched;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7124 if (shl->lnum != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7125 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7126 /* Check for three situations:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7127 * 1. If the "lnum" is below a previous match, start a new search.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7128 * 2. If the previous match includes "mincol", use it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7129 * 3. Continue after the previous match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7130 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7131 l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7132 if (lnum > l)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7133 shl->lnum = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7134 else if (lnum < l || shl->rm.endpos[0].col > mincol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7135 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7136 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7138 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7139 * Repeat searching for a match until one is found that includes "mincol"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7140 * or none is found in this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7141 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7142 called_emsg = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7143 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7144 {
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7145 #ifdef FEAT_RELTIME
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7146 /* Stop searching after passing the time limit. */
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7147 if (profile_passed_limit(&(shl->tm)))
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7148 {
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7149 shl->lnum = 0; /* no match found in time */
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7150 break;
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7151 }
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7152 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7153 /* Three situations:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7154 * 1. No useful previous match: search from start of line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7155 * 2. Not Vi compatible or empty match: continue at next character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7156 * Break the loop if this is beyond the end of the line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7157 * 3. Vi compatible searching: continue at end of previous match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7158 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7159 if (shl->lnum == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7160 matchcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7161 else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7162 || (shl->rm.endpos[0].lnum == 0
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7163 && shl->rm.endpos[0].col <= shl->rm.startpos[0].col))
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7164 {
688
bcd2edc4539e updated for version 7.0207
vimboss
parents: 685
diff changeset
7165 char_u *ml;
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7166
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7167 matchcol = shl->rm.startpos[0].col;
688
bcd2edc4539e updated for version 7.0207
vimboss
parents: 685
diff changeset
7168 ml = ml_get_buf(shl->buf, lnum, FALSE) + matchcol;
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7169 if (*ml == NUL)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7170 {
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7171 ++matchcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7172 shl->lnum = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7173 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7174 }
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7175 #ifdef FEAT_MBYTE
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7176 if (has_mbyte)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7177 matchcol += mb_ptr2len(ml);
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7178 else
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7179 #endif
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
7180 ++matchcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7181 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7182 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7183 matchcol = shl->rm.endpos[0].col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7185 shl->lnum = lnum;
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7186 nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol,
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7187 #ifdef FEAT_RELTIME
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7188 &(shl->tm)
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7189 #else
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7190 NULL
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7191 #endif
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
7192 );
2359
496feb41b83f Fix: When 'searchhl' causes a hang make CTRL-C disable 'shearchhl'.
Bram Moolenaar <bram@vim.org>
parents: 2356
diff changeset
7193 if (called_emsg || got_int)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7194 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7195 /* Error while handling regexp: stop using this regexp. */
1112
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
7196 if (shl == &search_hl)
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
7197 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
7198 /* don't free regprog in the match list, it's a copy */
1112
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
7199 vim_free(shl->rm.regprog);
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
7200 no_hlsearch = TRUE;
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
7201 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7202 shl->rm.regprog = NULL;
1112
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
7203 shl->lnum = 0;
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
7204 got_int = FALSE; /* avoid the "Type :quit to exit Vim" message */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7205 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7206 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7207 if (nmatched == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7208 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7209 shl->lnum = 0; /* no match found */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7210 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7211 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7212 if (shl->rm.startpos[0].lnum > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7213 || shl->rm.startpos[0].col >= mincol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7214 || nmatched > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7215 || shl->rm.endpos[0].col > mincol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7216 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7217 shl->lnum += shl->rm.startpos[0].lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7218 break; /* useful match found */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7219 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7220 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7221 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7222 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7223
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7224 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7225 screen_start_highlight(attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7226 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7227 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7228 attrentry_T *aep = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7230 screen_attr = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7231 if (full_screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7232 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7233 && termcap_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7234 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7235 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7236 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7237 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7238 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7239 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7240 char buf[20];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7241
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7242 /* The GUI handles this internally. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7243 sprintf(buf, IF_EB("\033|%dh", ESC_STR "|%dh"), attr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7244 OUT_STR(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7245 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7246 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7247 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7248 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7249 if (attr > HL_ALL) /* special HL attr. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7250 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7251 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7252 aep = syn_cterm_attr2entry(attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7253 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7254 aep = syn_term_attr2entry(attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7255 if (aep == NULL) /* did ":syntax clear" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7256 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7257 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7258 attr = aep->ae_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7259 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7260 if ((attr & HL_BOLD) && T_MD != NULL) /* bold */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7261 out_str(T_MD);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7262 else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7263 && cterm_normal_fg_bold)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7264 /* If the Normal FG color has BOLD attribute and the new HL
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7265 * has a FG color defined, clear BOLD. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7266 out_str(T_ME);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7267 if ((attr & HL_STANDOUT) && T_SO != NULL) /* standout */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7268 out_str(T_SO);
205
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
7269 if ((attr & (HL_UNDERLINE | HL_UNDERCURL)) && T_US != NULL)
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
7270 /* underline or undercurl */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7271 out_str(T_US);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7272 if ((attr & HL_ITALIC) && T_CZH != NULL) /* italic */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7273 out_str(T_CZH);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7274 if ((attr & HL_INVERSE) && T_MR != NULL) /* inverse (reverse) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7275 out_str(T_MR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7276
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7277 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7278 * Output the color or start string after bold etc., in case the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7279 * bold etc. override the color setting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7280 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7281 if (aep != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7282 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7283 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7284 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7285 if (aep->ae_u.cterm.fg_color)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7286 term_fg_color(aep->ae_u.cterm.fg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7287 if (aep->ae_u.cterm.bg_color)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7288 term_bg_color(aep->ae_u.cterm.bg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7289 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7290 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7291 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7292 if (aep->ae_u.term.start != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7293 out_str(aep->ae_u.term.start);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7294 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7295 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7296 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7300 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7301 screen_stop_highlight()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7302 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7303 int do_ME = FALSE; /* output T_ME code */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7304
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7305 if (screen_attr != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7306 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7307 && termcap_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7308 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7309 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7310 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7311 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7312 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7314 char buf[20];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7315
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7316 /* use internal GUI code */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7317 sprintf(buf, IF_EB("\033|%dH", ESC_STR "|%dH"), screen_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7318 OUT_STR(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7319 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7320 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7321 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7322 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7323 if (screen_attr > HL_ALL) /* special HL attr. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7324 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7325 attrentry_T *aep;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7326
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7327 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7328 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7329 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7330 * Assume that t_me restores the original colors!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7331 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7332 aep = syn_cterm_attr2entry(screen_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7333 if (aep != NULL && (aep->ae_u.cterm.fg_color
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7334 || aep->ae_u.cterm.bg_color))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7335 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7336 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7337 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7338 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7339 aep = syn_term_attr2entry(screen_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7340 if (aep != NULL && aep->ae_u.term.stop != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7341 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7342 if (STRCMP(aep->ae_u.term.stop, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7343 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7344 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7345 out_str(aep->ae_u.term.stop);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7346 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7347 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7348 if (aep == NULL) /* did ":syntax clear" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7349 screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7350 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7351 screen_attr = aep->ae_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7352 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7353
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7354 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7355 * Often all ending-codes are equal to T_ME. Avoid outputting the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7356 * same sequence several times.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7357 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7358 if (screen_attr & HL_STANDOUT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7359 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7360 if (STRCMP(T_SE, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7361 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7362 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7363 out_str(T_SE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7364 }
205
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
7365 if (screen_attr & (HL_UNDERLINE | HL_UNDERCURL))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7366 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7367 if (STRCMP(T_UE, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7368 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7369 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7370 out_str(T_UE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7371 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7372 if (screen_attr & HL_ITALIC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7373 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7374 if (STRCMP(T_CZR, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7375 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7376 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7377 out_str(T_CZR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7378 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7379 if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7380 out_str(T_ME);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7381
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7382 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7383 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7384 /* set Normal cterm colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7385 if (cterm_normal_fg_color != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7386 term_fg_color(cterm_normal_fg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7387 if (cterm_normal_bg_color != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7388 term_bg_color(cterm_normal_bg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7389 if (cterm_normal_fg_bold)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7390 out_str(T_MD);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7391 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7392 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7393 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7394 screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7395 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7396
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7397 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7398 * Reset the colors for a cterm. Used when leaving Vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7399 * The machine specific code may override this again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7400 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7401 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7402 reset_cterm_colors()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7403 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7404 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7405 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7406 /* set Normal cterm colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7407 if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7408 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7409 out_str(T_OP);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7410 screen_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7411 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7412 if (cterm_normal_fg_bold)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7413 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7414 out_str(T_ME);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7415 screen_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7416 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7417 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7418 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7420 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7421 * Put character ScreenLines["off"] on the screen at position "row" and "col",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7422 * using the attributes from ScreenAttrs["off"].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7423 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7424 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7425 screen_char(off, row, col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7426 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7427 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7428 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7429 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7430 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7432 /* Check for illegal values, just in case (could happen just after
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7433 * resizing). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7434 if (row >= screen_Rows || col >= screen_Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7435 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7436
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7437 /* Outputting the last character on the screen may scrollup the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7438 * Don't to it! Mark the character invalid (update it when scrolled up) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7439 if (row == screen_Rows - 1 && col == screen_Columns - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7440 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7441 /* account for first command-line character in rightleft mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7442 && !cmdmsg_rl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7443 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7444 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7445 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7446 ScreenAttrs[off] = (sattr_T)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7447 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7448 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7449
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7450 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7451 * Stop highlighting first, so it's easier to move the cursor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7452 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7453 #if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7454 if (screen_char_attr != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7455 attr = screen_char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7456 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7457 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7458 attr = ScreenAttrs[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7459 if (screen_attr != attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7460 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7461
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7462 windgoto(row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7464 if (screen_attr != attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7465 screen_start_highlight(attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7466
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7467 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7468 if (enc_utf8 && ScreenLinesUC[off] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7469 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7470 char_u buf[MB_MAXBYTES + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7471
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7472 /* Convert UTF-8 character to bytes and write it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7474 buf[utfc_char2bytes(off, buf)] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7475
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7476 out_str(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7477 if (utf_char2cells(ScreenLinesUC[off]) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7478 ++screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7479 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7480 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7481 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7482 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7483 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7484 out_flush_check();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7485 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7486 out_char(ScreenLines[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7487 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7488 /* double-byte character in single-width cell */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7489 if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7490 out_char(ScreenLines2[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7491 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7492 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7494 screen_cur_col++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7495 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7497 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7498
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7499 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7500 * Used for enc_dbcs only: Put one double-wide character at ScreenLines["off"]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7501 * on the screen at position 'row' and 'col'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7502 * The attributes of the first byte is used for all. This is required to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7503 * output the two bytes of a double-byte character with nothing in between.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7504 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7505 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7506 screen_char_2(off, row, col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7507 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7508 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7509 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7510 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7511 /* Check for illegal values (could be wrong when screen was resized). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7512 if (off + 1 >= (unsigned)(screen_Rows * screen_Columns))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7513 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7514
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7515 /* Outputting the last character on the screen may scrollup the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7516 * Don't to it! Mark the character invalid (update it when scrolled up) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7517 if (row == screen_Rows - 1 && col >= screen_Columns - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7518 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7519 ScreenAttrs[off] = (sattr_T)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7520 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7521 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7522
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7523 /* Output the first byte normally (positions the cursor), then write the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7524 * second byte directly. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7525 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7526 out_char(ScreenLines[off + 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7527 ++screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7528 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7529 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7530
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7531 #if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7532 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7533 * Draw a rectangle of the screen, inverted when "invert" is TRUE.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7534 * This uses the contents of ScreenLines[] and doesn't change it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7535 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7536 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7537 screen_draw_rectangle(row, col, height, width, invert)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7538 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7539 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7540 int height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7541 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7542 int invert;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7543 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7544 int r, c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7545 int off;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7546 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7547 int max_off;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7548 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7549
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7550 /* Can't use ScreenLines unless initialized */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7551 if (ScreenLines == NULL)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7552 return;
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7553
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7554 if (invert)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7555 screen_char_attr = HL_INVERSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7556 for (r = row; r < row + height; ++r)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7557 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7558 off = LineOffset[r];
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7559 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7560 max_off = off + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7561 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7562 for (c = col; c < col + width; ++c)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7563 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7564 #ifdef FEAT_MBYTE
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7565 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7566 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7567 screen_char_2(off + c, r, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7568 ++c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7569 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7570 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7571 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7572 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7573 screen_char(off + c, r, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7574 #ifdef FEAT_MBYTE
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7575 if (utf_off2cells(off + c, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7576 ++c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7577 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7578 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7579 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7580 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7581 screen_char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7582 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7583 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7584
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7585 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7586 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7587 * Redraw the characters for a vertically split window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7588 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7589 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7590 redraw_block(row, end, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7591 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7592 int end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7593 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7594 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7595 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7596 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7597
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7598 # ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7599 clip_may_clear_selection(row, end - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7600 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7601
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7602 if (wp == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7603 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7604 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7605 width = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7606 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7607 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7608 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7609 col = wp->w_wincol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7610 width = wp->w_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7611 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7612 screen_draw_rectangle(row, col, end - row, width, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7613 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7614 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7615
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7616 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7617 * 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
7618 * with character 'c1' in first column followed by 'c2' in the other columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7619 * Use attributes 'attr'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7620 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7621 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7622 screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7623 int start_row, end_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7624 int start_col, end_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7625 int c1, c2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7626 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7627 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7628 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7629 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7630 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7631 int end_off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7632 int did_delete;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7633 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7634 int norm_term;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7635 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7636 int force_next = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7637 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7638
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7639 if (end_row > screen_Rows) /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7640 end_row = screen_Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7641 if (end_col > screen_Columns) /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7642 end_col = screen_Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7643 if (ScreenLines == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7644 || start_row >= end_row
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7645 || start_col >= end_col) /* nothing to do */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7646 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7647
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7648 /* it's a "normal" terminal when not in a GUI or cterm */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7649 norm_term = (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7650 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7651 !gui.in_use &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7652 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7653 t_colors <= 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7654 for (row = start_row; row < end_row; ++row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7655 {
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7656 #ifdef FEAT_MBYTE
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7657 if (has_mbyte
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7658 # ifdef FEAT_GUI
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7659 && !gui.in_use
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7660 # endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7661 )
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7662 {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7663 /* When drawing over the right halve of a double-wide char clear
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7664 * out the left halve. When drawing over the left halve of a
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7665 * double wide-char clear out the right halve. Only needed in a
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7666 * terminal. */
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
7667 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
7668 screen_puts_len((char_u *)" ", 1, row, start_col - 1, 0);
1677
b98975453785 updated for version 7.2b-009
vimboss
parents: 1670
diff changeset
7669 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
7670 screen_puts_len((char_u *)" ", 1, row, end_col, 0);
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7671 }
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7672 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7673 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7674 * Try to use delete-line termcap code, when no attributes or in a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7675 * "normal" terminal, where a bold/italic space is just a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7676 * space.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7677 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7678 did_delete = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7679 if (c2 == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7680 && end_col == Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7681 && can_clear(T_CE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7682 && (attr == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7683 || (norm_term
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7684 && attr <= HL_ALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7685 && ((attr & ~(HL_BOLD | HL_ITALIC)) == 0))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7686 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7687 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7688 * check if we really need to clear something
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7689 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7690 col = start_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7691 if (c1 != ' ') /* don't clear first char */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7692 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7693
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7694 off = LineOffset[row] + col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7695 end_off = LineOffset[row] + end_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7696
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7697 /* skip blanks (used often, keep it fast!) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7698 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7699 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7700 while (off < end_off && ScreenLines[off] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7701 && ScreenAttrs[off] == 0 && ScreenLinesUC[off] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7702 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7703 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7704 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7705 while (off < end_off && ScreenLines[off] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7706 && ScreenAttrs[off] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7707 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7708 if (off < end_off) /* something to be cleared */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7709 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7710 col = off - LineOffset[row];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7711 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7712 term_windgoto(row, col);/* clear rest of this screen line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7713 out_str(T_CE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7714 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7715 col = end_col - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7716 while (col--) /* clear chars in ScreenLines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7717 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7718 ScreenLines[off] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7719 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7720 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7721 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7722 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7723 ScreenAttrs[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7724 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7725 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7726 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7727 did_delete = TRUE; /* the chars are cleared now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7728 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7729
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7730 off = LineOffset[row] + start_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7731 c = c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7732 for (col = start_col; col < end_col; ++col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7733 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7734 if (ScreenLines[off] != c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7735 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7736 || (enc_utf8 && (int)ScreenLinesUC[off]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7737 != (c >= 0x80 ? c : 0))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7738 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7739 || ScreenAttrs[off] != attr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7740 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7741 || force_next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7742 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7743 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7744 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7745 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7746 /* The bold trick may make a single row of pixels appear in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7747 * the next character. When a bold character is removed, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7748 * next character should be redrawn too. This happens for our
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7749 * own GUI and for some xterms. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7750 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7751 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7752 gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7753 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7754 # if defined(FEAT_GUI) && defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7755 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7756 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7757 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7758 term_is_xterm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7759 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7760 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7761 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7762 if (ScreenLines[off] != ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7763 && (ScreenAttrs[off] > HL_ALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7764 || ScreenAttrs[off] & HL_BOLD))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7765 force_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7766 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7767 force_next = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7768 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7769 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7770 ScreenLines[off] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7771 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7772 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7773 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7774 if (c >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7775 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7776 ScreenLinesUC[off] = c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7777 ScreenLinesC[0][off] = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7778 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7779 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7780 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7781 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7782 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7783 ScreenAttrs[off] = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7784 if (!did_delete || c != ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7785 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7786 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7787 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7788 if (col == start_col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7789 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7790 if (did_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7791 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7792 c = c2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7793 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7794 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7795 if (end_col == Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7796 LineWraps[row] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7797 if (row == Rows - 1) /* overwritten the command line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7798 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7799 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7800 if (c1 == ' ' && c2 == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7801 clear_cmdline = FALSE; /* command line has been cleared */
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
7802 if (start_col == 0)
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
7803 mode_displayed = FALSE; /* mode cleared or overwritten */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7804 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7805 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7806 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7807
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7808 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7809 * Check if there should be a delay. Used before clearing or redrawing the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7810 * screen or the command line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7811 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7812 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7813 check_for_delay(check_msg_scroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7814 int check_msg_scroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7815 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7816 if ((emsg_on_display || (check_msg_scroll && msg_scroll))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7817 && !did_wait_return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7818 && emsg_silent == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7819 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7820 out_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7821 ui_delay(1000L, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7822 emsg_on_display = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7823 if (check_msg_scroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7824 msg_scroll = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7825 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7826 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7827
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7828 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7829 * screen_valid - allocate screen buffers if size changed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7830 * If "clear" is TRUE: clear screen if it has been resized.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7831 * Returns TRUE if there is a valid screen to write to.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7832 * Returns FALSE when starting up and screen not initialized yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7833 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7834 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7835 screen_valid(clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7836 int clear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7837 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7838 screenalloc(clear); /* allocate screen buffers if size changed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7839 return (ScreenLines != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7840 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7841
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7842 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7843 * Resize the shell to Rows and Columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7844 * Allocate ScreenLines[] and associated items.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7845 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7846 * There may be some time between setting Rows and Columns and (re)allocating
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7847 * ScreenLines[]. This happens when starting up and when (manually) changing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7848 * the shell size. Always use screen_Rows and screen_Columns to access items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7849 * in ScreenLines[]. Use Rows and Columns for positioning text etc. where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7850 * final size of the shell is needed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7851 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7852 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7853 screenalloc(clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7854 int clear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7855 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7856 int new_row, old_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7857 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7858 int old_Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7859 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7860 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7861 int outofmem = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7862 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7863 schar_T *new_ScreenLines;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7864 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7865 u8char_T *new_ScreenLinesUC = NULL;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7866 u8char_T *new_ScreenLinesC[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7867 schar_T *new_ScreenLines2 = NULL;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7868 int i;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7869 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7870 sattr_T *new_ScreenAttrs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7871 unsigned *new_LineOffset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7872 char_u *new_LineWraps;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7873 #ifdef FEAT_WINDOWS
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7874 short *new_TabPageIdxs;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7875 tabpage_T *tp;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7876 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7877 static int entered = FALSE; /* avoid recursiveness */
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
7878 static int done_outofmem_msg = FALSE; /* did outofmem message */
1824
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7879 #ifdef FEAT_AUTOCMD
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7880 int retry_count = 0;
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7881
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7882 retry:
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7883 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7884 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7885 * Allocation of the screen buffers is done only when the size changes and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7886 * when Rows and Columns have been set and we have started doing full
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7887 * screen stuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7888 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7889 if ((ScreenLines != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7890 && Rows == screen_Rows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7891 && Columns == screen_Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7892 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7893 && enc_utf8 == (ScreenLinesUC != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7894 && (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL)
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7895 && p_mco == Screen_mco
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7896 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7897 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7898 || Rows == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7899 || Columns == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7900 || (!full_screen && ScreenLines == NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7901 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7902
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7903 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7904 * It's possible that we produce an out-of-memory message below, which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7905 * will cause this function to be called again. To break the loop, just
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7906 * return here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7907 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7908 if (entered)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7909 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7910 entered = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7911
911
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7912 /*
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7913 * Note that the window sizes are updated before reallocating the arrays,
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7914 * thus we must not redraw here!
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7915 */
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7916 ++RedrawingDisabled;
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7917
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7918 win_new_shellsize(); /* fit the windows in the new sized shell */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7919
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7920 comp_col(); /* recompute columns for shown command and ruler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7921
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7922 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7923 * We're changing the size of the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7924 * - Allocate new arrays for ScreenLines and ScreenAttrs.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7925 * - Move lines from the old arrays into the new arrays, clear extra
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7926 * lines (unless the screen is going to be cleared).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7927 * - Free the old arrays.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7928 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7929 * If anything fails, make ScreenLines NULL, so we don't do anything!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7930 * Continuing with the old ScreenLines may result in a crash, because the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7931 * size is wrong.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7932 */
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7933 FOR_ALL_TAB_WINDOWS(tp, wp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7934 win_free_lsize(wp);
1946
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7935 #ifdef FEAT_AUTOCMD
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7936 if (aucmd_win != NULL)
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7937 win_free_lsize(aucmd_win);
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7938 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7939
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7940 new_ScreenLines = (schar_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7941 (Rows + 1) * Columns * sizeof(schar_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7942 #ifdef FEAT_MBYTE
2122
476336a5ae95 updated for version 7.2.404
Bram Moolenaar <bram@zimbu.org>
parents: 2069
diff changeset
7943 vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7944 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7945 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7946 new_ScreenLinesUC = (u8char_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7947 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7948 for (i = 0; i < p_mco; ++i)
2124
dc8a5699253b updated for version 7.2.406
Bram Moolenaar <bram@zimbu.org>
parents: 2122
diff changeset
7949 new_ScreenLinesC[i] = (u8char_T *)lalloc_clear((long_u)(
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7950 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7951 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7952 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7953 new_ScreenLines2 = (schar_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7954 (Rows + 1) * Columns * sizeof(schar_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7955 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7956 new_ScreenAttrs = (sattr_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7957 (Rows + 1) * Columns * sizeof(sattr_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7958 new_LineOffset = (unsigned *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7959 Rows * sizeof(unsigned)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7960 new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE);
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7961 #ifdef FEAT_WINDOWS
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7962 new_TabPageIdxs = (short *)lalloc((long_u)(Columns * sizeof(short)), FALSE);
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7963 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7964
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
7965 FOR_ALL_TAB_WINDOWS(tp, wp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7966 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7967 if (win_alloc_lines(wp) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7968 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7969 outofmem = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7970 #ifdef FEAT_WINDOWS
1819
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7971 goto give_up;
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7972 #endif
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7973 }
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7974 }
1906
ff9ecf14efe3 updated for version 7.2-203
vimboss
parents: 1883
diff changeset
7975 #ifdef FEAT_AUTOCMD
1946
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7976 if (aucmd_win != NULL && aucmd_win->w_lines == NULL
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7977 && win_alloc_lines(aucmd_win) == FAIL)
1906
ff9ecf14efe3 updated for version 7.2-203
vimboss
parents: 1883
diff changeset
7978 outofmem = TRUE;
ff9ecf14efe3 updated for version 7.2-203
vimboss
parents: 1883
diff changeset
7979 #endif
1819
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7980 #ifdef FEAT_WINDOWS
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7981 give_up:
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7982 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7983
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7984 #ifdef FEAT_MBYTE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7985 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7986 if (new_ScreenLinesC[i] == NULL)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7987 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7988 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7989 if (new_ScreenLines == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7990 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7991 || (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7992 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7993 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7994 || new_ScreenAttrs == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7995 || new_LineOffset == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7996 || new_LineWraps == NULL
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7997 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7998 || new_TabPageIdxs == NULL
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7999 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8000 || outofmem)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8001 {
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
8002 if (ScreenLines != NULL || !done_outofmem_msg)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8003 {
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8004 /* guess the size */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8005 do_outofmem_msg((long_u)((Rows + 1) * Columns));
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8006
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8007 /* Remember we did this to avoid getting outofmem messages over
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8008 * and over again. */
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
8009 done_outofmem_msg = TRUE;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8010 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8011 vim_free(new_ScreenLines);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8012 new_ScreenLines = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8013 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8014 vim_free(new_ScreenLinesUC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8015 new_ScreenLinesUC = NULL;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8016 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8017 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8018 vim_free(new_ScreenLinesC[i]);
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8019 new_ScreenLinesC[i] = NULL;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8020 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8021 vim_free(new_ScreenLines2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8022 new_ScreenLines2 = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8023 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8024 vim_free(new_ScreenAttrs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8025 new_ScreenAttrs = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8026 vim_free(new_LineOffset);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8027 new_LineOffset = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8028 vim_free(new_LineWraps);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8029 new_LineWraps = NULL;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8030 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8031 vim_free(new_TabPageIdxs);
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8032 new_TabPageIdxs = NULL;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8033 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8034 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8035 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8036 {
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
8037 done_outofmem_msg = FALSE;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8038
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8039 for (new_row = 0; new_row < Rows; ++new_row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8040 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8041 new_LineOffset[new_row] = new_row * Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8042 new_LineWraps[new_row] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8043
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8044 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8045 * If the screen is not going to be cleared, copy as much as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8046 * possible from the old screen to the new one and clear the rest
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8047 * (used when resizing the window at the "--more--" prompt or when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8048 * executing an external command, for the GUI).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8049 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8050 if (!clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8051 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8052 (void)vim_memset(new_ScreenLines + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8053 ' ', (size_t)Columns * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8054 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8055 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8056 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8057 (void)vim_memset(new_ScreenLinesUC + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8058 0, (size_t)Columns * sizeof(u8char_T));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8059 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8060 (void)vim_memset(new_ScreenLinesC[i]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8061 + new_row * Columns,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8062 0, (size_t)Columns * sizeof(u8char_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8063 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8064 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8065 (void)vim_memset(new_ScreenLines2 + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8066 0, (size_t)Columns * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8067 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8068 (void)vim_memset(new_ScreenAttrs + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8069 0, (size_t)Columns * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8070 old_row = new_row + (screen_Rows - Rows);
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
8071 if (old_row >= 0 && ScreenLines != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8072 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8073 if (screen_Columns < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8074 len = screen_Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8075 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8076 len = Columns;
26
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
8077 #ifdef FEAT_MBYTE
571
0ae54f30d5bc updated for version 7.0162
vimboss
parents: 548
diff changeset
8078 /* When switching to utf-8 don't copy characters, they
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8079 * may be invalid now. Also when p_mco changes. */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8080 if (!(enc_utf8 && ScreenLinesUC == NULL)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8081 && p_mco == Screen_mco)
26
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
8082 #endif
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
8083 mch_memmove(new_ScreenLines + new_LineOffset[new_row],
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
8084 ScreenLines + LineOffset[old_row],
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
8085 (size_t)len * sizeof(schar_T));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8086 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8087 if (enc_utf8 && ScreenLinesUC != NULL
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8088 && p_mco == Screen_mco)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8089 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8090 mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8091 ScreenLinesUC + LineOffset[old_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8092 (size_t)len * sizeof(u8char_T));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8093 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8094 mch_memmove(new_ScreenLinesC[i]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8095 + new_LineOffset[new_row],
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8096 ScreenLinesC[i] + LineOffset[old_row],
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8097 (size_t)len * sizeof(u8char_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8098 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8099 if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8100 mch_memmove(new_ScreenLines2 + new_LineOffset[new_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8101 ScreenLines2 + LineOffset[old_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8102 (size_t)len * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8103 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8104 mch_memmove(new_ScreenAttrs + new_LineOffset[new_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8105 ScreenAttrs + LineOffset[old_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8106 (size_t)len * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8107 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8108 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8109 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8110 /* Use the last line of the screen for the current line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8111 current_ScreenLine = new_ScreenLines + Rows * Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8112 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8113
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8114 free_screenlines();
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8115
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8116 ScreenLines = new_ScreenLines;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8117 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8118 ScreenLinesUC = new_ScreenLinesUC;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8119 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8120 ScreenLinesC[i] = new_ScreenLinesC[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8121 Screen_mco = p_mco;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8122 ScreenLines2 = new_ScreenLines2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8123 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8124 ScreenAttrs = new_ScreenAttrs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8125 LineOffset = new_LineOffset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8126 LineWraps = new_LineWraps;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8127 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8128 TabPageIdxs = new_TabPageIdxs;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8129 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8130
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8131 /* It's important that screen_Rows and screen_Columns reflect the actual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8132 * size of ScreenLines[]. Set them before calling anything. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8133 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8134 old_Rows = screen_Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8135 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8136 screen_Rows = Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8137 screen_Columns = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8138
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8139 must_redraw = CLEAR; /* need to clear the screen later */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8140 if (clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8141 screenclear2();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8142
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8143 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8144 else if (gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8145 && !gui.starting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8146 && ScreenLines != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8147 && old_Rows != Rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8148 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8149 (void)gui_redraw_block(0, 0, (int)Rows - 1, (int)Columns - 1, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8150 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8151 * Adjust the position of the cursor, for when executing an external
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8152 * command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8153 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8154 if (msg_row >= Rows) /* Rows got smaller */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8155 msg_row = Rows - 1; /* put cursor at last row */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8156 else if (Rows > old_Rows) /* Rows got bigger */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8157 msg_row += Rows - old_Rows; /* put cursor in same place */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8158 if (msg_col >= Columns) /* Columns got smaller */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8159 msg_col = Columns - 1; /* put cursor at last column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8160 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8161 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8162
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8163 entered = FALSE;
911
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
8164 --RedrawingDisabled;
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
8165
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
8166 #ifdef FEAT_AUTOCMD
1824
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8167 /*
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8168 * 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
8169 * in case applying autocommands always changes Rows or Columns.
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8170 */
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8171 if (starting == 0 && ++retry_count <= 3)
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8172 {
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
8173 apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
1824
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8174 /* In rare cases, autocommands may have altered Rows or Columns,
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8175 * jump back to check if we need to allocate the screen again. */
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8176 goto retry;
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
8177 }
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
8178 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8179 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8181 void
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8182 free_screenlines()
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8183 {
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8184 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8185 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8186
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8187 vim_free(ScreenLinesUC);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8188 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8189 vim_free(ScreenLinesC[i]);
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8190 vim_free(ScreenLines2);
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8191 #endif
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8192 vim_free(ScreenLines);
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8193 vim_free(ScreenAttrs);
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8194 vim_free(LineOffset);
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8195 vim_free(LineWraps);
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8196 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8197 vim_free(TabPageIdxs);
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
8198 #endif
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8199 }
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8200
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
8201 void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8202 screenclear()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8203 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8204 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8205 screenalloc(FALSE); /* allocate screen buffers if size changed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8206 screenclear2(); /* clear the screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8208
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8209 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8210 screenclear2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8211 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8212 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8213
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8214 if (starting == NO_SCREEN || ScreenLines == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8215 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8216 || (gui.in_use && gui.starting)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8217 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8218 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8219 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8220
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8221 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8222 if (!gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8223 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8224 screen_attr = -1; /* force setting the Normal colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8225 screen_stop_highlight(); /* don't want highlighting here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8226
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8227 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8228 /* disable selection without redrawing it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8229 clip_scroll_selection(9999);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8230 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8232 /* blank out ScreenLines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8233 for (i = 0; i < Rows; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8234 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8235 lineclear(LineOffset[i], (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8236 LineWraps[i] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8237 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8239 if (can_clear(T_CL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8240 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8241 out_str(T_CL); /* clear the display */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8242 clear_cmdline = FALSE;
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
8243 mode_displayed = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8244 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8245 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8246 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8247 /* can't clear the screen, mark all chars with invalid attributes */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8248 for (i = 0; i < Rows; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8249 lineinvalid(LineOffset[i], (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8250 clear_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8251 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8253 screen_cleared = TRUE; /* can use contents of ScreenLines now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8254
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8255 win_rest_invalid(firstwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8256 redraw_cmdline = TRUE;
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
8257 #ifdef FEAT_WINDOWS
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
8258 redraw_tabline = TRUE;
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
8259 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8260 if (must_redraw == CLEAR) /* no need to clear again */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8261 must_redraw = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8262 compute_cmdrow();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8263 msg_row = cmdline_row; /* put cursor on last line for messages */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8264 msg_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8265 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8266 msg_scrolled = 0; /* can't scroll back */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8267 msg_didany = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8268 msg_didout = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8269 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8270
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8271 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8272 * Clear one line in ScreenLines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8273 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8274 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8275 lineclear(off, width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8276 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8277 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8278 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8279 (void)vim_memset(ScreenLines + off, ' ', (size_t)width * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8280 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8281 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8282 (void)vim_memset(ScreenLinesUC + off, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8283 (size_t)width * sizeof(u8char_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8284 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8285 (void)vim_memset(ScreenAttrs + off, 0, (size_t)width * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8286 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8287
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8288 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8289 * Mark one line in ScreenLines invalid by setting the attributes to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8290 * invalid value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8291 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8292 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8293 lineinvalid(off, width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8294 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8295 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8296 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8297 (void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8298 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8299
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8300 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8301 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8302 * Copy part of a Screenline for vertically split window "wp".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8303 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8304 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8305 linecopy(to, from, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8306 int to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8307 int from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8308 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8309 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8310 unsigned off_to = LineOffset[to] + wp->w_wincol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8311 unsigned off_from = LineOffset[from] + wp->w_wincol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8312
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8313 mch_memmove(ScreenLines + off_to, ScreenLines + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8314 wp->w_width * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8315 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8316 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8317 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8318 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8319
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8320 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8321 wp->w_width * sizeof(u8char_T));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8322 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8323 mch_memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from,
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
8324 wp->w_width * sizeof(u8char_T));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8325 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8326 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8327 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8328 wp->w_width * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8329 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8330 mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8331 wp->w_width * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8332 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8333 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8334
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8335 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8336 * Return TRUE if clearing with term string "p" would work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8337 * It can't work when the string is empty or it won't set the right background.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8338 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8339 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8340 can_clear(p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8341 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8342 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8343 return (*p != NUL && (t_colors <= 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8344 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8345 || gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8346 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8347 || cterm_normal_bg_color == 0 || *T_UT != NUL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8348 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8349
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8350 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8351 * Reset cursor position. Use whenever cursor was moved because of outputting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8352 * something directly to the screen (shell commands) or a terminal control
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8353 * code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8354 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8355 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8356 screen_start()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8357 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8358 screen_cur_row = screen_cur_col = 9999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8359 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8360
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8361 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8362 * Move the cursor to position "row","col" in the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8363 * This tries to find the most efficient way to move, minimizing the number of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8364 * characters sent to the terminal.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8365 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8366 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8367 windgoto(row, col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8368 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8369 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8370 {
205
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
8371 sattr_T *p;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8372 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8373 int plan;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8374 int cost;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8375 int wouldbe_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8376 int noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8377 char_u *bs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8378 int goto_cost;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8379 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8380
1213
8906c10ecbb0 updated for version 7.1b
vimboss
parents: 1112
diff changeset
8381 #define GOTO_COST 7 /* assume a term_windgoto() takes about 7 chars */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8382 #define HIGHL_COST 5 /* assume unhighlight takes 5 chars */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8383
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8384 #define PLAN_LE 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8385 #define PLAN_CR 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8386 #define PLAN_NL 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8387 #define PLAN_WRITE 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8388 /* Can't use ScreenLines unless initialized */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8389 if (ScreenLines == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8390 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8391
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8392 if (col != screen_cur_col || row != screen_cur_row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8393 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8394 /* Check for valid position. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8395 if (row < 0) /* window without text lines? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8396 row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8397 if (row >= screen_Rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8398 row = screen_Rows - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8399 if (col >= screen_Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8400 col = screen_Columns - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8401
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8402 /* check if no cursor movement is allowed in highlight mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8403 if (screen_attr && *T_MS == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8404 noinvcurs = HIGHL_COST;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8405 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8406 noinvcurs = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8407 goto_cost = GOTO_COST + noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8409 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8410 * Plan how to do the positioning:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8411 * 1. Use CR to move it to column 0, same row.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8412 * 2. Use T_LE to move it a few columns to the left.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8413 * 3. Use NL to move a few lines down, column 0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8414 * 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
8415 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8416 * Don't do this if the cursor went beyond the last column, the cursor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8417 * position is unknown then (some terminals wrap, some don't )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8418 *
1213
8906c10ecbb0 updated for version 7.1b
vimboss
parents: 1112
diff changeset
8419 * First check if the highlighting attributes allow us to write
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8420 * characters to move the cursor to the right.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8421 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8422 if (row >= screen_cur_row && screen_cur_col < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8423 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8424 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8425 * If the cursor is in the same row, bigger col, we can use CR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8426 * or T_LE.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8427 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8428 bs = NULL; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8429 attr = screen_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8430 if (row == screen_cur_row && col < screen_cur_col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8431 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8432 /* "le" is preferred over "bc", because "bc" is obsolete */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8433 if (*T_LE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8434 bs = T_LE; /* "cursor left" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8435 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8436 bs = T_BC; /* "backspace character (old) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8437 if (*bs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8438 cost = (screen_cur_col - col) * (int)STRLEN(bs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8439 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8440 cost = 999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8441 if (col + 1 < cost) /* using CR is less characters */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8442 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8443 plan = PLAN_CR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8444 wouldbe_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8445 cost = 1; /* CR is just one character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8446 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8447 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8448 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8449 plan = PLAN_LE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8450 wouldbe_col = col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8451 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8452 if (noinvcurs) /* will stop highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8453 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8454 cost += noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8455 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8456 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8457 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8458
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8459 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8460 * 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
8461 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8462 else if (row > screen_cur_row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8463 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8464 plan = PLAN_NL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8465 wouldbe_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8466 cost = (row - screen_cur_row) * 2; /* CR LF */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8467 if (noinvcurs) /* will stop highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8468 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8469 cost += noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8470 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8471 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8472 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8473
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8474 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8475 * If the cursor is in the same row, smaller col, just use write.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8476 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8477 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8478 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8479 plan = PLAN_WRITE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8480 wouldbe_col = screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8481 cost = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8482 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8484 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8485 * Check if any characters that need to be written have the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8486 * correct attributes. Also avoid UTF-8 characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8487 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8488 i = col - wouldbe_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8489 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8490 cost += i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8491 if (cost < goto_cost && i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8492 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8493 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8494 * Check if the attributes are correct without additionally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8495 * stopping highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8496 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8497 p = ScreenAttrs + LineOffset[row] + wouldbe_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8498 while (i && *p++ == attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8499 --i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8500 if (i != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8501 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8502 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8503 * Try if it works when highlighting is stopped here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8504 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8505 if (*--p == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8506 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8507 cost += noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8508 while (i && *p++ == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8509 --i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8510 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8511 if (i != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8512 cost = 999; /* different attributes, don't do it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8513 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8514 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8515 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8516 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8517 /* Don't use an UTF-8 char for positioning, it's slow. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8518 for (i = wouldbe_col; i < col; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8519 if (ScreenLinesUC[LineOffset[row] + i] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8520 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8521 cost = 999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8522 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8523 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8524 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8525 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8526 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8527
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8528 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8529 * We can do it without term_windgoto()!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8530 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8531 if (cost < goto_cost)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8532 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8533 if (plan == PLAN_LE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8534 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8535 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8536 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8537 while (screen_cur_col > col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8538 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8539 out_str(bs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8540 --screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8541 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8542 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8543 else if (plan == PLAN_CR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8544 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8545 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8546 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8547 out_char('\r');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8548 screen_cur_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8549 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8550 else if (plan == PLAN_NL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8551 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8552 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8553 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8554 while (screen_cur_row < row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8555 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8556 out_char('\n');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8557 ++screen_cur_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8558 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8559 screen_cur_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8560 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8561
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8562 i = col - screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8563 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8564 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8565 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8566 * Use cursor-right if it's one character only. Avoids
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8567 * removing a line of pixels from the last bold char, when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8568 * using the bold trick in the GUI.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8569 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8570 if (T_ND[0] != NUL && T_ND[1] == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8571 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8572 while (i-- > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8573 out_char(*T_ND);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8574 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8575 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8576 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8577 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8578
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8579 off = LineOffset[row] + screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8580 while (i-- > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8581 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8582 if (ScreenAttrs[off] != screen_attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8583 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8584 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8585 out_flush_check();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8586 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8587 out_char(ScreenLines[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8588 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8589 if (enc_dbcs == DBCS_JPNU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8590 && ScreenLines[off] == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8591 out_char(ScreenLines2[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8592 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8593 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8594 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8595 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8596 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8597 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8598 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8599 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8600 cost = 999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8601
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8602 if (cost >= goto_cost)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8603 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8604 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8605 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8606 if (row == screen_cur_row && (col > screen_cur_col) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8607 *T_CRI != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8608 term_cursor_right(col - screen_cur_col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8609 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8610 term_windgoto(row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8611 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8612 screen_cur_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8613 screen_cur_col = col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8614 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8615 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8616
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8617 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8618 * Set cursor to its position in the current window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8619 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8620 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8621 setcursor()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8622 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8623 if (redrawing())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8624 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8625 validate_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8626 windgoto(W_WINROW(curwin) + curwin->w_wrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8627 W_WINCOL(curwin) + (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8628 #ifdef FEAT_RIGHTLEFT
1545
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8629 /* With 'rightleft' set and the cursor on a double-wide
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8630 * character, position it on the leftmost column. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8631 curwin->w_p_rl ? ((int)W_WIDTH(curwin) - curwin->w_wcol - (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8632 # ifdef FEAT_MBYTE
1545
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8633 (has_mbyte
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8634 && (*mb_ptr2cells)(ml_get_cursor()) == 2
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8635 && vim_isprintc(gchar_cursor())) ? 2 :
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8636 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8637 1)) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8638 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8639 curwin->w_wcol));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8640 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8641 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8642
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8643
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8644 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8645 * insert 'line_count' lines at 'row' in window 'wp'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8646 * if 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8647 * if 'mayclear' is TRUE the screen will be cleared if it is faster than
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8648 * scrolling.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8649 * Returns FAIL if the lines are not inserted, OK for success.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8650 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8651 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8652 win_ins_lines(wp, row, line_count, invalid, mayclear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8653 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8654 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8655 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8656 int invalid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8657 int mayclear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8658 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8659 int did_delete;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8660 int nextrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8661 int lastrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8662 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8663
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8664 if (invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8665 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8666
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8667 if (wp->w_height < 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8668 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8670 if (line_count > wp->w_height - row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8671 line_count = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8672
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8673 retval = win_do_lines(wp, row, line_count, mayclear, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8674 if (retval != MAYBE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8675 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8676
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8677 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8678 * 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
8679 * lines at the bottom to avoid messing what is after the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8680 * If this fails and there are following windows, don't do anything to avoid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8681 * messing up those windows, better just redraw.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8682 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8683 did_delete = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8684 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8685 if (wp->w_next != NULL || wp->w_status_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8686 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8687 if (screen_del_lines(0, W_WINROW(wp) + wp->w_height - line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8688 line_count, (int)Rows, FALSE, NULL) == OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8689 did_delete = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8690 else if (wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8691 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8692 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8693 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8694 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8695 * if no lines deleted, blank the lines that will end up below the window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8696 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8697 if (!did_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8698 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8699 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8700 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8701 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8702 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8703 nextrow = W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8704 lastrow = nextrow + line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8705 if (lastrow > Rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8706 lastrow = Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8707 screen_fill(nextrow - line_count, lastrow - line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8708 W_WINCOL(wp), (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8709 ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8710 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8712 if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8713 == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8714 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8715 /* deletion will have messed up other windows */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8716 if (did_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8717 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8718 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8719 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8720 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8721 win_rest_invalid(W_NEXT(wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8722 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8723 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8724 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8725
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8726 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8727 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8728
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8729 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8730 * delete "line_count" window lines at "row" in window "wp"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8731 * If "invalid" is TRUE curwin->w_lines[] is invalidated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8732 * If "mayclear" is TRUE the screen will be cleared if it is faster than
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8733 * scrolling
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8734 * Return OK for success, FAIL if the lines are not deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8735 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8736 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8737 win_del_lines(wp, row, line_count, invalid, mayclear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8738 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8739 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8740 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8741 int invalid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8742 int mayclear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8743 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8744 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8746 if (invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8747 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8748
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8749 if (line_count > wp->w_height - row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8750 line_count = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8751
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8752 retval = win_do_lines(wp, row, line_count, mayclear, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8753 if (retval != MAYBE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8754 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8756 if (screen_del_lines(0, W_WINROW(wp) + row, line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8757 (int)Rows, FALSE, NULL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8758 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8759
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8760 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8761 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8762 * If there are windows or status lines below, try to put them at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8763 * correct place. If we can't do that, they have to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8764 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8765 if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8766 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8767 if (screen_ins_lines(0, W_WINROW(wp) + wp->w_height - line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8768 line_count, (int)Rows, NULL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8769 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8770 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8771 win_rest_invalid(wp->w_next);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8772 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8773 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8774 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8775 * If this is the last window and there is no status line, redraw the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8776 * command line later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8777 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8778 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8779 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8780 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8781 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8782 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8783
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8784 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8785 * Common code for win_ins_lines() and win_del_lines().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8786 * Returns OK or FAIL when the work has been done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8787 * Returns MAYBE when not finished yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8788 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8789 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8790 win_do_lines(wp, row, line_count, mayclear, del)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8791 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8792 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8793 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8794 int mayclear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8795 int del;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8796 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8797 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8798
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8799 if (!redrawing() || line_count <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8800 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8801
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8802 /* only a few lines left: redraw is faster */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8803 if (mayclear && Rows - line_count < 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8804 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8805 && wp->w_width == Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8806 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8807 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8808 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8809 screenclear(); /* will set wp->w_lines_valid to 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8810 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8811 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8812
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8813 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8814 * Delete all remaining lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8815 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8816 if (row + line_count >= wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8817 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8818 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8819 W_WINCOL(wp), (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8820 ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8821 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8822 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8823
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8824 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8825 * when scrolling, the message on the command line should be cleared,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8826 * otherwise it will stay there forever.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8827 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8828 clear_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8829
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8830 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8831 * If the terminal can set a scroll region, use that.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8832 * Always do this in a vertically split window. This will redraw from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8833 * ScreenLines[] when t_CV isn't defined. That's faster than using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8834 * win_line().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8835 * Don't use a scroll region when we are going to redraw the text, writing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8836 * a character in the lower right corner of the scroll region causes a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8837 * scroll-up in the DJGPP version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8838 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8839 if (scroll_region
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8840 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8841 || W_WIDTH(wp) != Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8842 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8843 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8844 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8845 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8846 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8847 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8848 scroll_region_set(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8849 if (del)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8850 retval = screen_del_lines(W_WINROW(wp) + row, 0, line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8851 wp->w_height - row, FALSE, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8852 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8853 retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8854 wp->w_height - row, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8855 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8856 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8857 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8858 scroll_region_reset();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8859 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8860 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8861
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8862 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8863 if (wp->w_next != NULL && p_tf) /* don't delete/insert on fast terminal */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8864 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8865 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8866
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8867 return MAYBE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8868 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8869
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8870 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8871 * window 'wp' and everything after it is messed up, mark it for redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8872 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8873 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8874 win_rest_invalid(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8875 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8876 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8877 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8878 while (wp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8879 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8880 if (wp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8881 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8882 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8883 redraw_win_later(wp, NOT_VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8884 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8885 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8886 wp = wp->w_next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8887 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8888 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8889 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8890 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8891
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8892 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8893 * The rest of the routines in this file perform screen manipulations. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8894 * given operation is performed physically on the screen. The corresponding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8895 * change is also made to the internal screen image. In this way, the editor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8896 * anticipates the effect of editing changes on the appearance of the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8897 * That way, when we call screenupdate a complete redraw isn't usually
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8898 * necessary. Another advantage is that we can keep adding code to anticipate
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8899 * screen changes, and in the meantime, everything still works.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8900 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8901
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8902 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8903 * types for inserting or deleting lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8904 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8905 #define USE_T_CAL 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8906 #define USE_T_CDL 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8907 #define USE_T_AL 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8908 #define USE_T_CE 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8909 #define USE_T_DL 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8910 #define USE_T_SR 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8911 #define USE_NL 7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8912 #define USE_T_CD 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8913 #define USE_REDRAW 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8914
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8915 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8916 * insert lines on the screen and update ScreenLines[]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8917 * 'end' is the line after the scrolled part. Normally it is Rows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8918 * When scrolling region used 'off' is the offset from the top for the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8919 * 'row' and 'end' are relative to the start of the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8920 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8921 * return FAIL for failure, OK for success.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8922 */
446
7472c565592a updated for version 7.0117
vimboss
parents: 422
diff changeset
8923 int
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8924 screen_ins_lines(off, row, line_count, end, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8925 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8926 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8927 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8928 int end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8929 win_T *wp; /* NULL or window to use width from */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8930 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8931 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8932 int j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8933 unsigned temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8934 int cursor_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8935 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8936 int result_empty;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8937 int can_ce = can_clear(T_CE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8938
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8939 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8940 * FAIL if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8941 * - there is no valid screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8942 * - the screen has to be redrawn completely
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8943 * - the line count is less than one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8944 * - the line count is more than 'ttyscroll'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8945 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8946 if (!screen_valid(TRUE) || line_count <= 0 || line_count > p_ttyscroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8947 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8948
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8949 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8950 * There are seven ways to insert lines:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8951 * 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
8952 * characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8953 * 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
8954 * the insert is just empty lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8955 * 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
8956 * present or line_count > 1. It looks better if we do all the inserts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8957 * at once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8958 * 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
8959 * insert is just empty lines and T_CE is not present or line_count >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8960 * 1.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8961 * 4. Use T_AL (insert line) if it exists.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8962 * 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
8963 * just empty lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8964 * 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
8965 * just empty lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8966 * 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
8967 * the 'da' flag is not set or we have clear line capability.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8968 * 8. redraw the characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8969 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8970 * Careful: In a hpterm scroll reverse doesn't work as expected, it moves
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8971 * the scrollbar for the window. It does have insert line, use that if it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8972 * exists.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8973 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8974 result_empty = (row + line_count >= end);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8975 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8976 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8977 type = USE_REDRAW;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8978 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8979 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8980 if (can_clear(T_CD) && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8981 type = USE_T_CD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8982 else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8983 type = USE_T_CAL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8984 else if (*T_CDL != NUL && result_empty && (line_count > 1 || !can_ce))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8985 type = USE_T_CDL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8986 else if (*T_AL != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8987 type = USE_T_AL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8988 else if (can_ce && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8989 type = USE_T_CE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8990 else if (*T_DL != NUL && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8991 type = USE_T_DL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8992 else if (*T_SR != NUL && row == 0 && (*T_DA == NUL || can_ce))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8993 type = USE_T_SR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8994 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8995 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8997 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8998 * For clearing the lines screen_del_lines() is used. This will also take
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8999 * care of t_db if necessary.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9000 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9001 if (type == USE_T_CD || type == USE_T_CDL ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9002 type == USE_T_CE || type == USE_T_DL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9003 return screen_del_lines(off, row, line_count, end, FALSE, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9004
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9005 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9006 * If text is retained below the screen, first clear or delete as many
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9007 * 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
9008 * the deleted lines won't later surface during a screen_del_lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9009 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9010 if (*T_DB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9011 screen_del_lines(off, end - line_count, line_count, end, FALSE, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9012
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9013 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9014 /* Remove a modeless selection when inserting lines halfway the screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9015 * or not the full width of the screen. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9016 if (off + row > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9017 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9018 || (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9019 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9020 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9021 clip_clear_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9022 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9023 clip_scroll_selection(-line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9024 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9025
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9026 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9027 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9028 * scrolling is actually carried out. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9029 gui_dont_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9030 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9031
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9032 if (*T_CCS != NUL) /* cursor relative to region */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9033 cursor_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9034 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9035 cursor_row = row + off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9036
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9037 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9038 * Shift LineOffset[] line_count down to reflect the inserted lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9039 * Clear the inserted lines in ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9040 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9041 row += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9042 end += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9043 for (i = 0; i < line_count; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9044 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9045 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9046 if (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9047 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9048 /* need to copy part of a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9049 j = end - 1 - i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9050 while ((j -= line_count) >= row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9051 linecopy(j + line_count, j, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9052 j += line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9053 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9054 lineclear(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9055 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9056 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9057 LineWraps[j] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9058 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9059 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9060 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9061 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9062 j = end - 1 - i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9063 temp = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9064 while ((j -= line_count) >= row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9065 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9066 LineOffset[j + line_count] = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9067 LineWraps[j + line_count] = LineWraps[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9068 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9069 LineOffset[j + line_count] = temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9070 LineWraps[j + line_count] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9071 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9072 lineclear(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9073 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9074 lineinvalid(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9075 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9076 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9077
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9078 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9079 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9080
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9081 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9082 /* redraw the characters */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9083 if (type == USE_REDRAW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9084 redraw_block(row, end, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9085 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9086 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9087 if (type == USE_T_CAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9088 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9089 term_append_lines(line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9090 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9091 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9092 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9093 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9094 for (i = 0; i < line_count; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9095 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9096 if (type == USE_T_AL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9097 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9098 if (i && cursor_row != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9099 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9100 out_str(T_AL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9101 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9102 else /* type == USE_T_SR */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9103 out_str(T_SR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9104 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9105 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9106 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9107
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9108 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9109 * With scroll-reverse and 'da' flag set we need to clear the lines that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9110 * have been scrolled down into the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9111 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9112 if (type == USE_T_SR && *T_DA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9113 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9114 for (i = 0; i < line_count; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9115 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9116 windgoto(off + i, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9117 out_str(T_CE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9118 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9119 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9120 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9121
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9122 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9123 gui_can_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9124 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9125 out_flush(); /* always flush after a scroll */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9126 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9127 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9128 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9129
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9130 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9131 * delete lines on the screen and update ScreenLines[]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9132 * 'end' is the line after the scrolled part. Normally it is Rows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9133 * When scrolling region used 'off' is the offset from the top for the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9134 * 'row' and 'end' are relative to the start of the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9135 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9136 * Return OK for success, FAIL if the lines are not deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9137 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9138 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9139 screen_del_lines(off, row, line_count, end, force, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9140 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9141 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9142 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9143 int end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9144 int force; /* even when line_count > p_ttyscroll */
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
9145 win_T *wp UNUSED; /* NULL or window to use width from */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9146 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9147 int j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9148 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9149 unsigned temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9150 int cursor_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9151 int cursor_end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9152 int result_empty; /* result is empty until end of region */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9153 int can_delete; /* deleting line codes can be used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9154 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9156 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9157 * FAIL if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9158 * - there is no valid screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9159 * - the screen has to be redrawn completely
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9160 * - the line count is less than one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9161 * - the line count is more than 'ttyscroll'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9162 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9163 if (!screen_valid(TRUE) || line_count <= 0 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9164 (!force && line_count > p_ttyscroll))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9165 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9166
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9167 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9168 * Check if the rest of the current region will become empty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9169 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9170 result_empty = row + line_count >= end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9171
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9172 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9173 * We can delete lines only when 'db' flag not set or when 'ce' option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9174 * available.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9175 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9176 can_delete = (*T_DB == NUL || can_clear(T_CE));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9177
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9178 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9179 * There are six ways to delete lines:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9180 * 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
9181 * characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9182 * 1. Use T_CD if it exists and the result is empty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9183 * 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
9184 * 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
9185 * none of the other ways work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9186 * 4. Use T_CE (erase line) if the result is empty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9187 * 5. Use T_DL (delete line) if it exists.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9188 * 6. redraw the characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9189 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9190 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9191 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9192 type = USE_REDRAW;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9193 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9194 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9195 if (can_clear(T_CD) && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9196 type = USE_T_CD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9197 #if defined(__BEOS__) && defined(BEOS_DR8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9198 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9199 * USE_NL does not seem to work in Terminal of DR8 so we set T_DB="" in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9200 * its internal termcap... this works okay for tests which test *T_DB !=
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9201 * NUL. It has the disadvantage that the user cannot use any :set t_*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9202 * command to get T_DB (back) to empty_option, only :set term=... will do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9203 * the trick...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9204 * Anyway, this hack will hopefully go away with the next OS release.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9205 * (Olaf Seibert)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9206 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9207 else if (row == 0 && T_DB == empty_option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9208 && (line_count == 1 || *T_CDL == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9209 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9210 else if (row == 0 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9211 #ifndef AMIGA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9212 /* On the Amiga, somehow '\n' on the last line doesn't always scroll
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9213 * up, so use delete-line command */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9214 line_count == 1 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9215 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9216 *T_CDL == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9217 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9218 type = USE_NL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9219 else if (*T_CDL != NUL && line_count > 1 && can_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9220 type = USE_T_CDL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9221 else if (can_clear(T_CE) && result_empty
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9222 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9223 && (wp == NULL || wp->w_width == Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9224 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9225 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9226 type = USE_T_CE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9227 else if (*T_DL != NUL && can_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9228 type = USE_T_DL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9229 else if (*T_CDL != NUL && can_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9230 type = USE_T_CDL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9231 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9232 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9234 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9235 /* Remove a modeless selection when deleting lines halfway the screen or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9236 * not the full width of the screen. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9237 if (off + row > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9238 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9239 || (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9240 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9241 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9242 clip_clear_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9243 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9244 clip_scroll_selection(line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9245 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9246
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9247 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9248 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9249 * scrolling is actually carried out. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9250 gui_dont_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9251 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9253 if (*T_CCS != NUL) /* cursor relative to region */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9254 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9255 cursor_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9256 cursor_end = end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9257 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9258 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9259 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9260 cursor_row = row + off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9261 cursor_end = end + off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9262 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9263
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9264 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9265 * Now shift LineOffset[] line_count up to reflect the deleted lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9266 * Clear the inserted lines in ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9267 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9268 row += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9269 end += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9270 for (i = 0; i < line_count; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9271 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9272 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9273 if (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9274 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9275 /* need to copy part of a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9276 j = row + i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9277 while ((j += line_count) <= end - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9278 linecopy(j - line_count, j, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9279 j -= line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9280 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9281 lineclear(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9282 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9283 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9284 LineWraps[j] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9285 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9286 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9287 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9288 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9289 /* whole width, moving the line pointers is faster */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9290 j = row + i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9291 temp = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9292 while ((j += line_count) <= end - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9293 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9294 LineOffset[j - line_count] = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9295 LineWraps[j - line_count] = LineWraps[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9296 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9297 LineOffset[j - line_count] = temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9298 LineWraps[j - line_count] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9299 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9300 lineclear(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9301 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9302 lineinvalid(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9303 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9304 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9305
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9306 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9307
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9308 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9309 /* redraw the characters */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9310 if (type == USE_REDRAW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9311 redraw_block(row, end, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9312 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9313 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9314 if (type == USE_T_CD) /* delete the lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9315 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9316 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9317 out_str(T_CD);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9318 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9319 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9320 else if (type == USE_T_CDL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9321 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9322 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9323 term_delete_lines(line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9324 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9325 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9326 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9327 * Deleting lines at top of the screen or scroll region: Just scroll
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9328 * the whole screen (scroll region) up by outputting newlines on the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9329 * last line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9330 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9331 else if (type == USE_NL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9332 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9333 windgoto(cursor_end - 1, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9334 for (i = line_count; --i >= 0; )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9335 out_char('\n'); /* cursor will remain on same line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9336 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9337 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9338 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9339 for (i = line_count; --i >= 0; )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9340 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9341 if (type == USE_T_DL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9342 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9343 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9344 out_str(T_DL); /* delete a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9345 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9346 else /* type == USE_T_CE */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9347 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9348 windgoto(cursor_row + i, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9349 out_str(T_CE); /* erase a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9350 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9351 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9352 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9353 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9354
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9355 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9356 * 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
9357 * scrolled up at the bottom of the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9358 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9359 if (*T_DB && (type == USE_T_DL || type == USE_T_CDL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9360 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9361 for (i = line_count; i > 0; --i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9362 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9363 windgoto(cursor_end - i, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9364 out_str(T_CE); /* erase a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9365 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9366 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9367 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9368
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9369 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9370 gui_can_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9371 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9372 out_flush(); /* always flush after a scroll */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9373 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9374
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9375 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9376 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9377
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9378 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9379 * show the current mode and ruler
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9380 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9381 * If clear_cmdline is TRUE, clear the rest of the cmdline.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9382 * 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
9383 * cleared only if a mode is shown.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9384 * Return the length of the message (0 if no message).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9385 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9386 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9387 showmode()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9388 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9389 int need_clear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9390 int length = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9391 int do_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9392 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9393 int nwr_save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9394 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9395 int sub_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9396 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9397
642
2392a6da4aa4 updated for version 7.0186
vimboss
parents: 639
diff changeset
9398 do_mode = ((p_smd && msg_silent == 0)
2392a6da4aa4 updated for version 7.0186
vimboss
parents: 639
diff changeset
9399 && ((State & INSERT)
2392a6da4aa4 updated for version 7.0186
vimboss
parents: 639
diff changeset
9400 || restart_edit
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9401 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9402 || VIsual_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9403 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9404 ));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9405 if (do_mode || Recording)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9406 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9407 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9408 * Don't show mode right now, when not redrawing or inside a mapping.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9409 * Call char_avail() only when we are going to show something, because
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9410 * it takes a bit of time.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9411 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9412 if (!redrawing() || (char_avail() && !KeyTyped) || msg_silent != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9413 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9414 redraw_cmdline = TRUE; /* show mode later */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9415 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9416 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9418 nwr_save = need_wait_return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9420 /* wait a bit before overwriting an important message */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9421 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9422
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9423 /* if the cmdline is more than one line high, erase top lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9424 need_clear = clear_cmdline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9425 if (clear_cmdline && cmdline_row < Rows - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9426 msg_clr_cmdline(); /* will reset clear_cmdline */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9427
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9428 /* Position on the last line in the window, column 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9429 msg_pos_mode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9430 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9431 attr = hl_attr(HLF_CM); /* Highlight mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9432 if (do_mode)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9433 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9434 MSG_PUTS_ATTR("--", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9435 #if defined(FEAT_XIM)
2520
6768ebd0bc04 Remove unused code.
Bram Moolenaar <bram@vim.org>
parents: 2509
diff changeset
9436 if (
6768ebd0bc04 Remove unused code.
Bram Moolenaar <bram@vim.org>
parents: 2509
diff changeset
9437 # ifdef FEAT_GUI_GTK
6768ebd0bc04 Remove unused code.
Bram Moolenaar <bram@vim.org>
parents: 2509
diff changeset
9438 preedit_get_status()
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9439 # else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9440 im_get_status()
2520
6768ebd0bc04 Remove unused code.
Bram Moolenaar <bram@vim.org>
parents: 2509
diff changeset
9441 # endif
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9442 )
2277
f42e0b5ff9e9 Change remaining HAVE_GTK2 to FEAT_GUI_GTK.
Bram Moolenaar <bram@vim.org>
parents: 2269
diff changeset
9443 # ifdef FEAT_GUI_GTK /* most of the time, it's not XIM being used */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9444 MSG_PUTS_ATTR(" IM", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9445 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9446 MSG_PUTS_ATTR(" XIM", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9447 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9448 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9449 #if defined(FEAT_HANGULIN) && defined(FEAT_GUI)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9450 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9451 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9452 if (hangul_input_state_get())
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 230
diff changeset
9453 MSG_PUTS_ATTR(" \307\321\261\333", attr); /* HANGUL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9454 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9455 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9456 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9457 if (edit_submode != NULL) /* CTRL-X in Insert mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9458 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9459 /* These messages can get long, avoid a wrap in a narrow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9460 * window. Prefer showing edit_submode_extra. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9461 length = (Rows - msg_row) * Columns - 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9462 if (edit_submode_extra != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9463 length -= vim_strsize(edit_submode_extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9464 if (length > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9465 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9466 if (edit_submode_pre != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9467 length -= vim_strsize(edit_submode_pre);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9468 if (length - vim_strsize(edit_submode) > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9469 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9470 if (edit_submode_pre != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9471 msg_puts_attr(edit_submode_pre, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9472 msg_puts_attr(edit_submode, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9473 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9474 if (edit_submode_extra != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9475 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9476 MSG_PUTS_ATTR(" ", attr); /* add a space in between */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9477 if ((int)edit_submode_highl < (int)HLF_COUNT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9478 sub_attr = hl_attr(edit_submode_highl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9479 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9480 sub_attr = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9481 msg_puts_attr(edit_submode_extra, sub_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9482 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9483 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9484 length = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9485 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9486 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9487 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9488 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9489 #ifdef FEAT_VREPLACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9490 if (State & VREPLACE_FLAG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9491 MSG_PUTS_ATTR(_(" VREPLACE"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9492 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9493 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9494 if (State & REPLACE_FLAG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9495 MSG_PUTS_ATTR(_(" REPLACE"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9496 else if (State & INSERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9497 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9498 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9499 if (p_ri)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9500 MSG_PUTS_ATTR(_(" REVERSE"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9501 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9502 MSG_PUTS_ATTR(_(" INSERT"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9503 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9504 else if (restart_edit == 'I')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9505 MSG_PUTS_ATTR(_(" (insert)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9506 else if (restart_edit == 'R')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9507 MSG_PUTS_ATTR(_(" (replace)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9508 else if (restart_edit == 'V')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9509 MSG_PUTS_ATTR(_(" (vreplace)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9510 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9511 if (p_hkmap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9512 MSG_PUTS_ATTR(_(" Hebrew"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9513 # ifdef FEAT_FKMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9514 if (p_fkmap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9515 MSG_PUTS_ATTR(farsi_text_5, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9516 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9517 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9518 #ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9519 if (State & LANGMAP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9520 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9521 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9522 if (curwin->w_p_arab)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9523 MSG_PUTS_ATTR(_(" Arabic"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9524 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9525 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9526 MSG_PUTS_ATTR(_(" (lang)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9527 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9528 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9529 if ((State & INSERT) && p_paste)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9530 MSG_PUTS_ATTR(_(" (paste)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9531
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9532 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9533 if (VIsual_active)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9534 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9535 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9537 /* Don't concatenate separate words to avoid translation
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9538 * problems. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9539 switch ((VIsual_select ? 4 : 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9540 + (VIsual_mode == Ctrl_V) * 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9541 + (VIsual_mode == 'V'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9542 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9543 case 0: p = N_(" VISUAL"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9544 case 1: p = N_(" VISUAL LINE"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9545 case 2: p = N_(" VISUAL BLOCK"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9546 case 4: p = N_(" SELECT"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9547 case 5: p = N_(" SELECT LINE"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9548 default: p = N_(" SELECT BLOCK"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9549 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9550 MSG_PUTS_ATTR(_(p), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9551 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9552 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9553 MSG_PUTS_ATTR(" --", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9554 }
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9555
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9556 need_clear = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9557 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9558 if (Recording
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9559 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9560 && edit_submode == NULL /* otherwise it gets too long */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9561 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9562 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9563 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9564 MSG_PUTS_ATTR(_("recording"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9565 need_clear = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9566 }
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9567
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9568 mode_displayed = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9569 if (need_clear || clear_cmdline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9570 msg_clr_eos();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9571 msg_didout = FALSE; /* overwrite this message */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9572 length = msg_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9573 msg_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9574 need_wait_return = nwr_save; /* never ask for hit-return for this */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9575 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9576 else if (clear_cmdline && msg_silent == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9577 /* Clear the whole command line. Will reset "clear_cmdline". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9578 msg_clr_cmdline();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9579
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9580 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9581 # ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9582 /* In Visual mode the size of the selected area must be redrawn. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9583 if (VIsual_active)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9584 clear_showcmd();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9585 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9586
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9587 /* If the last window has no status line, the ruler is after the mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9588 * message and must be redrawn */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9589 if (redrawing()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9590 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9591 && lastwin->w_status_height == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9592 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9593 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9594 win_redr_ruler(lastwin, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9595 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9596 redraw_cmdline = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9597 clear_cmdline = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9599 return length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9600 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9601
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9602 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9603 * Position for a mode message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9604 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9605 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9606 msg_pos_mode()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9607 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9608 msg_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9609 msg_row = Rows - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9610 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9611
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9612 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9613 * Delete mode message. Used when ESC is typed which is expected to end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9614 * Insert mode (but Insert mode didn't end yet!).
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9615 * Caller should check "mode_displayed".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9616 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9617 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9618 unshowmode(force)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9619 int force;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9620 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9621 /*
2055
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
9622 * Don't delete it right now, when not redrawing or inside a mapping.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9623 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9624 if (!redrawing() || (!force && char_avail() && !KeyTyped))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9625 redraw_cmdline = TRUE; /* delete mode later */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9626 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9627 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9628 msg_pos_mode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9629 if (Recording)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9630 MSG_PUTS_ATTR(_("recording"), hl_attr(HLF_CM));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9631 msg_clr_eos();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9632 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9633 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9634
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9635 #if defined(FEAT_WINDOWS)
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9636 /*
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9637 * Draw the tab pages line at the top of the Vim window.
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9638 */
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9639 static void
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9640 draw_tabline()
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9641 {
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9642 int tabcount = 0;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9643 tabpage_T *tp;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9644 int tabwidth;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9645 int col = 0;
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9646 int scol = 0;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9647 int attr;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9648 win_T *wp;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
9649 win_T *cwp;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
9650 int wincount;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
9651 int modified;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9652 int c;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9653 int len;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9654 int attr_sel = hl_attr(HLF_TPS);
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9655 int attr_nosel = hl_attr(HLF_TP);
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9656 int attr_fill = hl_attr(HLF_TPF);
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9657 char_u *p;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9658 int room;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9659 int use_sep_chars = (t_colors < 8
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9660 #ifdef FEAT_GUI
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9661 && !gui.in_use
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9662 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9663 );
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9664
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9665 redraw_tabline = FALSE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9666
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9667 #ifdef FEAT_GUI_TABLINE
798
95dac6af3b3a updated for version 7.0232
vimboss
parents: 777
diff changeset
9668 /* Take care of a GUI tabline. */
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9669 if (gui_use_tabline())
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9670 {
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9671 gui_update_tabline();
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9672 return;
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9673 }
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9674 #endif
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9675
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9676 if (tabline_height() < 1)
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9677 return;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9678
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9679 #if defined(FEAT_STL_OPT)
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9680
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9681 /* Init TabPageIdxs[] to zero: Clicking outside of tabs has no effect. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9682 for (scol = 0; scol < Columns; ++scol)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9683 TabPageIdxs[scol] = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9684
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9685 /* Use the 'tabline' option if it's set. */
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9686 if (*p_tal != NUL)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9687 {
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9688 int save_called_emsg = called_emsg;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9689
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9690 /* Check for an error. If there is one we would loop in redrawing the
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9691 * screen. Avoid that by making 'tabline' empty. */
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9692 called_emsg = FALSE;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9693 win_redr_custom(NULL, FALSE);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9694 if (called_emsg)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9695 set_string_option_direct((char_u *)"tabline", -1,
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 688
diff changeset
9696 (char_u *)"", OPT_FREE, SID_ERROR);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9697 called_emsg |= save_called_emsg;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9698 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9699 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9700 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9701 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9702 for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9703 ++tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9704
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9705 tabwidth = (Columns - 1 + tabcount / 2) / tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9706 if (tabwidth < 6)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9707 tabwidth = 6;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9708
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9709 attr = attr_nosel;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9710 tabcount = 0;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9711 scol = 0;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9712 for (tp = first_tabpage; tp != NULL && col < Columns - 4;
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9713 tp = tp->tp_next)
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9714 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9715 scol = col;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9716
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9717 if (tp->tp_topframe == topframe)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9718 attr = attr_sel;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9719 if (use_sep_chars && col > 0)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9720 screen_putchar('|', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9721
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9722 if (tp->tp_topframe != topframe)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9723 attr = attr_nosel;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9724
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9725 screen_putchar(' ', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9726
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9727 if (tp == curtab)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9728 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9729 cwp = curwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9730 wp = firstwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9731 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9732 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9733 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9734 cwp = tp->tp_curwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9735 wp = tp->tp_firstwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9736 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9737
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9738 modified = FALSE;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9739 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9740 if (bufIsChanged(wp->w_buffer))
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9741 modified = TRUE;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9742 if (modified || wincount > 1)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9743 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9744 if (wincount > 1)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9745 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9746 vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
9747 len = (int)STRLEN(NameBuff);
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9748 if (col + len >= Columns - 3)
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9749 break;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9750 screen_puts_len(NameBuff, len, 0, col,
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9751 #if defined(FEAT_SYN_HL)
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9752 hl_combine_attr(attr, hl_attr(HLF_T))
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9753 #else
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9754 attr
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9755 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9756 );
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9757 col += len;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9758 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9759 if (modified)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9760 screen_puts_len((char_u *)"+", 1, 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9761 screen_putchar(' ', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9762 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9763
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9764 room = scol - col + tabwidth - 1;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9765 if (room > 0)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9766 {
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9767 /* Get buffer name in NameBuff[] */
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9768 get_trans_bufname(cwp->w_buffer);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
9769 shorten_dir(NameBuff);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9770 len = vim_strsize(NameBuff);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9771 p = NameBuff;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9772 #ifdef FEAT_MBYTE
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9773 if (has_mbyte)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9774 while (len > room)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9775 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9776 len -= ptr2cells(p);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9777 mb_ptr_adv(p);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9778 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9779 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9780 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9781 if (len > room)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9782 {
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9783 p += len - room;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9784 len = room;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9785 }
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9786 if (len > Columns - col - 1)
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9787 len = Columns - col - 1;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9788
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
9789 screen_puts_len(p, (int)STRLEN(p), 0, col, attr);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9790 col += len;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9791 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9792 screen_putchar(' ', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9793
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9794 /* Store the tab page number in TabPageIdxs[], so that
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9795 * jump_to_mouse() knows where each one is. */
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9796 ++tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9797 while (scol < col)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9798 TabPageIdxs[scol++] = tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9799 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9800
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9801 if (use_sep_chars)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9802 c = '_';
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9803 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9804 c = ' ';
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9805 screen_fill(0, 1, col, (int)Columns, c, c, attr_fill);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9806
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9807 /* Put an "X" for closing the current tab if there are several. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9808 if (first_tabpage->tp_next != NULL)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9809 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9810 screen_putchar('X', 0, (int)Columns - 1, attr_nosel);
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9811 TabPageIdxs[Columns - 1] = -999;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9812 }
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9813 }
834
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9814
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9815 /* Reset the flag here again, in case evaluating 'tabline' causes it to be
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9816 * set. */
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9817 redraw_tabline = FALSE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9818 }
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9819
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9820 /*
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9821 * Get buffer name for "buf" into NameBuff[].
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9822 * Takes care of special buffer names and translates special characters.
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9823 */
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9824 void
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9825 get_trans_bufname(buf)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9826 buf_T *buf;
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9827 {
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9828 if (buf_spname(buf) != NULL)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9829 STRCPY(NameBuff, buf_spname(buf));
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9830 else
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9831 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9832 trans_characters(NameBuff, MAXPATHL);
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9833 }
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9834 #endif
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9835
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9836 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9837 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9838 * Get the character to use in a status line. Get its attributes in "*attr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9839 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9840 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9841 fillchar_status(attr, is_curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9842 int *attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9843 int is_curwin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9844 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9845 int fill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9846 if (is_curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9847 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9848 *attr = hl_attr(HLF_S);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9849 fill = fill_stl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9850 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9851 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9852 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9853 *attr = hl_attr(HLF_SNC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9854 fill = fill_stlnc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9855 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9856 /* Use fill when there is highlighting, and highlighting of current
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9857 * window differs, or the fillchars differ, or this is not the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9858 * current window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9859 if (*attr != 0 && ((hl_attr(HLF_S) != hl_attr(HLF_SNC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9860 || !is_curwin || firstwin == lastwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9861 || (fill_stl != fill_stlnc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9862 return fill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9863 if (is_curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9864 return '^';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9865 return '=';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9866 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9867 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9868
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9869 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9870 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9871 * Get the character to use in a separator between vertically split windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9872 * Get its attributes in "*attr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9873 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9874 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9875 fillchar_vsep(attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9876 int *attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9877 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9878 *attr = hl_attr(HLF_C);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9879 if (*attr == 0 && fill_vert == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9880 return '|';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9881 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9882 return fill_vert;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9883 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9884 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9885
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9886 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9887 * Return TRUE if redrawing should currently be done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9888 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9889 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9890 redrawing()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9891 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9892 return (!RedrawingDisabled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9893 && !(p_lz && char_avail() && !KeyTyped && !do_redraw));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9894 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9895
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9896 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9897 * Return TRUE if printing messages should currently be done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9898 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9899 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9900 messaging()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9901 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9902 return (!(p_lz && char_avail() && !KeyTyped));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9903 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9904
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9905 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9906 * Show current status info in ruler and various other places
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9907 * If always is FALSE, only show ruler if position has changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9908 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9909 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9910 showruler(always)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9911 int always;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9912 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9913 if (!always && !redrawing())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9914 return;
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9915 #ifdef FEAT_INS_EXPAND
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9916 if (pum_visible())
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9917 {
639
c79d4df4686e updated for version 7.0185
vimboss
parents: 625
diff changeset
9918 # ifdef FEAT_WINDOWS
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9919 /* Don't redraw right now, do it later. */
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9920 curwin->w_redr_status = TRUE;
639
c79d4df4686e updated for version 7.0185
vimboss
parents: 625
diff changeset
9921 # endif
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9922 return;
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9923 }
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9924 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9925 #if defined(FEAT_STL_OPT) && defined(FEAT_WINDOWS)
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
9926 if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height)
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9927 {
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
9928 redraw_custom_statusline(curwin);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9929 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9930 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9931 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9932 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9933 win_redr_ruler(curwin, always);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9934 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9935
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9936 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9937 if (need_maketitle
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9938 # ifdef FEAT_STL_OPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9939 || (p_icon && (stl_syntax & STL_IN_ICON))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9940 || (p_title && (stl_syntax & STL_IN_TITLE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9941 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9942 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9943 maketitle();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9944 #endif
1588
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9945 #ifdef FEAT_WINDOWS
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9946 /* Redraw the tab pages line if needed. */
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9947 if (redraw_tabline)
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9948 draw_tabline();
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9949 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9950 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9951
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9952 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9953 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9954 win_redr_ruler(wp, always)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9955 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9956 int always;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9957 {
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9958 #define RULER_BUF_LEN 70
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9959 char_u buffer[RULER_BUF_LEN];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9960 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9961 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9962 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9963 int empty_line = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9964 colnr_T virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9965 int i;
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9966 size_t len;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9967 int o;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9968 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9969 int this_ru_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9970 int off = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9971 int width = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9972 # define WITH_OFF(x) x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9973 # define WITH_WIDTH(x) x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9974 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9975 # define WITH_OFF(x) 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9976 # define WITH_WIDTH(x) Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9977 # define this_ru_col ru_col
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9978 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9980 /* If 'ruler' off or redrawing disabled, don't do anything */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9981 if (!p_ru)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9982 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9983
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9984 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9985 * Check if cursor.lnum is valid, since win_redr_ruler() may be called
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9986 * after deleting lines, before cursor.lnum is corrected.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9987 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9988 if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9989 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9990
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9991 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9992 /* Don't draw the ruler while doing insert-completion, it might overwrite
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9993 * the (long) mode message. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9994 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9995 if (wp == lastwin && lastwin->w_status_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9996 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9997 if (edit_submode != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9998 return;
540
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
9999 /* Don't draw the ruler when the popup menu is visible, it may overlap. */
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
10000 if (pum_visible())
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
10001 return;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10002 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10003
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10004 #ifdef FEAT_STL_OPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10005 if (*p_ruf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10006 {
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
10007 int save_called_emsg = called_emsg;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
10008
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
10009 called_emsg = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10010 win_redr_custom(wp, TRUE);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
10011 if (called_emsg)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
10012 set_string_option_direct((char_u *)"rulerformat", -1,
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 688
diff changeset
10013 (char_u *)"", OPT_FREE, SID_ERROR);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
10014 called_emsg |= save_called_emsg;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10015 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10016 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10017 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10018
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10019 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10020 * Check if not in Insert mode and the line is empty (will show "0-1").
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10021 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10022 if (!(State & INSERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10023 && *ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE) == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10024 empty_line = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10025
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10026 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10027 * Only draw the ruler when something changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10028 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10029 validate_virtcol_win(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10030 if ( redraw_cmdline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10031 || always
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10032 || wp->w_cursor.lnum != wp->w_ru_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10033 || wp->w_cursor.col != wp->w_ru_cursor.col
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10034 || wp->w_virtcol != wp->w_ru_virtcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10035 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10036 || wp->w_cursor.coladd != wp->w_ru_cursor.coladd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10037 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10038 || wp->w_topline != wp->w_ru_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10039 || wp->w_buffer->b_ml.ml_line_count != wp->w_ru_line_count
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10040 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10041 || wp->w_topfill != wp->w_ru_topfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10042 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10043 || empty_line != wp->w_ru_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10044 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10045 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10046 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10047 if (wp->w_status_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10048 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10049 row = W_WINROW(wp) + wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10050 fillchar = fillchar_status(&attr, wp == curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10051 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10052 off = W_WINCOL(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10053 width = W_WIDTH(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10054 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10055 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10056 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10057 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10058 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10059 row = Rows - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10060 fillchar = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10061 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10062 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10063 width = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10064 off = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10065 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10066 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10067
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10068 /* In list mode virtcol needs to be recomputed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10069 virtcol = wp->w_virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10070 if (wp->w_p_list && lcs_tab1 == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10071 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10072 wp->w_p_list = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10073 getvvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10074 wp->w_p_list = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10075 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10076
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10077 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10078 * Some sprintfs return the length, some return a pointer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10079 * To avoid portability problems we use strlen() here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10080 */
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
10081 vim_snprintf((char *)buffer, RULER_BUF_LEN, "%ld,",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10082 (wp->w_buffer->b_ml.ml_flags & ML_EMPTY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10083 ? 0L
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10084 : (long)(wp->w_cursor.lnum));
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
10085 len = STRLEN(buffer);
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
10086 col_print(buffer + len, RULER_BUF_LEN - len,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10087 empty_line ? 0 : (int)wp->w_cursor.col + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10088 (int)virtcol + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10089
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10090 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10091 * Add a "50%" if there is room for it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10092 * On the last line, don't print in the last column (scrolls the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10093 * screen up on some terminals).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10094 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10095 i = (int)STRLEN(buffer);
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
10096 get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10097 o = i + vim_strsize(buffer + i + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10098 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10099 if (wp->w_status_height == 0) /* can't use last char of screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10100 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10101 ++o;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10102 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10103 this_ru_col = ru_col - (Columns - width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10104 if (this_ru_col < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10105 this_ru_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10106 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10107 /* Never use more than half the window/screen width, leave the other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10108 * half for the filename. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10109 if (this_ru_col < (WITH_WIDTH(width) + 1) / 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10110 this_ru_col = (WITH_WIDTH(width) + 1) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10111 if (this_ru_col + o < WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10112 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10113 while (this_ru_col + o < WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10114 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10115 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10116 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10117 i += (*mb_char2bytes)(fillchar, buffer + i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10118 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10119 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10120 buffer[i++] = fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10121 ++o;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10122 }
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
10123 get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10124 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10125 /* Truncate at window boundary. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10126 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10127 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10128 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10129 o = 0;
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
10130 for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10131 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10132 o += (*mb_ptr2cells)(buffer + i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10133 if (this_ru_col + o > WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10134 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10135 buffer[i] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10136 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10137 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10138 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10139 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10140 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10141 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10142 if (this_ru_col + (int)STRLEN(buffer) > WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10143 buffer[WITH_WIDTH(width) - this_ru_col] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10145 screen_puts(buffer, row, this_ru_col + WITH_OFF(off), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10146 i = redraw_cmdline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10147 screen_fill(row, row + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10148 this_ru_col + WITH_OFF(off) + (int)STRLEN(buffer),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10149 (int)(WITH_OFF(off) + WITH_WIDTH(width)),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10150 fillchar, fillchar, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10151 /* don't redraw the cmdline because of showing the ruler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10152 redraw_cmdline = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10153 wp->w_ru_cursor = wp->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10154 wp->w_ru_virtcol = wp->w_virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10155 wp->w_ru_empty = empty_line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10156 wp->w_ru_topline = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10157 wp->w_ru_line_count = wp->w_buffer->b_ml.ml_line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10158 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10159 wp->w_ru_topfill = wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10160 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10161 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10162 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10163 #endif
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10164
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10165 #if defined(FEAT_LINEBREAK) || defined(PROTO)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10166 /*
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10167 * 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
10168 * Caller may need to check if 'number' or 'relativenumber' is set.
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10169 * Otherwise it depends on 'numberwidth' and the line count.
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10170 */
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10171 int
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10172 number_width(wp)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10173 win_T *wp;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10174 {
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10175 int n;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10176 linenr_T lnum;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10177
2178
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10178 if (wp->w_p_nu)
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10179 /* 'number' */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10180 lnum = wp->w_buffer->b_ml.ml_line_count;
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10181 else
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10182 /* 'relativenumber' */
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10183 lnum = wp->w_height;
c6f1aa1e9f32 Add 'relativenumber' patch from Markus Heidelberg.
Bram Moolenaar <bram@vim.org>
parents: 2124
diff changeset
10184
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10185 if (lnum == wp->w_nrwidth_line_count)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10186 return wp->w_nrwidth_width;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10187 wp->w_nrwidth_line_count = lnum;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10188
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10189 n = 0;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10190 do
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10191 {
856
8cd729851562 updated for version 7.0g
vimboss
parents: 849
diff changeset
10192 lnum /= 10;
8cd729851562 updated for version 7.0g
vimboss
parents: 849
diff changeset
10193 ++n;
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10194 } while (lnum > 0);
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10195
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10196 /* 'numberwidth' gives the minimal width plus one */
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10197 if (n < wp->w_p_nuw - 1)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10198 n = wp->w_p_nuw - 1;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10199
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10200 wp->w_nrwidth_width = n;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10201 return n;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10202 }
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
10203 #endif