annotate src/screen.c @ 2103:89dc68c0ab6f v7.2.386

updated for version 7.2.386 Problem: Focus hack for KDE 3.1 causes problems for other window managers. Solution: Remove the hack. (forwarded by Joel Bradshaw)
author Bram Moolenaar <bram@zimbu.org>
date Wed, 10 Mar 2010 12:25:03 +0100
parents 63613d8d7e4d
children 476336a5ae95
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 * character without composing chars ScreenLinesUC[] will be 0. When the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 * character occupies two display cells the next byte in ScreenLines[] is 0.
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
30 * ScreenLinesC[][] contain up to 'maxcombine' composing characters
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 * (drawn on top of the first character). They are 0 when not used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 * ScreenLines2[] is only used for euc-jp to store the second byte if the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 * first byte is 0x8e (single-width character).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 * The screen_*() functions write to the screen and handle updating
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 * ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 * update_screen() is the function that updates all windows and status lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 * 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
40 * called from other places when an immediate screen update is needed.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 * The part of the buffer that is displayed in a window is set with:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 * - w_topline (first buffer line in window)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 * - w_topfill (filler line above the first line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 * - w_leftcol (leftmost window cell in window),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 * - w_skipcol (skipped window cells of first line)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 * 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
49 * action to update the display. The main loop will check if w_topline is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 * valid and update it (scroll the window) when needed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 * Commands that scroll a window change w_topline and must call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 * check_cursor() to move the cursor into the visible part of the window, and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 * call redraw_later(VALID) to have the window displayed by update_screen()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 * later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 * Commands that change text in the buffer must call changed_bytes() or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 * changed_lines() to mark the area that changed and will require updating
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 * later. The main loop will call update_screen(), which will update each
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 * window that shows the changed buffer. This assumes text above the change
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 * can remain displayed as it is. Text after the change may need updating for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 * scrolling, folding and syntax highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 * Commands that change how a window is displayed (e.g., setting 'list') or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 * invalidate the contents of a window in another way (e.g., change fold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 * settings), must call redraw_later(NOT_VALID) to have the whole window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 * redisplayed by update_screen() later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 * Commands that change how a buffer is displayed (e.g., setting 'tabstop')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 * must call redraw_curbuf_later(NOT_VALID) to have all the windows for the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 * buffer redisplayed by update_screen() later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 *
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
73 * Commands that change highlighting and possibly cause a scroll too must call
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
74 * redraw_later(SOME_VALID) to update the whole window but still use scrolling
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
75 * to avoid redrawing everything. But the length of displayed lines must not
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
76 * change, use NOT_VALID then.
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
77 *
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 * Commands that move the window position must call redraw_later(NOT_VALID).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 * TODO: should minimize redrawing by scrolling when possible.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 * Commands that change everything (e.g., resizing the screen) must call
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 * redraw_all_later(NOT_VALID) or redraw_all_later(CLEAR).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
83 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
84 * Things that are handled indirectly:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
85 * - When messages scroll the screen up, msg_scrolled will be set and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
86 * update_screen() called to redraw.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
87 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
88
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
89 #include "vim.h"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
90
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
91 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
92 * The attributes that are actually active for writing to the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
93 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
94 static int screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
95
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
96 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
97 * Positioning the cursor is reduced by remembering the last position.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
98 * Mostly used by windgoto() and screen_char().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
99 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
100 static int screen_cur_row, screen_cur_col; /* last known cursor position */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
101
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
102 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
103 static match_T search_hl; /* used for 'hlsearch' highlight matching */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
104 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
105
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
106 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
107 static foldinfo_T win_foldinfo; /* info for 'foldcolumn' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
108 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
109
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
110 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
111 * Buffer for one screen line (characters and attributes).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
112 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
113 static schar_T *current_ScreenLine;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
114
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
115 static void win_update __ARGS((win_T *wp));
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
116 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
117 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
118 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
119 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
120 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
121 #endif
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
122 static int win_line __ARGS((win_T *, linenr_T, int, int, int nochange));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
123 static int char_needs_redraw __ARGS((int off_from, int off_to, int cols));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
124 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
125 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
126 # 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
127 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
128 static void screen_line __ARGS((int row, int coloff, int endcol, int clear_width));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
129 # define SCREEN_LINE(r, o, e, c, rl) screen_line((r), (o), (e), (c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
130 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
131 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
132 static void draw_vsep_win __ARGS((win_T *wp, int row));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
133 #endif
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
134 #ifdef FEAT_STL_OPT
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
135 static void redraw_custom_statusline __ARGS((win_T *wp));
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
136 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
137 #ifdef FEAT_SEARCH_EXTRA
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
138 #define SEARCH_HL_PRIORITY 0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
139 static void start_search_hl __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
140 static void end_search_hl __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
141 static void prepare_search_hl __ARGS((win_T *wp, linenr_T lnum));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
142 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
143 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
144 static void screen_start_highlight __ARGS((int attr));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
145 static void screen_char __ARGS((unsigned off, int row, int col));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
146 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
147 static void screen_char_2 __ARGS((unsigned off, int row, int col));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
148 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
149 static void screenclear2 __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
150 static void lineclear __ARGS((unsigned off, int width));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
151 static void lineinvalid __ARGS((unsigned off, int width));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
152 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
153 static void linecopy __ARGS((int to, int from, win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
154 static void redraw_block __ARGS((int row, int end, win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
155 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
156 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
157 static void win_rest_invalid __ARGS((win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
158 static void msg_pos_mode __ARGS((void));
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
159 #if defined(FEAT_WINDOWS)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
160 static void draw_tabline __ARGS((void));
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
161 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
162 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
163 static int fillchar_status __ARGS((int *attr, int is_curwin));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
164 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
165 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
166 static int fillchar_vsep __ARGS((int *attr));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
167 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
168 #ifdef FEAT_STL_OPT
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
169 static void win_redr_custom __ARGS((win_T *wp, int draw_ruler));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
170 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
171 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
172 static void win_redr_ruler __ARGS((win_T *wp, int always));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
173 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
175 #if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
176 /* Ugly global: overrule attribute used by screen_char() */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
177 static int screen_char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
178 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
179
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
180 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
181 * Redraw the current window later, with update_screen(type).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
182 * Set must_redraw only if not already set to a higher value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
183 * e.g. if must_redraw is CLEAR, type NOT_VALID will do nothing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
184 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
185 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
186 redraw_later(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
187 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
189 redraw_win_later(curwin, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
190 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
191
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
192 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
193 redraw_win_later(wp, type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
194 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
195 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
196 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
197 if (wp->w_redr_type < type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
198 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
199 wp->w_redr_type = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
200 if (type >= NOT_VALID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
201 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
202 if (must_redraw < type) /* must_redraw is the maximum of all windows */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
203 must_redraw = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
204 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
205 }
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 * Force a complete redraw later. Also resets the highlighting. To be used
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
209 * after executing a shell command that messes up the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
210 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
211 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
212 redraw_later_clear()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
213 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
214 redraw_all_later(CLEAR);
826
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
215 #ifdef FEAT_GUI
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
216 if (gui.in_use)
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
217 /* Use a code that will reset gui.highlight_mask in
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
218 * gui_stop_highlight(). */
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
219 screen_attr = HL_ALL + 1;
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
220 else
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
221 #endif
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
222 /* Use attributes that is very unlikely to appear in text. */
1cdd2661f34c updated for version 7.0d01
vimboss
parents: 820
diff changeset
223 screen_attr = HL_BOLD | HL_UNDERLINE | HL_INVERSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
224 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
225
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
226 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
227 * Mark all windows to be redrawn later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
228 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
229 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
230 redraw_all_later(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
231 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
232 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
233 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
235 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
236 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
237 redraw_win_later(wp, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
238 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
241 /*
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
242 * Mark all windows that are editing the current buffer to be updated later.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
243 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
244 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
245 redraw_curbuf_later(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
246 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
247 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
248 redraw_buf_later(curbuf, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
249 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
250
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
251 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
252 redraw_buf_later(buf, type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
253 buf_T *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
254 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
255 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
256 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
258 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
259 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
260 if (wp->w_buffer == buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
261 redraw_win_later(wp, type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
262 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
263 }
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 * Changed something in the current window, at buffer line "lnum", that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
267 * requires that line and possibly other lines to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
268 * Used when entering/leaving Insert mode with the cursor on a folded line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
269 * Used to remove the "$" from a change command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
270 * Note that when also inserting/deleting lines w_redraw_top and w_redraw_bot
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
271 * may become invalid and the whole window will have to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
272 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
273 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
274 redrawWinline(lnum, invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
275 linenr_T lnum;
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
276 int invalid UNUSED; /* window line height is invalid now */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
277 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
278 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
279 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
280 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
282 if (curwin->w_redraw_top == 0 || curwin->w_redraw_top > lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
283 curwin->w_redraw_top = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
284 if (curwin->w_redraw_bot == 0 || curwin->w_redraw_bot < lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
285 curwin->w_redraw_bot = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
286 redraw_later(VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
287
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
288 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
289 if (invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
290 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
291 /* A w_lines[] entry for this lnum has become invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
292 i = find_wl_entry(curwin, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
293 if (i >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
294 curwin->w_lines[i].wl_valid = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
295 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
296 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
297 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
298
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
299 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
300 * update all windows that are editing the current buffer
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
301 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
302 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
303 update_curbuf(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
304 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
305 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
306 redraw_curbuf_later(type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
307 update_screen(type);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
308 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
309
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
310 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
311 * update_screen()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
312 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
313 * Based on the current value of curwin->w_topline, transfer a screenfull
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
314 * of stuff from Filemem to ScreenLines[], and update curwin->w_botline.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
315 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
316 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
317 update_screen(type)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
318 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
319 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
320 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
321 static int did_intro = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
322 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
323 int did_one;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
324 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
325
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
326 /* Don't do anything if the screen structures are (not yet) valid. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
327 if (!screen_valid(TRUE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
328 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
329
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
330 if (must_redraw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
331 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
332 if (type < must_redraw) /* use maximal type */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
333 type = must_redraw;
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
334
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
335 /* 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
336 * reason to redraw while busy redrawing (e.g., asynchronous
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
337 * scrolling), or update_topline() in win_update() will cause a
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
338 * scroll, the screen will be redrawn later or in win_update(). */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
339 must_redraw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
340 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
342 /* Need to update w_lines[]. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
343 if (curwin->w_lines_valid == 0 && type < NOT_VALID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
344 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
345
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
346 /* Postpone the redrawing when it's not needed and when being called
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
347 * recursively. */
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
348 if (!redrawing() || updating_screen)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
349 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
350 redraw_later(type); /* remember type for next time */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
351 must_redraw = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
352 if (type > INVERTED_ALL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
353 curwin->w_lines_valid = 0; /* don't use w_lines[].wl_size now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
354 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
355 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
357 updating_screen = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
358 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
359 ++display_tick; /* let syntax code know we're in a next round of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
360 * display updating */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
361 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
362
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
363 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
364 * if the screen was scrolled up when displaying a message, scroll it down
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
365 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
366 if (msg_scrolled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
367 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
368 clear_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
369 if (msg_scrolled > Rows - 5) /* clearing is faster */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
370 type = CLEAR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
371 else if (type != CLEAR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
373 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
374 if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, NULL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
375 type = CLEAR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
376 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
377 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
378 if (W_WINROW(wp) < msg_scrolled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
379 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
380 if (W_WINROW(wp) + wp->w_height > msg_scrolled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
381 && wp->w_redr_type < REDRAW_TOP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
382 && wp->w_lines_valid > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
383 && wp->w_topline == wp->w_lines[0].wl_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
384 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
385 wp->w_upd_rows = msg_scrolled - W_WINROW(wp);
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 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
388 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
389 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
390 wp->w_redr_type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
391 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
392 if (W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
393 <= msg_scrolled)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
394 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
395 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
397 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
398 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
399 redraw_cmdline = TRUE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
400 #ifdef FEAT_WINDOWS
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
401 redraw_tabline = TRUE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
402 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
403 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
404 msg_scrolled = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
405 need_wait_return = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
406 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
407
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
408 /* reset cmdline_row now (may have been changed temporarily) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
409 compute_cmdrow();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
410
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
411 /* Check for changed highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
412 if (need_highlight_changed)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
413 highlight_changed();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
414
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
415 if (type == CLEAR) /* first clear screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
416 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
417 screenclear(); /* will reset clear_cmdline */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
418 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
419 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
420
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
421 if (clear_cmdline) /* going to clear cmdline (done below) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
422 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
423
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
424 #ifdef FEAT_LINEBREAK
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
425 /* Force redraw when width of 'number' column changes. */
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
426 if (curwin->w_redr_type < NOT_VALID
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
427 && curwin->w_nrwidth != (curwin->w_p_nu ? number_width(curwin) : 0))
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
428 curwin->w_redr_type = NOT_VALID;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
429 #endif
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
430
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
431 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
432 * Only start redrawing if there is really something to do.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
433 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
434 if (type == INVERTED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
435 update_curswant();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
436 if (curwin->w_redr_type < type
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
437 && !((type == VALID
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
438 && curwin->w_lines[0].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
439 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
440 && curwin->w_topfill == curwin->w_old_topfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
441 && curwin->w_botfill == curwin->w_old_botfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
442 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
443 && curwin->w_topline == curwin->w_lines[0].wl_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
444 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
445 || (type == INVERTED
1043
10d7ebdbe8a3 updated for version 7.0-169
vimboss
parents: 996
diff changeset
446 && VIsual_active
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
447 && curwin->w_old_cursor_lnum == curwin->w_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
448 && curwin->w_old_visual_mode == VIsual_mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
449 && (curwin->w_valid & VALID_VIRTCOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
450 && curwin->w_old_curswant == curwin->w_curswant)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
451 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
452 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
453 curwin->w_redr_type = type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
454
849
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
455 #ifdef FEAT_WINDOWS
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
456 /* Redraw the tab pages line if needed. */
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
457 if (redraw_tabline || type >= NOT_VALID)
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
458 draw_tabline();
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
459 #endif
eac1cd7f1eff updated for version 7.0f04
vimboss
parents: 835
diff changeset
460
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
461 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
462 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
463 * Correct stored syntax highlighting info for changes in each displayed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
464 * buffer. Each buffer must only be done once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
465 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
466 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
467 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
468 if (wp->w_buffer->b_mod_set)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
469 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
470 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
471 win_T *wwp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
472
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
473 /* Check if we already did this buffer. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
474 for (wwp = firstwin; wwp != wp; wwp = wwp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
475 if (wwp->w_buffer == wp->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
476 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
477 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
478 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
479 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
480 wwp == wp &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
481 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
482 syntax_present(wp->w_buffer))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
483 syn_stack_apply_changes(wp->w_buffer);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
484 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
485 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
486 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
487
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
488 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
489 * Go from top to bottom through the windows, redrawing the ones that need
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
490 * it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
491 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
492 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
493 did_one = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
494 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
495 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
496 search_hl.rm.regprog = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
497 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
498 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
499 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
500 if (wp->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
501 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
502 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
503 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
504 if (!did_one)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
505 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
506 did_one = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
507 # ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
508 start_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
509 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
510 # ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
511 /* When Visual area changed, may have to update selection. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
512 if (clip_star.available && clip_isautosel())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
513 clip_update_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
514 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
515 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
516 /* Remove the cursor before starting to do anything, because
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
517 * scrolling may make it difficult to redraw the text under
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
518 * it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
519 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
520 gui_undraw_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
521 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
522 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
523 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
524 win_update(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
525 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
526
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
527 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
528 /* redraw status line after the window to minimize cursor movement */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
529 if (wp->w_redr_status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
530 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
531 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
532 win_redr_status(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
533 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
534 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
535 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
536 #if defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
537 end_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
538 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
539
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
540 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
541 /* Reset b_mod_set flags. Going through all windows is probably faster
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
542 * than going through all buffers (there could be many buffers). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
543 for (wp = firstwin; wp != NULL; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
544 wp->w_buffer->b_mod_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
545 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
546 curbuf->b_mod_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
547 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
548
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
549 updating_screen = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
550 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
551 gui_may_resize_shell();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
552 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
553
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
554 /* Clear or redraw the command line. Done last, because scrolling may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
555 * mess up the command line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
556 if (clear_cmdline || redraw_cmdline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
557 showmode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
558
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
559 /* May put up an introductory message when not editing a file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
560 if (!did_intro && bufempty()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
561 && curbuf->b_fname == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
562 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
563 && firstwin->w_next == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
564 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
565 && vim_strchr(p_shm, SHM_INTRO) == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
566 intro_message(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
567 did_intro = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
568
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
569 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
570 /* Redraw the cursor and update the scrollbars when all screen updating is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
571 * done. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
572 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
573 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
574 out_flush(); /* required before updating the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
575 if (did_one)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
576 gui_update_cursor(FALSE, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
577 gui_update_scrollbars(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
578 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
579 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
580 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
581
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
582 #if defined(FEAT_SIGNS) || defined(FEAT_GUI)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
583 static void update_prepare __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
584 static void update_finish __ARGS((void));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
585
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
586 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
587 * Prepare for updating one or more windows.
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
588 * Caller must check for "updating_screen" already set to avoid recursiveness.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
589 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
590 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
591 update_prepare()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
592 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
593 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
594 updating_screen = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
595 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
596 /* Remove the cursor before starting to do anything, because scrolling may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
597 * make it difficult to redraw the text under it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
598 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
599 gui_undraw_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
600 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
601 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
602 start_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
603 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
604 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
605
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
606 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
607 * Finish updating one or more windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
608 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
609 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
610 update_finish()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
611 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
612 if (redraw_cmdline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
613 showmode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
614
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
615 # ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
616 end_search_hl();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
617 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
618
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
619 updating_screen = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
620
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
621 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
622 gui_may_resize_shell();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
623
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
624 /* Redraw the cursor and update the scrollbars when all screen updating is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
625 * done. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
626 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
627 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
628 out_flush(); /* required before updating the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
629 gui_update_cursor(FALSE, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
630 gui_update_scrollbars(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
631 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
632 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
633 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
634 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
635
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
636 #if defined(FEAT_SIGNS) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
637 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
638 update_debug_sign(buf, lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
639 buf_T *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
640 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
641 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
642 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
643 int doit = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
644
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
645 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
646 win_foldinfo.fi_level = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
647 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
648
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
649 /* update/delete a specific mark */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
650 FOR_ALL_WINDOWS(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
651 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
652 if (buf != NULL && lnum > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
653 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
654 if (wp->w_buffer == buf && lnum >= wp->w_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
655 && lnum < wp->w_botline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
656 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
657 if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
658 wp->w_redraw_top = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
659 if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
660 wp->w_redraw_bot = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
661 redraw_win_later(wp, VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
662 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
663 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
664 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
665 redraw_win_later(wp, VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
666 if (wp->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
667 doit = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
668 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
669
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
670 /* Return when there is nothing to do or screen updating already
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
671 * happening. */
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
672 if (!doit || updating_screen)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
673 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
674
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
675 /* update all windows that need updating */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
676 update_prepare();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
678 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
679 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
680 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
681 if (wp->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
682 win_update(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
683 if (wp->w_redr_status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
684 win_redr_status(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
685 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
686 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
687 if (curwin->w_redr_type != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
688 win_update(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
689 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
690
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
691 update_finish();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
692 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
693 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
694
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
695
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
696 #if defined(FEAT_GUI) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
697 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
698 * Update a single window, its status line and maybe the command line msg.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
699 * Used for the GUI scrollbar.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
700 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
701 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
702 updateWindow(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
703 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
704 {
2008
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
705 /* return if already busy updating */
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
706 if (updating_screen)
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
707 return;
f13a0227fb88 updated for version 7.2-305
vimboss
parents: 1994
diff changeset
708
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
709 update_prepare();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
710
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
711 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
712 /* When Visual area changed, may have to update selection. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
713 if (clip_star.available && clip_isautosel())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
714 clip_update_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
715 #endif
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
716
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
717 win_update(wp);
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
718
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
719 #ifdef FEAT_WINDOWS
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
720 /* When the screen was cleared redraw the tab pages line. */
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
721 if (redraw_tabline)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
722 draw_tabline();
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
723
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
724 if (wp->w_redr_status
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
725 # ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
726 || p_ru
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
727 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
728 # ifdef FEAT_STL_OPT
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
729 || *p_stl != NUL || *wp->w_p_stl != NUL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
730 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
731 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
732 win_redr_status(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
733 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
734
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
735 update_finish();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
736 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
737 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
738
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
739 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
740 * Update a single window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
741 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
742 * This may cause the windows below it also to be redrawn (when clearing the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
743 * screen or scrolling lines).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
744 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
745 * How the window is redrawn depends on wp->w_redr_type. Each type also
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
746 * implies the one below it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
747 * NOT_VALID redraw the whole window
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
748 * SOME_VALID redraw the whole window but do scroll when possible
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
749 * REDRAW_TOP redraw the top w_upd_rows window lines, otherwise like VALID
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
750 * INVERTED redraw the changed part of the Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
751 * INVERTED_ALL redraw the whole Visual area
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
752 * VALID 1. scroll up/down to adjust for a changed w_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
753 * 2. update lines at the top when scrolled down
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
754 * 3. redraw changed text:
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
755 * - if wp->w_buffer->b_mod_set set, update lines between
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
756 * b_mod_top and b_mod_bot.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
757 * - if wp->w_redraw_top non-zero, redraw lines between
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
758 * wp->w_redraw_top and wp->w_redr_bot.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
759 * - continue redrawing when syntax status is invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
760 * 4. if scrolled up, update lines at the bottom.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
761 * This results in three areas that may need updating:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
762 * top: from first row to top_end (when scrolled down)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
763 * mid: from mid_start to mid_end (update inversion or changed text)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
764 * bot: from bot_start to last row (when scrolled up)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
765 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
766 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
767 win_update(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
768 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
769 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
770 buf_T *buf = wp->w_buffer;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
771 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
772 int top_end = 0; /* Below last row of the top area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
773 updating. 0 when no top area updating. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
774 int mid_start = 999;/* first row of the mid area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
775 updating. 999 when no mid area updating. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
776 int mid_end = 0; /* Below last row of the mid area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
777 updating. 0 when no mid area updating. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
778 int bot_start = 999;/* first row of the bot area that needs
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
779 updating. 999 when no bot area updating */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
780 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
781 int scrolled_down = FALSE; /* TRUE when scrolled down when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
782 w_topline got smaller a bit */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
783 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
784 #ifdef FEAT_SEARCH_EXTRA
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
785 matchitem_T *cur; /* points to the match list */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
786 int top_to_mod = FALSE; /* redraw above mod_top */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
787 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
788
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
789 int row; /* current window row to display */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
790 linenr_T lnum; /* current buffer lnum to display */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
791 int idx; /* current index in w_lines[] */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
792 int srow; /* starting row of the current line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
793
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
794 int eof = FALSE; /* if TRUE, we hit the end of the file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
795 int didline = FALSE; /* if TRUE, we finished the last line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
796 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
797 long j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
798 static int recursive = FALSE; /* being called recursively */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
799 int old_botline = wp->w_botline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
800 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
801 long fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
802 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
803 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
804 /* remember what happened to the previous line, to know if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
805 * check_visual_highlight() can be used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
806 #define DID_NONE 1 /* didn't update a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
807 #define DID_LINE 2 /* updated a normal line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
808 #define DID_FOLD 3 /* updated a folded line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
809 int did_update = DID_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
810 linenr_T syntax_last_parsed = 0; /* last parsed text line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
811 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
812 linenr_T mod_top = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
813 linenr_T mod_bot = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
814 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
815 int save_got_int;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
816 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
817
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
818 type = wp->w_redr_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
819
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
820 if (type == NOT_VALID)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
821 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
822 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
823 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
824 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
825 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
826 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
827
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
828 /* Window is zero-height: nothing to draw. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
829 if (wp->w_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
830 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
831 wp->w_redr_type = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
832 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
833 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
835 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
836 /* Window is zero-width: Only need to draw the separator. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
837 if (wp->w_width == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
838 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
839 /* draw the vertical separator right of this window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
840 draw_vsep_win(wp, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
841 wp->w_redr_type = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
842 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
843 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
844 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
845
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
846 #ifdef FEAT_SEARCH_EXTRA
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
847 /* Setup for match and 'hlsearch' highlighting. Disable any previous
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
848 * match */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
849 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
850 while (cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
851 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
852 cur->hl.rm = cur->match;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
853 if (cur->hlg_id == 0)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
854 cur->hl.attr = 0;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
855 else
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
856 cur->hl.attr = syn_id2attr(cur->hlg_id);
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
857 cur->hl.buf = buf;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
858 cur->hl.lnum = 0;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
859 cur->hl.first_lnum = 0;
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
860 # ifdef FEAT_RELTIME
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
861 /* Set the time limit to 'redrawtime'. */
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
862 profile_setlimit(p_rdt, &(cur->hl.tm));
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
863 # endif
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
864 cur = cur->next;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
865 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
866 search_hl.buf = buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
867 search_hl.lnum = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
868 search_hl.first_lnum = 0;
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
869 /* time limit is set at the toplevel, for all windows */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
870 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
871
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
872 #ifdef FEAT_LINEBREAK
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
873 /* Force redraw when width of 'number' column changes. */
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
874 i = wp->w_p_nu ? number_width(wp) : 0;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
875 if (wp->w_nrwidth != i)
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
876 {
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
877 type = NOT_VALID;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
878 wp->w_nrwidth = i;
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
879 }
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
880 else
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
881 #endif
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
882
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
883 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
884 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
885 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
886 * When there are both inserted/deleted lines and specific lines to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
887 * redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
888 * everything (only happens when redrawing is off for while).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
889 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
890 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
891 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
892 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
893 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
894 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
895 * Set mod_top to the first line that needs displaying because of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
896 * changes. Set mod_bot to the first line after the changes.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
897 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
898 mod_top = wp->w_redraw_top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
899 if (wp->w_redraw_bot != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
900 mod_bot = wp->w_redraw_bot + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
901 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
902 mod_bot = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
903 wp->w_redraw_top = 0; /* reset for next time */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
904 wp->w_redraw_bot = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
905 if (buf->b_mod_set)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
906 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
907 if (mod_top == 0 || mod_top > buf->b_mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
908 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
909 mod_top = buf->b_mod_top;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
910 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
911 /* Need to redraw lines above the change that may be included
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
912 * in a pattern match. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
913 if (syntax_present(buf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
914 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
915 mod_top -= buf->b_syn_sync_linebreaks;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
916 if (mod_top < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
917 mod_top = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
918 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
919 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
920 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
921 if (mod_bot == 0 || mod_bot < buf->b_mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
922 mod_bot = buf->b_mod_bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
923
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
924 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
925 /* When 'hlsearch' is on and using a multi-line search pattern, a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
926 * change in one line may make the Search highlighting in a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
927 * previous line invalid. Simple solution: redraw all visible
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
928 * lines above the change.
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
929 * Same for a match pattern.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
930 */
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
931 if (search_hl.rm.regprog != NULL
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
932 && re_multiline(search_hl.rm.regprog))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
933 top_to_mod = TRUE;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
934 else
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
935 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
936 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
937 while (cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
938 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
939 if (cur->match.regprog != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
940 && re_multiline(cur->match.regprog))
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
941 {
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
942 top_to_mod = TRUE;
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
943 break;
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
944 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
945 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
946 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
947 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
948 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
949 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
950 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
951 if (mod_top != 0 && hasAnyFolding(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
952 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
953 linenr_T lnumt, lnumb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
954
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
955 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
956 * A change in a line can cause lines above it to become folded or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
957 * unfolded. Find the top most buffer line that may be affected.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
958 * If the line was previously folded and displayed, get the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
959 * line of that fold. If the line is folded now, get the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
960 * folded line. Use the minimum of these two.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
961 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
962
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
963 /* Find last valid w_lines[] entry above mod_top. Set lnumt to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
964 * the line below it. If there is no valid entry, use w_topline.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
965 * Find the first valid w_lines[] entry below mod_bot. Set lnumb
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
966 * to this line. If there is no valid entry, use MAXLNUM. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
967 lnumt = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
968 lnumb = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
969 for (i = 0; i < wp->w_lines_valid; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
970 if (wp->w_lines[i].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
971 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
972 if (wp->w_lines[i].wl_lastlnum < mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
973 lnumt = wp->w_lines[i].wl_lastlnum + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
974 if (lnumb == MAXLNUM && wp->w_lines[i].wl_lnum >= mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
975 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
976 lnumb = wp->w_lines[i].wl_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
977 /* When there is a fold column it might need updating
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
978 * in the next line ("J" just above an open fold). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
979 if (wp->w_p_fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
980 ++lnumb;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
981 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
982 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
983
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
984 (void)hasFoldingWin(wp, mod_top, &mod_top, NULL, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
985 if (mod_top > lnumt)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
986 mod_top = lnumt;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
987
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
988 /* Now do the same for the bottom line (one above mod_bot). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
989 --mod_bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
990 (void)hasFoldingWin(wp, mod_bot, NULL, &mod_bot, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
991 ++mod_bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
992 if (mod_bot < lnumb)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
993 mod_bot = lnumb;
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 /* When a change starts above w_topline and the end is below
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
998 * w_topline, start redrawing at w_topline.
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
999 * 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
1000 * made, but redraw the first line to find changes in syntax. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1001 if (mod_top != 0 && mod_top < wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1002 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1003 if (mod_bot > wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1004 mod_top = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1005 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1006 else if (syntax_present(buf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1007 top_end = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1008 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1009 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1010
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1011 /* When line numbers are displayed need to redraw all lines below
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1012 * inserted/deleted lines. */
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1013 if (mod_top != 0 && buf->b_mod_xlines != 0 && wp->w_p_nu)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
1014 mod_bot = MAXLNUM;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1015 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1017 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1018 * When only displaying the lines at the top, set top_end. Used when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1019 * window has scrolled down for msg_scrolled.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1020 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1021 if (type == REDRAW_TOP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1022 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1023 j = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1024 for (i = 0; i < wp->w_lines_valid; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1025 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1026 j += wp->w_lines[i].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1027 if (j >= wp->w_upd_rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1028 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1029 top_end = j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1030 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1031 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1032 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1033 if (top_end == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1034 /* not found (cannot happen?): redraw everything */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1035 type = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1036 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1037 /* top area defined, the rest is VALID */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1038 type = VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1039 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1040
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
1041 /* Trick: we want to avoid clearing the screen twice. screenclear() will
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1042 * set "screen_cleared" to TRUE. The special value MAYBE (which is still
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1043 * non-zero and thus not FALSE) will indicate that screenclear() was not
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1044 * called. */
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1045 if (screen_cleared)
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1046 screen_cleared = MAYBE;
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1047
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1048 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1049 * If there are no changes on the screen that require a complete redraw,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1050 * handle three cases:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1051 * 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
1052 * 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
1053 * 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
1054 * w_lines[] that needs updating.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1055 */
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1056 if ((type == VALID || type == SOME_VALID
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1057 || type == INVERTED || type == INVERTED_ALL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1058 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1059 && !wp->w_botfill && !wp->w_old_botfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1060 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1061 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1062 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1063 if (mod_top != 0 && wp->w_topline == mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1064 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1065 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1066 * w_topline is the first changed line, the scrolling will be done
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1067 * further down.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1068 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1069 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1070 else if (wp->w_lines[0].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1071 && (wp->w_topline < wp->w_lines[0].wl_lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1072 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1073 || (wp->w_topline == wp->w_lines[0].wl_lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1074 && wp->w_topfill > wp->w_old_topfill)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1075 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1076 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1077 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1078 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1079 * New topline is above old topline: May scroll down.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1080 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1081 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1082 if (hasAnyFolding(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1083 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1084 linenr_T ln;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1085
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1086 /* count the number of lines we are off, counting a sequence
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1087 * of folded lines as one */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1088 j = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1089 for (ln = wp->w_topline; ln < wp->w_lines[0].wl_lnum; ++ln)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1090 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1091 ++j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1092 if (j >= wp->w_height - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1093 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1094 (void)hasFoldingWin(wp, ln, NULL, &ln, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1095 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1096 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1097 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1098 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1099 j = wp->w_lines[0].wl_lnum - wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1100 if (j < wp->w_height - 2) /* not too far off */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1101 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1102 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
1103 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1104 /* insert extra lines for previously invisible filler lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1105 if (wp->w_lines[0].wl_lnum != wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1106 i += diff_check_fill(wp, wp->w_lines[0].wl_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1107 - wp->w_old_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1108 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1109 if (i < wp->w_height - 2) /* less than a screen off */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1110 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1111 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1112 * Try to insert the correct number of lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1113 * If not the last window, delete the lines at the bottom.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1114 * win_ins_lines may fail when the terminal can't do it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1115 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1116 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1117 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1118 if (win_ins_lines(wp, 0, i, FALSE, wp == firstwin) == OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1119 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1120 if (wp->w_lines_valid != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1121 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1122 /* Need to update rows that are new, stop at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1123 * first one that scrolled down. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1124 top_end = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1125 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1126 scrolled_down = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1127 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1128
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1129 /* Move the entries that were scrolled, disable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1130 * the entries for the lines to be redrawn. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1131 if ((wp->w_lines_valid += j) > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1132 wp->w_lines_valid = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1133 for (idx = wp->w_lines_valid; idx - j >= 0; idx--)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1134 wp->w_lines[idx] = wp->w_lines[idx - j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1135 while (idx >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1136 wp->w_lines[idx--].wl_valid = FALSE;
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 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1140 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1141 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1142 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1143 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1144 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1145 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1146 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1147 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1148 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1149 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1150 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1151 * New topline is at or below old topline: May scroll up.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1152 * When topline didn't change, find first entry in w_lines[] that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1153 * needs updating.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1154 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1155
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1156 /* try to find wp->w_topline in wp->w_lines[].wl_lnum */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1157 j = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1158 row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1159 for (i = 0; i < wp->w_lines_valid; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1160 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1161 if (wp->w_lines[i].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1162 && wp->w_lines[i].wl_lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1163 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1164 j = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1165 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1166 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1167 row += wp->w_lines[i].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1168 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1169 if (j == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1170 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1171 /* if wp->w_topline is not in wp->w_lines[].wl_lnum redraw all
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1172 * lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1173 mid_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1174 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1175 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1176 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1177 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1178 * Try to delete the correct number of lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1179 * wp->w_topline is at wp->w_lines[i].wl_lnum.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1180 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1181 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1182 /* If the topline didn't change, delete old filler lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1183 * otherwise delete filler lines of the new topline... */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1184 if (wp->w_lines[0].wl_lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1185 row += wp->w_old_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1186 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1187 row += diff_check_fill(wp, wp->w_topline);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1188 /* ... but don't delete new filler lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1189 row -= wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1190 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1191 if (row > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1192 {
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_del_lines(wp, 0, row, FALSE, wp == firstwin) == OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1195 bot_start = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1196 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1197 mid_start = 0; /* redraw all lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1198 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1199 if ((row == 0 || bot_start < 999) && wp->w_lines_valid != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1200 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1201 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1202 * Skip the lines (below the deleted lines) that are still
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1203 * valid and don't need redrawing. Copy their info
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1204 * upwards, to compensate for the deleted lines. Set
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1205 * bot_start to the first row that needs redrawing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1206 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1207 bot_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1208 idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1209 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1210 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1211 wp->w_lines[idx] = wp->w_lines[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1212 /* stop at line that didn't fit, unless it is still
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1213 * valid (no lines deleted) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1214 if (row > 0 && bot_start + row
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1215 + (int)wp->w_lines[j].wl_size > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1216 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1217 wp->w_lines_valid = idx + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1218 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1219 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1220 bot_start += wp->w_lines[idx++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1221
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1222 /* stop at the last valid entry in w_lines[].wl_size */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1223 if (++j >= wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1224 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1225 wp->w_lines_valid = idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1226 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1227 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1228 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1229 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1230 /* Correct the first entry for filler lines at the top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1231 * when it won't get updated below. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1232 if (wp->w_p_diff && bot_start > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1233 wp->w_lines[0].wl_size =
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1234 plines_win_nofill(wp, wp->w_topline, TRUE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1235 + wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1236 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1237 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1238 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1239 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1240
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1241 /* When starting redraw in the first line, redraw all lines. When
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1242 * there is only one window it's probably faster to clear the screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1243 * first. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1244 if (mid_start == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1245 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1246 mid_end = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1247 if (lastwin == firstwin)
981
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1248 {
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1249 /* 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
1250 * win_ins_lines() above, "screen_cleared" is FALSE or MAYBE
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1251 * then. */
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1252 if (screen_cleared != TRUE)
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1253 screenclear();
981
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1254 #ifdef FEAT_WINDOWS
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1255 /* The screen was cleared, redraw the tab pages line. */
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1256 if (redraw_tabline)
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1257 draw_tabline();
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1258 #endif
eb4ee2010aae updated for version 7.0-107
vimboss
parents: 944
diff changeset
1259 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1260 }
1331
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1261
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1262 /* 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
1263 * cleared (only happens for the first window) or when screenclear()
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1264 * was called directly above, "must_redraw" will have been set to
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1265 * NOT_VALID, need to reset it here to avoid redrawing twice. */
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1266 if (screen_cleared == TRUE)
d51bf80e8fc9 updated for version 7.1-045
vimboss
parents: 1326
diff changeset
1267 must_redraw = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1268 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1269 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1270 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1271 /* Not VALID or INVERTED: redraw all lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1272 mid_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1273 mid_end = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1274 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1275
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1276 if (type == SOME_VALID)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1277 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1278 /* SOME_VALID: redraw all lines. */
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1279 mid_start = 0;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1280 mid_end = wp->w_height;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1281 type = NOT_VALID;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1282 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
1283
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1284 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1285 /* check if we are updating or removing the inverted part */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1286 if ((VIsual_active && buf == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1287 || (wp->w_old_cursor_lnum != 0 && type != NOT_VALID))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1288 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1289 linenr_T from, to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1290
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1291 if (VIsual_active)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1292 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1293 if (VIsual_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1294 && (VIsual_mode != wp->w_old_visual_mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1295 || type == INVERTED_ALL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1296 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1297 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1298 * If the type of Visual selection changed, redraw the whole
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1299 * selection. Also when the ownership of the X selection is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1300 * gained or lost.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1301 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1302 if (curwin->w_cursor.lnum < VIsual.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1303 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1304 from = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1305 to = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1306 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1307 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1308 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1309 from = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1310 to = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1311 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1312 /* redraw more when the cursor moved as well */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1313 if (wp->w_old_cursor_lnum < from)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1314 from = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1315 if (wp->w_old_cursor_lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1316 to = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1317 if (wp->w_old_visual_lnum < from)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1318 from = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1319 if (wp->w_old_visual_lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1320 to = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1321 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1322 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1323 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1324 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1325 * Find the line numbers that need to be updated: The lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1326 * between the old cursor position and the current cursor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1327 * position. Also check if the Visual position changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1328 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1329 if (curwin->w_cursor.lnum < wp->w_old_cursor_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1330 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1331 from = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1332 to = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1333 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1334 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1335 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1336 from = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1337 to = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1338 if (from == 0) /* Visual mode just started */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1339 from = to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1340 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1341
422
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1342 if (VIsual.lnum != wp->w_old_visual_lnum
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1343 || VIsual.col != wp->w_old_visual_col)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1344 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1345 if (wp->w_old_visual_lnum < from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1346 && wp->w_old_visual_lnum != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1347 from = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1348 if (wp->w_old_visual_lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1349 to = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1350 if (VIsual.lnum < from)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1351 from = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1352 if (VIsual.lnum > to)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1353 to = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1354 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1355 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1356
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1357 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1358 * If in block mode and changed column or curwin->w_curswant:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1359 * update all lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1360 * First compute the actual start and end column.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1361 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1362 if (VIsual_mode == Ctrl_V)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1363 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1364 colnr_T fromc, toc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1365
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1366 getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1367 ++toc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1368 if (curwin->w_curswant == MAXCOL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1369 toc = MAXCOL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1370
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1371 if (fromc != wp->w_old_cursor_fcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1372 || toc != wp->w_old_cursor_lcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1373 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1374 if (from > VIsual.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1375 from = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1376 if (to < VIsual.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1377 to = VIsual.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1378 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1379 wp->w_old_cursor_fcol = fromc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1380 wp->w_old_cursor_lcol = toc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1381 }
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 /* Use the line numbers of the old Visual area. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1386 if (wp->w_old_cursor_lnum < wp->w_old_visual_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1387 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1388 from = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1389 to = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1390 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1391 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1392 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1393 from = wp->w_old_visual_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1394 to = wp->w_old_cursor_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1395 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1396 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1398 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1399 * There is no need to update lines above the top of the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1400 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1401 if (from < wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1402 from = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1404 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1405 * 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
1406 * the lines that are visible in the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1407 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1408 if (wp->w_valid & VALID_BOTLINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1409 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1410 if (from >= wp->w_botline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1411 from = wp->w_botline - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1412 if (to >= wp->w_botline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1413 to = wp->w_botline - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1414 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1416 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1417 * Find the minimal part to be updated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1418 * Watch out for scrolling that made entries in w_lines[] invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1419 * E.g., CTRL-U makes the first half of w_lines[] invalid and sets
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1420 * top_end; need to redraw from top_end to the "to" line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1421 * A middle mouse click with a Visual selection may change the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1422 * above the Visual area and reset wl_valid, do count these for
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1423 * mid_end (in srow).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1424 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1425 if (mid_start > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1426 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1427 lnum = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1428 idx = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1429 srow = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1430 if (scrolled_down)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1431 mid_start = top_end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1432 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1433 mid_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1434 while (lnum < from && idx < wp->w_lines_valid) /* find start */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1435 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1436 if (wp->w_lines[idx].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1437 mid_start += wp->w_lines[idx].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1438 else if (!scrolled_down)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1439 srow += wp->w_lines[idx].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1440 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1441 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1442 if (idx < wp->w_lines_valid && wp->w_lines[idx].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1443 lnum = wp->w_lines[idx].wl_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1444 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1445 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1446 ++lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1447 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1448 srow += mid_start;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1449 mid_end = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1450 for ( ; idx < wp->w_lines_valid; ++idx) /* find end */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1451 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1452 if (wp->w_lines[idx].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1453 && wp->w_lines[idx].wl_lnum >= to + 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1454 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1455 /* Only update until first row of this line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1456 mid_end = srow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1457 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1458 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1459 srow += wp->w_lines[idx].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1460 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1461 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1462 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1463
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1464 if (VIsual_active && buf == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1465 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1466 wp->w_old_visual_mode = VIsual_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1467 wp->w_old_cursor_lnum = curwin->w_cursor.lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1468 wp->w_old_visual_lnum = VIsual.lnum;
422
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1469 wp->w_old_visual_col = VIsual.col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1470 wp->w_old_curswant = curwin->w_curswant;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1471 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1472 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1473 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1474 wp->w_old_visual_mode = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1475 wp->w_old_cursor_lnum = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1476 wp->w_old_visual_lnum = 0;
422
169f2a51b527 updated for version 7.0110
vimboss
parents: 386
diff changeset
1477 wp->w_old_visual_col = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1478 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1479 #endif /* FEAT_VISUAL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1480
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1481 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1482 /* reset got_int, otherwise regexp won't work */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1483 save_got_int = got_int;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1484 got_int = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1485 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1486 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1487 win_foldinfo.fi_level = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1488 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1489
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1490 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1491 * Update all the window rows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1492 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1493 idx = 0; /* first entry in w_lines[].wl_size */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1494 row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1495 srow = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1496 lnum = wp->w_topline; /* first line shown in window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1497 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1498 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1499 /* stop updating when reached the end of the window (check for _past_
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1500 * the end of the window is at the end of the loop) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1501 if (row == wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1502 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1503 didline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1504 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1505 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1506
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1507 /* stop updating when hit the end of the file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1508 if (lnum > buf->b_ml.ml_line_count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1509 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1510 eof = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1511 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1512 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1513
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1514 /* Remember the starting row of the line that is going to be dealt
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1515 * with. It is used further down when the line doesn't fit. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1516 srow = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1518 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1519 * Update a line when it is in an area that needs updating, when it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1520 * has changes or w_lines[idx] is invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1521 * bot_start may be halfway a wrapped line after using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1522 * win_del_lines(), check if the current line includes it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1523 * When syntax folding is being used, the saved syntax states will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1524 * already have been updated, we can't see where the syntax state is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1525 * the same again, just update until the end of the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1526 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1527 if (row < top_end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1528 || (row >= mid_start && row < mid_end)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1529 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1530 || top_to_mod
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1531 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1532 || idx >= wp->w_lines_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1533 || (row + wp->w_lines[idx].wl_size > bot_start)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1534 || (mod_top != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1535 && (lnum == mod_top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1536 || (lnum >= mod_top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1537 && (lnum < mod_bot
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1538 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1539 || did_update == DID_FOLD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1540 || (did_update == DID_LINE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1541 && syntax_present(buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1542 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1543 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1544 (foldmethodIsSyntax(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1545 && hasAnyFolding(wp)) ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1546 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1547 syntax_check_changed(lnum)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1548 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1549 )))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1550 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1551 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1552 if (lnum == mod_top)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1553 top_to_mod = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1554 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1555
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1556 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1557 * When at start of changed lines: May scroll following lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1558 * up or down to minimize redrawing.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1559 * Don't do this when the change continues until the end.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1560 * Don't scroll when dollar_vcol is non-zero, keep the "$".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1561 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1562 if (lnum == mod_top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1563 && mod_bot != MAXLNUM
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1564 && !(dollar_vcol != 0 && mod_bot == mod_top + 1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1565 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1566 int old_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1567 int new_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1568 int xtra_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1569 linenr_T l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1570
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1571 /* Count the old number of window rows, using w_lines[], which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1572 * should still contain the sizes for the lines as they are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1573 * currently displayed. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1574 for (i = idx; i < wp->w_lines_valid; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1575 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1576 /* Only valid lines have a meaningful wl_lnum. Invalid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1577 * lines are part of the changed area. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1578 if (wp->w_lines[i].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1579 && wp->w_lines[i].wl_lnum == mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1580 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1581 old_rows += wp->w_lines[i].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1582 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1583 if (wp->w_lines[i].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1584 && wp->w_lines[i].wl_lastlnum + 1 == mod_bot)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1585 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1586 /* Must have found the last valid entry above mod_bot.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1587 * Add following invalid entries. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1588 ++i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1589 while (i < wp->w_lines_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1590 && !wp->w_lines[i].wl_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1591 old_rows += wp->w_lines[i++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1592 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1593 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1594 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1595 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1596
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1597 if (i >= wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1598 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1599 /* We can't find a valid line below the changed lines,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1600 * need to redraw until the end of the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1601 * Inserting/deleting lines has no use. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1602 bot_start = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1603 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1604 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1605 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1606 /* Able to count old number of rows: Count new window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1607 * rows, and may insert/delete lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1608 j = idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1609 for (l = lnum; l < mod_bot; ++l)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1610 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1611 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1612 if (hasFoldingWin(wp, l, NULL, &l, TRUE, NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1613 ++new_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1614 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1615 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1616 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1617 if (l == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1618 new_rows += plines_win_nofill(wp, l, TRUE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1619 + wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1620 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1621 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1622 new_rows += plines_win(wp, l, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1623 ++j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1624 if (new_rows > wp->w_height - row - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1625 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1626 /* it's getting too much, must redraw the rest */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1627 new_rows = 9999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1628 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1629 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1630 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1631 xtra_rows = new_rows - old_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1632 if (xtra_rows < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1633 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1634 /* May scroll text up. If there is not enough
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1635 * remaining text or scrolling fails, must redraw the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1636 * rest. If scrolling works, must redraw the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1637 * below the scrolled text. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1638 if (row - xtra_rows >= wp->w_height - 2)
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 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1641 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1642 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1643 if (win_del_lines(wp, row,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1644 -xtra_rows, FALSE, FALSE) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1645 mod_bot = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1646 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1647 bot_start = wp->w_height + xtra_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1648 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1649 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1650 else if (xtra_rows > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1651 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1652 /* May scroll text down. If there is not enough
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1653 * remaining text of scrolling fails, must redraw the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1654 * rest. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1655 if (row + xtra_rows >= wp->w_height - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1656 mod_bot = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1657 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1658 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1659 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1660 if (win_ins_lines(wp, row + old_rows,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1661 xtra_rows, FALSE, FALSE) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1662 mod_bot = MAXLNUM;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1663 else if (top_end > row + old_rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1664 /* Scrolled the part at the top that requires
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1665 * updating down. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1666 top_end += xtra_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1667 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1668 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1669
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1670 /* When not updating the rest, may need to move w_lines[]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1671 * entries. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1672 if (mod_bot != MAXLNUM && i != j)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1673 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1674 if (j < i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1675 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1676 int x = row + new_rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1678 /* move entries in w_lines[] upwards */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1679 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1680 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1681 /* stop at last valid entry in w_lines[] */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1682 if (i >= wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1683 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1684 wp->w_lines_valid = j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1685 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1686 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1687 wp->w_lines[j] = wp->w_lines[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1688 /* stop at a line that won't fit */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1689 if (x + (int)wp->w_lines[j].wl_size
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1690 > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1691 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1692 wp->w_lines_valid = j + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1693 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1694 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1695 x += wp->w_lines[j++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1696 ++i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1697 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1698 if (bot_start > x)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1699 bot_start = x;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1700 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1701 else /* j > i */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1702 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1703 /* move entries in w_lines[] downwards */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1704 j -= i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1705 wp->w_lines_valid += j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1706 if (wp->w_lines_valid > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1707 wp->w_lines_valid = wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1708 for (i = wp->w_lines_valid; i - j >= idx; --i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1709 wp->w_lines[i] = wp->w_lines[i - j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1710
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1711 /* The w_lines[] entries for inserted lines are
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1712 * now invalid, but wl_size may be used above.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1713 * Reset to zero. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1714 while (i >= idx)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1715 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1716 wp->w_lines[i].wl_size = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1717 wp->w_lines[i--].wl_valid = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1718 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1719 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1720 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1721 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1722 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1723
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1724 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1725 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1726 * When lines are folded, display one line for all of them.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1727 * Otherwise, display normally (can be several display lines when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1728 * 'wrap' is on).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1729 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1730 fold_count = foldedCount(wp, lnum, &win_foldinfo);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1731 if (fold_count != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1732 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1733 fold_line(wp, fold_count, &win_foldinfo, lnum, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1734 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1735 --fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1736 wp->w_lines[idx].wl_folded = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1737 wp->w_lines[idx].wl_lastlnum = lnum + fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1738 # ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1739 did_update = DID_FOLD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1740 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1741 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1742 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1743 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1744 if (idx < wp->w_lines_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1745 && wp->w_lines[idx].wl_valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1746 && wp->w_lines[idx].wl_lnum == lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1747 && lnum > wp->w_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1748 && !(dy_flags & DY_LASTLINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1749 && srow + wp->w_lines[idx].wl_size > wp->w_height
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1750 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1751 && diff_check_fill(wp, lnum) == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1752 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1753 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1754 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1755 /* This line is not going to fit. Don't draw anything here,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1756 * will draw "@ " lines below. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1757 row = wp->w_height + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1758 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1759 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1760 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1761 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1762 prepare_search_hl(wp, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1763 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1764 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1765 /* Let the syntax stuff know we skipped a few lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1766 if (syntax_last_parsed != 0 && syntax_last_parsed + 1 < lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1767 && syntax_present(buf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1768 syntax_end_parsing(syntax_last_parsed + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1769 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1770
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1771 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1772 * Display one line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1773 */
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
1774 row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1775
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1776 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1777 wp->w_lines[idx].wl_folded = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1778 wp->w_lines[idx].wl_lastlnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1779 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1780 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1781 did_update = DID_LINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1782 syntax_last_parsed = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1783 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1784 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1786 wp->w_lines[idx].wl_lnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1787 wp->w_lines[idx].wl_valid = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1788 if (row > wp->w_height) /* past end of screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1789 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1790 /* we may need the size of that too long line later on */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1791 if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1792 wp->w_lines[idx].wl_size = plines_win(wp, lnum, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1793 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1794 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1795 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1796 if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1797 wp->w_lines[idx].wl_size = row - srow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1798 ++idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1799 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1800 lnum += fold_count + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1801 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1802 ++lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1803 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1804 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1805 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1806 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1807 /* This line does not need updating, advance to the next one */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1808 row += wp->w_lines[idx++].wl_size;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1809 if (row > wp->w_height) /* past end of screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1810 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1811 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1812 lnum = wp->w_lines[idx - 1].wl_lastlnum + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1813 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1814 ++lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1815 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1816 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1817 did_update = DID_NONE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1818 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1819 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1820
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1821 if (lnum > buf->b_ml.ml_line_count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1822 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1823 eof = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1824 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1825 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1826 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1827 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1828 * End of loop over all window lines.
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1832 if (idx > wp->w_lines_valid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1833 wp->w_lines_valid = idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1835 #ifdef FEAT_SYN_HL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1836 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1837 * Let the syntax stuff know we stop parsing here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1838 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1839 if (syntax_last_parsed != 0 && syntax_present(buf))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1840 syntax_end_parsing(syntax_last_parsed + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1841 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1843 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1844 * 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
1845 * line we were working on, then the line didn't fit.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1846 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1847 wp->w_empty_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1848 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1849 wp->w_filler_rows = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1850 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1851 if (!eof && !didline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1852 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1853 if (lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1854 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1855 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1856 * Single line that does not fit!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1857 * Don't overwrite it, it can be edited.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1858 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1859 wp->w_botline = lnum + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1860 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1861 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1862 else if (diff_check_fill(wp, lnum) >= wp->w_height - srow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1863 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1864 /* Window ends in filler lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1865 wp->w_botline = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1866 wp->w_filler_rows = wp->w_height - srow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1867 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1868 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1869 else if (dy_flags & DY_LASTLINE) /* 'display' has "lastline" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1870 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1871 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1872 * Last line isn't finished: Display "@@@" at the end.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1873 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1874 screen_fill(W_WINROW(wp) + wp->w_height - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1875 W_WINROW(wp) + wp->w_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1876 (int)W_ENDCOL(wp) - 3, (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1877 '@', '@', hl_attr(HLF_AT));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1878 set_empty_rows(wp, srow);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1879 wp->w_botline = lnum;
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 win_draw_end(wp, '@', ' ', srow, wp->w_height, HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1884 wp->w_botline = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1885 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1886 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1887 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1888 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1889 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1890 draw_vsep_win(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1891 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1892 if (eof) /* we hit the end of the file */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1893 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1894 wp->w_botline = buf->b_ml.ml_line_count + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1895 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1896 j = diff_check_fill(wp, wp->w_botline);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1897 if (j > 0 && !wp->w_botfill)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1898 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1899 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1900 * Display filler lines at the end of the file
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1901 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1902 if (char2cells(fill_diff) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1903 i = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1904 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1905 i = fill_diff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1906 if (row + j > wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1907 j = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1908 win_draw_end(wp, i, i, row, row + (int)j, HLF_DED);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1909 row += j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1910 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1911 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1912 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1913 else if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1914 wp->w_botline = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1915
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1916 /* make sure the rest of the screen is blank */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1917 /* put '~'s on rows that aren't part of the file. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1918 win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1919 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1920
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1921 /* Reset the type of redrawing required, the window has been updated. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1922 wp->w_redr_type = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1923 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1924 wp->w_old_topfill = wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1925 wp->w_old_botfill = wp->w_botfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1926 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1927
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1928 if (dollar_vcol == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1929 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1930 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1931 * There is a trick with w_botline. If we invalidate it on each
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1932 * change that might modify it, this will cause a lot of expensive
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1933 * calls to plines() in update_topline() each time. Therefore the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1934 * value of w_botline is often approximated, and this value is used to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1935 * compute the value of w_topline. If the value of w_botline was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1936 * wrong, check that the value of w_topline is correct (cursor is on
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1937 * the visible part of the text). If it's not, we need to redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1938 * again. Mostly this just means scrolling up a few lines, so it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1939 * doesn't look too bad. Only do this for the current window (where
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1940 * changes are relevant).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1941 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1942 wp->w_valid |= VALID_BOTLINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1943 if (wp == curwin && wp->w_botline != old_botline && !recursive)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1944 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1945 recursive = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1946 curwin->w_valid &= ~VALID_TOPLINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1947 update_topline(); /* may invalidate w_botline again */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1948 if (must_redraw != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1949 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1950 /* Don't update for changes in buffer again. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1951 i = curbuf->b_mod_set;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1952 curbuf->b_mod_set = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1953 win_update(curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1954 must_redraw = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1955 curbuf->b_mod_set = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1956 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1957 recursive = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1958 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1959 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1960
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1961 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1962 /* restore got_int, unless CTRL-C was hit while redrawing */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1963 if (!got_int)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1964 got_int = save_got_int;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1965 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1966 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1967
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1968 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1969 static int draw_signcolumn __ARGS((win_T *wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1970
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1971 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1972 * Return TRUE when window "wp" has a column to draw signs in.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1973 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1974 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1975 draw_signcolumn(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1976 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1977 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1978 return (wp->w_buffer->b_signlist != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1979 # ifdef FEAT_NETBEANS_INTG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1980 || usingNetbeans
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1981 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1982 );
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1983 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1984 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1985
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1986 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1987 * 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
1988 * as the filler character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1989 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1990 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1991 win_draw_end(wp, c1, c2, row, endrow, hl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1992 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1993 int c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1994 int c2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1995 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1996 int endrow;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
1997 hlf_T hl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1998 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1999 #if defined(FEAT_FOLDING) || defined(FEAT_SIGNS) || defined(FEAT_CMDWIN)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2000 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2001 # define FDC_OFF n
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2002 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2003 # define FDC_OFF 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2004 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2005
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2006 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2007 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2008 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2009 /* No check for cmdline window: should never be right-left. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2010 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2011 n = wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2012
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2013 if (n > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2014 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2015 /* draw the fold column at the right */
119
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2016 if (n > W_WIDTH(wp))
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2017 n = W_WIDTH(wp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2018 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2019 W_ENDCOL(wp) - n, (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2020 ' ', ' ', hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2021 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2022 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2023 # ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2024 if (draw_signcolumn(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2025 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2026 int nn = n + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2027
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2028 /* draw the sign column left of the fold column */
119
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2029 if (nn > W_WIDTH(wp))
e8f07016e34d updated for version 7.0042
vimboss
parents: 67
diff changeset
2030 nn = W_WIDTH(wp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2031 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2032 W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2033 ' ', ' ', hl_attr(HLF_SC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2034 n = nn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2035 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2036 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2037 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2038 W_WINCOL(wp), W_ENDCOL(wp) - 1 - FDC_OFF,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2039 c2, c2, hl_attr(hl));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2040 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2041 W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2042 c1, c2, hl_attr(hl));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2043 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2044 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2045 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2046 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2047 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2048 if (cmdwin_type != 0 && wp == curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2049 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2050 /* draw the cmdline character in the leftmost column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2051 n = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2052 if (n > wp->w_width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2053 n = wp->w_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2054 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2055 W_WINCOL(wp), (int)W_WINCOL(wp) + n,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2056 cmdwin_type, ' ', hl_attr(HLF_AT));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2057 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2058 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2059 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2060 if (wp->w_p_fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2061 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2062 int nn = n + wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2063
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2064 /* draw the fold column at the left */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2065 if (nn > W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2066 nn = W_WIDTH(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2067 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2068 W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2069 ' ', ' ', hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2070 n = nn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2071 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2072 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2073 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2074 if (draw_signcolumn(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2075 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2076 int nn = n + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2077
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2078 /* draw the sign column after the fold column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2079 if (nn > W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2080 nn = W_WIDTH(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2081 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2082 W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2083 ' ', ' ', hl_attr(HLF_SC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2084 n = nn;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2085 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2086 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2087 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2088 W_WINCOL(wp) + FDC_OFF, (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2089 c1, c2, hl_attr(hl));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2090 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2091 set_empty_rows(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2092 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2093
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2094 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2095 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2096 * Display one folded line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2097 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2098 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2099 fold_line(wp, fold_count, foldinfo, lnum, row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2100 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2101 long fold_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2102 foldinfo_T *foldinfo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2103 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2104 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2105 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2106 char_u buf[51];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2107 pos_T *top, *bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2108 linenr_T lnume = lnum + fold_count - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2109 int len;
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 26
diff changeset
2110 char_u *text;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2111 int fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2112 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2113 int txtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2114 int off = (int)(current_ScreenLine - ScreenLines);
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2115 int ri;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2116
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2117 /* Build the fold line:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2118 * 1. Add the cmdwin_type for the command-line window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2119 * 2. Add the 'foldcolumn'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2120 * 3. Add the 'number' column
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2121 * 4. Compose the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2122 * 5. Add the text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2123 * 6. set highlighting for the Visual area an other text
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2124 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2125 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2127 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2128 * 1. Add the cmdwin_type for the command-line window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2129 * Ignores 'rightleft', this window is never right-left.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2130 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2131 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2132 if (cmdwin_type != 0 && wp == curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2133 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2134 ScreenLines[off] = cmdwin_type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2135 ScreenAttrs[off] = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2136 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2137 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2138 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2139 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2140 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2141 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2142 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2143
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2144 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2145 * 2. Add the 'foldcolumn'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2146 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2147 fdc = wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2148 if (fdc > W_WIDTH(wp) - col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2149 fdc = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2150 if (fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2151 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2152 fill_foldcolumn(buf, wp, TRUE, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2153 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2154 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2155 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2156 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2158 copy_text_attr(off + W_WIDTH(wp) - fdc - col, buf, fdc,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2159 hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2160 /* reverse the fold column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2161 for (i = 0; i < fdc; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2162 ScreenLines[off + W_WIDTH(wp) - i - 1 - col] = buf[i];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2163 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2164 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2165 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2166 copy_text_attr(off + col, buf, fdc, hl_attr(HLF_FC));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2167 col += fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2168 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2169
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2170 #ifdef FEAT_RIGHTLEFT
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2171 # define RL_MEMSET(p, v, l) if (wp->w_p_rl) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2172 for (ri = 0; ri < l; ++ri) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2173 ScreenAttrs[off + (W_WIDTH(wp) - (p) - (l)) + ri] = v; \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2174 else \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2175 for (ri = 0; ri < l; ++ri) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2176 ScreenAttrs[off + (p) + ri] = v
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2177 #else
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2178 # define RL_MEMSET(p, v, l) for (ri = 0; ri < l; ++ri) \
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2179 ScreenAttrs[off + (p) + ri] = v
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2180 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2181
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2182 /* Set all attributes of the 'number' column and the text */
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2183 RL_MEMSET(col, hl_attr(HLF_FL), W_WIDTH(wp) - col);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2184
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2185 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2186 /* If signs are being displayed, add two spaces. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2187 if (draw_signcolumn(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2188 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2189 len = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2190 if (len > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2191 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2192 if (len > 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2193 len = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2194 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2195 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2196 /* the line number isn't reversed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2197 copy_text_attr(off + W_WIDTH(wp) - len - col,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2198 (char_u *)" ", len, hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2199 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2200 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2201 copy_text_attr(off + col, (char_u *)" ", len, hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2202 col += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2203 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2204 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2205 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2206
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2207 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2208 * 3. Add the 'number' column
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2209 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2210 if (wp->w_p_nu)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2211 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2212 len = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2213 if (len > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2214 {
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2215 int w = number_width(wp);
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2216
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2217 if (len > w + 1)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2218 len = w + 1;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
2219 sprintf((char *)buf, "%*ld ", w, (long)lnum);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2220 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2221 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2222 /* the line number isn't reversed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2223 copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2224 hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2225 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2226 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2227 copy_text_attr(off + col, buf, len, hl_attr(HLF_FL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2228 col += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2229 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2230 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2231
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2232 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2233 * 4. Compose the folded-line string with 'foldtext', if set.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2234 */
29
ac33b7c03fac updated for version 7.0018
vimboss
parents: 26
diff changeset
2235 text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2236
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2237 txtcol = col; /* remember where text starts */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2238
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2239 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2240 * 5. move the text to current_ScreenLine. Fill up with "fill_fold".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2241 * Right-left text is put in columns 0 - number-col, normal text is put
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2242 * in columns number-col - window-width.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2243 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2244 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2245 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2246 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2247 int cells;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2248 int u8c, u8cc[MAX_MCO];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2249 int i;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2250 int idx;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2251 int c_len;
33
f6033dcbaf31 updated for version 7.0020
vimboss
parents: 29
diff changeset
2252 char_u *p;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2253 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2254 int prev_c = 0; /* previous Arabic character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2255 int prev_c1 = 0; /* first composing char for prev_c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2256 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2258 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2259 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2260 idx = off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2261 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2262 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2263 idx = off + col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2265 /* Store multibyte characters in ScreenLines[] et al. correctly. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2266 for (p = text; *p != NUL; )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2267 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2268 cells = (*mb_ptr2cells)(p);
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
2269 c_len = (*mb_ptr2len)(p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2270 if (col + cells > W_WIDTH(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2271 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2272 - (wp->w_p_rl ? col : 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2273 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2274 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2275 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2276 ScreenLines[idx] = *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2277 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2278 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2279 u8c = utfc_ptr2char(p, u8cc);
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2280 if (*p < 0x80 && u8cc[0] == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2281 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2282 ScreenLinesUC[idx] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2283 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2284 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2285 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2286 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2287 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2288 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2289 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2290 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2291 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2292 /* Do Arabic shaping. */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2293 int pc, pc1, nc;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2294 int pcc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2295 int firstbyte = *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2296
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2297 /* The idea of what is the previous and next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2298 * character depends on 'rightleft'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2299 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2300 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2301 pc = prev_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2302 pc1 = prev_c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2303 nc = utf_ptr2char(p + c_len);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2304 prev_c1 = u8cc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2305 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2306 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2307 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2308 pc = utfc_ptr2char(p + c_len, pcc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2309 nc = prev_c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2310 pc1 = pcc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2311 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2312 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2313
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2314 u8c = arabic_shape(u8c, &firstbyte, &u8cc[0],
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2315 pc, pc1, nc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2316 ScreenLines[idx] = firstbyte;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2317 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2318 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2319 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2320 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2321 /* Non-BMP character: display as ? or fullwidth ?. */
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
2322 #ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2323 if (u8c >= 0x10000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2324 ScreenLinesUC[idx] = (cells == 2) ? 0xff1f : (int)'?';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2325 else
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
2326 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2327 ScreenLinesUC[idx] = u8c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2328 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2329 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2330 ScreenLinesC[i][idx] = u8cc[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2331 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2332 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2333 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2334 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2335 if (cells > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2336 ScreenLines[idx + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2337 }
2069
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2338 else if (enc_dbcs == DBCS_JPNU && *p == 0x8e)
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2339 /* double-byte single width character */
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2340 ScreenLines2[idx] = p[1];
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2341 else if (cells > 1)
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2342 /* double-width character */
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
2343 ScreenLines[idx + 1] = p[1];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2344 col += cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2345 idx += cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2346 p += c_len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2347 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2348 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2349 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2350 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2351 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2352 len = (int)STRLEN(text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2353 if (len > W_WIDTH(wp) - col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2354 len = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2355 if (len > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2356 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2357 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2358 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2359 STRNCPY(current_ScreenLine, text, len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2360 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2361 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2362 STRNCPY(current_ScreenLine + col, text, len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2363 col += len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2364 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2365 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2366
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2367 /* Fill the rest of the line with the fold filler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2368 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2369 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2370 col -= txtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2371 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2372 while (col < W_WIDTH(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2373 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2374 - (wp->w_p_rl ? txtcol : 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2375 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2376 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2377 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2378 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2379 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2380 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2381 if (fill_fold >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2382 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2383 ScreenLinesUC[off + col] = fill_fold;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2384 ScreenLinesC[0][off + col] = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2385 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2386 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2387 ScreenLinesUC[off + col] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2388 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2389 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2390 ScreenLines[off + col++] = fill_fold;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2391 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2392
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2393 if (text != buf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2394 vim_free(text);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2395
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2396 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2397 * 6. set highlighting for the Visual area an other text.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2398 * If all folded lines are in the Visual area, highlight the line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2399 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2400 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2401 if (VIsual_active && wp->w_buffer == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2402 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2403 if (ltoreq(curwin->w_cursor, VIsual))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2404 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2405 /* Visual is after curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2406 top = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2407 bot = &VIsual;
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 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2411 /* Visual is before curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2412 top = &VIsual;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2413 bot = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2414 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2415 if (lnum >= top->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2416 && lnume <= bot->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2417 && (VIsual_mode != 'v'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2418 || ((lnum > top->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2419 || (lnum == top->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2420 && top->col == 0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2421 && (lnume < bot->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2422 || (lnume == bot->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2423 && (bot->col - (*p_sel == 'e'))
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
2424 >= (colnr_T)STRLEN(ml_get_buf(wp->w_buffer, lnume, FALSE)))))))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2425 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2426 if (VIsual_mode == Ctrl_V)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2427 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2428 /* Visual block mode: highlight the chars part of the block */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2429 if (wp->w_old_cursor_fcol + txtcol < (colnr_T)W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2430 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2431 if (wp->w_old_cursor_lcol + txtcol < (colnr_T)W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2432 len = wp->w_old_cursor_lcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2433 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2434 len = W_WIDTH(wp) - txtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2435 RL_MEMSET(wp->w_old_cursor_fcol + txtcol, hl_attr(HLF_V),
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 227
diff changeset
2436 len - (int)wp->w_old_cursor_fcol);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2437 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2438 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2439 else
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2440 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2441 /* Set all attributes of the text */
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2442 RL_MEMSET(txtcol, hl_attr(HLF_V), W_WIDTH(wp) - txtcol);
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2443 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2444 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2445 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2446 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2447
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2448 #ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2449 /* Show 'cursorcolumn' in the fold line. */
1725
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2450 if (wp->w_p_cuc)
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2451 {
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2452 txtcol += wp->w_virtcol;
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2453 if (wp->w_p_wrap)
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2454 txtcol -= wp->w_skipcol;
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2455 else
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2456 txtcol -= wp->w_leftcol;
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2457 if (txtcol >= 0 && txtcol < W_WIDTH(wp))
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2458 ScreenAttrs[off + txtcol] = hl_combine_attr(
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2459 ScreenAttrs[off + txtcol], hl_attr(HLF_CUC));
7c3302e07dd7 updated for version 7.2-023
vimboss
parents: 1685
diff changeset
2460 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2461 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2462
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2463 SCREEN_LINE(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2464 (int)W_WIDTH(wp), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2465
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2466 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2467 * Update w_cline_height and w_cline_folded if the cursor line was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2468 * updated (saves a call to plines() later).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2469 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2470 if (wp == curwin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2471 && lnum <= curwin->w_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2472 && lnume >= curwin->w_cursor.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2473 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2474 curwin->w_cline_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2475 curwin->w_cline_height = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2476 curwin->w_cline_folded = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2477 curwin->w_valid |= (VALID_CHEIGHT|VALID_CROW);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2478 }
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 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2482 * Copy "buf[len]" to ScreenLines["off"] and set attributes to "attr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2483 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2484 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2485 copy_text_attr(off, buf, len, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2486 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2487 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2488 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2489 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2490 {
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2491 int i;
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2492
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2493 mch_memmove(ScreenLines + off, buf, (size_t)len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2494 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2495 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2496 vim_memset(ScreenLinesUC + off, 0, sizeof(u8char_T) * (size_t)len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2497 # endif
216
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2498 for (i = 0; i < len; ++i)
da182deebec7 updated for version 7.0061
vimboss
parents: 205
diff changeset
2499 ScreenAttrs[off + i] = attr;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2500 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2501
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2502 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2503 * Fill the foldcolumn at "p" for window "wp".
548
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2504 * Only to be called when 'foldcolumn' > 0.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2505 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2506 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2507 fill_foldcolumn(p, wp, closed, lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2508 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2509 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2510 int closed; /* TRUE of FALSE */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2511 linenr_T lnum; /* current line number */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2512 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2513 int i = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2514 int level;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2515 int first_level;
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2516 int empty;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2518 /* Init to all spaces. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2519 copy_spaces(p, (size_t)wp->w_p_fdc);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2520
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2521 level = win_foldinfo.fi_level;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2522 if (level > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2523 {
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2524 /* If there is only one column put more info in it. */
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2525 empty = (wp->w_p_fdc == 1) ? 0 : 1;
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2526
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2527 /* If the column is too narrow, we start at the lowest level that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2528 * fits and use numbers to indicated the depth. */
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2529 first_level = level - wp->w_p_fdc - closed + 1 + empty;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2530 if (first_level < 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2531 first_level = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2532
519
d50452846776 updated for version 7.0145
vimboss
parents: 507
diff changeset
2533 for (i = 0; i + empty < wp->w_p_fdc; ++i)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2534 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2535 if (win_foldinfo.fi_lnum == lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2536 && first_level + i >= win_foldinfo.fi_low_level)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2537 p[i] = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2538 else if (first_level == 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2539 p[i] = '|';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2540 else if (first_level + i <= 9)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2541 p[i] = '0' + first_level + i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2542 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2543 p[i] = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2544 if (first_level + i == level)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2545 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2546 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2547 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2548 if (closed)
548
f43150a669dc updated for version 7.0155
vimboss
parents: 540
diff changeset
2549 p[i >= wp->w_p_fdc ? i - 1 : i] = '+';
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2550 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2551 #endif /* FEAT_FOLDING */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2552
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2553 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2554 * Display line "lnum" of window 'wp' on the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2555 * Start at row "startrow", stop when "endrow" is reached.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2556 * wp->w_virtcol needs to be valid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2557 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2558 * Return the number of last row the line occupies.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2559 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2560 static int
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
2561 win_line(wp, lnum, startrow, endrow, nochange)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2562 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2563 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2564 int startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2565 int endrow;
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
2566 int nochange UNUSED; /* not updating for changed text */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2567 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2568 int col; /* visual column on screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2569 unsigned off; /* offset in ScreenLines/ScreenAttrs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2570 int c = 0; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2571 long vcol = 0; /* virtual column (for tabs) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2572 long vcol_prev = -1; /* "vcol" of previous character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2573 char_u *line; /* current line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2574 char_u *ptr; /* current position in "line" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2575 int row; /* row in the window, excl w_winrow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2576 int screen_row; /* row on the screen, incl w_winrow */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2577
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2578 char_u extra[18]; /* "%ld" and 'fdc' must fit in here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2579 int n_extra = 0; /* number of extra chars */
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
2580 char_u *p_extra = NULL; /* string of extra chars, plus NUL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2581 int c_extra = NUL; /* extra chars, all the same */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2582 int extra_attr = 0; /* attributes when n_extra != 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2583 static char_u *at_end_str = (char_u *)""; /* used for p_extra when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2584 displaying lcs_eol at end-of-line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2585 int lcs_eol_one = lcs_eol; /* lcs_eol until it's been used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2586 int lcs_prec_todo = lcs_prec; /* lcs_prec until it's been used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2587
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2588 /* saved "extra" items for when draw_state becomes WL_LINE (again) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2589 int saved_n_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2590 char_u *saved_p_extra = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2591 int saved_c_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2592 int saved_char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2593
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2594 int n_attr = 0; /* chars with special attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2595 int saved_attr2 = 0; /* char_attr saved for n_attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2596 int n_attr3 = 0; /* chars with overruling special attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2597 int saved_attr3 = 0; /* char_attr saved for n_attr3 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2598
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2599 int n_skip = 0; /* nr of chars to skip for 'nowrap' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2601 int fromcol, tocol; /* start/end of inverting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2602 int fromcol_prev = -2; /* start of inverting after cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2603 int noinvcur = FALSE; /* don't invert the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2604 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2605 pos_T *top, *bot;
1813
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
2606 int lnum_in_visual_area = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2607 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2608 pos_T pos;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2609 long v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2610
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2611 int char_attr = 0; /* attributes for next character */
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
2612 int attr_pri = FALSE; /* char_attr has priority */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2613 int area_highlighting = FALSE; /* Visual or incsearch highlighting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2614 in this line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2615 int attr = 0; /* attributes for area highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2616 int area_attr = 0; /* attributes desired by highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2617 int search_attr = 0; /* attributes desired by 'hlsearch' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2618 #ifdef FEAT_SYN_HL
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2619 int vcol_save_attr = 0; /* saved attr for 'cursorcolumn' */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2620 int syntax_attr = 0; /* attributes desired by syntax */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2621 int has_syntax = FALSE; /* this buffer has syntax highl. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2622 int save_did_emsg;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
2623 int eol_hl_off = 0; /* 1 if highlighted char after EOL */
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2624 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2625 #ifdef FEAT_SPELL
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2626 int has_spell = FALSE; /* this buffer has spell checking */
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2627 # define SPWORDLEN 150
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2628 char_u nextline[SPWORDLEN * 2];/* text with start of the next line */
353
3161473d6462 updated for version 7.0091
vimboss
parents: 348
diff changeset
2629 int nextlinecol = 0; /* column where nextline[] starts */
3161473d6462 updated for version 7.0091
vimboss
parents: 348
diff changeset
2630 int nextline_idx = 0; /* index in nextline[] where next line
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2631 starts */
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2632 int spell_attr = 0; /* attributes desired by spelling */
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2633 int word_end = 0; /* last byte with same spell_attr */
378
6b49757d378c updated for version 7.0098
vimboss
parents: 356
diff changeset
2634 static linenr_T checked_lnum = 0; /* line number for "checked_col" */
6b49757d378c updated for version 7.0098
vimboss
parents: 356
diff changeset
2635 static int checked_col = 0; /* column in "checked_lnum" up to which
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2636 * there are no spell errors */
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2637 static int cap_col = -1; /* column to check for Cap word */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2638 static linenr_T capcol_lnum = 0; /* line number where "cap_col" used */
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2639 int cur_checked_col = 0; /* checked column for current line */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2640 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2641 int extra_check; /* has syntax or linebreak */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2642 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2643 int multi_attr = 0; /* attributes desired by multibyte */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2644 int mb_l = 1; /* multi-byte byte length */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2645 int mb_c = 0; /* decoded multi-byte character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2646 int mb_utf8 = FALSE; /* screen char is UTF-8 char */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
2647 int u8cc[MAX_MCO]; /* composing UTF-8 chars */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2648 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2649 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2650 int filler_lines; /* nr of filler lines to be drawn */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2651 int filler_todo; /* nr of filler lines still to do + 1 */
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
2652 hlf_T diff_hlf = (hlf_T)0; /* type of diff highlighting */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2653 int change_start = MAXCOL; /* first col of changed area */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2654 int change_end = -1; /* last col of changed area */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2655 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2656 colnr_T trailcol = MAXCOL; /* start of trailing spaces */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2657 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2658 int need_showbreak = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2659 #endif
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
2660 #if defined(FEAT_SIGNS) || (defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)) \
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
2661 || defined(FEAT_SYN_HL) || defined(FEAT_DIFF)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2662 # define LINE_ATTR
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
2663 int line_attr = 0; /* attribute for the whole line */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2664 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2665 #ifdef FEAT_SEARCH_EXTRA
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2666 matchitem_T *cur; /* points to the match list */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2667 match_T *shl; /* points to search_hl or a match */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2668 int shl_flag; /* flag to indicate whether search_hl
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2669 has been processed or not */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2670 int prevcol_hl_flag; /* flag to indicate whether prevcol
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2671 equals startcol of search_hl or one
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
2672 of the matches */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2673 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2674 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2675 int prev_c = 0; /* previous Arabic character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2676 int prev_c1 = 0; /* first composing char for prev_c */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2677 #endif
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
2678 #if defined(LINE_ATTR)
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
2679 int did_line_attr = 0;
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
2680 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2681
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2682 /* draw_state: items that are drawn in sequence: */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2683 #define WL_START 0 /* nothing done yet */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2684 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2685 # define WL_CMDLINE WL_START + 1 /* cmdline window column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2686 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2687 # define WL_CMDLINE WL_START
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2688 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2689 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2690 # define WL_FOLD WL_CMDLINE + 1 /* 'foldcolumn' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2691 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2692 # define WL_FOLD WL_CMDLINE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2693 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2694 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2695 # define WL_SIGN WL_FOLD + 1 /* column for signs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2696 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2697 # define WL_SIGN WL_FOLD /* column for signs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2698 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2699 #define WL_NR WL_SIGN + 1 /* line number */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2700 #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2701 # define WL_SBR WL_NR + 1 /* 'showbreak' or 'diff' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2702 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2703 # define WL_SBR WL_NR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2704 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2705 #define WL_LINE WL_SBR + 1 /* text in the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2706 int draw_state = WL_START; /* what to draw next */
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
2707 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2708 int feedback_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2709 int feedback_old_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2710 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2711
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2712
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2713 if (startrow > endrow) /* past the end already! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2714 return startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2715
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2716 row = startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2717 screen_row = row + W_WINROW(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2718
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2719 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2720 * To speed up the loop below, set extra_check when there is linebreak,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2721 * trailing white space and/or syntax processing to be done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2722 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2723 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2724 extra_check = wp->w_p_lbr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2725 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2726 extra_check = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2727 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2728 #ifdef FEAT_SYN_HL
482
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
2729 if (syntax_present(wp->w_buffer) && !wp->w_buffer->b_syn_error)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2730 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2731 /* Prepare for syntax highlighting in this line. When there is an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2732 * error, stop syntax highlighting. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2733 save_did_emsg = did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2734 did_emsg = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2735 syntax_start(wp, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2736 if (did_emsg)
482
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
2737 wp->w_buffer->b_syn_error = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2738 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2739 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2740 did_emsg = save_did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2741 has_syntax = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2742 extra_check = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2743 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2744 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2745 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2746
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2747 #ifdef FEAT_SPELL
258
f93df7322443 updated for version 7.0070
vimboss
parents: 236
diff changeset
2748 if (wp->w_p_spell
f93df7322443 updated for version 7.0070
vimboss
parents: 236
diff changeset
2749 && *wp->w_buffer->b_p_spl != NUL
f93df7322443 updated for version 7.0070
vimboss
parents: 236
diff changeset
2750 && wp->w_buffer->b_langp.ga_len > 0
f93df7322443 updated for version 7.0070
vimboss
parents: 236
diff changeset
2751 && *(char **)(wp->w_buffer->b_langp.ga_data) != NULL)
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2752 {
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2753 /* Prepare for spell checking. */
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2754 has_spell = TRUE;
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2755 extra_check = TRUE;
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2756
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2757 /* 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
2758 * line are found too: "et<line-break>al.".
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2759 * Trick: skip a few chars for C/shell/Vim comments */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2760 nextline[SPWORDLEN] = NUL;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2761 if (lnum < wp->w_buffer->b_ml.ml_line_count)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2762 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2763 line = ml_get_buf(wp->w_buffer, lnum + 1, FALSE);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2764 spell_cat_line(nextline + SPWORDLEN, line, SPWORDLEN);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2765 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2766
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2767 /* When a word wrapped from the previous line the start of the current
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2768 * line is valid. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2769 if (lnum == checked_lnum)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2770 cur_checked_col = checked_col;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2771 checked_lnum = 0;
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2772
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2773 /* When there was a sentence end in the previous line may require a
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2774 * word starting with capital in this line. In line 1 always check
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2775 * the first word. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2776 if (lnum != capcol_lnum)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2777 cap_col = -1;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2778 if (lnum == 1)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2779 cap_col = 0;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2780 capcol_lnum = 0;
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
2781 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2782 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2783
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2784 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2785 * handle visual active in this window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2786 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2787 fromcol = -10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2788 tocol = MAXCOL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2789 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2790 if (VIsual_active && wp->w_buffer == curwin->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2791 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2792 /* Visual is after curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2793 if (ltoreq(curwin->w_cursor, VIsual))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2794 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2795 top = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2796 bot = &VIsual;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2797 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2798 else /* Visual is before curwin->w_cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2799 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2800 top = &VIsual;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2801 bot = &curwin->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2802 }
1813
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
2803 lnum_in_visual_area = (lnum >= top->lnum && lnum <= bot->lnum);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2804 if (VIsual_mode == Ctrl_V) /* block mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2805 {
1813
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
2806 if (lnum_in_visual_area)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2807 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2808 fromcol = wp->w_old_cursor_fcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2809 tocol = wp->w_old_cursor_lcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2810 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2811 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2812 else /* non-block mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2813 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2814 if (lnum > top->lnum && lnum <= bot->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2815 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2816 else if (lnum == top->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2817 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2818 if (VIsual_mode == 'V') /* linewise */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2819 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2820 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2821 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2822 getvvcol(wp, top, (colnr_T *)&fromcol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2823 if (gchar_pos(top) == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2824 tocol = fromcol + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2825 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2826 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2827 if (VIsual_mode != 'V' && lnum == bot->lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2828 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2829 if (*p_sel == 'e' && bot->col == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2830 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2831 && bot->coladd == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2832 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2833 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2834 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2835 fromcol = -10;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2836 tocol = MAXCOL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2837 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
2838 else if (bot->col == MAXCOL)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
2839 tocol = MAXCOL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2840 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2841 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2842 pos = *bot;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2843 if (*p_sel == 'e')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2844 getvvcol(wp, &pos, (colnr_T *)&tocol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2845 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2846 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2847 getvvcol(wp, &pos, NULL, NULL, (colnr_T *)&tocol);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2848 ++tocol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2849 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2850 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2851 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2852 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2853
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2854 #ifndef MSDOS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2855 /* Check if the character under the cursor should not be inverted */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2856 if (!highlight_match && lnum == curwin->w_cursor.lnum && wp == curwin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2857 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2858 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2859 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2860 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2861 noinvcur = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2862 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2863
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2864 /* if inverting in this line set area_highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2865 if (fromcol >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2866 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2867 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2868 attr = hl_attr(HLF_V);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2869 #if defined(FEAT_CLIPBOARD) && defined(FEAT_X11)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2870 if (clip_star.available && !clip_star.owned && clip_isautosel())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2871 attr = hl_attr(HLF_VNC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2872 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2873 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2874 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2875
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2876 /*
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
2877 * handle 'incsearch' and ":s///c" highlighting
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2878 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2879 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2880 #endif /* FEAT_VISUAL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2881 if (highlight_match
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2882 && wp == curwin
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2883 && lnum >= curwin->w_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2884 && lnum <= curwin->w_cursor.lnum + search_match_lines)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2885 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2886 if (lnum == curwin->w_cursor.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2887 getvcol(curwin, &(curwin->w_cursor),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2888 (colnr_T *)&fromcol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2889 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2890 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2891 if (lnum == curwin->w_cursor.lnum + search_match_lines)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2892 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2893 pos.lnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2894 pos.col = search_match_endcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2895 getvcol(curwin, &pos, (colnr_T *)&tocol, NULL, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2896 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2897 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2898 tocol = MAXCOL;
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
2899 /* do at least one character; happens when past end of line */
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
2900 if (fromcol == tocol)
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
2901 tocol = fromcol + 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2902 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2903 attr = hl_attr(HLF_I);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2904 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2905
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2906 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2907 filler_lines = diff_check(wp, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2908 if (filler_lines < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2909 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2910 if (filler_lines == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2911 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2912 if (diff_find_change(wp, lnum, &change_start, &change_end))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2913 diff_hlf = HLF_ADD; /* added line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2914 else if (change_start == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2915 diff_hlf = HLF_TXD; /* changed text */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2916 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2917 diff_hlf = HLF_CHD; /* changed line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2918 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2919 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2920 diff_hlf = HLF_ADD; /* added line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2921 filler_lines = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2922 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2923 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2924 if (lnum == wp->w_topline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2925 filler_lines = wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2926 filler_todo = filler_lines;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2927 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2928
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2929 #ifdef LINE_ATTR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2930 # ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2931 /* If this line has a sign with line highlighting set line_attr. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2932 v = buf_getsigntype(wp->w_buffer, lnum, SIGN_LINEHL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2933 if (v != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2934 line_attr = sign_get_attr((int)v, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2935 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2936 # if defined(FEAT_QUICKFIX) && defined(FEAT_WINDOWS)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2937 /* Highlight the current line in the quickfix window. */
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
2938 if (bt_quickfix(wp->w_buffer) && qf_current_entry(wp) == lnum)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2939 line_attr = hl_attr(HLF_L);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2940 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2941 if (line_attr != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2942 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2943 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2944
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2945 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2946 ptr = line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2947
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
2948 #ifdef FEAT_SPELL
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2949 if (has_spell)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2950 {
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2951 /* For checking first word with a capital skip white space. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2952 if (cap_col == 0)
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
2953 cap_col = (int)(skipwhite(line) - line);
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
2954
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2955 /* 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
2956 * current line into nextline[]. Above the start of the next line was
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2957 * copied to nextline[SPWORDLEN]. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2958 if (nextline[SPWORDLEN] == NUL)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2959 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2960 /* No next line or it is empty. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2961 nextlinecol = MAXCOL;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2962 nextline_idx = 0;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2963 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2964 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2965 {
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
2966 v = (long)STRLEN(line);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2967 if (v < SPWORDLEN)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2968 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2969 /* Short line, use it completely and append the start of the
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2970 * next line. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2971 nextlinecol = 0;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2972 mch_memmove(nextline, line, (size_t)v);
1621
82b5078be2dd updated for version 7.2a
vimboss
parents: 1616
diff changeset
2973 STRMOVE(nextline + v, nextline + SPWORDLEN);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2974 nextline_idx = v + 1;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2975 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2976 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2977 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2978 /* Long line, use only the last SPWORDLEN bytes. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2979 nextlinecol = v - SPWORDLEN;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2980 mch_memmove(nextline, line + nextlinecol, SPWORDLEN);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2981 nextline_idx = SPWORDLEN + 1;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2982 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2983 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2984 }
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2985 #endif
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
2986
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2987 /* find start of trailing whitespace */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2988 if (wp->w_p_list && lcs_trail)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2989 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2990 trailcol = (colnr_T)STRLEN(ptr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2991 while (trailcol > (colnr_T)0 && vim_iswhite(ptr[trailcol - 1]))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2992 --trailcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2993 trailcol += (colnr_T) (ptr - line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2994 extra_check = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2995 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2996
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2997 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2998 * 'nowrap' or 'wrap' and a single line that doesn't fit: Advance to the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2999 * first character to be displayed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3000 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3001 if (wp->w_p_wrap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3002 v = wp->w_skipcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3003 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3004 v = wp->w_leftcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3005 if (v > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3006 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3007 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3008 char_u *prev_ptr = ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3009 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3010 while (vcol < v && *ptr != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3011 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3012 c = win_lbr_chartabsize(wp, ptr, (colnr_T)vcol, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3013 vcol += c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3014 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3015 prev_ptr = ptr;
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
3016 #endif
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
3017 mb_ptr_adv(ptr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3018 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3019
1984
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3020 #if defined(FEAT_SYN_HL) || defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL)
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3021 /* When:
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3022 * - 'cuc' is set, or
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3023 * - 'virtualedit' is set, or
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3024 * - the visual mode is active,
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3025 * 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
3026 */
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3027 if (vcol < v && (
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3028 # ifdef FEAT_SYN_HL
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3029 wp->w_p_cuc
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3030 # if defined(FEAT_VIRTUALEDIT) || defined(FEAT_VISUAL)
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3031 ||
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3032 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3033 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3034 # ifdef FEAT_VIRTUALEDIT
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3035 virtual_active()
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3036 # ifdef FEAT_VISUAL
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3037 ||
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3038 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3039 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3040 # ifdef FEAT_VISUAL
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3041 (VIsual_active && wp->w_buffer == curwin->w_buffer)
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3042 # endif
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3043 ))
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3044 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3045 vcol = v;
1984
b57babddb32b updated for version 7.2-281
vimboss
parents: 1983
diff changeset
3046 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3047 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3048
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3049 /* Handle a character that's not completely on the screen: Put ptr at
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3050 * that character but skip the first few screen characters. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3051 if (vcol > v)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3052 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3053 vcol -= c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3054 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3055 ptr = prev_ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3056 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3057 --ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3058 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3059 n_skip = v - vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3060 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3061
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3062 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3063 * Adjust for when the inverted text is before the screen,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3064 * and when the start of the inverted text is before the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3065 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3066 if (tocol <= vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3067 fromcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3068 else if (fromcol >= 0 && fromcol < vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3069 fromcol = vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3070
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3071 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3072 /* When w_skipcol is non-zero, first line needs 'showbreak' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3073 if (wp->w_p_wrap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3074 need_showbreak = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3075 #endif
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3076 #ifdef FEAT_SPELL
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3077 /* 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
3078 * word and if it's badly spelled or not. */
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3079 if (has_spell)
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3080 {
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3081 int len;
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3082 colnr_T linecol = (colnr_T)(ptr - line);
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3083 hlf_T spell_hlf = HLF_COUNT;
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3084
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3085 pos = wp->w_cursor;
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3086 wp->w_cursor.lnum = lnum;
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3087 wp->w_cursor.col = linecol;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3088 len = spell_move_to(wp, FORWARD, TRUE, TRUE, &spell_hlf);
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3089
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3090 /* spell_move_to() may call ml_get() and make "line" invalid */
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3091 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3092 ptr = line + linecol;
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3093
530
339999b511a0 updated for version 7.0148
vimboss
parents: 519
diff changeset
3094 if (len == 0 || (int)wp->w_cursor.col > ptr - line)
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3095 {
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3096 /* 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
3097 * word */
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3098 spell_hlf = HLF_COUNT;
1536
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3099 word_end = (int)(spell_to_word_end(ptr, wp->w_buffer)
24b7b3cc4eec updated for version 7.1-251
vimboss
parents: 1521
diff changeset
3100 - line + 1);
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3101 }
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3102 else
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3103 {
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3104 /* bad word found, use attributes until end of word */
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3105 word_end = wp->w_cursor.col + len + 1;
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3106
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3107 /* Turn index into actual attributes. */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3108 if (spell_hlf != HLF_COUNT)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3109 spell_attr = highlight_attr[spell_hlf];
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3110 }
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3111 wp->w_cursor = pos;
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3112
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3113 # ifdef FEAT_SYN_HL
501
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3114 /* Need to restart syntax highlighting for this line. */
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3115 if (has_syntax)
ce2181d14aa0 updated for version 7.0139
vimboss
parents: 499
diff changeset
3116 syntax_start(wp, lnum);
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3117 # endif
499
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3118 }
08012a1ff8d4 updated for version 7.0137
vimboss
parents: 482
diff changeset
3119 #endif
7
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 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3123 * Correct highlighting for cursor that can't be disabled.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3124 * Avoids having to check this for each character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3125 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3126 if (fromcol >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3127 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3128 if (noinvcur)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3129 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3130 if ((colnr_T)fromcol == wp->w_virtcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3131 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3132 /* highlighting starts at cursor, let it start just after the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3133 * cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3134 fromcol_prev = fromcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3135 fromcol = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3136 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3137 else if ((colnr_T)fromcol < wp->w_virtcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3138 /* restart highlighting after the cursor */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3139 fromcol_prev = wp->w_virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3140 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3141 if (fromcol >= tocol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3142 fromcol = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3143 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3144
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3145 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3146 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3147 * Handle highlighting the last used search pattern and matches.
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3148 * Do this for both search_hl and the match list.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3149 */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3150 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3151 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3152 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3153 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3154 if (shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3155 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3156 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3157 shl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3158 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3159 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3160 shl = &cur->hl;
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3161 shl->startcol = MAXCOL;
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3162 shl->endcol = MAXCOL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3163 shl->attr_cur = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3164 if (shl->rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3165 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3166 v = (long)(ptr - line);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3167 next_search_hl(wp, shl, lnum, (colnr_T)v);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3168
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3169 /* Need to get the line again, a multi-line regexp may have made it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3170 * invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3171 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3172 ptr = line + v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3173
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3174 if (shl->lnum != 0 && shl->lnum <= lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3175 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3176 if (shl->lnum == lnum)
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3177 shl->startcol = shl->rm.startpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3178 else
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3179 shl->startcol = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3180 if (lnum == shl->lnum + shl->rm.endpos[0].lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3181 - shl->rm.startpos[0].lnum)
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3182 shl->endcol = shl->rm.endpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3183 else
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3184 shl->endcol = MAXCOL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3185 /* Highlight one character for an empty match. */
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3186 if (shl->startcol == shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3187 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3188 #ifdef FEAT_MBYTE
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3189 if (has_mbyte && line[shl->endcol] != NUL)
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3190 shl->endcol += (*mb_ptr2len)(line + shl->endcol);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3191 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3192 #endif
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3193 ++shl->endcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3194 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3195 if ((long)shl->startcol < v) /* match at leftcol */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3196 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3197 shl->attr_cur = shl->attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3198 search_attr = shl->attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3199 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3200 area_highlighting = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3201 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3202 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3203 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3204 cur = cur->next;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3205 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3206 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3207
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3208 #ifdef FEAT_SYN_HL
818
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 809
diff changeset
3209 /* Cursor line highlighting for 'cursorline'. Not when Visual mode is
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 809
diff changeset
3210 * active, because it's not clear what is selected then. */
1f929f3ca806 updated for version 7.0c03
vimboss
parents: 809
diff changeset
3211 if (wp->w_p_cul && lnum == wp->w_cursor.lnum && !VIsual_active)
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3212 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3213 line_attr = hl_attr(HLF_CUL);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3214 area_highlighting = TRUE;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3215 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3216 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3217
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3218 off = (unsigned)(current_ScreenLine - ScreenLines);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3219 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3220 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3221 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3222 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3223 /* Rightleft window: process the text in the normal direction, but put
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3224 * it in current_ScreenLine[] from right to left. Start at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3225 * rightmost column of the window. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3226 col = W_WIDTH(wp) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3227 off += col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3228 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3229 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3231 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3232 * Repeat for the whole displayed line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3233 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3234 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3235 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3236 /* Skip this quickly when working on the text. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3237 if (draw_state != WL_LINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3238 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3239 #ifdef FEAT_CMDWIN
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3240 if (draw_state == WL_CMDLINE - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3241 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3242 draw_state = WL_CMDLINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3243 if (cmdwin_type != 0 && wp == curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3244 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3245 /* Draw the cmdline character. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3246 n_extra = 1;
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3247 c_extra = cmdwin_type;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3248 char_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3249 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3250 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3251 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3252
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3253 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3254 if (draw_state == WL_FOLD - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3255 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3256 draw_state = WL_FOLD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3257 if (wp->w_p_fdc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3258 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3259 /* Draw the 'foldcolumn'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3260 fill_foldcolumn(extra, wp, FALSE, lnum);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3261 n_extra = wp->w_p_fdc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3262 p_extra = extra;
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3263 p_extra[n_extra] = NUL;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3264 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3265 char_attr = hl_attr(HLF_FC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3266 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3267 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3268 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3269
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3270 #ifdef FEAT_SIGNS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3271 if (draw_state == WL_SIGN - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3272 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3273 draw_state = WL_SIGN;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3274 /* Show the sign column when there are any signs in this
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3275 * buffer or when using Netbeans. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3276 if (draw_signcolumn(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3277 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3278 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3279 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3280 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3281 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3282 int_u text_sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3283 # ifdef FEAT_SIGN_ICONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3284 int_u icon_sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3285 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3286
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3287 /* Draw two cells with the sign value or blank. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3288 c_extra = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3289 char_attr = hl_attr(HLF_SC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3290 n_extra = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3291
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3292 if (row == startrow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3293 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3294 text_sign = buf_getsigntype(wp->w_buffer, lnum,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3295 SIGN_TEXT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3296 # ifdef FEAT_SIGN_ICONS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3297 icon_sign = buf_getsigntype(wp->w_buffer, lnum,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3298 SIGN_ICON);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3299 if (gui.in_use && icon_sign != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3300 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3301 /* Use the image in this position. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3302 c_extra = SIGN_BYTE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3303 # ifdef FEAT_NETBEANS_INTG
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3304 if (buf_signcount(wp->w_buffer, lnum) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3305 c_extra = MULTISIGN_BYTE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3306 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3307 char_attr = icon_sign;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3308 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3309 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3310 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3311 if (text_sign != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3312 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3313 p_extra = sign_get_text(text_sign);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3314 if (p_extra != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3315 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3316 c_extra = NUL;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
3317 n_extra = (int)STRLEN(p_extra);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3318 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3319 char_attr = sign_get_attr(text_sign, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3320 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3321 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3322 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3323 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3324 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3325
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3326 if (draw_state == WL_NR - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3327 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3328 draw_state = WL_NR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3329 /* Display the line number. After the first fill with blanks
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3330 * when the 'n' flag isn't in 'cpo' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3331 if (wp->w_p_nu
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3332 && (row == startrow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3333 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3334 + filler_lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3335 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3336 || vim_strchr(p_cpo, CPO_NUMCOL) == NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3337 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3338 /* Draw the line number (empty space after wrapping). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3339 if (row == startrow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3340 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3341 + filler_lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3342 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3343 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3344 {
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3345 sprintf((char *)extra, "%*ld ",
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3346 number_width(wp), (long)lnum);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3347 if (wp->w_skipcol > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3348 for (p_extra = extra; *p_extra == ' '; ++p_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3349 *p_extra = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3350 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3351 if (wp->w_p_rl) /* reverse line numbers */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3352 rl_mirror(extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3353 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3354 p_extra = extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3355 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3356 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3357 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3358 c_extra = ' ';
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
3359 n_extra = number_width(wp) + 1;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3360 char_attr = hl_attr(HLF_N);
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3361 #ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3362 /* When 'cursorline' is set highlight the line number of
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3363 * the current line differently. */
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3364 if (wp->w_p_cul && lnum == wp->w_cursor.lnum)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3365 char_attr = hl_combine_attr(hl_attr(HLF_CUL), char_attr);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3366 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3367 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3368 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3369
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3370 #if defined(FEAT_LINEBREAK) || defined(FEAT_DIFF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3371 if (draw_state == WL_SBR - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3372 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3373 draw_state = WL_SBR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3374 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3375 if (filler_todo > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3376 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3377 /* Draw "deleted" diff line(s). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3378 if (char2cells(fill_diff) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3379 c_extra = '-';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3380 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3381 c_extra = fill_diff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3382 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3383 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3384 n_extra = col + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3385 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3386 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3387 n_extra = W_WIDTH(wp) - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3388 char_attr = hl_attr(HLF_DED);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3389 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3390 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3391 # ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3392 if (*p_sbr != NUL && need_showbreak)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3393 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3394 /* Draw 'showbreak' at the start of each broken line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3395 p_extra = p_sbr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3396 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3397 n_extra = (int)STRLEN(p_sbr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3398 char_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3399 need_showbreak = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3400 /* Correct end of highlighted area for 'showbreak',
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3401 * required when 'linebreak' is also set. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3402 if (tocol == vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3403 tocol += n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3404 }
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 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3408
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3409 if (draw_state == WL_LINE - 1 && n_extra == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3410 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3411 draw_state = WL_LINE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3412 if (saved_n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3413 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3414 /* Continue item from end of wrapped line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3415 n_extra = saved_n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3416 c_extra = saved_c_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3417 p_extra = saved_p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3418 char_attr = saved_char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3419 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3420 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3421 char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3422 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3423 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3424
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3425 /* When still displaying '$' of change command, stop at cursor */
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3426 if (dollar_vcol != 0 && wp == curwin
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3427 && lnum == wp->w_cursor.lnum && vcol >= (long)wp->w_virtcol
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3428 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3429 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3430 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3431 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3432 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3433 SCREEN_LINE(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3434 wp->w_p_rl);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3435 /* Pretend we have finished updating the window. Except when
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3436 * 'cursorcolumn' is set. */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3437 #ifdef FEAT_SYN_HL
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3438 if (wp->w_p_cuc)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3439 row = wp->w_cline_row + wp->w_cline_height;
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3440 else
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3441 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3442 row = wp->w_height;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3443 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3444 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3445
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3446 if (draw_state == WL_LINE && area_highlighting)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3447 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3448 /* handle Visual or match highlighting in this line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3449 if (vcol == fromcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3450 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3451 || (has_mbyte && vcol + 1 == fromcol && n_extra == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3452 && (*mb_ptr2cells)(ptr) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3453 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3454 || ((int)vcol_prev == fromcol_prev
1814
febddd8d11b0 updated for version 7.2-112
vimboss
parents: 1813
diff changeset
3455 && vcol_prev < vcol /* not at margin */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3456 && vcol < tocol))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3457 area_attr = attr; /* start highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3458 else if (area_attr != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3459 && (vcol == tocol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3460 || (noinvcur && (colnr_T)vcol == wp->w_virtcol)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3461 area_attr = 0; /* stop highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3462
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3463 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3464 if (!n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3465 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3466 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3467 * Check for start/end of search pattern match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3468 * After end, check for start/end of next match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3469 * When another match, have to check for start again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3470 * Watch out for matching an empty string!
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3471 * Do this for 'search_hl' and the match list (ordered by
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3472 * priority).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3473 */
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3474 v = (long)(ptr - line);
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3475 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3476 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3477 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3478 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3479 if (shl_flag == FALSE
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3480 && ((cur != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3481 && cur->priority > SEARCH_HL_PRIORITY)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3482 || cur == NULL))
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3483 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3484 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3485 shl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3486 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3487 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3488 shl = &cur->hl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3489 while (shl->rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3490 {
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3491 if (shl->startcol != MAXCOL
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3492 && v >= (long)shl->startcol
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3493 && v < (long)shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3494 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3495 shl->attr_cur = shl->attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3496 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3497 else if (v == (long)shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3498 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3499 shl->attr_cur = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3500
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3501 next_search_hl(wp, shl, lnum, (colnr_T)v);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3502
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3503 /* Need to get the line again, a multi-line regexp
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3504 * may have made it invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3505 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3506 ptr = line + v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3507
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3508 if (shl->lnum == lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3509 {
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3510 shl->startcol = shl->rm.startpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3511 if (shl->rm.endpos[0].lnum == 0)
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3512 shl->endcol = shl->rm.endpos[0].col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3513 else
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3514 shl->endcol = MAXCOL;
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3515
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3516 if (shl->startcol == shl->endcol)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3517 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3518 /* highlight empty match, try again after
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3519 * it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3520 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3521 if (has_mbyte)
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3522 shl->endcol += (*mb_ptr2len)(line
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3523 + shl->endcol);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3524 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3525 #endif
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
3526 ++shl->endcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3527 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3528
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3529 /* Loop to check if the match starts at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3530 * current position */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3531 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3532 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3533 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3534 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3535 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3536 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3537 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3538 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3539
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3540 /* Use attributes from match with highest priority among
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3541 * 'search_hl' and the match list. */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3542 search_attr = search_hl.attr_cur;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3543 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3544 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3545 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3546 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3547 if (shl_flag == FALSE
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3548 && ((cur != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3549 && cur->priority > SEARCH_HL_PRIORITY)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3550 || cur == NULL))
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
3551 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3552 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3553 shl_flag = TRUE;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
3554 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3555 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3556 shl = &cur->hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3557 if (shl->attr_cur != 0)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3558 search_attr = shl->attr_cur;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3559 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3560 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3561 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3562 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3563 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3564
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3565 #ifdef FEAT_DIFF
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3566 if (diff_hlf != (hlf_T)0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3567 {
1295
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3568 if (diff_hlf == HLF_CHD && ptr - line >= change_start
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3569 && n_extra == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3570 diff_hlf = HLF_TXD; /* changed text */
1295
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3571 if (diff_hlf == HLF_TXD && ptr - line > change_end
b090b216a832 updated for version 7.1-009
vimboss
parents: 1213
diff changeset
3572 && n_extra == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3573 diff_hlf = HLF_CHD; /* changed line */
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3574 line_attr = hl_attr(diff_hlf);
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3575 }
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3576 #endif
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3577
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3578 /* Decide which of the highlight attributes to use. */
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3579 attr_pri = TRUE;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3580 if (area_attr != 0)
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3581 char_attr = area_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3582 else if (search_attr != 0)
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3583 char_attr = search_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3584 #ifdef LINE_ATTR
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3585 /* Use line_attr when not in the Visual or 'incsearch' area
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3586 * (area_attr may be 0 when "noinvcur" is set). */
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3587 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
1842
c1709e3f8536 updated for version 7.2-140
vimboss
parents: 1824
diff changeset
3588 || vcol < fromcol || vcol_prev < fromcol_prev
c1709e3f8536 updated for version 7.2-140
vimboss
parents: 1824
diff changeset
3589 || vcol >= tocol))
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3590 char_attr = line_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3591 #endif
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3592 else
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3593 {
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3594 attr_pri = FALSE;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3595 #ifdef FEAT_SYN_HL
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3596 if (has_syntax)
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3597 char_attr = syntax_attr;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3598 else
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3599 #endif
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3600 char_attr = 0;
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3601 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3602 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3603
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3604 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3605 * Get the next character to put on the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3606 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3607 /*
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3608 * The "p_extra" points to the extra stuff that is inserted to
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3609 * represent special characters (non-printable stuff) and other
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3610 * things. When all characters are the same, c_extra is used.
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3611 * "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
3612 * "p_extra[n_extra]".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3613 * For the '$' of the 'list' option, n_extra == 1, p_extra == "".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3614 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3615 if (n_extra > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3616 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3617 if (c_extra != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3618 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3619 c = c_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3620 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3621 mb_c = c; /* doesn't handle non-utf-8 multi-byte! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3622 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3623 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3624 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3625 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3626 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3627 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3628 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3629 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3630 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3631 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3632 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3633 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3634 c = *p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3635 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3636 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3637 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3638 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3639 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3640 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3641 /* If the UTF-8 character is more than one byte:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3642 * Decode it into "mb_c". */
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3643 mb_l = (*mb_ptr2len)(p_extra);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3644 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3645 if (mb_l > n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3646 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3647 else if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3648 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3649 mb_c = utfc_ptr2char(p_extra, u8cc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3650 mb_utf8 = TRUE;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3651 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3652 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3653 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3654 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3655 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3656 /* if this is a DBCS character, put it in "mb_c" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3657 mb_l = MB_BYTE2LEN(c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3658 if (mb_l >= n_extra)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3659 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3660 else if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3661 mb_c = (c << 8) + p_extra[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3662 }
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3663 if (mb_l == 0) /* at the NUL at end-of-line */
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3664 mb_l = 1;
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3665
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3666 /* If a double-width char doesn't fit display a '>' in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3667 * last column. */
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3668 if ((
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3669 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3670 wp->w_p_rl ? (col <= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3671 # endif
504
35cde31bdcbd updated for version 7.0141
vimboss
parents: 501
diff changeset
3672 (col >= W_WIDTH(wp) - 1))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3673 && (*mb_char2cells)(mb_c) == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3674 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3675 c = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3676 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3677 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3678 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3679 multi_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3680 /* put the pointer back to output the double-width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3681 * character at the start of the next line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3682 ++n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3683 --p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3684 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3685 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3686 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3687 n_extra -= mb_l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3688 p_extra += mb_l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3689 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3690 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3691 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3692 ++p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3693 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3694 --n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3695 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3696 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3697 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3698 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3699 * Get a character from the line itself.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3700 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3701 c = *ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3702 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3703 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3704 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3705 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3706 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3707 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3708 /* If the UTF-8 character is more than one byte: Decode it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3709 * into "mb_c". */
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
3710 mb_l = (*mb_ptr2len)(ptr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3711 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3712 if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3713 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3714 mb_c = utfc_ptr2char(ptr, u8cc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3715 /* Overlong encoded ASCII or ASCII with composing char
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3716 * is displayed normally, except a NUL. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3717 if (mb_c < 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3718 c = mb_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3719 mb_utf8 = TRUE;
507
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3720
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3721 /* At start of the line we can have a composing char.
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3722 * Draw it as a space with a composing char. */
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3723 if (utf_iscomposing(mb_c))
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3724 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3725 int i;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
3726
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3727 for (i = Screen_mco - 1; i > 0; --i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3728 u8cc[i] = u8cc[i - 1];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3729 u8cc[0] = mb_c;
507
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3730 mb_c = ' ';
a1059cda45f2 updated for version 7.0142
vimboss
parents: 504
diff changeset
3731 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3732 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3733
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3734 if ((mb_l == 1 && c >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3735 || (mb_l >= 1 && mb_c == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3736 || (mb_l > 1 && (!vim_isprintc(mb_c)
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3737 # ifdef UNICODE16
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3738 || mb_c >= 0x10000
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3739 # endif
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3740 )))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3741 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3742 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3743 * Illegal UTF-8 byte: display as <xx>.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3744 * Non-BMP character : display as ? or fullwidth ?.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3745 */
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3746 # ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3747 if (mb_c < 0x10000)
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3748 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3749 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3750 transchar_hex(extra, mb_c);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3751 # ifdef FEAT_RIGHTLEFT
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3752 if (wp->w_p_rl) /* reverse */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3753 rl_mirror(extra);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3754 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3755 }
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3756 # ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3757 else if (utf_char2cells(mb_c) != 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3758 STRCPY(extra, "?");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3759 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3760 /* 0xff1f in UTF-8: full-width '?' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3761 STRCPY(extra, "\357\274\237");
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
3762 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3763
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3764 p_extra = extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3765 c = *p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3766 mb_c = mb_ptr2char_adv(&p_extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3767 mb_utf8 = (c >= 0x80);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3768 n_extra = (int)STRLEN(p_extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3769 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3770 if (area_attr == 0 && search_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3771 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3772 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3773 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3774 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3775 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3776 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3777 else if (mb_l == 0) /* at the NUL at end-of-line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3778 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3779 #ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3780 else if (p_arshape && !p_tbidi && ARABIC_CHAR(mb_c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3781 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3782 /* Do Arabic shaping. */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3783 int pc, pc1, nc;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3784 int pcc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3785
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3786 /* The idea of what is the previous and next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3787 * character depends on 'rightleft'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3788 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3789 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3790 pc = prev_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3791 pc1 = prev_c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3792 nc = utf_ptr2char(ptr + mb_l);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3793 prev_c1 = u8cc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3794 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3795 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3796 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3797 pc = utfc_ptr2char(ptr + mb_l, pcc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3798 nc = prev_c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3799 pc1 = pcc[0];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3800 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3801 prev_c = mb_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3802
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3803 mb_c = arabic_shape(mb_c, &c, &u8cc[0], pc, pc1, nc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3804 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3805 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3806 prev_c = mb_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3807 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3808 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3809 else /* enc_dbcs */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3810 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3811 mb_l = MB_BYTE2LEN(c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3812 if (mb_l == 0) /* at the NUL at end-of-line */
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 else if (mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3815 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3816 /* We assume a second byte below 32 is illegal.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3817 * Hopefully this is OK for all double-byte encodings!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3818 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3819 if (ptr[1] >= 32)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3820 mb_c = (c << 8) + ptr[1];
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 if (ptr[1] == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3824 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3825 /* head byte at end of line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3826 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3827 transchar_nonprint(extra, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3828 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3829 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3830 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3831 /* illegal tail byte */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3832 mb_l = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3833 STRCPY(extra, "XX");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3834 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3835 p_extra = extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3836 n_extra = (int)STRLEN(extra) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3837 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3838 c = *p_extra++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3839 if (area_attr == 0 && search_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3840 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3841 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3842 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3843 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3844 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3845 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3846 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3847 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3848 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3849 /* If a double-width char doesn't fit display a '>' in the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3850 * last column; the character is displayed at the start of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3851 * next line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3852 if ((
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3853 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3854 wp->w_p_rl ? (col <= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3855 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3856 (col >= W_WIDTH(wp) - 1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3857 && (*mb_char2cells)(mb_c) == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3858 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3859 c = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3860 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3861 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3862 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3863 multi_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3864 /* Put pointer back so that the character will be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3865 * displayed at the start of the next line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3866 --ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3867 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3868 else if (*ptr != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3869 ptr += mb_l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3870
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3871 /* If a double-width char doesn't fit at the left side display
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3872 * a '<' in the first column. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3873 if (n_skip > 0 && mb_l > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3874 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3875 n_extra = 1;
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
3876 c_extra = '<';
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3877 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3878 if (area_attr == 0 && search_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3879 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3880 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3881 extra_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3882 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3883 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3884 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3885 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3886 mb_l = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3887 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3888
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3889 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3890 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3891 ++ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3892
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3893 /* 'list' : change char 160 to lcs_nbsp. */
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3894 if (wp->w_p_list && (c == 160
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3895 #ifdef FEAT_MBYTE
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3896 || (mb_utf8 && mb_c == 160)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3897 #endif
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3898 ) && lcs_nbsp)
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3899 {
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3900 c = lcs_nbsp;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3901 if (area_attr == 0 && search_attr == 0)
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3902 {
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3903 n_attr = 1;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3904 extra_attr = hl_attr(HLF_8);
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3905 saved_attr2 = char_attr; /* save current attr */
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3906 }
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3907 #ifdef FEAT_MBYTE
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3908 mb_c = c;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3909 if (enc_utf8 && (*mb_char2len)(c) > 1)
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3910 {
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3911 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
3912 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
3913 c = 0xc0;
12
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3914 }
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3915 else
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3916 mb_utf8 = FALSE;
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3917 #endif
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3918 }
bdeee1504ac1 updated for version 7.0004
vimboss
parents: 11
diff changeset
3919
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3920 if (extra_check)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3921 {
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3922 #ifdef FEAT_SPELL
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3923 int can_spell = TRUE;
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3924 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3925
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3926 #ifdef FEAT_SYN_HL
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3927 /* Get syntax attribute, unless still at the start of the line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3928 * (double-wide char that doesn't fit). */
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3929 v = (long)(ptr - line);
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3930 if (has_syntax && v > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3931 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3932 /* Get the syntax attribute for the character. If there
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3933 * is an error, disable syntax highlighting. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3934 save_did_emsg = did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3935 did_emsg = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3936
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3937 syntax_attr = get_syntax_attr((colnr_T)v - 1,
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3938 # ifdef FEAT_SPELL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3939 has_spell ? &can_spell :
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3940 # endif
1504
1b55bbf5c580 updated for version 7.1-219
vimboss
parents: 1439
diff changeset
3941 NULL, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3942
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3943 if (did_emsg)
482
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
3944 {
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
3945 wp->w_buffer->b_syn_error = TRUE;
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
3946 has_syntax = FALSE;
6f8b578776ab updated for version 7.0131
vimboss
parents: 474
diff changeset
3947 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3948 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3949 did_emsg = save_did_emsg;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3950
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3951 /* Need to get the line again, a multi-line regexp may
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3952 * have made it invalid. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3953 line = ml_get_buf(wp->w_buffer, lnum, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3954 ptr = line + v;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3955
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3956 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3957 char_attr = syntax_attr;
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
3958 else
303
6a21eb563c34 updated for version 7.0080
vimboss
parents: 301
diff changeset
3959 char_attr = hl_combine_attr(syntax_attr, char_attr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
3960 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3961 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3962
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3963 #ifdef FEAT_SPELL
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
3964 /* Check spelling (unless at the end of the line).
319
0ee579e01743 updated for version 7.0083
vimboss
parents: 303
diff changeset
3965 * Only do this when there is no syntax highlighting, the
0ee579e01743 updated for version 7.0083
vimboss
parents: 303
diff changeset
3966 * @Spell cluster is not used or the current syntax item
0ee579e01743 updated for version 7.0083
vimboss
parents: 303
diff changeset
3967 * contains the @Spell cluster. */
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3968 if (has_spell && v >= word_end && v > cur_checked_col)
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3969 {
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 227
diff changeset
3970 spell_attr = 0;
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3971 # ifdef FEAT_SYN_HL
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
3972 if (!attr_pri)
230
9281a51ca7a2 updated for version 7.0064
vimboss
parents: 227
diff changeset
3973 char_attr = syntax_attr;
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3974 # endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3975 if (c != 0 && (
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3976 # ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3977 !has_syntax ||
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3978 # endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
3979 can_spell))
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3980 {
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3981 char_u *prev_ptr, *p;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3982 int len;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
3983 hlf_T spell_hlf = HLF_COUNT;
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3984 # ifdef FEAT_MBYTE
336
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
3985 if (has_mbyte)
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
3986 {
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
3987 prev_ptr = ptr - mb_l;
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
3988 v -= mb_l - 1;
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
3989 }
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
3990 else
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
3991 # endif
336
2d8c2622e1fa updated for version 7.0087
vimboss
parents: 319
diff changeset
3992 prev_ptr = ptr - 1;
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3993
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3994 /* Use nextline[] if possible, it has the start of the
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3995 * next line concatenated. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3996 if ((prev_ptr - line) - nextlinecol >= 0)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3997 p = nextline + (prev_ptr - line) - nextlinecol;
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3998 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
3999 p = prev_ptr;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4000 cap_col -= (int)(prev_ptr - line);
625
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
4001 len = spell_check(wp, p, &spell_hlf, &cap_col,
81fe2ccc1207 updated for version 7.0179
vimboss
parents: 574
diff changeset
4002 nochange);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4003 word_end = v + len;
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4004
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4005 /* In Insert mode only highlight a word that
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4006 * doesn't touch the cursor. */
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4007 if (spell_hlf != HLF_COUNT
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4008 && (State & INSERT) != 0
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4009 && wp->w_cursor.lnum == lnum
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4010 && wp->w_cursor.col >=
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4011 (colnr_T)(prev_ptr - line)
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4012 && wp->w_cursor.col < (colnr_T)word_end)
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4013 {
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4014 spell_hlf = HLF_COUNT;
301
006e9c8a6a8a updated for version 7.0079
vimboss
parents: 277
diff changeset
4015 spell_redraw_lnum = lnum;
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4016 }
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4017
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4018 if (spell_hlf == HLF_COUNT && p != prev_ptr
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4019 && (p - nextline) + len > nextline_idx)
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4020 {
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4021 /* Remember that the good word continues at the
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4022 * start of the next line. */
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4023 checked_lnum = lnum + 1;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4024 checked_col = (int)((p - nextline) + len - nextline_idx);
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4025 }
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4026
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4027 /* Turn index into actual attributes. */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4028 if (spell_hlf != HLF_COUNT)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4029 spell_attr = highlight_attr[spell_hlf];
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4030
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4031 if (cap_col > 0)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4032 {
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4033 if (p != prev_ptr
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4034 && (p - nextline) + cap_col >= nextline_idx)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4035 {
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4036 /* Remember that the word in the next line
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4037 * must start with a capital. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4038 capcol_lnum = lnum + 1;
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4039 cap_col = (int)((p - nextline) + cap_col
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4040 - nextline_idx);
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4041 }
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4042 else
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4043 /* Compute the actual column. */
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
4044 cap_col += (int)(prev_ptr - line);
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4045 }
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4046 }
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4047 }
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4048 if (spell_attr != 0)
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4049 {
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4050 if (!attr_pri)
348
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4051 char_attr = hl_combine_attr(char_attr, spell_attr);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4052 else
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4053 char_attr = hl_combine_attr(spell_attr, char_attr);
7e819e81117e updated for version 7.0090
vimboss
parents: 336
diff changeset
4054 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4055 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4056 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4057 /*
221
7fd4b5df33be updated for version 7.0062
vimboss
parents: 216
diff changeset
4058 * Found last space before word: check for line break.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4059 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4060 if (wp->w_p_lbr && vim_isbreak(c) && !vim_isbreak(*ptr)
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4061 && !wp->w_p_list)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4062 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4063 n_extra = win_lbr_chartabsize(wp, ptr - (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4064 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4065 has_mbyte ? mb_l :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4066 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4067 1), (colnr_T)vcol, NULL) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4068 c_extra = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4069 if (vim_iswhite(c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4070 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4071 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4072 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4073
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4074 if (trailcol != MAXCOL && ptr > line + trailcol && c == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4075 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4076 c = lcs_trail;
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4077 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4078 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4079 n_attr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4080 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4081 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4082 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4083 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4084 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4085 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4086 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4087 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4088 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4089 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4090 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4091 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4092 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4093 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4094 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4095 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4096
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4097 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4098 * Handling of non-printable characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4099 */
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4100 if (!(chartab[c & 0xff] & CT_PRINT_CHAR))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4101 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4102 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4103 * when getting a character from the file, we may have to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4104 * turn it into something else on the way to putting it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4105 * into "ScreenLines".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4106 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4107 if (c == TAB && (!wp->w_p_list || lcs_tab1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4108 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4109 /* tab amount depends on current column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4110 n_extra = (int)wp->w_buffer->b_p_ts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4111 - vcol % (int)wp->w_buffer->b_p_ts - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4112 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4113 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4114 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4115 if (wp->w_p_list)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4116 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4117 c = lcs_tab1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4118 c_extra = lcs_tab2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4119 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4120 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4121 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4122 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4123 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4124 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4125 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4126 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4127 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4128 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4129 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4130 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4131 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4132 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4133 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4134 c_extra = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4135 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4136 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4137 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4138 else if (c == NUL
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4139 && ((wp->w_p_list && lcs_eol > 0)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4140 || ((fromcol >= 0 || fromcol_prev >= 0)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4141 && tocol > vcol
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4142 #ifdef FEAT_VISUAL
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4143 && VIsual_mode != Ctrl_V
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
4144 #endif
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4145 && (
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4146 # ifdef FEAT_RIGHTLEFT
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4147 wp->w_p_rl ? (col >= 0) :
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4148 # endif
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4149 (col < W_WIDTH(wp)))
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4150 && !(noinvcur
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4151 && lnum == wp->w_cursor.lnum
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4152 && (colnr_T)vcol == wp->w_virtcol)))
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4153 && lcs_eol_one >= 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4154 {
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4155 /* Display a '$' after the line or highlight an extra
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4156 * character if the line break is included. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4157 #if defined(FEAT_DIFF) || defined(LINE_ATTR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4158 /* For a diff line the highlighting continues after the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4159 * "$". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4160 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4161 # ifdef FEAT_DIFF
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
4162 diff_hlf == (hlf_T)0
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4163 # ifdef LINE_ATTR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4164 &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4165 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4166 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4167 # ifdef LINE_ATTR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4168 line_attr == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4169 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4170 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4171 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4172 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4173 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4174 /* In virtualedit, visual selections may extend
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4175 * beyond end of line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4176 if (area_highlighting && virtual_active()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4177 && tocol != MAXCOL && vcol < tocol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4178 n_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4179 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4180 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4181 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4182 p_extra = at_end_str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4183 n_extra = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4184 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4185 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4186 }
36
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4187 if (wp->w_p_list)
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4188 c = lcs_eol;
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4189 else
125e80798a85 updated for version 7.0021
vimboss
parents: 33
diff changeset
4190 c = ' ';
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4191 lcs_eol_one = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4192 --ptr; /* put it back at the NUL */
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4193 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4194 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4195 extra_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4196 n_attr = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4197 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4198 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4199 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4200 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4201 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4202 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4203 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4204 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4205 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4206 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4207 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4208 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4209 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4210 else if (c != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4211 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4212 p_extra = transchar(c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4213 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4214 if ((dy_flags & DY_UHEX) && wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4215 rl_mirror(p_extra); /* reverse "<12>" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4216 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4217 n_extra = byte2cells(c) - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4218 c_extra = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4219 c = *p_extra++;
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4220 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4221 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4222 n_attr = n_extra + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4223 extra_attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4224 saved_attr2 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4225 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4226 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4227 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4228 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4229 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4230 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4231 else if (VIsual_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4232 && (VIsual_mode == Ctrl_V
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4233 || VIsual_mode == 'v')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4234 && virtual_active()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4235 && tocol != MAXCOL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4236 && vcol < tocol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4237 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4238 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4239 wp->w_p_rl ? (col >= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4240 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4241 (col < W_WIDTH(wp))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4242 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4243 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4244 --ptr; /* put it back at the NUL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4245 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4246 #endif
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4247 #if defined(LINE_ATTR)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4248 else if ((
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4249 # ifdef FEAT_DIFF
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4250 diff_hlf != (hlf_T)0 ||
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4251 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4252 line_attr != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4253 ) && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4254 # ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4255 wp->w_p_rl ? (col >= 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4256 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4257 (col < W_WIDTH(wp))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4258 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4259 /* Highlight until the right side of the window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4260 c = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4261 --ptr; /* put it back at the NUL */
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4262
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4263 /* Remember we do the char for line highlighting. */
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4264 ++did_line_attr;
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4265
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4266 /* don't do search HL for the rest of the line */
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4267 if (line_attr != 0 && char_attr == search_attr && col > 0)
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4268 char_attr = line_attr;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4269 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4270 if (diff_hlf == HLF_TXD)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4271 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4272 diff_hlf = HLF_CHD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4273 if (attr == 0 || char_attr != attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4274 char_attr = hl_attr(diff_hlf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4275 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4276 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4277 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4278 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4279 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4280 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4281
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4282 /* Don't override visual selection highlighting. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4283 if (n_attr > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4284 && draw_state == WL_LINE
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4285 && !attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4286 char_attr = extra_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4287
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 40
diff changeset
4288 #if defined(FEAT_XIM) && defined(FEAT_GUI_GTK)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4289 /* XIM don't send preedit_start and preedit_end, but they send
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4290 * preedit_changed and commit. Thus Vim can't set "im_is_active", use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4291 * im_is_preediting() here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4292 if (xic != NULL
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4293 && lnum == wp->w_cursor.lnum
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4294 && (State & INSERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4295 && !p_imdisable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4296 && im_is_preediting()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4297 && draw_state == WL_LINE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4298 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4299 colnr_T tcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4300
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4301 if (preedit_end_col == MAXCOL)
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4302 getvcol(curwin, &(wp->w_cursor), &tcol, NULL, NULL);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4303 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4304 tcol = preedit_end_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4305 if ((long)preedit_start_col <= vcol && vcol < (long)tcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4306 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4307 if (feedback_old_attr < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4308 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4309 feedback_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4310 feedback_old_attr = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4311 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4312 char_attr = im_get_feedback_attr(feedback_col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4313 if (char_attr < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4314 char_attr = feedback_old_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4315 feedback_col++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4316 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4317 else if (feedback_old_attr >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4318 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4319 char_attr = feedback_old_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4320 feedback_old_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4321 feedback_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4322 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4323 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4324 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4325 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4326 * Handle the case where we are in column 0 but not on the first
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4327 * character of the line and the user wants us to show us a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4328 * special character (via 'listchars' option "precedes:<char>".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4329 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4330 if (lcs_prec_todo != NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4331 && (wp->w_p_wrap ? wp->w_skipcol > 0 : wp->w_leftcol > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4332 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4333 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4334 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4335 && draw_state > WL_NR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4336 && c != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4337 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4338 c = lcs_prec;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4339 lcs_prec_todo = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4340 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4341 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4342 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4343 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4344 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4345 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4346 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4347 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4348 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4349 mb_utf8 = FALSE; /* don't draw as UTF-8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4350 #endif
674
4b8583e82cb8 updated for version 7.0201
vimboss
parents: 673
diff changeset
4351 if (!attr_pri)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4352 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4353 saved_attr3 = char_attr; /* save current attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4354 char_attr = hl_attr(HLF_AT); /* later copied to char_attr */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4355 n_attr3 = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4356 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4357 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4358
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4359 /*
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4360 * At end of the text line or just after the last character.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4361 */
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4362 if (c == NUL
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4363 #if defined(LINE_ATTR)
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4364 || did_line_attr == 1
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4365 #endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4366 )
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4367 {
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4368 #ifdef FEAT_SEARCH_EXTRA
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4369 long prevcol = (long)(ptr - line) - (c == NUL);
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4370
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4371 /* we're not really at that column when skipping some text */
1439
a5b3a7fb6a5a updated for version 7.1-154
vimboss
parents: 1437
diff changeset
4372 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
4373 ++prevcol;
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4374 #endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4375
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4376 /* invert at least one char, used for Visual and empty line or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4377 * highlight match at end of line. If it's beyond the last
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4378 * char on the screen, just overwrite that one (tricky!) Not
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4379 * needed when a '$' was displayed for 'list'. */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4380 #ifdef FEAT_SEARCH_EXTRA
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4381 prevcol_hl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4382 if (prevcol == (long)search_hl.startcol)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4383 prevcol_hl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4384 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4385 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4386 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4387 while (cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4388 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4389 if (prevcol == (long)cur->hl.startcol)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4390 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4391 prevcol_hl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4392 break;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4393 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4394 cur = cur->next;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4395 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4396 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4397 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4398 if (lcs_eol == lcs_eol_one
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4399 && ((area_attr != 0 && vcol == fromcol
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4400 #ifdef FEAT_VISUAL
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4401 && (VIsual_mode != Ctrl_V
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4402 || lnum == VIsual.lnum
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4403 || lnum == curwin->w_cursor.lnum)
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4404 #endif
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4405 && c == NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4406 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4407 /* highlight 'hlsearch' match at end of line */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4408 || (prevcol_hl_flag == TRUE
910
abff2f6a3ad7 updated for version 7.0-036
vimboss
parents: 867
diff changeset
4409 # if defined(LINE_ATTR)
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4410 && did_line_attr <= 1
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4411 # endif
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4412 )
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4413 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4414 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4415 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4416 int n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4417
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4418 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4419 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4420 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4421 if (col < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4422 n = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4423 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4424 else
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 if (col >= W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4428 n = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4429 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4430 if (n != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4431 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4432 /* At the window boundary, highlight the last character
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4433 * instead (better than nothing). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4434 off += n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4435 col += n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4436 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4437 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4438 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4439 /* Add a blank character to highlight. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4440 ScreenLines[off] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4441 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4442 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4443 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4444 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4445 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4446 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4447 if (area_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4448 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4449 /* Use attributes from match with highest priority among
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4450 * 'search_hl' and the match list. */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4451 char_attr = search_hl.attr;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4452 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4453 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4454 while (cur != NULL || shl_flag == FALSE)
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4455 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4456 if (shl_flag == FALSE
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4457 && ((cur != NULL
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4458 && cur->priority > SEARCH_HL_PRIORITY)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4459 || cur == NULL))
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4460 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4461 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4462 shl_flag = TRUE;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4463 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4464 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4465 shl = &cur->hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4466 if ((ptr - line) - 1 == (long)shl->startcol)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4467 char_attr = shl->attr;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4468 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4469 cur = cur->next;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
4470 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4471 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4472 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4473 ScreenAttrs[off] = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4474 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4475 if (wp->w_p_rl)
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4476 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4477 --col;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4478 --off;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4479 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4480 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4481 #endif
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4482 {
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4483 ++col;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4484 ++off;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4485 }
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4486 ++vcol;
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4487 #ifdef FEAT_SYN_HL
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4488 eol_hl_off = 1;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4489 #endif
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4490 }
867
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4491 }
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4492
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4493 /*
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4494 * At end of the text line.
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4495 */
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4496 if (c == NUL)
a5677b7ce858 updated for version 7.0g04
vimboss
parents: 856
diff changeset
4497 {
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4498 #ifdef FEAT_SYN_HL
1850
eaecfa88c246 updated for version 7.2-148
vimboss
parents: 1849
diff changeset
4499 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
4500 && lnum == wp->w_cursor.lnum)
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4501 {
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4502 /* highlight last char after line */
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4503 --col;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4504 --off;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4505 --vcol;
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4506 }
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4507
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4508 /* Highlight 'cursorcolumn' past end of the line. */
758
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4509 if (wp->w_p_wrap)
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4510 v = wp->w_skipcol;
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4511 else
d591d4ceeaee updated for version 7.0224
vimboss
parents: 743
diff changeset
4512 v = wp->w_leftcol;
820
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4513 /* check if line ends before left margin */
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4514 if (vcol < v + col - win_col_off(wp))
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4515
57c7403f6599 updated for version 7.0c11
vimboss
parents: 819
diff changeset
4516 vcol = v + col - win_col_off(wp);
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4517 if (wp->w_p_cuc
1437
8b2e9257cc11 updated for version 7.1-152
vimboss
parents: 1401
diff changeset
4518 && (int)wp->w_virtcol >= vcol - eol_hl_off
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4519 && (int)wp->w_virtcol < W_WIDTH(wp) * (row - startrow + 1)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4520 + v
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4521 && lnum != wp->w_cursor.lnum
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4522 # ifdef FEAT_RIGHTLEFT
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4523 && !wp->w_p_rl
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4524 # endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4525 )
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4526 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4527 while (col < W_WIDTH(wp))
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4528 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4529 ScreenLines[off] = ' ';
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4530 #ifdef FEAT_MBYTE
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4531 if (enc_utf8)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4532 ScreenLinesUC[off] = 0;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4533 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4534 ++col;
777
f664cc974a7a updated for version 7.0227
vimboss
parents: 766
diff changeset
4535 if (vcol == (long)wp->w_virtcol)
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4536 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4537 ScreenAttrs[off] = hl_attr(HLF_CUC);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4538 break;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4539 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4540 ScreenAttrs[off++] = 0;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4541 ++vcol;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4542 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4543 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4544 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4545
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4546 SCREEN_LINE(screen_row, W_WINCOL(wp), col, (int)W_WIDTH(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4547 wp->w_p_rl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4548 row++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4549
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4550 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4551 * Update w_cline_height and w_cline_folded if the cursor line was
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4552 * updated (saves a call to plines() later).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4553 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4554 if (wp == curwin && lnum == curwin->w_cursor.lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4555 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4556 curwin->w_cline_row = startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4557 curwin->w_cline_height = row - startrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4558 #ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4559 curwin->w_cline_folded = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4560 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4561 curwin->w_valid |= (VALID_CHEIGHT|VALID_CROW);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4562 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4563
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4564 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4565 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4566
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4567 /* line continues beyond line end */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4568 if (lcs_ext
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4569 && !wp->w_p_wrap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4570 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4571 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4572 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4573 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4574 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4575 wp->w_p_rl ? col == 0 :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4576 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4577 col == W_WIDTH(wp) - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4578 && (*ptr != NUL
1555
71db8539b8c4 updated for version 7.1-268
vimboss
parents: 1545
diff changeset
4579 || (wp->w_p_list && lcs_eol_one > 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4580 || (n_extra && (c_extra != NUL || *p_extra != NUL))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4581 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4582 c = lcs_ext;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4583 char_attr = hl_attr(HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4584 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4585 mb_c = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4586 if (enc_utf8 && (*mb_char2len)(c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4587 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4588 mb_utf8 = TRUE;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4589 u8cc[0] = 0;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4590 c = 0xc0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4591 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4592 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4593 mb_utf8 = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4594 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4595 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4596
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4597 #ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4598 /* Highlight the cursor column if 'cursorcolumn' is set. But don't
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4599 * highlight the cursor position itself. */
777
f664cc974a7a updated for version 7.0227
vimboss
parents: 766
diff changeset
4600 if (wp->w_p_cuc && vcol == (long)wp->w_virtcol
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4601 && lnum != wp->w_cursor.lnum
1813
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
4602 && draw_state == WL_LINE
b5ad00887b81 updated for version 7.2-111
vimboss
parents: 1725
diff changeset
4603 && !lnum_in_visual_area)
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4604 {
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4605 vcol_save_attr = char_attr;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4606 char_attr = hl_combine_attr(char_attr, hl_attr(HLF_CUC));
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4607 }
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4608 else
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4609 vcol_save_attr = -1;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4610 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4611
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4612 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4613 * Store character to be displayed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4614 * Skip characters that are left of the screen for 'nowrap'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4615 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4616 vcol_prev = vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4617 if (draw_state < WL_LINE || n_skip <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4618 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4619 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4620 * Store the character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4621 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4622 #if defined(FEAT_RIGHTLEFT) && defined(FEAT_MBYTE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4623 if (has_mbyte && wp->w_p_rl && (*mb_char2cells)(mb_c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4624 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4625 /* A double-wide character is: put first halve in left cell. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4626 --off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4627 --col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4628 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4629 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4630 ScreenLines[off] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4631 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4632 if (enc_dbcs == DBCS_JPNU)
2069
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4633 {
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4634 if ((mb_c & 0xff00) == 0x8e00)
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4635 ScreenLines[off] = 0x8e;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4636 ScreenLines2[off] = mb_c & 0xff;
2069
63613d8d7e4d updated for version 7.2.354
Bram Moolenaar <bram@zimbu.org>
parents: 2055
diff changeset
4637 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4638 else if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4639 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4640 if (mb_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4641 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4642 int i;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
4643
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4644 ScreenLinesUC[off] = mb_c;
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4645 if ((c & 0xff) == 0)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
4646 ScreenLines[off] = 0x80; /* avoid storing zero */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4647 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4648 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4649 ScreenLinesC[i][off] = u8cc[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4650 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4651 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4652 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4653 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4654 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4655 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4656 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4657 if (multi_attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4658 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4659 ScreenAttrs[off] = multi_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4660 multi_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4661 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4662 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4663 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4664 ScreenAttrs[off] = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4665
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4666 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4667 if (has_mbyte && (*mb_char2cells)(mb_c) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4668 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4669 /* Need to fill two screen columns. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4670 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4671 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4672 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4673 /* UTF-8: Put a 0 in the second screen char. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4674 ScreenLines[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4675 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4676 /* DBCS: Put second byte in the second screen char. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4677 ScreenLines[off] = mb_c & 0xff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4678 ++vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4679 /* When "tocol" is halfway a character, set it to the end of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4680 * the character, otherwise highlighting won't stop. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4681 if (tocol == vcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4682 ++tocol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4683 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4684 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4685 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4686 /* now it's time to backup one cell */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4687 --off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4688 --col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4689 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4690 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4691 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4692 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4693 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4694 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4695 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4696 --off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4697 --col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4698 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4699 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4700 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4701 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4702 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4703 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4704 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4705 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4706 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4707 --n_skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4708
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4709 /* Only advance the "vcol" when after the 'number' column. */
1849
11a74d2cab9d updated for version 7.2-147
vimboss
parents: 1843
diff changeset
4710 if (draw_state > WL_NR
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4711 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4712 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4713 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4714 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4715 ++vcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4716
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4717 #ifdef FEAT_SYN_HL
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4718 if (vcol_save_attr >= 0)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4719 char_attr = vcol_save_attr;
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4720 #endif
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4721
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4722 /* restore attributes after "predeces" in 'listchars' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4723 if (draw_state > WL_NR && n_attr3 > 0 && --n_attr3 == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4724 char_attr = saved_attr3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4725
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4726 /* restore attributes after last 'listchars' or 'number' char */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4727 if (n_attr > 0 && draw_state == WL_LINE && --n_attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4728 char_attr = saved_attr2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4729
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4730 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4731 * 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
4732 * so far. If there is no more to display it is caught above.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4733 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4734 if ((
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4735 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4736 wp->w_p_rl ? (col < 0) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4737 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4738 (col >= W_WIDTH(wp)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4739 && (*ptr != NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4740 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4741 || filler_todo > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4742 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4743 || (wp->w_p_list && lcs_eol != NUL && p_extra != at_end_str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4744 || (n_extra != 0 && (c_extra != NUL || *p_extra != NUL)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4745 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4746 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4747 SCREEN_LINE(screen_row, W_WINCOL(wp), col, (int)W_WIDTH(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4748 wp->w_p_rl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4749 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4750 ++screen_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4751
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4752 /* When not wrapping and finished diff lines, or when displayed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4753 * '$' and highlighting until last column, break here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4754 if ((!wp->w_p_wrap
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4755 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4756 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4757 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4758 ) || lcs_eol_one == -1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4759 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4760
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4761 /* When the window is too narrow draw all "@" lines. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4762 if (draw_state != WL_LINE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4763 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4764 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4765 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4766 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4767 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4768 win_draw_end(wp, '@', ' ', row, wp->w_height, HLF_AT);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4769 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4770 draw_vsep_win(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4771 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4772 row = endrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4773 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4774
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4775 /* When line got too long for screen break here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4776 if (row == endrow)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4777 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4778 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4779 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4780 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4781
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4782 if (screen_cur_row == screen_row - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4783 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4784 && filler_todo <= 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4785 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4786 && W_WIDTH(wp) == Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4787 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4788 /* Remember that the line wraps, used for modeless copy. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4789 LineWraps[screen_row - 1] = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4790
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4791 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4792 * Special trick to make copy/paste of wrapped lines work with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4793 * xterm/screen: write an extra character beyond the end of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4794 * the line. This will work with all terminal types
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4795 * (regardless of the xn,am settings).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4796 * Only do this on a fast tty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4797 * Only do this if the cursor is on the current line
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4798 * (something has been written in it).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4799 * Don't do this for the GUI.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4800 * Don't do this for double-width characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4801 * Don't do this for a window not at the right screen border.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4802 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4803 if (p_tf
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4804 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4805 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4806 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4807 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4808 && !(has_mbyte
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4809 && ((*mb_off2cells)(LineOffset[screen_row],
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4810 LineOffset[screen_row] + screen_Columns)
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4811 == 2
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4812 || (*mb_off2cells)(LineOffset[screen_row - 1]
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4813 + (int)Columns - 2,
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4814 LineOffset[screen_row] + screen_Columns)
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4815 == 2))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4816 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4817 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4818 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4819 /* First make sure we are at the end of the screen line,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4820 * then output the same character again to let the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4821 * terminal know about the wrap. If the terminal doesn't
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4822 * auto-wrap, we overwrite the character. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4823 if (screen_cur_col != W_WIDTH(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4824 screen_char(LineOffset[screen_row - 1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4825 + (unsigned)Columns - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4826 screen_row - 1, (int)(Columns - 1));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4827
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4828 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4829 /* When there is a multi-byte character, just output a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4830 * space to keep it simple. */
148
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 119
diff changeset
4831 if (has_mbyte && MB_BYTE2LEN(ScreenLines[LineOffset[
72aefd4c1e0d updated for version 7.0046
vimboss
parents: 119
diff changeset
4832 screen_row - 1] + (Columns - 1)]) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4833 out_char(' ');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4834 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4835 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4836 out_char(ScreenLines[LineOffset[screen_row - 1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4837 + (Columns - 1)]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4838 /* force a redraw of the first char on the next line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4839 ScreenAttrs[LineOffset[screen_row]] = (sattr_T)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4840 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4841 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4842 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4843
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4844 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4845 off = (unsigned)(current_ScreenLine - ScreenLines);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4846 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4847 if (wp->w_p_rl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4848 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4849 col = W_WIDTH(wp) - 1; /* col is not used if breaking! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4850 off += col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4851 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4852 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4853
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4854 /* reset the drawing state for the start of a wrapped line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4855 draw_state = WL_START;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4856 saved_n_extra = n_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4857 saved_p_extra = p_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4858 saved_c_extra = c_extra;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4859 saved_char_attr = char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4860 n_extra = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4861 lcs_prec_todo = lcs_prec;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4862 #ifdef FEAT_LINEBREAK
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4863 # ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4864 if (filler_todo <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4865 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4866 need_showbreak = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4867 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4868 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4869 --filler_todo;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4870 /* When the filler lines are actually below the last line of the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4871 * file, don't draw the line itself, break here. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4872 if (filler_todo == 0 && wp->w_botfill)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4873 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4874 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4875 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4876
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4877 } /* for every character in the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4878
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
4879 #ifdef FEAT_SPELL
386
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4880 /* After an empty line check first word for capital. */
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4881 if (*skipwhite(line) == NUL)
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4882 {
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4883 capcol_lnum = lnum + 1;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4884 cap_col = 0;
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4885 }
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4886 #endif
607d3cd9364f updated for version 7.0100
vimboss
parents: 378
diff changeset
4887
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4888 return row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4889 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4890
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4891 #ifdef FEAT_MBYTE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4892 static int comp_char_differs __ARGS((int, int));
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4893
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4894 /*
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4895 * Return if the composing characters at "off_from" and "off_to" differ.
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4896 */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4897 static int
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4898 comp_char_differs(off_from, off_to)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4899 int off_from;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4900 int off_to;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4901 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4902 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4903
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4904 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4905 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4906 if (ScreenLinesC[i][off_from] != ScreenLinesC[i][off_to])
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4907 return TRUE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4908 if (ScreenLinesC[i][off_from] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4909 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4910 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4911 return FALSE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4912 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4913 #endif
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
4914
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4915 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4916 * Check whether the given character needs redrawing:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4917 * - the (first byte of the) character is different
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4918 * - the attributes are different
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4919 * - the character is multi-byte and the next byte is different
1616
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
4920 * - the character is two cells wide and the second cell differs.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4921 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4922 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4923 char_needs_redraw(off_from, off_to, cols)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4924 int off_from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4925 int off_to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4926 int cols;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4927 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4928 if (cols > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4929 && ((ScreenLines[off_from] != ScreenLines[off_to]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4930 || ScreenAttrs[off_from] != ScreenAttrs[off_to])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4931
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4932 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4933 || (enc_dbcs != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4934 && MB_BYTE2LEN(ScreenLines[off_from]) > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4935 && (enc_dbcs == DBCS_JPNU && ScreenLines[off_from] == 0x8e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4936 ? ScreenLines2[off_from] != ScreenLines2[off_to]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4937 : (cols > 1 && ScreenLines[off_from + 1]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4938 != ScreenLines[off_to + 1])))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4939 || (enc_utf8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4940 && (ScreenLinesUC[off_from] != ScreenLinesUC[off_to]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4941 || (ScreenLinesUC[off_from] != 0
1616
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
4942 && comp_char_differs(off_from, off_to))
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
4943 || (cols > 1 && ScreenLines[off_from + 1]
dbef8434a2ea updated for version 7.1-329
vimboss
parents: 1588
diff changeset
4944 != ScreenLines[off_to + 1])))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4945 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4946 ))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4947 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4948 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4949 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4950
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4951 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4952 * Move one "cooked" screen line to the screen, but only the characters that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4953 * have actually changed. Handle insert/delete character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4954 * "coloff" gives the first column on the screen for this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4955 * "endcol" gives the columns where valid characters are.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4956 * "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
4957 * needs to be cleared, negative otherwise.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4958 * "rlflag" is TRUE in a rightleft window:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4959 * When TRUE and "clear_width" > 0, clear columns 0 to "endcol"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4960 * When FALSE and "clear_width" > 0, clear columns "endcol" to "clear_width"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4961 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4962 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4963 screen_line(row, coloff, endcol, clear_width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4964 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4965 , rlflag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4966 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4967 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4968 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4969 int coloff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4970 int endcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4971 int clear_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4972 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4973 int rlflag;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4974 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4975 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4976 unsigned off_from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4977 unsigned off_to;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4978 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4979 unsigned max_off_from;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4980 unsigned max_off_to;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
4981 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4982 int col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4983 #if defined(FEAT_GUI) || defined(UNIX) || defined(FEAT_VERTSPLIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4984 int hl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4985 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4986 int force = FALSE; /* force update rest of the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4987 int redraw_this /* bool: does character need redraw? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4988 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4989 = TRUE /* For GUI when while-loop empty */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4990 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4991 ;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4992 int redraw_next; /* redraw_this for next character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4993 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4994 int clear_next = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4995 int char_cells; /* 1: normal char */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4996 /* 2: occupies two display cells */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4997 # define CHAR_CELLS char_cells
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4998 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
4999 # define CHAR_CELLS 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5000 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5001
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5002 # ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5003 clip_may_clear_selection(row, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5004 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5005
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5006 off_from = (unsigned)(current_ScreenLine - ScreenLines);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5007 off_to = LineOffset[row] + coloff;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5008 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5009 max_off_from = off_from + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5010 max_off_to = LineOffset[row] + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5011 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5012
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5013 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5014 if (rlflag)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5015 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5016 /* Clear rest first, because it's left of the text. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5017 if (clear_width > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5018 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5019 while (col <= endcol && ScreenLines[off_to] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5020 && ScreenAttrs[off_to] == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5021 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5022 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5023 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5024 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5025 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5026 ++off_to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5027 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5028 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5029 if (col <= endcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5030 screen_fill(row, row + 1, col + coloff,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5031 endcol + coloff + 1, ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5032 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5033 col = endcol + 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5034 off_to = LineOffset[row] + col + coloff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5035 off_from += col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5036 endcol = (clear_width > 0 ? clear_width : -clear_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5037 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5038 #endif /* FEAT_RIGHTLEFT */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5039
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5040 redraw_next = char_needs_redraw(off_from, off_to, endcol - col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5041
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5042 while (col < endcol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5043 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5044 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5045 if (has_mbyte && (col + 1 < endcol))
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5046 char_cells = (*mb_off2cells)(off_from, max_off_from);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5047 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5048 char_cells = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5049 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5050
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5051 redraw_this = redraw_next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5052 redraw_next = force || char_needs_redraw(off_from + CHAR_CELLS,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5053 off_to + CHAR_CELLS, endcol - col - CHAR_CELLS);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5054
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5055 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5056 /* If the next character was bold, then redraw the current character to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5057 * remove any pixels that might have spilt over into us. This only
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5058 * happens in the GUI.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5059 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5060 if (redraw_next && gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5061 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5062 hl = ScreenAttrs[off_to + CHAR_CELLS];
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5063 if (hl > HL_ALL)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5064 hl = syn_attr2attr(hl);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5065 if (hl & HL_BOLD)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5066 redraw_this = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5067 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5068 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5070 if (redraw_this)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5071 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5072 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5073 * Special handling when 'xs' termcap flag set (hpterm):
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5074 * Attributes for characters are stored at the position where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5075 * cursor is when writing the highlighting code. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5076 * start-highlighting code must be written with the cursor on the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5077 * first highlighted character. The stop-highlighting code must
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5078 * be written with the cursor just after the last highlighted
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5079 * character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5080 * Overwriting a character doesn't remove it's highlighting. Need
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5081 * to clear the rest of the line, and force redrawing it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5082 * completely.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5083 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5084 if ( p_wiv
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5085 && !force
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5086 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5087 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5088 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5089 && ScreenAttrs[off_to] != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5090 && ScreenAttrs[off_from] != ScreenAttrs[off_to])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5091 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5092 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5093 * Need to remove highlighting attributes here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5094 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5095 windgoto(row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5096 out_str(T_CE); /* clear rest of this screen line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5097 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5098 force = TRUE; /* force redraw of rest of the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5099 redraw_next = TRUE; /* or else next char would miss out */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5100
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5101 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5102 * If the previous character was highlighted, need to stop
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5103 * highlighting at this character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5104 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5105 if (col + coloff > 0 && ScreenAttrs[off_to - 1] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5106 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5107 screen_attr = ScreenAttrs[off_to - 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5108 term_windgoto(row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5109 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5110 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5111 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5112 screen_attr = 0; /* highlighting has stopped */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5113 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5114 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5115 if (enc_dbcs != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5116 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5117 /* Check if overwriting a double-byte with a single-byte or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5118 * the other way around requires another character to be
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5119 * redrawn. For UTF-8 this isn't needed, because comparing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5120 * ScreenLinesUC[] is sufficient. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5121 if (char_cells == 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5122 && col + 1 < endcol
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5123 && (*mb_off2cells)(off_to, max_off_to) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5124 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5125 /* Writing a single-cell character over a double-cell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5126 * character: need to redraw the next cell. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5127 ScreenLines[off_to + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5128 redraw_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5129 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5130 else if (char_cells == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5131 && col + 2 < endcol
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5132 && (*mb_off2cells)(off_to, max_off_to) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5133 && (*mb_off2cells)(off_to + 1, max_off_to) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5134 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5135 /* Writing the second half of a double-cell character over
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5136 * a double-cell character: need to redraw the second
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5137 * cell. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5138 ScreenLines[off_to + 2] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5139 redraw_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5140 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5141
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5142 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5143 ScreenLines2[off_to] = ScreenLines2[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5144 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5145 /* When writing a single-width character over a double-width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5146 * character and at the end of the redrawn text, need to clear out
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5147 * the right halve of the old character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5148 * Also required when writing the right halve of a double-width
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5149 * char over the left halve of an existing one. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5150 if (has_mbyte && col + char_cells == endcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5151 && ((char_cells == 1
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5152 && (*mb_off2cells)(off_to, max_off_to) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5153 || (char_cells == 2
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5154 && (*mb_off2cells)(off_to, max_off_to) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5155 && (*mb_off2cells)(off_to + 1, max_off_to) > 1)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5156 clear_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5157 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5158
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5159 ScreenLines[off_to] = ScreenLines[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5160 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5161 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5162 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5163 ScreenLinesUC[off_to] = ScreenLinesUC[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5164 if (ScreenLinesUC[off_from] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5165 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5166 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5167
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5168 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5169 ScreenLinesC[i][off_to] = ScreenLinesC[i][off_from];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5170 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5171 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5172 if (char_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5173 ScreenLines[off_to + 1] = ScreenLines[off_from + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5174 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5175
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5176 #if defined(FEAT_GUI) || defined(UNIX)
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
5177 /* The bold trick makes a single column of pixels appear in the
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
5178 * next character. When a bold character is removed, the next
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5179 * character should be redrawn too. This happens for our own GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5180 * and for some xterms. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5181 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5182 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5183 gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5184 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5185 # if defined(FEAT_GUI) && defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5186 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5187 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5188 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5189 term_is_xterm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5190 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5191 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5192 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5193 hl = ScreenAttrs[off_to];
743
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5194 if (hl > HL_ALL)
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5195 hl = syn_attr2attr(hl);
afac7b58ed46 updated for version 7.0222
vimboss
parents: 714
diff changeset
5196 if (hl & HL_BOLD)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5197 redraw_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5198 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5199 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5200 ScreenAttrs[off_to] = ScreenAttrs[off_from];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5201 #ifdef FEAT_MBYTE
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5202 /* For simplicity set the attributes of second half of a
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5203 * double-wide character equal to the first half. */
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5204 if (char_cells == 2)
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5205 ScreenAttrs[off_to + 1] = ScreenAttrs[off_from];
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
5206
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5207 if (enc_dbcs != 0 && char_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5208 screen_char_2(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5209 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5210 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5211 screen_char(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5212 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5213 else if ( p_wiv
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5214 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5215 && !gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5216 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5217 && col + coloff > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5218 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5219 if (ScreenAttrs[off_to] == ScreenAttrs[off_to - 1])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5220 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5221 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5222 * Don't output stop-highlight when moving the cursor, it will
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5223 * stop the highlighting when it should continue.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5224 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5225 screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5226 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5227 else if (screen_attr != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5228 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5229 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5230
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5231 off_to += CHAR_CELLS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5232 off_from += CHAR_CELLS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5233 col += CHAR_CELLS;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5234 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5235
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5236 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5237 if (clear_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5238 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5239 /* Clear the second half of a double-wide character of which the left
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5240 * half was overwritten with a single-wide character. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5241 ScreenLines[off_to] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5242 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5243 ScreenLinesUC[off_to] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5244 screen_char(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5245 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5246 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5247
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5248 if (clear_width > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5249 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5250 && !rlflag
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5251 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5252 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5253 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5254 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5255 int startCol = col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5256 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5257
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5258 /* blank out the rest of the line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5259 while (col < clear_width && ScreenLines[off_to] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5260 && ScreenAttrs[off_to] == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5261 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5262 && (!enc_utf8 || ScreenLinesUC[off_to] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5263 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5264 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5265 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5266 ++off_to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5267 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5268 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5269 if (col < clear_width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5270 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5271 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5272 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5273 * In the GUI, clearing the rest of the line may leave pixels
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5274 * behind if the first character cleared was bold. Some bold
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5275 * fonts spill over the left. In this case we redraw the previous
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5276 * character too. If we didn't skip any blanks above, then we
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5277 * only redraw if the character wasn't already redrawn anyway.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5278 */
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5279 if (gui.in_use && (col > startCol || !redraw_this))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5280 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5281 hl = ScreenAttrs[off_to];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5282 if (hl > HL_ALL || (hl & HL_BOLD))
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5283 {
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5284 int prev_cells = 1;
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5285 # ifdef FEAT_MBYTE
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5286 if (enc_utf8)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5287 /* for utf-8, ScreenLines[char_offset + 1] == 0 means
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5288 * that its width is 2. */
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5289 prev_cells = ScreenLines[off_to - 1] == 0 ? 2 : 1;
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5290 else if (enc_dbcs != 0)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5291 {
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5292 /* find previous character by counting from first
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5293 * column and get its width. */
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5294 unsigned off = LineOffset[row];
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5295 unsigned max_off = LineOffset[row] + screen_Columns;
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5296
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5297 while (off < off_to)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5298 {
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5299 prev_cells = (*mb_off2cells)(off, max_off);
996
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5300 off += prev_cells;
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5301 }
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5302 }
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5303
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5304 if (enc_dbcs != 0 && prev_cells > 1)
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5305 screen_char_2(off_to - prev_cells, row,
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5306 col + coloff - prev_cells);
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5307 else
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5308 # endif
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5309 screen_char(off_to - prev_cells, row,
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5310 col + coloff - prev_cells);
5858c00d0f2c updated for version 7.0-122
vimboss
parents: 981
diff changeset
5311 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5312 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5313 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5314 screen_fill(row, row + 1, col + coloff, clear_width + coloff,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5315 ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5316 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5317 off_to += clear_width - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5318 col = clear_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5319 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5320 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5321 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5322
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5323 if (clear_width > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5324 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5325 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5326 /* For a window that's left of another, draw the separator char. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5327 if (col + coloff < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5328 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5329 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5330
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5331 c = fillchar_vsep(&hl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5332 if (ScreenLines[off_to] != c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5333 # ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5334 || (enc_utf8 && (int)ScreenLinesUC[off_to]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5335 != (c >= 0x80 ? c : 0))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5336 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5337 || ScreenAttrs[off_to] != hl)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5338 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5339 ScreenLines[off_to] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5340 ScreenAttrs[off_to] = hl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5341 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5342 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5343 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5344 if (c >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5345 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5346 ScreenLinesUC[off_to] = c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
5347 ScreenLinesC[0][off_to] = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5348 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5349 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5350 ScreenLinesUC[off_to] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5351 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5352 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5353 screen_char(off_to, row, col + coloff);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5354 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5355 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5356 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5357 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5358 LineWraps[row] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5359 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5360 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5361
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5362 #if defined(FEAT_RIGHTLEFT) || defined(PROTO)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5363 /*
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5364 * Mirror text "str" for right-left displaying.
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5365 * Only works for single-byte characters (e.g., numbers).
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5366 */
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5367 void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5368 rl_mirror(str)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5369 char_u *str;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5370 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5371 char_u *p1, *p2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5372 int t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5373
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5374 for (p1 = str, p2 = str + STRLEN(str) - 1; p1 < p2; ++p1, --p2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5375 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5376 t = *p1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5377 *p1 = *p2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5378 *p2 = t;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5379 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5380 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5381 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5382
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5383 #if defined(FEAT_WINDOWS) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5384 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5385 * mark all status lines for redraw; used after first :cd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5386 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5387 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5388 status_redraw_all()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5389 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5390 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5391
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5392 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5393 if (wp->w_status_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5394 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5395 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5396 redraw_later(VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5397 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5398 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5399
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5400 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5401 * mark all status lines of the current buffer for redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5402 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5403 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5404 status_redraw_curbuf()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5405 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5406 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5407
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5408 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5409 if (wp->w_status_height != 0 && wp->w_buffer == curbuf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5410 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5411 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5412 redraw_later(VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5413 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5414 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5415
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5416 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5417 * Redraw all status lines that need to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5418 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5419 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5420 redraw_statuslines()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5421 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5422 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5424 for (wp = firstwin; wp; wp = wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5425 if (wp->w_redr_status)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5426 win_redr_status(wp);
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
5427 if (redraw_tabline)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
5428 draw_tabline();
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5429 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5430 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5431
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5432 #if (defined(FEAT_WILDMENU) && defined(FEAT_VERTSPLIT)) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5433 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5434 * Redraw all status lines at the bottom of frame "frp".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5435 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5436 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5437 win_redraw_last_status(frp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5438 frame_T *frp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5439 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5440 if (frp->fr_layout == FR_LEAF)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5441 frp->fr_win->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5442 else if (frp->fr_layout == FR_ROW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5443 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5444 for (frp = frp->fr_child; frp != NULL; frp = frp->fr_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5445 win_redraw_last_status(frp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5446 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5447 else /* frp->fr_layout == FR_COL */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5448 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5449 frp = frp->fr_child;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5450 while (frp->fr_next != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5451 frp = frp->fr_next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5452 win_redraw_last_status(frp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5453 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5454 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5455 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5456
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5457 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5458 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5459 * Draw the verticap separator right of window "wp" starting with line "row".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5460 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5461 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5462 draw_vsep_win(wp, row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5463 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5464 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5465 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5466 int hl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5467 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5468
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5469 if (wp->w_vsep_width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5470 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5471 /* draw the vertical separator right of this window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5472 c = fillchar_vsep(&hl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5473 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5474 W_ENDCOL(wp), W_ENDCOL(wp) + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5475 c, ' ', hl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5476 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5477 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5478 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5479
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5480 #ifdef FEAT_WILDMENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5481 static int status_match_len __ARGS((expand_T *xp, char_u *s));
277
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5482 static int skip_status_match_char __ARGS((expand_T *xp, char_u *s));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5483
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5484 /*
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5485 * 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
5486 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5487 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5488 status_match_len(xp, s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5489 expand_T *xp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5490 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5491 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5492 int len = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5493
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5494 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5495 int emenu = (xp->xp_context == EXPAND_MENUS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5496 || xp->xp_context == EXPAND_MENUNAMES);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5497
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5498 /* Check for menu separators - replace with '|'. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5499 if (emenu && menu_is_separator(s))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5500 return 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5501 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5502
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5503 while (*s != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5504 {
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5505 s += skip_status_match_char(xp, s);
42
c75153d791d0 updated for version 7.0026
vimboss
parents: 40
diff changeset
5506 len += ptr2cells(s);
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5507 mb_ptr_adv(s);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5508 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5509
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5510 return len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5511 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5512
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5513 /*
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5514 * 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
5515 * These are backslashes used for escaping. Do show backslashes in help tags.
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5516 */
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5517 static int
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5518 skip_status_match_char(xp, s)
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5519 expand_T *xp;
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5520 char_u *s;
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5521 {
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5522 if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP)
277
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5523 #ifdef FEAT_MENU
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5524 || ((xp->xp_context == EXPAND_MENUS
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5525 || xp->xp_context == EXPAND_MENUNAMES)
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5526 && (s[0] == '\t' || (s[0] == '\\' && s[1] != NUL)))
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5527 #endif
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5528 )
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5529 {
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5530 #ifndef BACKSLASH_IN_FILENAME
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5531 if (xp->xp_shell && csh_like_shell() && s[1] == '\\' && s[2] == '!')
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5532 return 2;
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5533 #endif
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5534 return 1;
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5535 }
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5536 return 0;
277
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5537 }
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5538
fe16c18c24a7 updated for version 7.0074
vimboss
parents: 258
diff changeset
5539 /*
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5540 * Show wildchar matches in the status line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5541 * Show at least the "match" item.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5542 * 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
5543 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5544 * If inversion is possible we use it. Else '=' characters are used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5545 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5546 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5547 win_redr_status_matches(xp, num_matches, matches, match, showtail)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5548 expand_T *xp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5549 int num_matches;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5550 char_u **matches; /* list of matches */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5551 int match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5552 int showtail;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5553 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5554 #define L_MATCH(m) (showtail ? sm_gettail(matches[m]) : matches[m])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5555 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5556 char_u *buf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5557 int len;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
5558 int clen; /* length in screen cells */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5559 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5560 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5561 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5562 int highlight = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5563 char_u *selstart = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5564 int selstart_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5565 char_u *selend = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5566 static int first_match = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5567 int add_left = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5568 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5569 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5570 int emenu;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5571 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5572 #if defined(FEAT_MBYTE) || defined(FEAT_MENU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5573 int l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5574 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5575
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5576 if (matches == NULL) /* interrupted completion? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5577 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5578
39
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5579 #ifdef FEAT_MBYTE
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5580 if (has_mbyte)
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5581 buf = alloc((unsigned)Columns * MB_MAXBYTES + 1);
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5582 else
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5583 #endif
410fa1a31baf updated for version 7.0023
vimboss
parents: 36
diff changeset
5584 buf = alloc((unsigned)Columns + 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5585 if (buf == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5586 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5587
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5588 if (match == -1) /* don't show match but original text */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5589 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5590 match = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5591 highlight = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5592 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5593 /* count 1 for the ending ">" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5594 clen = status_match_len(xp, L_MATCH(match)) + 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5595 if (match == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5596 first_match = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5597 else if (match < first_match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5598 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5599 /* jumping left, as far as we can go */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5600 first_match = match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5601 add_left = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5602 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5603 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5604 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5605 /* check if match fits on the screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5606 for (i = first_match; i < match; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5607 clen += status_match_len(xp, L_MATCH(i)) + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5608 if (first_match > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5609 clen += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5610 /* jumping right, put match at the left */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5611 if ((long)clen > Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5612 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5613 first_match = match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5614 /* if showing the last match, we can add some on the left */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5615 clen = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5616 for (i = match; i < num_matches; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5617 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5618 clen += status_match_len(xp, L_MATCH(i)) + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5619 if ((long)clen >= Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5620 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5621 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5622 if (i == num_matches)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5623 add_left = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5624 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5625 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5626 if (add_left)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5627 while (first_match > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5628 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5629 clen += status_match_len(xp, L_MATCH(first_match - 1)) + 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5630 if ((long)clen >= Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5631 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5632 --first_match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5633 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5634
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5635 fillchar = fillchar_status(&attr, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5636
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5637 if (first_match == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5638 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5639 *buf = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5640 len = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5641 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5642 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5643 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5644 STRCPY(buf, "< ");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5645 len = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5646 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5647 clen = len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5648
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5649 i = first_match;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5650 while ((long)(clen + status_match_len(xp, L_MATCH(i)) + 2) < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5651 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5652 if (i == match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5653 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5654 selstart = buf + len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5655 selstart_col = clen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5656 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5657
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5658 s = L_MATCH(i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5659 /* Check for menu separators - replace with '|' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5660 #ifdef FEAT_MENU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5661 emenu = (xp->xp_context == EXPAND_MENUS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5662 || xp->xp_context == EXPAND_MENUNAMES);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5663 if (emenu && menu_is_separator(s))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5664 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5665 STRCPY(buf + len, transchar('|'));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5666 l = (int)STRLEN(buf + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5667 len += l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5668 clen += l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5669 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5670 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5671 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5672 for ( ; *s != NUL; ++s)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5673 {
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
5674 s += skip_status_match_char(xp, s);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5675 clen += ptr2cells(s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5676 #ifdef FEAT_MBYTE
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5677 if (has_mbyte && (l = (*mb_ptr2len)(s)) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5678 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5679 STRNCPY(buf + len, s, l);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5680 s += l - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5681 len += l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5682 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5683 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5684 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5685 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5686 STRCPY(buf + len, transchar_byte(*s));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5687 len += (int)STRLEN(buf + len);
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 (i == match)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5691 selend = buf + len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5692
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5693 *(buf + len++) = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5694 *(buf + len++) = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5695 clen += 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5696 if (++i == num_matches)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5697 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5698 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5699
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5700 if (i != num_matches)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5701 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5702 *(buf + len++) = '>';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5703 ++clen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5704 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5705
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5706 buf[len] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5707
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5708 row = cmdline_row - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5709 if (row >= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5710 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5711 if (wild_menu_showing == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5712 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5713 if (msg_scrolled > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5714 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5715 /* Put the wildmenu just above the command line. If there is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5716 * no room, scroll the screen one line up. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5717 if (cmdline_row == Rows - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5718 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5719 screen_del_lines(0, 0, 1, (int)Rows, TRUE, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5720 ++msg_scrolled;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5721 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5722 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5723 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5724 ++cmdline_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5725 ++row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5726 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5727 wild_menu_showing = WM_SCROLLED;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5728 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5729 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5730 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5731 /* Create status line if needed by setting 'laststatus' to 2.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5732 * Set 'winminheight' to zero to avoid that the window is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5733 * resized. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5734 if (lastwin->w_status_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5735 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5736 save_p_ls = p_ls;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5737 save_p_wmh = p_wmh;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5738 p_ls = 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5739 p_wmh = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5740 last_status(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5741 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5742 wild_menu_showing = WM_SHOWN;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5743 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5744 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5746 screen_puts(buf, row, 0, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5747 if (selstart != NULL && highlight)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5748 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5749 *selend = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5750 screen_puts(selstart, row, selstart_col, hl_attr(HLF_WM));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5751 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5752
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5753 screen_fill(row, row + 1, clen, (int)Columns, fillchar, fillchar, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5754 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5755
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5756 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5757 win_redraw_last_status(topframe);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5758 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5759 lastwin->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5760 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5761 vim_free(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5762 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5763 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5764
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5765 #if defined(FEAT_WINDOWS) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5766 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5767 * Redraw the status line of window wp.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5768 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5769 * If inversion is possible we use it. Else '=' characters are used.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5770 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5771 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5772 win_redr_status(wp)
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 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5776 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5777 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5778 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5779 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5780 int this_ru_col;
1910
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5781 static int busy = FALSE;
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5782
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5783 /* It's possible to get here recursively when 'statusline' (indirectly)
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5784 * invokes ":redrawstatus". Simply ignore the call then. */
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5785 if (busy)
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5786 return;
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5787 busy = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5788
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5789 wp->w_redr_status = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5790 if (wp->w_status_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5791 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5792 /* no status line, can only be last window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5793 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5794 }
540
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
5795 else if (!redrawing()
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
5796 #ifdef FEAT_INS_EXPAND
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
5797 /* don't update status line when popup menu is visible and may be
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
5798 * drawn over it */
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
5799 || pum_visible()
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
5800 #endif
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
5801 )
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5802 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5803 /* Don't redraw right now, do it later. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5804 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5805 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5806 #ifdef FEAT_STL_OPT
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
5807 else if (*p_stl != NUL || *wp->w_p_stl != NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5808 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5809 /* redraw custom status line */
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5810 redraw_custom_statusline(wp);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5811 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5812 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5813 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5814 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5815 fillchar = fillchar_status(&attr, wp == curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5816
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
5817 get_trans_bufname(wp->w_buffer);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5818 p = NameBuff;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5819 len = (int)STRLEN(p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5820
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5821 if (wp->w_buffer->b_help
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5822 #ifdef FEAT_QUICKFIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5823 || wp->w_p_pvw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5824 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5825 || bufIsChanged(wp->w_buffer)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5826 || wp->w_buffer->b_p_ro)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5827 *(p + len++) = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5828 if (wp->w_buffer->b_help)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5829 {
809
4f1b94b51e99 updated for version 7.0b02
vimboss
parents: 798
diff changeset
5830 STRCPY(p + len, _("[Help]"));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5831 len += (int)STRLEN(p + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5832 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5833 #ifdef FEAT_QUICKFIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5834 if (wp->w_p_pvw)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5835 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5836 STRCPY(p + len, _("[Preview]"));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5837 len += (int)STRLEN(p + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5838 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5839 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5840 if (bufIsChanged(wp->w_buffer))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5841 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5842 STRCPY(p + len, "[+]");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5843 len += 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5844 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5845 if (wp->w_buffer->b_p_ro)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5846 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5847 STRCPY(p + len, "[RO]");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5848 len += 4;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5849 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5850
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5851 #ifndef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5852 this_ru_col = ru_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5853 if (this_ru_col < (Columns + 1) / 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5854 this_ru_col = (Columns + 1) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5855 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5856 this_ru_col = ru_col - (Columns - W_WIDTH(wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5857 if (this_ru_col < (W_WIDTH(wp) + 1) / 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5858 this_ru_col = (W_WIDTH(wp) + 1) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5859 if (this_ru_col <= 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5860 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5861 p = (char_u *)"<"; /* No room for file name! */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5862 len = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5863 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5864 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5865 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5866 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5867 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5868 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5869 int clen = 0, i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5870
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5871 /* Count total number of display cells. */
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5872 for (i = 0; p[i] != NUL; i += (*mb_ptr2len)(p + i))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5873 clen += (*mb_ptr2cells)(p + i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5874 /* Find first character that will fit.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5875 * Going from start to end is much faster for DBCS. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5876 for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
5877 i += (*mb_ptr2len)(p + i))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5878 clen -= (*mb_ptr2cells)(p + i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5879 len = clen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5880 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5881 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5882 p = p + i - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5883 *p = '<';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5884 ++len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5885 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5886
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5887 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5888 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5889 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5890 if (len > this_ru_col - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5891 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5892 p += len - (this_ru_col - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5893 *p = '<';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5894 len = this_ru_col - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5895 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5896
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5897 row = W_WINROW(wp) + wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5898 screen_puts(p, row, W_WINCOL(wp), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5899 screen_fill(row, row + 1, len + W_WINCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5900 this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5901
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5902 if (get_keymap_str(wp, NameBuff, MAXPATHL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5903 && (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5904 screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5905 - 1 + W_WINCOL(wp)), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5906
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5907 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5908 win_redr_ruler(wp, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5909 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5910 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5911
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5912 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5913 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5914 * May need to draw the character below the vertical separator.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5915 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5916 if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5917 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5918 if (stl_connected(wp))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5919 fillchar = fillchar_status(&attr, wp == curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5920 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5921 fillchar = fillchar_vsep(&attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5922 screen_putchar(fillchar, W_WINROW(wp) + wp->w_height, W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5923 attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5924 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5925 #endif
1910
1287e2bbeb40 updated for version 7.2-207
vimboss
parents: 1906
diff changeset
5926 busy = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5927 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5928
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5929 #ifdef FEAT_STL_OPT
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5930 /*
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5931 * Redraw the status line according to 'statusline' and take care of any
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5932 * errors encountered.
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5933 */
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5934 static void
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5935 redraw_custom_statusline(wp)
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5936 win_T *wp;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5937 {
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5938 static int entered = FALSE;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5939 int save_called_emsg = called_emsg;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5940
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5941 /* When called recursively return. This can happen when the statusline
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5942 * contains an expression that triggers a redraw. */
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5943 if (entered)
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5944 return;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5945 entered = TRUE;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5946
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5947 called_emsg = FALSE;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5948 win_redr_custom(wp, FALSE);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5949 if (called_emsg)
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5950 {
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5951 /* When there is an error disable the statusline, otherwise the
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5952 * display is messed up with errors and a redraw triggers the problem
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5953 * again and again. */
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5954 set_string_option_direct((char_u *)"statusline", -1,
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5955 (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 688
diff changeset
5956 ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5957 }
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5958 called_emsg |= save_called_emsg;
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
5959 entered = FALSE;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5960 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5961 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
5962
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5963 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5964 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5965 * Return TRUE if the status line of window "wp" is connected to the status
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5966 * 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
5967 * Only call if (wp->w_vsep_width != 0).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5968 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5969 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5970 stl_connected(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5971 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5972 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5973 frame_T *fr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5974
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5975 fr = wp->w_frame;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5976 while (fr->fr_parent != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5977 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5978 if (fr->fr_parent->fr_layout == FR_COL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5979 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5980 if (fr->fr_next != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5981 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5982 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5983 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5984 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5985 if (fr->fr_next != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5986 return TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5987 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5988 fr = fr->fr_parent;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5989 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5990 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5991 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5992 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5993
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5994 #endif /* FEAT_WINDOWS */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5995
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5996 #if defined(FEAT_WINDOWS) || defined(FEAT_STL_OPT) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5997 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5998 * Get the value to show for the language mappings, active 'keymap'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
5999 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6000 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6001 get_keymap_str(wp, buf, len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6002 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6003 char_u *buf; /* buffer for the result */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6004 int len; /* length of buffer */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6005 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6006 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6007
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6008 if (wp->w_buffer->b_p_iminsert != B_IMODE_LMAP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6009 return FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6010
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6011 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6012 #ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6013 buf_T *old_curbuf = curbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6014 win_T *old_curwin = curwin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6015 char_u *s;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6016
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6017 curbuf = wp->w_buffer;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6018 curwin = wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6019 STRCPY(buf, "b:keymap_name"); /* must be writable */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6020 ++emsg_skip;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6021 s = p = eval_to_string(buf, NULL, FALSE);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6022 --emsg_skip;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6023 curbuf = old_curbuf;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6024 curwin = old_curwin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6025 if (p == NULL || *p == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6026 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6027 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6028 #ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6029 if (wp->w_buffer->b_kmap_state & KEYMAP_LOADED)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6030 p = wp->w_buffer->b_p_keymap;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6031 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6032 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6033 p = (char_u *)"lang";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6034 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6035 if ((int)(STRLEN(p) + 3) < len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6036 sprintf((char *)buf, "<%s>", p);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6037 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6038 buf[0] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6039 #ifdef FEAT_EVAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6040 vim_free(s);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6041 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6042 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6043 return buf[0] != NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6044 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6045 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6046
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6047 #if defined(FEAT_STL_OPT) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6048 /*
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6049 * Redraw the status line or ruler of window "wp".
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6050 * When "wp" is NULL redraw the tab pages line from 'tabline'.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6051 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6052 static void
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
6053 win_redr_custom(wp, draw_ruler)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6054 win_T *wp;
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
6055 int draw_ruler; /* TRUE or FALSE */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6056 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6057 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6058 int curattr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6059 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6060 int col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6061 int maxwidth;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6062 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6063 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6064 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6065 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6066 char_u buf[MAXPATHL];
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6067 char_u *stl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6068 char_u *p;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6069 struct stl_hlrec hltab[STL_MAX_ITEM];
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6070 struct stl_hlrec tabtab[STL_MAX_ITEM];
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6071 int use_sandbox = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6072
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6073 /* setup environment for the task at hand */
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6074 if (wp == NULL)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6075 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6076 /* Use 'tabline'. Always at the first line of the screen. */
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6077 stl = p_tal;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6078 row = 0;
707
111b7dcc8a17 updated for version 7.0213
vimboss
parents: 699
diff changeset
6079 fillchar = ' ';
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6080 attr = hl_attr(HLF_TPF);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6081 maxwidth = Columns;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6082 # ifdef FEAT_EVAL
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6083 use_sandbox = was_set_insecurely((char_u *)"tabline", 0);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6084 # endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6085 }
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
6086 else
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6087 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6088 row = W_WINROW(wp) + wp->w_height;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6089 fillchar = fillchar_status(&attr, wp == curwin);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6090 maxwidth = W_WIDTH(wp);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6091
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6092 if (draw_ruler)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6093 {
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6094 stl = p_ruf;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6095 /* advance past any leading group spec - implicit in ru_col */
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6096 if (*stl == '%')
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6097 {
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6098 if (*++stl == '-')
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6099 stl++;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6100 if (atoi((char *)stl))
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6101 while (VIM_ISDIGIT(*stl))
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6102 stl++;
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6103 if (*stl++ != '(')
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6104 stl = p_ruf;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6105 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6106 #ifdef FEAT_VERTSPLIT
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6107 col = ru_col - (Columns - W_WIDTH(wp));
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6108 if (col < (W_WIDTH(wp) + 1) / 2)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6109 col = (W_WIDTH(wp) + 1) / 2;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6110 #else
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6111 col = ru_col;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6112 if (col > (Columns + 1) / 2)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6113 col = (Columns + 1) / 2;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6114 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6115 maxwidth = W_WIDTH(wp) - col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6116 #ifdef FEAT_WINDOWS
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6117 if (!wp->w_status_height)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6118 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6119 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6120 row = Rows - 1;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6121 --maxwidth; /* writing in last column may cause scrolling */
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6122 fillchar = ' ';
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6123 attr = 0;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6124 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6125
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6126 # ifdef FEAT_EVAL
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6127 use_sandbox = was_set_insecurely((char_u *)"rulerformat", 0);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6128 # endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6129 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6130 else
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6131 {
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6132 if (*wp->w_p_stl != NUL)
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6133 stl = wp->w_p_stl;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6134 else
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6135 stl = p_stl;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6136 # ifdef FEAT_EVAL
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6137 use_sandbox = was_set_insecurely((char_u *)"statusline",
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6138 *wp->w_p_stl == NUL ? 0 : OPT_LOCAL);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6139 # endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6140 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6141
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6142 #ifdef FEAT_VERTSPLIT
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6143 col += W_WINCOL(wp);
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6144 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6145 }
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6146
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6147 if (maxwidth <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6148 return;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6149
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6150 /* Make a copy, because the statusline may include a function call that
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6151 * might change the option value and free the memory. */
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6152 stl = vim_strsave(stl);
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6153 width = build_stl_str_hl(wp == NULL ? curwin : wp,
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
6154 buf, sizeof(buf),
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6155 stl, use_sandbox,
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6156 fillchar, maxwidth, hltab, tabtab);
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
6157 vim_free(stl);
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
6158 len = (int)STRLEN(buf);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6159
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
6160 while (width < maxwidth && len < (int)sizeof(buf) - 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6161 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6162 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6163 len += (*mb_char2bytes)(fillchar, buf + len);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6164 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6165 buf[len++] = fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6166 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6167 ++width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6168 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6169 buf[len] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6170
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6171 /*
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6172 * Draw each snippet with the specified highlighting.
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6173 */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6174 curattr = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6175 p = buf;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6176 for (n = 0; hltab[n].start != NULL; n++)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6177 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6178 len = (int)(hltab[n].start - p);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6179 screen_puts_len(p, len, row, col, curattr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6180 col += vim_strnsize(p, len);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6181 p = hltab[n].start;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6182
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6183 if (hltab[n].userhl == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6184 curattr = attr;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6185 else if (hltab[n].userhl < 0)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6186 curattr = syn_id2attr(-hltab[n].userhl);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6187 #ifdef FEAT_WINDOWS
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
6188 else if (wp != NULL && wp != curwin && wp->w_status_height != 0)
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6189 curattr = highlight_stlnc[hltab[n].userhl - 1];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6190 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6191 else
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6192 curattr = highlight_user[hltab[n].userhl - 1];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6193 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6194 screen_puts(p, row, col, curattr);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6195
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6196 if (wp == NULL)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6197 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6198 /* Fill the TabPageIdxs[] array for clicking in the tab pagesline. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6199 col = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6200 len = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6201 p = buf;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6202 fillchar = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6203 for (n = 0; tabtab[n].start != NULL; n++)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6204 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6205 len += vim_strnsize(p, (int)(tabtab[n].start - p));
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6206 while (col < len)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6207 TabPageIdxs[col++] = fillchar;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6208 p = tabtab[n].start;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6209 fillchar = tabtab[n].userhl;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6210 }
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6211 while (col < Columns)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6212 TabPageIdxs[col++] = fillchar;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6213 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6214 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6215
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6216 #endif /* FEAT_STL_OPT */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6217
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6218 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6219 * Output a single character directly to the screen and update ScreenLines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6220 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6221 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6222 screen_putchar(c, row, col, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6223 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6224 int row, col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6225 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6226 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6227 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6228 char_u buf[MB_MAXBYTES + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6229
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6230 buf[(*mb_char2bytes)(c, buf)] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6231 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6232 char_u buf[2];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6233
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6234 buf[0] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6235 buf[1] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6236 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6237 screen_puts(buf, row, col, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6238 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6239
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6240 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6241 * Get a single character directly from ScreenLines into "bytes[]".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6242 * Also return its attribute in *attrp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6243 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6244 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6245 screen_getbytes(row, col, bytes, attrp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6246 int row, col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6247 char_u *bytes;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6248 int *attrp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6249 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6250 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6251
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6252 /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6253 if (ScreenLines != NULL && row < screen_Rows && col < screen_Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6254 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6255 off = LineOffset[row] + col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6256 *attrp = ScreenAttrs[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6257 bytes[0] = ScreenLines[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6258 bytes[1] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6260 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6261 if (enc_utf8 && ScreenLinesUC[off] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6262 bytes[utfc_char2bytes(off, bytes)] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6263 else if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6264 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6265 bytes[0] = ScreenLines[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6266 bytes[1] = ScreenLines2[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6267 bytes[2] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6268 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6269 else if (enc_dbcs && MB_BYTE2LEN(bytes[0]) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6270 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6271 bytes[1] = ScreenLines[off + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6272 bytes[2] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6273 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6274 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6275 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6276 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6277
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6278 #ifdef FEAT_MBYTE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6279 static int screen_comp_differs __ARGS((int, int*));
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6280
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6281 /*
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6282 * Return TRUE if composing characters for screen posn "off" differs from
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6283 * composing characters in "u8cc".
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6284 */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6285 static int
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6286 screen_comp_differs(off, u8cc)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6287 int off;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6288 int *u8cc;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6289 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6290 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6291
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6292 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6293 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6294 if (ScreenLinesC[i][off] != (u8char_T)u8cc[i])
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6295 return TRUE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6296 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6297 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6298 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6299 return FALSE;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6300 }
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6301 #endif
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6302
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6303 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6304 * Put string '*text' on the screen at position 'row' and 'col', with
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6305 * attributes 'attr', and update ScreenLines[] and ScreenAttrs[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6306 * Note: only outputs within one row, message is truncated at screen boundary!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6307 * Note: if ScreenLines[], row and/or col is invalid, nothing is done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6308 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6309 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6310 screen_puts(text, row, col, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6311 char_u *text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6312 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6313 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6314 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6315 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6316 screen_puts_len(text, -1, row, col, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6317 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6318
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6319 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6320 * Like screen_puts(), but output "text[len]". When "len" is -1 output up to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6321 * a NUL.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6322 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6323 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6324 screen_puts_len(text, len, row, col, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6325 char_u *text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6326 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6327 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6328 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6329 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6330 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6331 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6332 char_u *ptr = text;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6333 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6334 #ifdef FEAT_MBYTE
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6335 unsigned max_off;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6336 int mbyte_blen = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6337 int mbyte_cells = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6338 int u8c = 0;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6339 int u8cc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6340 int clear_next_cell = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6341 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6342 int prev_c = 0; /* previous Arabic character */
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6343 int pc, nc, nc1;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6344 int pcc[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6345 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6346 #endif
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6347 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6348 int force_redraw_this;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6349 int force_redraw_next = FALSE;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6350 #endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6351 int need_redraw;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6352
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6353 if (ScreenLines == NULL || row >= screen_Rows) /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6354 return;
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6355 off = LineOffset[row] + col;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6356
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6357 #ifdef FEAT_MBYTE
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6358 /* 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
6359 * left halve. Only needed in a terminal. */
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
6360 if (has_mbyte && col > 0 && col < screen_Columns
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6361 # ifdef FEAT_GUI
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6362 && !gui.in_use
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6363 # endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
6364 && mb_fix_col(col, row) != col)
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6365 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6366 ScreenLines[off - 1] = ' ';
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6367 ScreenAttrs[off - 1] = 0;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6368 if (enc_utf8)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6369 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6370 ScreenLinesUC[off - 1] = 0;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6371 ScreenLinesC[0][off - 1] = 0;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6372 }
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6373 /* redraw the previous cell, make it empty */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6374 screen_char(off - 1, row, col - 1);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6375 /* force the cell at "col" to be redrawn */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6376 force_redraw_next = TRUE;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6377 }
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6378 #endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6379
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6380 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6381 max_off = LineOffset[row] + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6382 #endif
1340
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
6383 while (col < screen_Columns
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
6384 && (len < 0 || (int)(ptr - text) < len)
8e42199f5121 updated for version 7.1-054
vimboss
parents: 1331
diff changeset
6385 && *ptr != NUL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6386 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6387 c = *ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6388 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6389 /* check if this is the first byte of a multibyte */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6390 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6391 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6392 if (enc_utf8 && len > 0)
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
6393 mbyte_blen = utfc_ptr2len_len(ptr, (int)((text + len) - ptr));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6394 else
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
6395 mbyte_blen = (*mb_ptr2len)(ptr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6396 if (enc_dbcs == DBCS_JPNU && c == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6397 mbyte_cells = 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6398 else if (enc_dbcs != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6399 mbyte_cells = mbyte_blen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6400 else /* enc_utf8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6401 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6402 if (len >= 0)
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6403 u8c = utfc_ptr2char_len(ptr, u8cc,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6404 (int)((text + len) - ptr));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6405 else
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6406 u8c = utfc_ptr2char(ptr, u8cc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6407 mbyte_cells = utf_char2cells(u8c);
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
6408 # ifdef UNICODE16
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6409 /* Non-BMP character: display as ? or fullwidth ?. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6410 if (u8c >= 0x10000)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6411 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6412 u8c = (mbyte_cells == 2) ? 0xff1f : (int)'?';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6413 if (attr == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6414 attr = hl_attr(HLF_8);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6415 }
1401
e351146e7974 updated for version 7.1-116
vimboss
parents: 1378
diff changeset
6416 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6417 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6418 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6419 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6420 /* Do Arabic shaping. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6421 if (len >= 0 && (int)(ptr - text) + mbyte_blen >= len)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6422 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6423 /* Past end of string to be displayed. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6424 nc = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6425 nc1 = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6426 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6427 else
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6428 {
1994
439f44b874a7 updated for version 7.2-291
vimboss
parents: 1984
diff changeset
6429 nc = utfc_ptr2char_len(ptr + mbyte_blen, pcc,
439f44b874a7 updated for version 7.2-291
vimboss
parents: 1984
diff changeset
6430 (int)((text + len) - ptr - mbyte_blen));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6431 nc1 = pcc[0];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6432 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6433 pc = prev_c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6434 prev_c = u8c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6435 u8c = arabic_shape(u8c, &c, &u8cc[0], nc, nc1, pc);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6436 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6437 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6438 prev_c = u8c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6439 # endif
2055
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6440 if (col + mbyte_cells > screen_Columns)
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6441 {
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6442 /* 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
6443 * 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
6444 c = '>';
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6445 mbyte_cells = 1;
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
6446 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6447 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6448 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6449 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6450
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6451 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6452 force_redraw_this = force_redraw_next;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6453 force_redraw_next = FALSE;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6454 #endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6455
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6456 need_redraw = ScreenLines[off] != c
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6457 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6458 || (mbyte_cells == 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6459 && ScreenLines[off + 1] != (enc_dbcs ? ptr[1] : 0))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6460 || (enc_dbcs == DBCS_JPNU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6461 && c == 0x8e
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6462 && ScreenLines2[off] != ptr[1])
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6463 || (enc_utf8
1821
9913ff570616 updated for version 7.2-119
vimboss
parents: 1819
diff changeset
6464 && (ScreenLinesUC[off] != (u8char_T)(c >= 0x80 ? u8c : 0)
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6465 || screen_comp_differs(off, u8cc)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6466 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6467 || ScreenAttrs[off] != attr
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6468 || exmode_active;
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6469
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6470 if (need_redraw
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6471 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6472 || force_redraw_this
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6473 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6474 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6475 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6476 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6477 /* The bold trick makes a single row of pixels appear in the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6478 * character. When a bold character is removed, the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6479 * character should be redrawn too. This happens for our own GUI
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6480 * and for some xterms. */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6481 if (need_redraw && ScreenLines[off] != ' ' && (
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6482 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6483 gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6484 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6485 # if defined(FEAT_GUI) && defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6486 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6487 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6488 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6489 term_is_xterm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6490 # endif
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6491 ))
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6492 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6493 int n = ScreenAttrs[off];
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6494
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6495 if (n > HL_ALL)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6496 n = syn_attr2attr(n);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6497 if (n & HL_BOLD)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6498 force_redraw_next = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6499 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6500 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6501 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6502 /* When at the end of the text and overwriting a two-cell
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6503 * character with a one-cell character, need to clear the next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6504 * cell. Also when overwriting the left halve of a two-cell char
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6505 * with the right halve of a two-cell char. Do this only once
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6506 * (mb_off2cells() may return 2 on the right halve). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6507 if (clear_next_cell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6508 clear_next_cell = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6509 else if (has_mbyte
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6510 && (len < 0 ? ptr[mbyte_blen] == NUL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6511 : ptr + mbyte_blen >= text + len)
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6512 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6513 || (mbyte_cells == 2
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6514 && (*mb_off2cells)(off, max_off) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6515 && (*mb_off2cells)(off + 1, max_off) > 1)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6516 clear_next_cell = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6518 /* Make sure we never leave a second byte of a double-byte behind,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6519 * it confuses mb_off2cells(). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6520 if (enc_dbcs
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6521 && ((mbyte_cells == 1 && (*mb_off2cells)(off, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6522 || (mbyte_cells == 2
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6523 && (*mb_off2cells)(off, max_off) == 1
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
6524 && (*mb_off2cells)(off + 1, max_off) > 1)))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6525 ScreenLines[off + mbyte_blen] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6526 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6527 ScreenLines[off] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6528 ScreenAttrs[off] = attr;
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 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6531 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6532 if (c < 0x80 && u8cc[0] == 0)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6533 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6534 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6535 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6536 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6537
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6538 ScreenLinesUC[off] = u8c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6539 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6540 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6541 ScreenLinesC[i][off] = u8cc[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6542 if (u8cc[i] == 0)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6543 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
6544 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6545 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6546 if (mbyte_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6547 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6548 ScreenLines[off + 1] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6549 ScreenAttrs[off + 1] = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6550 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6551 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6552 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6553 else if (mbyte_cells == 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6554 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6555 ScreenLines[off + 1] = ptr[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6556 ScreenAttrs[off + 1] = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6557 screen_char_2(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6558 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6559 else if (enc_dbcs == DBCS_JPNU && c == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6560 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6561 ScreenLines2[off] = ptr[1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6562 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6563 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6564 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6565 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6566 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6567 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6568 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6569 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6570 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6571 off += mbyte_cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6572 col += mbyte_cells;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6573 ptr += mbyte_blen;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6574 if (clear_next_cell)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6575 ptr = (char_u *)" ";
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6576 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6577 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6578 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6579 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6580 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6581 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6582 ++ptr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6583 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6584 }
1843
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6585
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6586 #if defined(FEAT_MBYTE) || defined(FEAT_GUI) || defined(UNIX)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6587 /* 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
6588 * doesn't extend up to there, update the character here. */
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6589 if (force_redraw_next && col < screen_Columns)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6590 {
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6591 # ifdef FEAT_MBYTE
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6592 if (enc_dbcs != 0 && dbcs_off2cells(off, max_off) > 1)
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6593 screen_char_2(off, row, col);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6594 else
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6595 # endif
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6596 screen_char(off, row, col);
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6597 }
823e9ddf23f7 updated for version 7.2-141
vimboss
parents: 1842
diff changeset
6598 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6599 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6601 #ifdef FEAT_SEARCH_EXTRA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6602 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6603 * Prepare for 'hlsearch' highlighting.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6604 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6605 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6606 start_search_hl()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6607 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6608 if (p_hls && !no_hlsearch)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6609 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6610 last_pat_prog(&search_hl.rm);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6611 search_hl.attr = hl_attr(HLF_L);
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6612 # ifdef FEAT_RELTIME
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6613 /* Set the time limit to 'redrawtime'. */
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6614 profile_setlimit(p_rdt, &search_hl.tm);
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6615 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6616 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6617 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6618
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6619 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6620 * Clean up for 'hlsearch' highlighting.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6621 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6622 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6623 end_search_hl()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6624 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6625 if (search_hl.rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6626 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6627 vim_free(search_hl.rm.regprog);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6628 search_hl.rm.regprog = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6629 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6630 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6631
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6632 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6633 * Advance to the match in window "wp" line "lnum" or past it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6634 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6635 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6636 prepare_search_hl(wp, lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6637 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6638 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6639 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6640 matchitem_T *cur; /* points to the match list */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6641 match_T *shl; /* points to search_hl or a match */
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6642 int shl_flag; /* flag to indicate whether search_hl
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6643 has been processed or not */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6644 int n;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6645
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6646 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6647 * When using a multi-line pattern, start searching at the top
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6648 * of the window or just after a closed fold.
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6649 * Do this both for search_hl and the match list.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6650 */
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6651 cur = wp->w_match_head;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6652 shl_flag = FALSE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6653 while (cur != NULL || shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6654 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6655 if (shl_flag == FALSE)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6656 {
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6657 shl = &search_hl;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6658 shl_flag = TRUE;
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6659 }
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6660 else
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6661 shl = &cur->hl;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6662 if (shl->rm.regprog != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6663 && shl->lnum == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6664 && re_multiline(shl->rm.regprog))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6665 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6666 if (shl->first_lnum == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6667 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6668 # ifdef FEAT_FOLDING
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6669 for (shl->first_lnum = lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6670 shl->first_lnum > wp->w_topline; --shl->first_lnum)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6671 if (hasFoldingWin(wp, shl->first_lnum - 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6672 NULL, NULL, TRUE, NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6673 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6674 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6675 shl->first_lnum = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6676 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6677 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6678 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6679 while (shl->first_lnum < lnum && shl->rm.regprog != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6680 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6681 next_search_hl(wp, shl, shl->first_lnum, (colnr_T)n);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6682 if (shl->lnum != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6683 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6684 shl->first_lnum = shl->lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6685 + shl->rm.endpos[0].lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6686 - shl->rm.startpos[0].lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6687 n = shl->rm.endpos[0].col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6688 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6689 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6690 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6691 ++shl->first_lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6692 n = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6693 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6694 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6695 }
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6696 if (shl != &search_hl && cur != NULL)
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6697 cur = cur->next;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6698 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6699 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6700
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6701 /*
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6702 * Search for a next 'hlsearch' or match.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6703 * Uses shl->buf.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6704 * Sets shl->lnum and shl->rm contents.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6705 * Note: Assumes a previous match is always before "lnum", unless
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6706 * shl->lnum is zero.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6707 * Careful: Any pointers for buffer lines will become invalid.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6708 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6709 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6710 next_search_hl(win, shl, lnum, mincol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6711 win_T *win;
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6712 match_T *shl; /* points to search_hl or a match */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6713 linenr_T lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6714 colnr_T mincol; /* minimal column for a match */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6715 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6716 linenr_T l;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6717 colnr_T matchcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6718 long nmatched;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6719
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6720 if (shl->lnum != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6721 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6722 /* Check for three situations:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6723 * 1. If the "lnum" is below a previous match, start a new search.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6724 * 2. If the previous match includes "mincol", use it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6725 * 3. Continue after the previous match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6726 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6727 l = shl->lnum + shl->rm.endpos[0].lnum - shl->rm.startpos[0].lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6728 if (lnum > l)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6729 shl->lnum = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6730 else if (lnum < l || shl->rm.endpos[0].col > mincol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6731 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6732 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6733
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6734 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6735 * Repeat searching for a match until one is found that includes "mincol"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6736 * or none is found in this line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6737 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6738 called_emsg = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6739 for (;;)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6740 {
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6741 #ifdef FEAT_RELTIME
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6742 /* Stop searching after passing the time limit. */
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6743 if (profile_passed_limit(&(shl->tm)))
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6744 {
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6745 shl->lnum = 0; /* no match found in time */
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6746 break;
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6747 }
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6748 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6749 /* Three situations:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6750 * 1. No useful previous match: search from start of line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6751 * 2. Not Vi compatible or empty match: continue at next character.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6752 * Break the loop if this is beyond the end of the line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6753 * 3. Vi compatible searching: continue at end of previous match.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6754 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6755 if (shl->lnum == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6756 matchcol = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6757 else if (vim_strchr(p_cpo, CPO_SEARCH) == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6758 || (shl->rm.endpos[0].lnum == 0
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6759 && shl->rm.endpos[0].col <= shl->rm.startpos[0].col))
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6760 {
688
bcd2edc4539e updated for version 7.0207
vimboss
parents: 685
diff changeset
6761 char_u *ml;
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6762
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6763 matchcol = shl->rm.startpos[0].col;
688
bcd2edc4539e updated for version 7.0207
vimboss
parents: 685
diff changeset
6764 ml = ml_get_buf(shl->buf, lnum, FALSE) + matchcol;
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6765 if (*ml == NUL)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6766 {
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6767 ++matchcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6768 shl->lnum = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6769 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6770 }
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6771 #ifdef FEAT_MBYTE
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6772 if (has_mbyte)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6773 matchcol += mb_ptr2len(ml);
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6774 else
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6775 #endif
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
6776 ++matchcol;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6777 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6778 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6779 matchcol = shl->rm.endpos[0].col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6780
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6781 shl->lnum = lnum;
1521
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6782 nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol,
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6783 #ifdef FEAT_RELTIME
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6784 &(shl->tm)
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6785 #else
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6786 NULL
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6787 #endif
cc4fe241baa3 updated for version 7.1-236
vimboss
parents: 1504
diff changeset
6788 );
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6789 if (called_emsg)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6790 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6791 /* Error while handling regexp: stop using this regexp. */
1112
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
6792 if (shl == &search_hl)
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
6793 {
1326
22886f3d882d updated for version 7.1-040
vimboss
parents: 1295
diff changeset
6794 /* 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
6795 vim_free(shl->rm.regprog);
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
6796 no_hlsearch = TRUE;
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
6797 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6798 shl->rm.regprog = NULL;
1112
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
6799 shl->lnum = 0;
56695f1182f0 updated for version 7.0-238
vimboss
parents: 1043
diff changeset
6800 got_int = FALSE; /* avoid the "Type :quit to exit Vim" message */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6801 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6802 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6803 if (nmatched == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6804 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6805 shl->lnum = 0; /* no match found */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6806 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6807 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6808 if (shl->rm.startpos[0].lnum > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6809 || shl->rm.startpos[0].col >= mincol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6810 || nmatched > 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6811 || shl->rm.endpos[0].col > mincol)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6812 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6813 shl->lnum += shl->rm.startpos[0].lnum;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6814 break; /* useful match found */
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 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6818 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6819
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6820 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6821 screen_start_highlight(attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6822 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6823 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6824 attrentry_T *aep = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6825
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6826 screen_attr = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6827 if (full_screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6828 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6829 && termcap_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6830 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6831 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6832 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6833 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6834 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6835 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6836 char buf[20];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6837
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6838 /* The GUI handles this internally. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6839 sprintf(buf, IF_EB("\033|%dh", ESC_STR "|%dh"), attr);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6840 OUT_STR(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6841 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6842 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6843 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6844 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6845 if (attr > HL_ALL) /* special HL attr. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6846 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6847 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6848 aep = syn_cterm_attr2entry(attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6849 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6850 aep = syn_term_attr2entry(attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6851 if (aep == NULL) /* did ":syntax clear" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6852 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6853 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6854 attr = aep->ae_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6855 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6856 if ((attr & HL_BOLD) && T_MD != NULL) /* bold */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6857 out_str(T_MD);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6858 else if (aep != NULL && t_colors > 1 && aep->ae_u.cterm.fg_color
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6859 && cterm_normal_fg_bold)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6860 /* If the Normal FG color has BOLD attribute and the new HL
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6861 * has a FG color defined, clear BOLD. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
6862 out_str(T_ME);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6863 if ((attr & HL_STANDOUT) && T_SO != NULL) /* standout */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6864 out_str(T_SO);
205
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
6865 if ((attr & (HL_UNDERLINE | HL_UNDERCURL)) && T_US != NULL)
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
6866 /* underline or undercurl */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6867 out_str(T_US);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6868 if ((attr & HL_ITALIC) && T_CZH != NULL) /* italic */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6869 out_str(T_CZH);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6870 if ((attr & HL_INVERSE) && T_MR != NULL) /* inverse (reverse) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6871 out_str(T_MR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6872
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6873 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6874 * Output the color or start string after bold etc., in case the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6875 * bold etc. override the color setting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6876 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6877 if (aep != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6878 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6879 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6880 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6881 if (aep->ae_u.cterm.fg_color)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6882 term_fg_color(aep->ae_u.cterm.fg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6883 if (aep->ae_u.cterm.bg_color)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6884 term_bg_color(aep->ae_u.cterm.bg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6885 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6886 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6887 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6888 if (aep->ae_u.term.start != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6889 out_str(aep->ae_u.term.start);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6890 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6891 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6892 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6893 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6894 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6895
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6896 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6897 screen_stop_highlight()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6898 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6899 int do_ME = FALSE; /* output T_ME code */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6900
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6901 if (screen_attr != 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6902 #ifdef WIN3264
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6903 && termcap_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6904 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6905 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6906 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6907 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6908 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6909 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6910 char buf[20];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6911
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6912 /* use internal GUI code */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6913 sprintf(buf, IF_EB("\033|%dH", ESC_STR "|%dH"), screen_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6914 OUT_STR(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6915 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6916 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6917 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6918 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6919 if (screen_attr > HL_ALL) /* special HL attr. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6920 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6921 attrentry_T *aep;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6922
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6923 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6924 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6925 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6926 * Assume that t_me restores the original colors!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6927 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6928 aep = syn_cterm_attr2entry(screen_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6929 if (aep != NULL && (aep->ae_u.cterm.fg_color
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6930 || aep->ae_u.cterm.bg_color))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6931 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6932 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6933 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6934 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6935 aep = syn_term_attr2entry(screen_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6936 if (aep != NULL && aep->ae_u.term.stop != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6937 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6938 if (STRCMP(aep->ae_u.term.stop, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6939 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6940 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6941 out_str(aep->ae_u.term.stop);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6942 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6943 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6944 if (aep == NULL) /* did ":syntax clear" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6945 screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6946 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6947 screen_attr = aep->ae_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6948 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6949
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6950 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6951 * Often all ending-codes are equal to T_ME. Avoid outputting the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6952 * same sequence several times.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6953 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6954 if (screen_attr & HL_STANDOUT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6955 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6956 if (STRCMP(T_SE, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6957 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6958 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6959 out_str(T_SE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6960 }
205
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
6961 if (screen_attr & (HL_UNDERLINE | HL_UNDERCURL))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6962 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6963 if (STRCMP(T_UE, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6964 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6965 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6966 out_str(T_UE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6967 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6968 if (screen_attr & HL_ITALIC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6969 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6970 if (STRCMP(T_CZR, T_ME) == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6971 do_ME = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6972 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6973 out_str(T_CZR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6974 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6975 if (do_ME || (screen_attr & (HL_BOLD | HL_INVERSE)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6976 out_str(T_ME);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6977
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6978 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6979 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6980 /* set Normal cterm colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6981 if (cterm_normal_fg_color != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6982 term_fg_color(cterm_normal_fg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6983 if (cterm_normal_bg_color != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6984 term_bg_color(cterm_normal_bg_color - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6985 if (cterm_normal_fg_bold)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6986 out_str(T_MD);
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 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6990 screen_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6991 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6992
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6993 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6994 * Reset the colors for a cterm. Used when leaving Vim.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6995 * The machine specific code may override this again.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6996 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6997 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6998 reset_cterm_colors()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6999 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7000 if (t_colors > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7001 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7002 /* set Normal cterm colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7003 if (cterm_normal_fg_color > 0 || cterm_normal_bg_color > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7004 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7005 out_str(T_OP);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7006 screen_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7007 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7008 if (cterm_normal_fg_bold)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7009 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7010 out_str(T_ME);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7011 screen_attr = -1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7012 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7013 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7014 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7015
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7016 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7017 * Put character ScreenLines["off"] on the screen at position "row" and "col",
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7018 * using the attributes from ScreenAttrs["off"].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7019 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7020 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7021 screen_char(off, row, col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7022 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7023 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7024 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7025 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7026 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7027
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7028 /* Check for illegal values, just in case (could happen just after
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7029 * resizing). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7030 if (row >= screen_Rows || col >= screen_Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7031 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7032
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7033 /* Outputting the last character on the screen may scrollup the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7034 * Don't to it! Mark the character invalid (update it when scrolled up) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7035 if (row == screen_Rows - 1 && col == screen_Columns - 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7036 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7037 /* account for first command-line character in rightleft mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7038 && !cmdmsg_rl
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7039 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7040 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7041 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7042 ScreenAttrs[off] = (sattr_T)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7043 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7044 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7045
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7046 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7047 * Stop highlighting first, so it's easier to move the cursor.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7048 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7049 #if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7050 if (screen_char_attr != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7051 attr = screen_char_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7052 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7053 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7054 attr = ScreenAttrs[off];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7055 if (screen_attr != attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7056 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7057
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7058 windgoto(row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7059
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7060 if (screen_attr != attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7061 screen_start_highlight(attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7062
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7063 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7064 if (enc_utf8 && ScreenLinesUC[off] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7065 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7066 char_u buf[MB_MAXBYTES + 1];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7067
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7068 /* Convert UTF-8 character to bytes and write it. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7070 buf[utfc_char2bytes(off, buf)] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7071
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7072 out_str(buf);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7073 if (utf_char2cells(ScreenLinesUC[off]) > 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7074 ++screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7075 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7076 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7077 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7078 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7079 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7080 out_flush_check();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7081 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7082 out_char(ScreenLines[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7083 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7084 /* double-byte character in single-width cell */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7085 if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7086 out_char(ScreenLines2[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7087 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7088 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7089
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7090 screen_cur_col++;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7091 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7092
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7093 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7094
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7095 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7096 * Used for enc_dbcs only: Put one double-wide character at ScreenLines["off"]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7097 * on the screen at position 'row' and 'col'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7098 * The attributes of the first byte is used for all. This is required to
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7099 * output the two bytes of a double-byte character with nothing in between.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7100 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7101 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7102 screen_char_2(off, row, col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7103 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7104 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7105 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7106 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7107 /* Check for illegal values (could be wrong when screen was resized). */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7108 if (off + 1 >= (unsigned)(screen_Rows * screen_Columns))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7109 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7110
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7111 /* Outputting the last character on the screen may scrollup the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7112 * Don't to it! Mark the character invalid (update it when scrolled up) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7113 if (row == screen_Rows - 1 && col >= screen_Columns - 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7114 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7115 ScreenAttrs[off] = (sattr_T)-1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7116 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7117 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7118
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7119 /* Output the first byte normally (positions the cursor), then write the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7120 * second byte directly. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7121 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7122 out_char(ScreenLines[off + 1]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7123 ++screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7124 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7125 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7126
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7127 #if defined(FEAT_CLIPBOARD) || defined(FEAT_VERTSPLIT) || defined(PROTO)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7128 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7129 * Draw a rectangle of the screen, inverted when "invert" is TRUE.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7130 * This uses the contents of ScreenLines[] and doesn't change it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7131 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7132 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7133 screen_draw_rectangle(row, col, height, width, invert)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7134 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7135 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7136 int height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7137 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7138 int invert;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7139 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7140 int r, c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7141 int off;
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7142 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7143 int max_off;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7144 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7145
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7146 /* Can't use ScreenLines unless initialized */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7147 if (ScreenLines == NULL)
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7148 return;
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7149
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7150 if (invert)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7151 screen_char_attr = HL_INVERSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7152 for (r = row; r < row + height; ++r)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7153 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7154 off = LineOffset[r];
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7155 #ifdef FEAT_MBYTE
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7156 max_off = off + screen_Columns;
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7157 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7158 for (c = col; c < col + width; ++c)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7159 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7160 #ifdef FEAT_MBYTE
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7161 if (enc_dbcs != 0 && dbcs_off2cells(off + c, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7162 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7163 screen_char_2(off + c, r, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7164 ++c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7165 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7166 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7167 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7168 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7169 screen_char(off + c, r, c);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7170 #ifdef FEAT_MBYTE
1378
a4365075d05c updated for version 7.1-093
vimboss
parents: 1340
diff changeset
7171 if (utf_off2cells(off + c, max_off) > 1)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7172 ++c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7173 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7174 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7175 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7176 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7177 screen_char_attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7178 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7179 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7181 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7182 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7183 * Redraw the characters for a vertically split window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7184 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7185 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7186 redraw_block(row, end, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7187 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7188 int end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7189 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7190 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7191 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7192 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7193
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7194 # ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7195 clip_may_clear_selection(row, end - 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7196 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7198 if (wp == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7199 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7200 col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7201 width = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7202 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7203 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7204 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7205 col = wp->w_wincol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7206 width = wp->w_width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7208 screen_draw_rectangle(row, col, end - row, width, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7209 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7210 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7211
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7212 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7213 * 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
7214 * with character 'c1' in first column followed by 'c2' in the other columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7215 * Use attributes 'attr'.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7216 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7217 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7218 screen_fill(start_row, end_row, start_col, end_col, c1, c2, attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7219 int start_row, end_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7220 int start_col, end_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7221 int c1, c2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7222 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7223 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7224 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7225 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7226 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7227 int end_off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7228 int did_delete;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7229 int c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7230 int norm_term;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7231 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7232 int force_next = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7233 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7234
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7235 if (end_row > screen_Rows) /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7236 end_row = screen_Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7237 if (end_col > screen_Columns) /* safety check */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7238 end_col = screen_Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7239 if (ScreenLines == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7240 || start_row >= end_row
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7241 || start_col >= end_col) /* nothing to do */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7242 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7243
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7244 /* it's a "normal" terminal when not in a GUI or cterm */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7245 norm_term = (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7246 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7247 !gui.in_use &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7248 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7249 t_colors <= 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7250 for (row = start_row; row < end_row; ++row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7251 {
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7252 #ifdef FEAT_MBYTE
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7253 if (has_mbyte
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7254 # ifdef FEAT_GUI
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7255 && !gui.in_use
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7256 # endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7257 )
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7258 {
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7259 /* When drawing over the right halve of a double-wide char clear
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7260 * out the left halve. When drawing over the left halve of a
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7261 * double wide-char clear out the right halve. Only needed in a
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7262 * terminal. */
1685
7015ddf81055 updated for version 7.2b-018
vimboss
parents: 1677
diff changeset
7263 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
7264 screen_puts_len((char_u *)" ", 1, row, start_col - 1, 0);
1677
b98975453785 updated for version 7.2b-009
vimboss
parents: 1670
diff changeset
7265 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
7266 screen_puts_len((char_u *)" ", 1, row, end_col, 0);
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7267 }
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
7268 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7269 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7270 * Try to use delete-line termcap code, when no attributes or in a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7271 * "normal" terminal, where a bold/italic space is just a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7272 * space.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7273 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7274 did_delete = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7275 if (c2 == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7276 && end_col == Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7277 && can_clear(T_CE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7278 && (attr == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7279 || (norm_term
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7280 && attr <= HL_ALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7281 && ((attr & ~(HL_BOLD | HL_ITALIC)) == 0))))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7282 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7283 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7284 * check if we really need to clear something
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7285 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7286 col = start_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7287 if (c1 != ' ') /* don't clear first char */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7288 ++col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7289
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7290 off = LineOffset[row] + col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7291 end_off = LineOffset[row] + end_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7292
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7293 /* skip blanks (used often, keep it fast!) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7294 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7295 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7296 while (off < end_off && ScreenLines[off] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7297 && ScreenAttrs[off] == 0 && ScreenLinesUC[off] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7298 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7299 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7300 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7301 while (off < end_off && ScreenLines[off] == ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7302 && ScreenAttrs[off] == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7303 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7304 if (off < end_off) /* something to be cleared */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7305 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7306 col = off - LineOffset[row];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7307 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7308 term_windgoto(row, col);/* clear rest of this screen line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7309 out_str(T_CE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7310 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7311 col = end_col - col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7312 while (col--) /* clear chars in ScreenLines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7314 ScreenLines[off] = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7315 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7316 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7317 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7318 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7319 ScreenAttrs[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7320 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7321 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7322 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7323 did_delete = TRUE; /* the chars are cleared now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7324 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7325
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7326 off = LineOffset[row] + start_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7327 c = c1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7328 for (col = start_col; col < end_col; ++col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7329 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7330 if (ScreenLines[off] != c
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7331 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7332 || (enc_utf8 && (int)ScreenLinesUC[off]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7333 != (c >= 0x80 ? c : 0))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7334 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7335 || ScreenAttrs[off] != attr
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7336 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7337 || force_next
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7338 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7339 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7340 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7341 #if defined(FEAT_GUI) || defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7342 /* The bold trick may make a single row of pixels appear in
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7343 * the next character. When a bold character is removed, the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7344 * next character should be redrawn too. This happens for our
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7345 * own GUI and for some xterms. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7346 if (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7347 # ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7348 gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7349 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7350 # if defined(FEAT_GUI) && defined(UNIX)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7351 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7352 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7353 # ifdef UNIX
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7354 term_is_xterm
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7355 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7356 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7357 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7358 if (ScreenLines[off] != ' '
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7359 && (ScreenAttrs[off] > HL_ALL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7360 || ScreenAttrs[off] & HL_BOLD))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7361 force_next = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7362 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7363 force_next = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7364 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7365 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7366 ScreenLines[off] = c;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7367 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7368 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7369 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7370 if (c >= 0x80)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7371 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7372 ScreenLinesUC[off] = c;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7373 ScreenLinesC[0][off] = 0;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7374 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7375 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7376 ScreenLinesUC[off] = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7377 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7378 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7379 ScreenAttrs[off] = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7380 if (!did_delete || c != ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7381 screen_char(off, row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7382 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7383 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7384 if (col == start_col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7385 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7386 if (did_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7387 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7388 c = c2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7389 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7390 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7391 if (end_col == Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7392 LineWraps[row] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7393 if (row == Rows - 1) /* overwritten the command line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7394 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7395 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7396 if (c1 == ' ' && c2 == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7397 clear_cmdline = FALSE; /* command line has been cleared */
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
7398 if (start_col == 0)
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
7399 mode_displayed = FALSE; /* mode cleared or overwritten */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7400 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7401 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7402 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7403
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7404 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7405 * Check if there should be a delay. Used before clearing or redrawing the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7406 * screen or the command line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7407 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7408 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7409 check_for_delay(check_msg_scroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7410 int check_msg_scroll;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7411 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7412 if ((emsg_on_display || (check_msg_scroll && msg_scroll))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7413 && !did_wait_return
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7414 && emsg_silent == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7415 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7416 out_flush();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7417 ui_delay(1000L, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7418 emsg_on_display = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7419 if (check_msg_scroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7420 msg_scroll = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7421 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7422 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7423
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7424 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7425 * screen_valid - allocate screen buffers if size changed
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7426 * If "clear" is TRUE: clear screen if it has been resized.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7427 * Returns TRUE if there is a valid screen to write to.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7428 * Returns FALSE when starting up and screen not initialized yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7429 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7430 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7431 screen_valid(clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7432 int clear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7433 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7434 screenalloc(clear); /* allocate screen buffers if size changed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7435 return (ScreenLines != NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7436 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7437
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7438 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7439 * Resize the shell to Rows and Columns.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7440 * Allocate ScreenLines[] and associated items.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7441 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7442 * There may be some time between setting Rows and Columns and (re)allocating
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7443 * ScreenLines[]. This happens when starting up and when (manually) changing
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7444 * the shell size. Always use screen_Rows and screen_Columns to access items
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7445 * in ScreenLines[]. Use Rows and Columns for positioning text etc. where the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7446 * final size of the shell is needed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7447 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7448 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7449 screenalloc(clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7450 int clear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7451 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7452 int new_row, old_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7453 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7454 int old_Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7455 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7456 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7457 int outofmem = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7458 int len;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7459 schar_T *new_ScreenLines;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7460 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7461 u8char_T *new_ScreenLinesUC = NULL;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7462 u8char_T *new_ScreenLinesC[MAX_MCO];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7463 schar_T *new_ScreenLines2 = NULL;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7464 int i;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7465 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7466 sattr_T *new_ScreenAttrs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7467 unsigned *new_LineOffset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7468 char_u *new_LineWraps;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7469 #ifdef FEAT_WINDOWS
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7470 short *new_TabPageIdxs;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7471 tabpage_T *tp;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7472 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7473 static int entered = FALSE; /* avoid recursiveness */
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
7474 static int done_outofmem_msg = FALSE; /* did outofmem message */
1824
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7475 #ifdef FEAT_AUTOCMD
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7476 int retry_count = 0;
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7477
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7478 retry:
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7479 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7480 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7481 * Allocation of the screen buffers is done only when the size changes and
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7482 * when Rows and Columns have been set and we have started doing full
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7483 * screen stuff.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7484 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7485 if ((ScreenLines != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7486 && Rows == screen_Rows
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7487 && Columns == screen_Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7488 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7489 && enc_utf8 == (ScreenLinesUC != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7490 && (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL)
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7491 && p_mco == Screen_mco
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7492 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7493 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7494 || Rows == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7495 || Columns == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7496 || (!full_screen && ScreenLines == NULL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7497 return;
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 * It's possible that we produce an out-of-memory message below, which
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7501 * will cause this function to be called again. To break the loop, just
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7502 * return here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7503 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7504 if (entered)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7505 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7506 entered = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7507
911
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7508 /*
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7509 * Note that the window sizes are updated before reallocating the arrays,
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7510 * thus we must not redraw here!
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7511 */
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7512 ++RedrawingDisabled;
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7513
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7514 win_new_shellsize(); /* fit the windows in the new sized shell */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7515
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7516 comp_col(); /* recompute columns for shown command and ruler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7517
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7518 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7519 * We're changing the size of the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7520 * - Allocate new arrays for ScreenLines and ScreenAttrs.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7521 * - Move lines from the old arrays into the new arrays, clear extra
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7522 * lines (unless the screen is going to be cleared).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7523 * - Free the old arrays.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7524 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7525 * If anything fails, make ScreenLines NULL, so we don't do anything!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7526 * Continuing with the old ScreenLines may result in a crash, because the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7527 * size is wrong.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7528 */
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7529 FOR_ALL_TAB_WINDOWS(tp, wp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7530 win_free_lsize(wp);
1946
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7531 #ifdef FEAT_AUTOCMD
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7532 if (aucmd_win != NULL)
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7533 win_free_lsize(aucmd_win);
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7534 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7535
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7536 new_ScreenLines = (schar_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7537 (Rows + 1) * Columns * sizeof(schar_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7538 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7539 vim_memset(new_ScreenLinesC, 0, sizeof(u8char_T) * MAX_MCO);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7540 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7541 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7542 new_ScreenLinesUC = (u8char_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7543 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7544 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7545 new_ScreenLinesC[i] = (u8char_T *)lalloc((long_u)(
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7546 (Rows + 1) * Columns * sizeof(u8char_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7547 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7548 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7549 new_ScreenLines2 = (schar_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7550 (Rows + 1) * Columns * sizeof(schar_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7551 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7552 new_ScreenAttrs = (sattr_T *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7553 (Rows + 1) * Columns * sizeof(sattr_T)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7554 new_LineOffset = (unsigned *)lalloc((long_u)(
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7555 Rows * sizeof(unsigned)), FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7556 new_LineWraps = (char_u *)lalloc((long_u)(Rows * sizeof(char_u)), FALSE);
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7557 #ifdef FEAT_WINDOWS
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
7558 new_TabPageIdxs = (short *)lalloc((long_u)(Columns * sizeof(short)), FALSE);
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7559 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7560
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
7561 FOR_ALL_TAB_WINDOWS(tp, wp)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7562 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7563 if (win_alloc_lines(wp) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7564 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7565 outofmem = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7566 #ifdef FEAT_WINDOWS
1819
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7567 goto give_up;
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7568 #endif
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7569 }
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7570 }
1906
ff9ecf14efe3 updated for version 7.2-203
vimboss
parents: 1883
diff changeset
7571 #ifdef FEAT_AUTOCMD
1946
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7572 if (aucmd_win != NULL && aucmd_win->w_lines == NULL
a9f561ffbc53 updated for version 7.2-243
vimboss
parents: 1910
diff changeset
7573 && win_alloc_lines(aucmd_win) == FAIL)
1906
ff9ecf14efe3 updated for version 7.2-203
vimboss
parents: 1883
diff changeset
7574 outofmem = TRUE;
ff9ecf14efe3 updated for version 7.2-203
vimboss
parents: 1883
diff changeset
7575 #endif
1819
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7576 #ifdef FEAT_WINDOWS
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7577 give_up:
15130d4dfea1 updated for version 7.2-117
vimboss
parents: 1814
diff changeset
7578 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7579
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7580 #ifdef FEAT_MBYTE
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7581 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7582 if (new_ScreenLinesC[i] == NULL)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7583 break;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7584 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7585 if (new_ScreenLines == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7586 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7587 || (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7588 || (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7589 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7590 || new_ScreenAttrs == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7591 || new_LineOffset == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7592 || new_LineWraps == NULL
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7593 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7594 || new_TabPageIdxs == NULL
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7595 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7596 || outofmem)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7597 {
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
7598 if (ScreenLines != NULL || !done_outofmem_msg)
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7599 {
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7600 /* guess the size */
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7601 do_outofmem_msg((long_u)((Rows + 1) * Columns));
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7602
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7603 /* Remember we did this to avoid getting outofmem messages over
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7604 * and over again. */
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
7605 done_outofmem_msg = TRUE;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7606 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7607 vim_free(new_ScreenLines);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7608 new_ScreenLines = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7609 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7610 vim_free(new_ScreenLinesUC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7611 new_ScreenLinesUC = NULL;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7612 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7613 {
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7614 vim_free(new_ScreenLinesC[i]);
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7615 new_ScreenLinesC[i] = NULL;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7616 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7617 vim_free(new_ScreenLines2);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7618 new_ScreenLines2 = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7619 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7620 vim_free(new_ScreenAttrs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7621 new_ScreenAttrs = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7622 vim_free(new_LineOffset);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7623 new_LineOffset = NULL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7624 vim_free(new_LineWraps);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7625 new_LineWraps = NULL;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7626 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7627 vim_free(new_TabPageIdxs);
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7628 new_TabPageIdxs = NULL;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7629 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7630 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7631 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7632 {
944
b2dcb8457067 updated for version 7.0-070
vimboss
parents: 911
diff changeset
7633 done_outofmem_msg = FALSE;
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7634
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7635 for (new_row = 0; new_row < Rows; ++new_row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7636 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7637 new_LineOffset[new_row] = new_row * Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7638 new_LineWraps[new_row] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7639
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7640 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7641 * If the screen is not going to be cleared, copy as much as
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7642 * possible from the old screen to the new one and clear the rest
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7643 * (used when resizing the window at the "--more--" prompt or when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7644 * executing an external command, for the GUI).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7645 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7646 if (!clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7647 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7648 (void)vim_memset(new_ScreenLines + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7649 ' ', (size_t)Columns * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7650 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7651 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7652 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7653 (void)vim_memset(new_ScreenLinesUC + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7654 0, (size_t)Columns * sizeof(u8char_T));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7655 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7656 (void)vim_memset(new_ScreenLinesC[i]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7657 + new_row * Columns,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7658 0, (size_t)Columns * sizeof(u8char_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7659 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7660 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7661 (void)vim_memset(new_ScreenLines2 + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7662 0, (size_t)Columns * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7663 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7664 (void)vim_memset(new_ScreenAttrs + new_row * Columns,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7665 0, (size_t)Columns * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7666 old_row = new_row + (screen_Rows - Rows);
534
c6296b0ad9ea updated for version 7.0151
vimboss
parents: 530
diff changeset
7667 if (old_row >= 0 && ScreenLines != NULL)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7668 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7669 if (screen_Columns < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7670 len = screen_Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7671 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7672 len = Columns;
26
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
7673 #ifdef FEAT_MBYTE
571
0ae54f30d5bc updated for version 7.0162
vimboss
parents: 548
diff changeset
7674 /* When switching to utf-8 don't copy characters, they
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7675 * may be invalid now. Also when p_mco changes. */
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7676 if (!(enc_utf8 && ScreenLinesUC == NULL)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7677 && p_mco == Screen_mco)
26
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
7678 #endif
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
7679 mch_memmove(new_ScreenLines + new_LineOffset[new_row],
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
7680 ScreenLines + LineOffset[old_row],
404aac550f35 updated for version 7.0017
vimboss
parents: 13
diff changeset
7681 (size_t)len * sizeof(schar_T));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7682 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7683 if (enc_utf8 && ScreenLinesUC != NULL
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7684 && p_mco == Screen_mco)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7685 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7686 mch_memmove(new_ScreenLinesUC + new_LineOffset[new_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7687 ScreenLinesUC + LineOffset[old_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7688 (size_t)len * sizeof(u8char_T));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7689 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7690 mch_memmove(new_ScreenLinesC[i]
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7691 + new_LineOffset[new_row],
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7692 ScreenLinesC[i] + LineOffset[old_row],
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7693 (size_t)len * sizeof(u8char_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7694 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7695 if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7696 mch_memmove(new_ScreenLines2 + new_LineOffset[new_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7697 ScreenLines2 + LineOffset[old_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7698 (size_t)len * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7699 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7700 mch_memmove(new_ScreenAttrs + new_LineOffset[new_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7701 ScreenAttrs + LineOffset[old_row],
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7702 (size_t)len * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7703 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7704 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7705 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7706 /* Use the last line of the screen for the current line. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7707 current_ScreenLine = new_ScreenLines + Rows * Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7708 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7709
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7710 free_screenlines();
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7711
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7712 ScreenLines = new_ScreenLines;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7713 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7714 ScreenLinesUC = new_ScreenLinesUC;
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7715 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7716 ScreenLinesC[i] = new_ScreenLinesC[i];
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7717 Screen_mco = p_mco;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7718 ScreenLines2 = new_ScreenLines2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7719 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7720 ScreenAttrs = new_ScreenAttrs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7721 LineOffset = new_LineOffset;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7722 LineWraps = new_LineWraps;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7723 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7724 TabPageIdxs = new_TabPageIdxs;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7725 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7726
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7727 /* It's important that screen_Rows and screen_Columns reflect the actual
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7728 * size of ScreenLines[]. Set them before calling anything. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7729 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7730 old_Rows = screen_Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7731 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7732 screen_Rows = Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7733 screen_Columns = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7734
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7735 must_redraw = CLEAR; /* need to clear the screen later */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7736 if (clear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7737 screenclear2();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7738
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7739 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7740 else if (gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7741 && !gui.starting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7742 && ScreenLines != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7743 && old_Rows != Rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7744 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7745 (void)gui_redraw_block(0, 0, (int)Rows - 1, (int)Columns - 1, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7746 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7747 * Adjust the position of the cursor, for when executing an external
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7748 * command.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7749 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7750 if (msg_row >= Rows) /* Rows got smaller */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7751 msg_row = Rows - 1; /* put cursor at last row */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7752 else if (Rows > old_Rows) /* Rows got bigger */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7753 msg_row += Rows - old_Rows; /* put cursor in same place */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7754 if (msg_col >= Columns) /* Columns got smaller */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7755 msg_col = Columns - 1; /* put cursor at last column */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7756 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7757 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7758
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7759 entered = FALSE;
911
697dec8ec5e7 updated for version 7.0-037
vimboss
parents: 910
diff changeset
7760 --RedrawingDisabled;
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
7761
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
7762 #ifdef FEAT_AUTOCMD
1824
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7763 /*
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7764 * 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
7765 * in case applying autocommands always changes Rows or Columns.
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7766 */
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7767 if (starting == 0 && ++retry_count <= 3)
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7768 {
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
7769 apply_autocmds(EVENT_VIMRESIZED, NULL, NULL, FALSE, curbuf);
1824
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7770 /* In rare cases, autocommands may have altered Rows or Columns,
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7771 * jump back to check if we need to allocate the screen again. */
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7772 goto retry;
3af28ecf9e56 updated for version 7.2-122
vimboss
parents: 1821
diff changeset
7773 }
766
f0d0d3d3a1e2 updated for version 7.0225
vimboss
parents: 758
diff changeset
7774 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7775 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7776
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7777 void
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7778 free_screenlines()
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7779 {
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7780 #ifdef FEAT_MBYTE
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7781 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7782
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7783 vim_free(ScreenLinesUC);
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7784 for (i = 0; i < Screen_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7785 vim_free(ScreenLinesC[i]);
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7786 vim_free(ScreenLines2);
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7787 #endif
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7788 vim_free(ScreenLines);
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7789 vim_free(ScreenAttrs);
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7790 vim_free(LineOffset);
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7791 vim_free(LineWraps);
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7792 #ifdef FEAT_WINDOWS
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7793 vim_free(TabPageIdxs);
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
7794 #endif
356
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7795 }
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7796
0f2b5d1b8117 updated for version 7.0092
vimboss
parents: 353
diff changeset
7797 void
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7798 screenclear()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7799 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7800 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7801 screenalloc(FALSE); /* allocate screen buffers if size changed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7802 screenclear2(); /* clear the screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7803 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7804
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7805 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7806 screenclear2()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7807 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7808 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7809
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7810 if (starting == NO_SCREEN || ScreenLines == NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7811 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7812 || (gui.in_use && gui.starting)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7813 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7814 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7815 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7816
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7817 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7818 if (!gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7819 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7820 screen_attr = -1; /* force setting the Normal colors */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7821 screen_stop_highlight(); /* don't want highlighting here */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7822
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7823 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7824 /* disable selection without redrawing it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7825 clip_scroll_selection(9999);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7826 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7827
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7828 /* blank out ScreenLines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7829 for (i = 0; i < Rows; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7830 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7831 lineclear(LineOffset[i], (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7832 LineWraps[i] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7833 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7834
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7835 if (can_clear(T_CL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7836 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7837 out_str(T_CL); /* clear the display */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7838 clear_cmdline = FALSE;
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
7839 mode_displayed = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7840 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7841 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7842 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7843 /* can't clear the screen, mark all chars with invalid attributes */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7844 for (i = 0; i < Rows; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7845 lineinvalid(LineOffset[i], (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7846 clear_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7847 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7848
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7849 screen_cleared = TRUE; /* can use contents of ScreenLines now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7850
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7851 win_rest_invalid(firstwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7852 redraw_cmdline = TRUE;
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
7853 #ifdef FEAT_WINDOWS
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
7854 redraw_tabline = TRUE;
670
f892bda292a8 updated for version 7.0198
vimboss
parents: 667
diff changeset
7855 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7856 if (must_redraw == CLEAR) /* no need to clear again */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7857 must_redraw = NOT_VALID;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7858 compute_cmdrow();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7859 msg_row = cmdline_row; /* put cursor on last line for messages */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7860 msg_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7861 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7862 msg_scrolled = 0; /* can't scroll back */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7863 msg_didany = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7864 msg_didout = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7865 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7866
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7867 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7868 * Clear one line in ScreenLines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7869 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7870 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7871 lineclear(off, width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7872 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7873 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7874 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7875 (void)vim_memset(ScreenLines + off, ' ', (size_t)width * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7876 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7877 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7878 (void)vim_memset(ScreenLinesUC + off, 0,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7879 (size_t)width * sizeof(u8char_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7880 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7881 (void)vim_memset(ScreenAttrs + off, 0, (size_t)width * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7882 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7883
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7884 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7885 * Mark one line in ScreenLines invalid by setting the attributes to an
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7886 * invalid value.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7887 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7888 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7889 lineinvalid(off, width)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7890 unsigned off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7891 int width;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7892 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7893 (void)vim_memset(ScreenAttrs + off, -1, (size_t)width * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7894 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7895
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7896 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7897 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7898 * Copy part of a Screenline for vertically split window "wp".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7899 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7900 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7901 linecopy(to, from, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7902 int to;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7903 int from;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7904 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7905 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7906 unsigned off_to = LineOffset[to] + wp->w_wincol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7907 unsigned off_from = LineOffset[from] + wp->w_wincol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7908
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7909 mch_memmove(ScreenLines + off_to, ScreenLines + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7910 wp->w_width * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7911 # ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7912 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7913 {
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7914 int i;
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7915
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7916 mch_memmove(ScreenLinesUC + off_to, ScreenLinesUC + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7917 wp->w_width * sizeof(u8char_T));
714
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7918 for (i = 0; i < p_mco; ++i)
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7919 mch_memmove(ScreenLinesC[i] + off_to, ScreenLinesC[i] + off_from,
0f9f4761ad9c updated for version 7.0216
vimboss
parents: 707
diff changeset
7920 wp->w_width * sizeof(u8char_T));
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7921 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7922 if (enc_dbcs == DBCS_JPNU)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7923 mch_memmove(ScreenLines2 + off_to, ScreenLines2 + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7924 wp->w_width * sizeof(schar_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7925 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7926 mch_memmove(ScreenAttrs + off_to, ScreenAttrs + off_from,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7927 wp->w_width * sizeof(sattr_T));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7928 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7929 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7930
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7931 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7932 * Return TRUE if clearing with term string "p" would work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7933 * 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
7934 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7935 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7936 can_clear(p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7937 char_u *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7938 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7939 return (*p != NUL && (t_colors <= 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7940 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7941 || gui.in_use
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7942 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7943 || cterm_normal_bg_color == 0 || *T_UT != NUL));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7944 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7945
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7946 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7947 * Reset cursor position. Use whenever cursor was moved because of outputting
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7948 * something directly to the screen (shell commands) or a terminal control
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7949 * code.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7950 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7951 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7952 screen_start()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7953 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7954 screen_cur_row = screen_cur_col = 9999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7955 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7956
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7957 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7958 * Move the cursor to position "row","col" in the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7959 * This tries to find the most efficient way to move, minimizing the number of
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7960 * characters sent to the terminal.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7961 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7962 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7963 windgoto(row, col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7964 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7965 int col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7966 {
205
d292c40ca788 updated for version 7.0060
vimboss
parents: 168
diff changeset
7967 sattr_T *p;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7968 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7969 int plan;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7970 int cost;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7971 int wouldbe_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7972 int noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7973 char_u *bs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7974 int goto_cost;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7975 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7976
1213
8906c10ecbb0 updated for version 7.1b
vimboss
parents: 1112
diff changeset
7977 #define GOTO_COST 7 /* assume a term_windgoto() takes about 7 chars */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7978 #define HIGHL_COST 5 /* assume unhighlight takes 5 chars */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7979
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7980 #define PLAN_LE 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7981 #define PLAN_CR 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7982 #define PLAN_NL 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7983 #define PLAN_WRITE 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7984 /* Can't use ScreenLines unless initialized */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7985 if (ScreenLines == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7986 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7987
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7988 if (col != screen_cur_col || row != screen_cur_row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7989 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7990 /* Check for valid position. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7991 if (row < 0) /* window without text lines? */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7992 row = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7993 if (row >= screen_Rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7994 row = screen_Rows - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7995 if (col >= screen_Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7996 col = screen_Columns - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7997
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7998 /* check if no cursor movement is allowed in highlight mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7999 if (screen_attr && *T_MS == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8000 noinvcurs = HIGHL_COST;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8001 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8002 noinvcurs = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8003 goto_cost = GOTO_COST + noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8004
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8005 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8006 * Plan how to do the positioning:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8007 * 1. Use CR to move it to column 0, same row.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8008 * 2. Use T_LE to move it a few columns to the left.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8009 * 3. Use NL to move a few lines down, column 0.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8010 * 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
8011 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8012 * Don't do this if the cursor went beyond the last column, the cursor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8013 * position is unknown then (some terminals wrap, some don't )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8014 *
1213
8906c10ecbb0 updated for version 7.1b
vimboss
parents: 1112
diff changeset
8015 * First check if the highlighting attributes allow us to write
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8016 * characters to move the cursor to the right.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8017 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8018 if (row >= screen_cur_row && screen_cur_col < Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8019 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8020 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8021 * If the cursor is in the same row, bigger col, we can use CR
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8022 * or T_LE.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8023 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8024 bs = NULL; /* init for GCC */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8025 attr = screen_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8026 if (row == screen_cur_row && col < screen_cur_col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8027 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8028 /* "le" is preferred over "bc", because "bc" is obsolete */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8029 if (*T_LE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8030 bs = T_LE; /* "cursor left" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8031 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8032 bs = T_BC; /* "backspace character (old) */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8033 if (*bs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8034 cost = (screen_cur_col - col) * (int)STRLEN(bs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8035 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8036 cost = 999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8037 if (col + 1 < cost) /* using CR is less characters */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8038 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8039 plan = PLAN_CR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8040 wouldbe_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8041 cost = 1; /* CR is just one character */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8042 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8043 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8044 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8045 plan = PLAN_LE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8046 wouldbe_col = col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8047 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8048 if (noinvcurs) /* will stop highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8049 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8050 cost += noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8051 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8052 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8053 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8054
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8055 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8056 * 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
8057 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8058 else if (row > screen_cur_row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8059 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8060 plan = PLAN_NL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8061 wouldbe_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8062 cost = (row - screen_cur_row) * 2; /* CR LF */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8063 if (noinvcurs) /* will stop highlighting */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8064 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8065 cost += noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8066 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8067 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8068 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8069
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8070 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8071 * If the cursor is in the same row, smaller col, just use write.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8072 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8073 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8074 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8075 plan = PLAN_WRITE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8076 wouldbe_col = screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8077 cost = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8078 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8079
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8080 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8081 * Check if any characters that need to be written have the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8082 * correct attributes. Also avoid UTF-8 characters.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8083 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8084 i = col - wouldbe_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8085 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8086 cost += i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8087 if (cost < goto_cost && i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8088 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8089 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8090 * Check if the attributes are correct without additionally
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8091 * stopping highlighting.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8092 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8093 p = ScreenAttrs + LineOffset[row] + wouldbe_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8094 while (i && *p++ == attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8095 --i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8096 if (i != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8097 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8098 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8099 * Try if it works when highlighting is stopped here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8100 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8101 if (*--p == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8102 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8103 cost += noinvcurs;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8104 while (i && *p++ == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8105 --i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8106 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8107 if (i != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8108 cost = 999; /* different attributes, don't do it */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8109 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8110 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8111 if (enc_utf8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8112 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8113 /* Don't use an UTF-8 char for positioning, it's slow. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8114 for (i = wouldbe_col; i < col; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8115 if (ScreenLinesUC[LineOffset[row] + i] != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8116 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8117 cost = 999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8118 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8119 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8120 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8121 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8122 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8123
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8124 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8125 * We can do it without term_windgoto()!
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8126 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8127 if (cost < goto_cost)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8128 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8129 if (plan == PLAN_LE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8130 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8131 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8132 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8133 while (screen_cur_col > col)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8134 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8135 out_str(bs);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8136 --screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8137 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8138 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8139 else if (plan == PLAN_CR)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8140 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8141 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8142 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8143 out_char('\r');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8144 screen_cur_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8145 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8146 else if (plan == PLAN_NL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8147 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8148 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8149 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8150 while (screen_cur_row < row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8151 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8152 out_char('\n');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8153 ++screen_cur_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8154 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8155 screen_cur_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8156 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8157
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8158 i = col - screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8159 if (i > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8160 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8161 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8162 * Use cursor-right if it's one character only. Avoids
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8163 * removing a line of pixels from the last bold char, when
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8164 * using the bold trick in the GUI.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8165 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8166 if (T_ND[0] != NUL && T_ND[1] == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8167 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8168 while (i-- > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8169 out_char(*T_ND);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8170 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8171 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8172 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8173 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8174
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8175 off = LineOffset[row] + screen_cur_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8176 while (i-- > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8177 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8178 if (ScreenAttrs[off] != screen_attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8179 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8180 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8181 out_flush_check();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8182 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8183 out_char(ScreenLines[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8184 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8185 if (enc_dbcs == DBCS_JPNU
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8186 && ScreenLines[off] == 0x8e)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8187 out_char(ScreenLines2[off]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8188 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8189 ++off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8190 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8191 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8192 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8193 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8194 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8195 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8196 cost = 999;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8197
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8198 if (cost >= goto_cost)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8199 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8200 if (noinvcurs)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8201 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8202 if (row == screen_cur_row && (col > screen_cur_col) &&
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8203 *T_CRI != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8204 term_cursor_right(col - screen_cur_col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8205 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8206 term_windgoto(row, col);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8207 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8208 screen_cur_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8209 screen_cur_col = col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8210 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8211 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8213 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8214 * Set cursor to its position in the current window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8215 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8216 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8217 setcursor()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8218 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8219 if (redrawing())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8220 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8221 validate_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8222 windgoto(W_WINROW(curwin) + curwin->w_wrow,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8223 W_WINCOL(curwin) + (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8224 #ifdef FEAT_RIGHTLEFT
1545
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8225 /* With 'rightleft' set and the cursor on a double-wide
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8226 * character, position it on the leftmost column. */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8227 curwin->w_p_rl ? ((int)W_WIDTH(curwin) - curwin->w_wcol - (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8228 # ifdef FEAT_MBYTE
1545
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8229 (has_mbyte
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8230 && (*mb_ptr2cells)(ml_get_cursor()) == 2
cbe70f2e756d updated for version 7.1-259
vimboss
parents: 1536
diff changeset
8231 && vim_isprintc(gchar_cursor())) ? 2 :
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8232 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8233 1)) :
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8234 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8235 curwin->w_wcol));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8236 }
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8240 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8241 * insert 'line_count' lines at 'row' in window 'wp'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8242 * if 'invalid' is TRUE the wp->w_lines[].wl_lnum is invalidated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8243 * if 'mayclear' is TRUE the screen will be cleared if it is faster than
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8244 * scrolling.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8245 * Returns FAIL if the lines are not inserted, OK for success.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8246 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8247 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8248 win_ins_lines(wp, row, line_count, invalid, mayclear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8249 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8250 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8251 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8252 int invalid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8253 int mayclear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8254 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8255 int did_delete;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8256 int nextrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8257 int lastrow;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8258 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8259
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8260 if (invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8261 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8262
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8263 if (wp->w_height < 5)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8264 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8265
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8266 if (line_count > wp->w_height - row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8267 line_count = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8268
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8269 retval = win_do_lines(wp, row, line_count, mayclear, FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8270 if (retval != MAYBE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8271 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8272
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8273 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8274 * 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
8275 * lines at the bottom to avoid messing what is after the window.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8276 * If this fails and there are following windows, don't do anything to avoid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8277 * messing up those windows, better just redraw.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8278 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8279 did_delete = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8280 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8281 if (wp->w_next != NULL || wp->w_status_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8282 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8283 if (screen_del_lines(0, W_WINROW(wp) + wp->w_height - line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8284 line_count, (int)Rows, FALSE, NULL) == OK)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8285 did_delete = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8286 else if (wp->w_next)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8287 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8288 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8289 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8290 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8291 * if no lines deleted, blank the lines that will end up below the window
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8292 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8293 if (!did_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8294 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8295 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8296 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8297 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8298 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8299 nextrow = W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8300 lastrow = nextrow + line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8301 if (lastrow > Rows)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8302 lastrow = Rows;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8303 screen_fill(nextrow - line_count, lastrow - line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8304 W_WINCOL(wp), (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8305 ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8306 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8307
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8308 if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8309 == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8310 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8311 /* deletion will have messed up other windows */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8312 if (did_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8313 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8314 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8315 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8316 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8317 win_rest_invalid(W_NEXT(wp));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8318 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8319 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8320 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8321
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8322 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8323 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8324
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8325 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8326 * delete "line_count" window lines at "row" in window "wp"
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8327 * If "invalid" is TRUE curwin->w_lines[] is invalidated.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8328 * If "mayclear" is TRUE the screen will be cleared if it is faster than
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8329 * scrolling
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8330 * Return OK for success, FAIL if the lines are not deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8331 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8332 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8333 win_del_lines(wp, row, line_count, invalid, mayclear)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8334 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8335 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8336 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8337 int invalid;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8338 int mayclear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8339 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8340 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8341
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8342 if (invalid)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8343 wp->w_lines_valid = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8344
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8345 if (line_count > wp->w_height - row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8346 line_count = wp->w_height - row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8347
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8348 retval = win_do_lines(wp, row, line_count, mayclear, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8349 if (retval != MAYBE)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8350 return retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8351
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8352 if (screen_del_lines(0, W_WINROW(wp) + row, line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8353 (int)Rows, FALSE, NULL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8354 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8355
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8356 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8357 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8358 * If there are windows or status lines below, try to put them at the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8359 * correct place. If we can't do that, they have to be redrawn.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8360 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8361 if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8362 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8363 if (screen_ins_lines(0, W_WINROW(wp) + wp->w_height - line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8364 line_count, (int)Rows, NULL) == FAIL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8365 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8366 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8367 win_rest_invalid(wp->w_next);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8368 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8369 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8370 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8371 * If this is the last window and there is no status line, redraw the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8372 * command line later.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8373 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8374 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8375 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8376 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8377 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8378 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8379
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8380 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8381 * Common code for win_ins_lines() and win_del_lines().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8382 * Returns OK or FAIL when the work has been done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8383 * Returns MAYBE when not finished yet.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8384 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8385 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8386 win_do_lines(wp, row, line_count, mayclear, del)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8387 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8388 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8389 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8390 int mayclear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8391 int del;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8392 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8393 int retval;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8394
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8395 if (!redrawing() || line_count <= 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8396 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8397
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8398 /* only a few lines left: redraw is faster */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8399 if (mayclear && Rows - line_count < 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8400 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8401 && wp->w_width == Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8402 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8403 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8404 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8405 screenclear(); /* will set wp->w_lines_valid to 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8406 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8407 }
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 * Delete all remaining lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8411 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8412 if (row + line_count >= wp->w_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8413 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8414 screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8415 W_WINCOL(wp), (int)W_ENDCOL(wp),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8416 ' ', ' ', 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8417 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8418 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8419
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8420 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8421 * when scrolling, the message on the command line should be cleared,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8422 * otherwise it will stay there forever.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8423 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8424 clear_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8425
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8426 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8427 * If the terminal can set a scroll region, use that.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8428 * Always do this in a vertically split window. This will redraw from
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8429 * ScreenLines[] when t_CV isn't defined. That's faster than using
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8430 * win_line().
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8431 * 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
8432 * a character in the lower right corner of the scroll region causes a
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8433 * scroll-up in the DJGPP version.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8434 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8435 if (scroll_region
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8436 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8437 || W_WIDTH(wp) != Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8438 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8439 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8440 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8441 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8442 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8443 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8444 scroll_region_set(wp, row);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8445 if (del)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8446 retval = screen_del_lines(W_WINROW(wp) + row, 0, line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8447 wp->w_height - row, FALSE, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8448 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8449 retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8450 wp->w_height - row, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8451 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8452 if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8453 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8454 scroll_region_reset();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8455 return retval;
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 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8459 if (wp->w_next != NULL && p_tf) /* don't delete/insert on fast terminal */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8460 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8461 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8462
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8463 return MAYBE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8464 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8465
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8466 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8467 * window 'wp' and everything after it is messed up, mark it for redraw
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8468 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8469 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8470 win_rest_invalid(wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8471 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8472 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8473 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8474 while (wp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8475 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8476 if (wp != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8477 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8478 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8479 redraw_win_later(wp, NOT_VALID);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8480 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8481 wp->w_redr_status = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8482 wp = wp->w_next;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8483 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8484 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8485 redraw_cmdline = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8486 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8487
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8488 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8489 * The rest of the routines in this file perform screen manipulations. The
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8490 * given operation is performed physically on the screen. The corresponding
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8491 * change is also made to the internal screen image. In this way, the editor
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8492 * anticipates the effect of editing changes on the appearance of the screen.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8493 * That way, when we call screenupdate a complete redraw isn't usually
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8494 * necessary. Another advantage is that we can keep adding code to anticipate
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8495 * screen changes, and in the meantime, everything still works.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8496 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8497
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8498 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8499 * types for inserting or deleting lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8500 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8501 #define USE_T_CAL 1
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8502 #define USE_T_CDL 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8503 #define USE_T_AL 3
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8504 #define USE_T_CE 4
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8505 #define USE_T_DL 5
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8506 #define USE_T_SR 6
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8507 #define USE_NL 7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8508 #define USE_T_CD 8
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8509 #define USE_REDRAW 9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8510
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8511 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8512 * insert lines on the screen and update ScreenLines[]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8513 * 'end' is the line after the scrolled part. Normally it is Rows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8514 * When scrolling region used 'off' is the offset from the top for the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8515 * 'row' and 'end' are relative to the start of the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8516 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8517 * return FAIL for failure, OK for success.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8518 */
446
7472c565592a updated for version 7.0117
vimboss
parents: 422
diff changeset
8519 int
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8520 screen_ins_lines(off, row, line_count, end, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8521 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8522 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8523 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8524 int end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8525 win_T *wp; /* NULL or window to use width from */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8526 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8527 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8528 int j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8529 unsigned temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8530 int cursor_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8531 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8532 int result_empty;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8533 int can_ce = can_clear(T_CE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8534
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8535 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8536 * FAIL if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8537 * - there is no valid screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8538 * - the screen has to be redrawn completely
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8539 * - the line count is less than one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8540 * - the line count is more than 'ttyscroll'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8541 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8542 if (!screen_valid(TRUE) || line_count <= 0 || line_count > p_ttyscroll)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8543 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8544
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8545 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8546 * There are seven ways to insert lines:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8547 * 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
8548 * characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8549 * 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
8550 * the insert is just empty lines
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8551 * 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
8552 * present or line_count > 1. It looks better if we do all the inserts
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8553 * at once.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8554 * 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
8555 * insert is just empty lines and T_CE is not present or line_count >
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8556 * 1.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8557 * 4. Use T_AL (insert line) if it exists.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8558 * 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
8559 * just empty lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8560 * 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
8561 * just empty lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8562 * 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
8563 * the 'da' flag is not set or we have clear line capability.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8564 * 8. redraw the characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8565 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8566 * Careful: In a hpterm scroll reverse doesn't work as expected, it moves
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8567 * the scrollbar for the window. It does have insert line, use that if it
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8568 * exists.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8569 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8570 result_empty = (row + line_count >= end);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8571 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8572 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8573 type = USE_REDRAW;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8574 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8575 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8576 if (can_clear(T_CD) && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8577 type = USE_T_CD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8578 else if (*T_CAL != NUL && (line_count > 1 || *T_AL == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8579 type = USE_T_CAL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8580 else if (*T_CDL != NUL && result_empty && (line_count > 1 || !can_ce))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8581 type = USE_T_CDL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8582 else if (*T_AL != NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8583 type = USE_T_AL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8584 else if (can_ce && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8585 type = USE_T_CE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8586 else if (*T_DL != NUL && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8587 type = USE_T_DL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8588 else if (*T_SR != NUL && row == 0 && (*T_DA == NUL || can_ce))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8589 type = USE_T_SR;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8590 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8591 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8592
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8593 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8594 * For clearing the lines screen_del_lines() is used. This will also take
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8595 * care of t_db if necessary.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8596 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8597 if (type == USE_T_CD || type == USE_T_CDL ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8598 type == USE_T_CE || type == USE_T_DL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8599 return screen_del_lines(off, row, line_count, end, FALSE, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8600
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8601 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8602 * If text is retained below the screen, first clear or delete as many
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8603 * 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
8604 * the deleted lines won't later surface during a screen_del_lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8605 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8606 if (*T_DB)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8607 screen_del_lines(off, end - line_count, line_count, end, FALSE, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8608
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8609 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8610 /* Remove a modeless selection when inserting lines halfway the screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8611 * or not the full width of the screen. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8612 if (off + row > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8613 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8614 || (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8615 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8616 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8617 clip_clear_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8618 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8619 clip_scroll_selection(-line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8620 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8621
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8622 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8623 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8624 * scrolling is actually carried out. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8625 gui_dont_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8626 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8627
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8628 if (*T_CCS != NUL) /* cursor relative to region */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8629 cursor_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8630 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8631 cursor_row = row + off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8632
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8633 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8634 * Shift LineOffset[] line_count down to reflect the inserted lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8635 * Clear the inserted lines in ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8636 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8637 row += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8638 end += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8639 for (i = 0; i < line_count; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8640 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8641 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8642 if (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8643 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8644 /* need to copy part of a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8645 j = end - 1 - i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8646 while ((j -= line_count) >= row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8647 linecopy(j + line_count, j, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8648 j += line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8649 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8650 lineclear(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8651 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8652 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8653 LineWraps[j] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8654 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8655 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8656 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8657 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8658 j = end - 1 - i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8659 temp = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8660 while ((j -= line_count) >= row)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8661 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8662 LineOffset[j + line_count] = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8663 LineWraps[j + line_count] = LineWraps[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8664 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8665 LineOffset[j + line_count] = temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8666 LineWraps[j + line_count] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8667 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8668 lineclear(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8669 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8670 lineinvalid(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8671 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8672 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8673
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8674 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8675 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8676
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8677 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8678 /* redraw the characters */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8679 if (type == USE_REDRAW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8680 redraw_block(row, end, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8681 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8682 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8683 if (type == USE_T_CAL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8684 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8685 term_append_lines(line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8686 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8687 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8688 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8689 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8690 for (i = 0; i < line_count; i++)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8691 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8692 if (type == USE_T_AL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8693 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8694 if (i && cursor_row != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8695 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8696 out_str(T_AL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8697 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8698 else /* type == USE_T_SR */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8699 out_str(T_SR);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8700 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8701 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8702 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8703
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8704 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8705 * With scroll-reverse and 'da' flag set we need to clear the lines that
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8706 * have been scrolled down into the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8707 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8708 if (type == USE_T_SR && *T_DA)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8709 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8710 for (i = 0; i < line_count; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8711 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8712 windgoto(off + i, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8713 out_str(T_CE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8714 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8715 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8716 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8717
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8718 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8719 gui_can_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8720 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8721 out_flush(); /* always flush after a scroll */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8722 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8723 return OK;
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 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8727 * delete lines on the screen and update ScreenLines[]
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8728 * 'end' is the line after the scrolled part. Normally it is Rows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8729 * When scrolling region used 'off' is the offset from the top for the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8730 * 'row' and 'end' are relative to the start of the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8731 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8732 * Return OK for success, FAIL if the lines are not deleted.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8733 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8734 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8735 screen_del_lines(off, row, line_count, end, force, wp)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8736 int off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8737 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8738 int line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8739 int end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8740 int force; /* even when line_count > p_ttyscroll */
1883
c8f343a465a2 updated for version 7.2-180
vimboss
parents: 1869
diff changeset
8741 win_T *wp UNUSED; /* NULL or window to use width from */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8742 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8743 int j;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8744 int i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8745 unsigned temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8746 int cursor_row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8747 int cursor_end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8748 int result_empty; /* result is empty until end of region */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8749 int can_delete; /* deleting line codes can be used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8750 int type;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8751
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8752 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8753 * FAIL if
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8754 * - there is no valid screen
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8755 * - the screen has to be redrawn completely
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8756 * - the line count is less than one
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8757 * - the line count is more than 'ttyscroll'
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8758 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8759 if (!screen_valid(TRUE) || line_count <= 0 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8760 (!force && line_count > p_ttyscroll))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8761 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8762
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8763 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8764 * Check if the rest of the current region will become empty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8765 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8766 result_empty = row + line_count >= end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8767
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8768 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8769 * We can delete lines only when 'db' flag not set or when 'ce' option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8770 * available.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8771 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8772 can_delete = (*T_DB == NUL || can_clear(T_CE));
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 * There are six ways to delete lines:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8776 * 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
8777 * characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8778 * 1. Use T_CD if it exists and the result is empty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8779 * 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
8780 * 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
8781 * none of the other ways work.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8782 * 4. Use T_CE (erase line) if the result is empty.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8783 * 5. Use T_DL (delete line) if it exists.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8784 * 6. redraw the characters from ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8785 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8786 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8787 if (wp != NULL && wp->w_width != Columns && *T_CSV == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8788 type = USE_REDRAW;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8789 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8790 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8791 if (can_clear(T_CD) && result_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8792 type = USE_T_CD;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8793 #if defined(__BEOS__) && defined(BEOS_DR8)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8794 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8795 * 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
8796 * its internal termcap... this works okay for tests which test *T_DB !=
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8797 * NUL. It has the disadvantage that the user cannot use any :set t_*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8798 * command to get T_DB (back) to empty_option, only :set term=... will do
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8799 * the trick...
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8800 * Anyway, this hack will hopefully go away with the next OS release.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8801 * (Olaf Seibert)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8802 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8803 else if (row == 0 && T_DB == empty_option
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8804 && (line_count == 1 || *T_CDL == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8805 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8806 else if (row == 0 && (
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8807 #ifndef AMIGA
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8808 /* On the Amiga, somehow '\n' on the last line doesn't always scroll
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8809 * up, so use delete-line command */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8810 line_count == 1 ||
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8811 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8812 *T_CDL == NUL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8813 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8814 type = USE_NL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8815 else if (*T_CDL != NUL && line_count > 1 && can_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8816 type = USE_T_CDL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8817 else if (can_clear(T_CE) && result_empty
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8818 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8819 && (wp == NULL || wp->w_width == Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8820 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8821 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8822 type = USE_T_CE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8823 else if (*T_DL != NUL && can_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8824 type = USE_T_DL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8825 else if (*T_CDL != NUL && can_delete)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8826 type = USE_T_CDL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8827 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8828 return FAIL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8829
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8830 #ifdef FEAT_CLIPBOARD
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8831 /* Remove a modeless selection when deleting lines halfway the screen or
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8832 * not the full width of the screen. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8833 if (off + row > 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8834 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8835 || (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8836 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8837 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8838 clip_clear_selection();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8839 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8840 clip_scroll_selection(line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8841 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8842
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8843 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8844 /* Don't update the GUI cursor here, ScreenLines[] is invalid until the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8845 * scrolling is actually carried out. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8846 gui_dont_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8847 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8848
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8849 if (*T_CCS != NUL) /* cursor relative to region */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8850 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8851 cursor_row = row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8852 cursor_end = end;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8853 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8854 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8855 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8856 cursor_row = row + off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8857 cursor_end = end + off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8858 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8859
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8860 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8861 * Now shift LineOffset[] line_count up to reflect the deleted lines.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8862 * Clear the inserted lines in ScreenLines[].
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8863 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8864 row += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8865 end += off;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8866 for (i = 0; i < line_count; ++i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8867 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8868 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8869 if (wp != NULL && wp->w_width != Columns)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8870 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8871 /* need to copy part of a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8872 j = row + i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8873 while ((j += line_count) <= end - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8874 linecopy(j - line_count, j, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8875 j -= line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8876 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8877 lineclear(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8878 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8879 lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8880 LineWraps[j] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8881 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8882 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8883 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8884 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8885 /* whole width, moving the line pointers is faster */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8886 j = row + i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8887 temp = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8888 while ((j += line_count) <= end - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8889 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8890 LineOffset[j - line_count] = LineOffset[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8891 LineWraps[j - line_count] = LineWraps[j];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8892 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8893 LineOffset[j - line_count] = temp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8894 LineWraps[j - line_count] = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8895 if (can_clear((char_u *)" "))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8896 lineclear(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8897 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8898 lineinvalid(temp, (int)Columns);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8899 }
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 screen_stop_highlight();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8903
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8904 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8905 /* redraw the characters */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8906 if (type == USE_REDRAW)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8907 redraw_block(row, end, wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8908 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8909 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8910 if (type == USE_T_CD) /* delete the lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8911 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8912 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8913 out_str(T_CD);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8914 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8915 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8916 else if (type == USE_T_CDL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8917 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8918 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8919 term_delete_lines(line_count);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8920 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8921 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8922 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8923 * Deleting lines at top of the screen or scroll region: Just scroll
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8924 * the whole screen (scroll region) up by outputting newlines on the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8925 * last line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8926 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8927 else if (type == USE_NL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8928 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8929 windgoto(cursor_end - 1, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8930 for (i = line_count; --i >= 0; )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8931 out_char('\n'); /* cursor will remain on same line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8932 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8933 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8934 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8935 for (i = line_count; --i >= 0; )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8936 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8937 if (type == USE_T_DL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8938 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8939 windgoto(cursor_row, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8940 out_str(T_DL); /* delete a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8941 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8942 else /* type == USE_T_CE */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8943 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8944 windgoto(cursor_row + i, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8945 out_str(T_CE); /* erase a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8946 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8947 screen_start(); /* don't know where cursor is now */
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
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8951 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8952 * 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
8953 * scrolled up at the bottom of the region.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8954 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8955 if (*T_DB && (type == USE_T_DL || type == USE_T_CDL))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8956 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8957 for (i = line_count; i > 0; --i)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8958 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8959 windgoto(cursor_end - i, 0);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8960 out_str(T_CE); /* erase a line */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8961 screen_start(); /* don't know where cursor is now */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8962 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8963 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8964
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8965 #ifdef FEAT_GUI
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8966 gui_can_update_cursor();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8967 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8968 out_flush(); /* always flush after a scroll */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8969 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8970
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8971 return OK;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8972 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8973
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8974 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8975 * show the current mode and ruler
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8976 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8977 * If clear_cmdline is TRUE, clear the rest of the cmdline.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8978 * 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
8979 * cleared only if a mode is shown.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8980 * Return the length of the message (0 if no message).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8981 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8982 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8983 showmode()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8984 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8985 int need_clear;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8986 int length = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8987 int do_mode;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8988 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8989 int nwr_save;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8990 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8991 int sub_attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8992 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8993
642
2392a6da4aa4 updated for version 7.0186
vimboss
parents: 639
diff changeset
8994 do_mode = ((p_smd && msg_silent == 0)
2392a6da4aa4 updated for version 7.0186
vimboss
parents: 639
diff changeset
8995 && ((State & INSERT)
2392a6da4aa4 updated for version 7.0186
vimboss
parents: 639
diff changeset
8996 || restart_edit
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8997 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8998 || VIsual_active
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8999 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9000 ));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9001 if (do_mode || Recording)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9002 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9003 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9004 * Don't show mode right now, when not redrawing or inside a mapping.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9005 * Call char_avail() only when we are going to show something, because
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9006 * it takes a bit of time.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9007 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9008 if (!redrawing() || (char_avail() && !KeyTyped) || msg_silent != 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9009 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9010 redraw_cmdline = TRUE; /* show mode later */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9011 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9012 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9013
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9014 nwr_save = need_wait_return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9015
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9016 /* wait a bit before overwriting an important message */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9017 check_for_delay(FALSE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9018
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9019 /* if the cmdline is more than one line high, erase top lines */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9020 need_clear = clear_cmdline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9021 if (clear_cmdline && cmdline_row < Rows - 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9022 msg_clr_cmdline(); /* will reset clear_cmdline */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9023
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9024 /* Position on the last line in the window, column 0 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9025 msg_pos_mode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9026 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9027 attr = hl_attr(HLF_CM); /* Highlight mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9028 if (do_mode)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9029 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9030 MSG_PUTS_ATTR("--", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9031 #if defined(FEAT_XIM)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9032 # if 0 /* old version, changed by SungHyun Nam July 2008 */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9033 if (xic != NULL && im_get_status() && !p_imdisable
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9034 && curbuf->b_p_iminsert == B_IMODE_IM)
1668
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9035 # else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9036 if (
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9037 # ifdef HAVE_GTK2
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9038 preedit_get_status()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9039 # else
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9040 im_get_status()
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9041 # endif
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9042 )
0b796e045c42 updated for version 7.2b-000
vimboss
parents: 1621
diff changeset
9043 # endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9044 # ifdef HAVE_GTK2 /* most of the time, it's not XIM being used */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9045 MSG_PUTS_ATTR(" IM", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9046 # else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9047 MSG_PUTS_ATTR(" XIM", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9048 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9049 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9050 #if defined(FEAT_HANGULIN) && defined(FEAT_GUI)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9051 if (gui.in_use)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9052 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9053 if (hangul_input_state_get())
236
4707450c2b33 updated for version 7.0066
vimboss
parents: 230
diff changeset
9054 MSG_PUTS_ATTR(" \307\321\261\333", attr); /* HANGUL */
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9055 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9056 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9057 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9058 if (edit_submode != NULL) /* CTRL-X in Insert mode */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9059 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9060 /* These messages can get long, avoid a wrap in a narrow
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9061 * window. Prefer showing edit_submode_extra. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9062 length = (Rows - msg_row) * Columns - 3;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9063 if (edit_submode_extra != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9064 length -= vim_strsize(edit_submode_extra);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9065 if (length > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9066 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9067 if (edit_submode_pre != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9068 length -= vim_strsize(edit_submode_pre);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9069 if (length - vim_strsize(edit_submode) > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9070 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9071 if (edit_submode_pre != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9072 msg_puts_attr(edit_submode_pre, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9073 msg_puts_attr(edit_submode, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9074 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9075 if (edit_submode_extra != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9076 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9077 MSG_PUTS_ATTR(" ", attr); /* add a space in between */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9078 if ((int)edit_submode_highl < (int)HLF_COUNT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9079 sub_attr = hl_attr(edit_submode_highl);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9080 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9081 sub_attr = attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9082 msg_puts_attr(edit_submode_extra, sub_attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9083 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9084 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9085 length = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9086 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9087 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9088 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9089 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9090 #ifdef FEAT_VREPLACE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9091 if (State & VREPLACE_FLAG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9092 MSG_PUTS_ATTR(_(" VREPLACE"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9093 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9094 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9095 if (State & REPLACE_FLAG)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9096 MSG_PUTS_ATTR(_(" REPLACE"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9097 else if (State & INSERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9098 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9099 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9100 if (p_ri)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9101 MSG_PUTS_ATTR(_(" REVERSE"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9102 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9103 MSG_PUTS_ATTR(_(" INSERT"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9104 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9105 else if (restart_edit == 'I')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9106 MSG_PUTS_ATTR(_(" (insert)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9107 else if (restart_edit == 'R')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9108 MSG_PUTS_ATTR(_(" (replace)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9109 else if (restart_edit == 'V')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9110 MSG_PUTS_ATTR(_(" (vreplace)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9111 #ifdef FEAT_RIGHTLEFT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9112 if (p_hkmap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9113 MSG_PUTS_ATTR(_(" Hebrew"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9114 # ifdef FEAT_FKMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9115 if (p_fkmap)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9116 MSG_PUTS_ATTR(farsi_text_5, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9117 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9118 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9119 #ifdef FEAT_KEYMAP
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9120 if (State & LANGMAP)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9121 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9122 # ifdef FEAT_ARABIC
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9123 if (curwin->w_p_arab)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9124 MSG_PUTS_ATTR(_(" Arabic"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9125 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9126 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9127 MSG_PUTS_ATTR(_(" (lang)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9128 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9129 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9130 if ((State & INSERT) && p_paste)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9131 MSG_PUTS_ATTR(_(" (paste)"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9132
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9133 #ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9134 if (VIsual_active)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9135 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9136 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9137
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9138 /* Don't concatenate separate words to avoid translation
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9139 * problems. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9140 switch ((VIsual_select ? 4 : 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9141 + (VIsual_mode == Ctrl_V) * 2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9142 + (VIsual_mode == 'V'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9143 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9144 case 0: p = N_(" VISUAL"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9145 case 1: p = N_(" VISUAL LINE"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9146 case 2: p = N_(" VISUAL BLOCK"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9147 case 4: p = N_(" SELECT"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9148 case 5: p = N_(" SELECT LINE"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9149 default: p = N_(" SELECT BLOCK"); break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9150 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9151 MSG_PUTS_ATTR(_(p), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9152 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9153 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9154 MSG_PUTS_ATTR(" --", attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9155 }
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9156
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9157 need_clear = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9158 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9159 if (Recording
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9160 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9161 && edit_submode == NULL /* otherwise it gets too long */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9162 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9163 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9164 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9165 MSG_PUTS_ATTR(_("recording"), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9166 need_clear = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9167 }
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9168
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9169 mode_displayed = TRUE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9170 if (need_clear || clear_cmdline)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9171 msg_clr_eos();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9172 msg_didout = FALSE; /* overwrite this message */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9173 length = msg_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9174 msg_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9175 need_wait_return = nwr_save; /* never ask for hit-return for this */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9176 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9177 else if (clear_cmdline && msg_silent == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9178 /* Clear the whole command line. Will reset "clear_cmdline". */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9179 msg_clr_cmdline();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9180
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9181 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9182 # ifdef FEAT_VISUAL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9183 /* In Visual mode the size of the selected area must be redrawn. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9184 if (VIsual_active)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9185 clear_showcmd();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9186 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9187
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9188 /* If the last window has no status line, the ruler is after the mode
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9189 * message and must be redrawn */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9190 if (redrawing()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9191 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9192 && lastwin->w_status_height == 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9193 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9194 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9195 win_redr_ruler(lastwin, TRUE);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9196 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9197 redraw_cmdline = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9198 clear_cmdline = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9199
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9200 return length;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9201 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9202
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9203 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9204 * Position for a mode message.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9205 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9206 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9207 msg_pos_mode()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9208 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9209 msg_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9210 msg_row = Rows - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9211 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9212
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9213 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9214 * Delete mode message. Used when ESC is typed which is expected to end
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9215 * Insert mode (but Insert mode didn't end yet!).
644
e4fa26ce8769 updated for version 7.0187
vimboss
parents: 642
diff changeset
9216 * Caller should check "mode_displayed".
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9217 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9218 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9219 unshowmode(force)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9220 int force;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9221 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9222 /*
2055
4aa4510d548c updated for version 7.2.341
Bram Moolenaar <bram@zimbu.org>
parents: 2008
diff changeset
9223 * Don't delete it right now, when not redrawing or inside a mapping.
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9224 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9225 if (!redrawing() || (!force && char_avail() && !KeyTyped))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9226 redraw_cmdline = TRUE; /* delete mode later */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9227 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9228 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9229 msg_pos_mode();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9230 if (Recording)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9231 MSG_PUTS_ATTR(_("recording"), hl_attr(HLF_CM));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9232 msg_clr_eos();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9233 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9234 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9235
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9236 #if defined(FEAT_WINDOWS)
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9237 /*
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9238 * Draw the tab pages line at the top of the Vim window.
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9239 */
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9240 static void
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9241 draw_tabline()
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9242 {
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9243 int tabcount = 0;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9244 tabpage_T *tp;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9245 int tabwidth;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9246 int col = 0;
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9247 int scol = 0;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9248 int attr;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9249 win_T *wp;
671
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
9250 win_T *cwp;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
9251 int wincount;
83a006f81bac updated for version 7.0199
vimboss
parents: 670
diff changeset
9252 int modified;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9253 int c;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9254 int len;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9255 int attr_sel = hl_attr(HLF_TPS);
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9256 int attr_nosel = hl_attr(HLF_TP);
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9257 int attr_fill = hl_attr(HLF_TPF);
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9258 char_u *p;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9259 int room;
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9260 int use_sep_chars = (t_colors < 8
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9261 #ifdef FEAT_GUI
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9262 && !gui.in_use
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9263 #endif
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9264 );
673
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9265
513866ffe6af updated for version 7.0200
vimboss
parents: 671
diff changeset
9266 redraw_tabline = FALSE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9267
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9268 #ifdef FEAT_GUI_TABLINE
798
95dac6af3b3a updated for version 7.0232
vimboss
parents: 777
diff changeset
9269 /* Take care of a GUI tabline. */
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9270 if (gui_use_tabline())
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9271 {
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9272 gui_update_tabline();
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9273 return;
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9274 }
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9275 #endif
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9276
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9277 if (tabline_height() < 1)
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9278 return;
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9279
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9280 #if defined(FEAT_STL_OPT)
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9281
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9282 /* Init TabPageIdxs[] to zero: Clicking outside of tabs has no effect. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9283 for (scol = 0; scol < Columns; ++scol)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9284 TabPageIdxs[scol] = 0;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9285
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9286 /* Use the 'tabline' option if it's set. */
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9287 if (*p_tal != NUL)
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9288 {
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9289 int save_called_emsg = called_emsg;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9290
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9291 /* 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
9292 * screen. Avoid that by making 'tabline' empty. */
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9293 called_emsg = FALSE;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9294 win_redr_custom(NULL, FALSE);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9295 if (called_emsg)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9296 set_string_option_direct((char_u *)"tabline", -1,
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 688
diff changeset
9297 (char_u *)"", OPT_FREE, SID_ERROR);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9298 called_emsg |= save_called_emsg;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9299 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9300 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9301 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9302 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9303 for (tp = first_tabpage; tp != NULL; tp = tp->tp_next)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9304 ++tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9305
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9306 tabwidth = (Columns - 1 + tabcount / 2) / tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9307 if (tabwidth < 6)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9308 tabwidth = 6;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9309
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9310 attr = attr_nosel;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9311 tabcount = 0;
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9312 scol = 0;
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9313 for (tp = first_tabpage; tp != NULL && col < Columns - 4;
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9314 tp = tp->tp_next)
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9315 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9316 scol = col;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9317
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9318 if (tp->tp_topframe == topframe)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9319 attr = attr_sel;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9320 if (use_sep_chars && col > 0)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9321 screen_putchar('|', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9322
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9323 if (tp->tp_topframe != topframe)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9324 attr = attr_nosel;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9325
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9326 screen_putchar(' ', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9327
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9328 if (tp == curtab)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9329 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9330 cwp = curwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9331 wp = firstwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9332 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9333 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9334 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9335 cwp = tp->tp_curwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9336 wp = tp->tp_firstwin;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9337 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9338
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9339 modified = FALSE;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9340 for (wincount = 0; wp != NULL; wp = wp->w_next, ++wincount)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9341 if (bufIsChanged(wp->w_buffer))
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9342 modified = TRUE;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9343 if (modified || wincount > 1)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9344 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9345 if (wincount > 1)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9346 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9347 vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
9348 len = (int)STRLEN(NameBuff);
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9349 if (col + len >= Columns - 3)
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9350 break;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9351 screen_puts_len(NameBuff, len, 0, col,
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9352 #if defined(FEAT_SYN_HL)
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9353 hl_combine_attr(attr, hl_attr(HLF_T))
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9354 #else
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9355 attr
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9356 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9357 );
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9358 col += len;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9359 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9360 if (modified)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9361 screen_puts_len((char_u *)"+", 1, 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9362 screen_putchar(' ', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9363 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9364
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9365 room = scol - col + tabwidth - 1;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9366 if (room > 0)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9367 {
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9368 /* Get buffer name in NameBuff[] */
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9369 get_trans_bufname(cwp->w_buffer);
819
23f82b5d2814 updated for version 7.0c10
vimboss
parents: 818
diff changeset
9370 shorten_dir(NameBuff);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9371 len = vim_strsize(NameBuff);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9372 p = NameBuff;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9373 #ifdef FEAT_MBYTE
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9374 if (has_mbyte)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9375 while (len > room)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9376 {
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9377 len -= ptr2cells(p);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9378 mb_ptr_adv(p);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9379 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9380 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9381 #endif
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9382 if (len > room)
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9383 {
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9384 p += len - room;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9385 len = room;
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9386 }
699
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9387 if (len > Columns - col - 1)
2af8de31a3a8 updated for version 7.0211
vimboss
parents: 694
diff changeset
9388 len = Columns - col - 1;
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9389
835
8bebcabccc2c updated for version 7.0e01
vimboss
parents: 834
diff changeset
9390 screen_puts_len(p, (int)STRLEN(p), 0, col, attr);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9391 col += len;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9392 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9393 screen_putchar(' ', 0, col++, attr);
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9394
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9395 /* Store the tab page number in TabPageIdxs[], so that
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9396 * jump_to_mouse() knows where each one is. */
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9397 ++tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9398 while (scol < col)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9399 TabPageIdxs[scol++] = tabcount;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9400 }
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9401
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9402 if (use_sep_chars)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9403 c = '_';
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9404 else
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9405 c = ' ';
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9406 screen_fill(0, 1, col, (int)Columns, c, c, attr_fill);
681
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9407
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9408 /* Put an "X" for closing the current tab if there are several. */
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9409 if (first_tabpage->tp_next != NULL)
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9410 {
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9411 screen_putchar('X', 0, (int)Columns - 1, attr_nosel);
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9412 TabPageIdxs[Columns - 1] = -999;
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9413 }
9364d114ed8d updated for version 7.0204
vimboss
parents: 680
diff changeset
9414 }
834
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9415
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9416 /* Reset the flag here again, in case evaluating 'tabline' causes it to be
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9417 * set. */
5117153003bd updated for version 7.0e
vimboss
parents: 826
diff changeset
9418 redraw_tabline = FALSE;
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9419 }
685
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9420
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9421 /*
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9422 * Get buffer name for "buf" into NameBuff[].
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9423 * Takes care of special buffer names and translates special characters.
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9424 */
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9425 void
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9426 get_trans_bufname(buf)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9427 buf_T *buf;
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9428 {
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9429 if (buf_spname(buf) != NULL)
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9430 STRCPY(NameBuff, buf_spname(buf));
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9431 else
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9432 home_replace(buf, buf->b_fname, NameBuff, MAXPATHL, TRUE);
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9433 trans_characters(NameBuff, MAXPATHL);
d7e33248b9c8 updated for version 7.0206
vimboss
parents: 681
diff changeset
9434 }
667
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9435 #endif
9090f866cd57 updated for version 7.0197
vimboss
parents: 644
diff changeset
9436
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9437 #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9438 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9439 * Get the character to use in a status line. Get its attributes in "*attr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9440 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9441 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9442 fillchar_status(attr, is_curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9443 int *attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9444 int is_curwin;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9445 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9446 int fill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9447 if (is_curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9448 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9449 *attr = hl_attr(HLF_S);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9450 fill = fill_stl;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9451 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9452 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9453 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9454 *attr = hl_attr(HLF_SNC);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9455 fill = fill_stlnc;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9456 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9457 /* Use fill when there is highlighting, and highlighting of current
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9458 * window differs, or the fillchars differ, or this is not the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9459 * current window */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9460 if (*attr != 0 && ((hl_attr(HLF_S) != hl_attr(HLF_SNC)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9461 || !is_curwin || firstwin == lastwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9462 || (fill_stl != fill_stlnc)))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9463 return fill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9464 if (is_curwin)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9465 return '^';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9466 return '=';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9467 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9468 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9469
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9470 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9471 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9472 * Get the character to use in a separator between vertically split windows.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9473 * Get its attributes in "*attr".
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9474 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9475 static int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9476 fillchar_vsep(attr)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9477 int *attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9478 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9479 *attr = hl_attr(HLF_C);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9480 if (*attr == 0 && fill_vert == ' ')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9481 return '|';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9482 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9483 return fill_vert;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9484 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9485 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9486
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9487 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9488 * Return TRUE if redrawing should currently be done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9489 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9490 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9491 redrawing()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9492 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9493 return (!RedrawingDisabled
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9494 && !(p_lz && char_avail() && !KeyTyped && !do_redraw));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9495 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9496
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9497 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9498 * Return TRUE if printing messages should currently be done.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9499 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9500 int
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9501 messaging()
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9502 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9503 return (!(p_lz && char_avail() && !KeyTyped));
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9504 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9505
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9506 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9507 * Show current status info in ruler and various other places
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9508 * If always is FALSE, only show ruler if position has changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9509 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9510 void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9511 showruler(always)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9512 int always;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9513 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9514 if (!always && !redrawing())
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9515 return;
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9516 #ifdef FEAT_INS_EXPAND
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9517 if (pum_visible())
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9518 {
639
c79d4df4686e updated for version 7.0185
vimboss
parents: 625
diff changeset
9519 # ifdef FEAT_WINDOWS
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9520 /* Don't redraw right now, do it later. */
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9521 curwin->w_redr_status = TRUE;
639
c79d4df4686e updated for version 7.0185
vimboss
parents: 625
diff changeset
9522 # endif
574
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9523 return;
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9524 }
25a70b1cd2da updated for version 7.0163
vimboss
parents: 571
diff changeset
9525 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9526 #if defined(FEAT_STL_OPT) && defined(FEAT_WINDOWS)
40
f1d2a58883b9 updated for version 7.0024
vimboss
parents: 39
diff changeset
9527 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
9528 {
1983
f54dab7cebab updated for version 7.2-280
vimboss
parents: 1946
diff changeset
9529 redraw_custom_statusline(curwin);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9530 }
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9531 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9532 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9533 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9534 win_redr_ruler(curwin, always);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9535 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9536
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9537 #ifdef FEAT_TITLE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9538 if (need_maketitle
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9539 # ifdef FEAT_STL_OPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9540 || (p_icon && (stl_syntax & STL_IN_ICON))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9541 || (p_title && (stl_syntax & STL_IN_TITLE))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9542 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9543 )
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9544 maketitle();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9545 #endif
1588
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9546 #ifdef FEAT_WINDOWS
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9547 /* Redraw the tab pages line if needed. */
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9548 if (redraw_tabline)
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9549 draw_tabline();
3b48421dbde1 updated for version 7.1-301
vimboss
parents: 1555
diff changeset
9550 #endif
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9551 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9552
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9553 #ifdef FEAT_CMDL_INFO
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9554 static void
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9555 win_redr_ruler(wp, always)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9556 win_T *wp;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9557 int always;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9558 {
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9559 #define RULER_BUF_LEN 70
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9560 char_u buffer[RULER_BUF_LEN];
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9561 int row;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9562 int fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9563 int attr;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9564 int empty_line = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9565 colnr_T virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9566 int i;
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9567 size_t len;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9568 int o;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9569 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9570 int this_ru_col;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9571 int off = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9572 int width = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9573 # define WITH_OFF(x) x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9574 # define WITH_WIDTH(x) x
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9575 #else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9576 # define WITH_OFF(x) 0
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9577 # define WITH_WIDTH(x) Columns
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9578 # define this_ru_col ru_col
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9579 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9580
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9581 /* If 'ruler' off or redrawing disabled, don't do anything */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9582 if (!p_ru)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9583 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9584
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9585 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9586 * Check if cursor.lnum is valid, since win_redr_ruler() may be called
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9587 * after deleting lines, before cursor.lnum is corrected.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9588 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9589 if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9590 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9591
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9592 #ifdef FEAT_INS_EXPAND
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9593 /* Don't draw the ruler while doing insert-completion, it might overwrite
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9594 * the (long) mode message. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9595 # ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9596 if (wp == lastwin && lastwin->w_status_height == 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9597 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9598 if (edit_submode != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9599 return;
540
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
9600 /* 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
9601 if (pum_visible())
2df7f3a5eb96 updated for version 7.0153
vimboss
parents: 534
diff changeset
9602 return;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9603 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9604
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9605 #ifdef FEAT_STL_OPT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9606 if (*p_ruf)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9607 {
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9608 int save_called_emsg = called_emsg;
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9609
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9610 called_emsg = FALSE;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9611 win_redr_custom(wp, TRUE);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9612 if (called_emsg)
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9613 set_string_option_direct((char_u *)"rulerformat", -1,
694
07d199fe02ed updated for version 7.0209
vimboss
parents: 688
diff changeset
9614 (char_u *)"", OPT_FREE, SID_ERROR);
680
5b101ff9d4c4 updated for version 7.0203
vimboss
parents: 677
diff changeset
9615 called_emsg |= save_called_emsg;
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9616 return;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9617 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9618 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9619
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9620 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9621 * 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
9622 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9623 if (!(State & INSERT)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9624 && *ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE) == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9625 empty_line = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9626
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9627 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9628 * Only draw the ruler when something changed.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9629 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9630 validate_virtcol_win(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9631 if ( redraw_cmdline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9632 || always
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9633 || wp->w_cursor.lnum != wp->w_ru_cursor.lnum
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9634 || wp->w_cursor.col != wp->w_ru_cursor.col
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9635 || wp->w_virtcol != wp->w_ru_virtcol
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9636 #ifdef FEAT_VIRTUALEDIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9637 || wp->w_cursor.coladd != wp->w_ru_cursor.coladd
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9638 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9639 || wp->w_topline != wp->w_ru_topline
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9640 || wp->w_buffer->b_ml.ml_line_count != wp->w_ru_line_count
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9641 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9642 || wp->w_topfill != wp->w_ru_topfill
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9643 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9644 || empty_line != wp->w_ru_empty)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9645 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9646 cursor_off();
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9647 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9648 if (wp->w_status_height)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9649 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9650 row = W_WINROW(wp) + wp->w_height;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9651 fillchar = fillchar_status(&attr, wp == curwin);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9652 # ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9653 off = W_WINCOL(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9654 width = W_WIDTH(wp);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9655 # endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9656 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9657 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9658 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9659 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9660 row = Rows - 1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9661 fillchar = ' ';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9662 attr = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9663 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9664 width = Columns;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9665 off = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9666 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9667 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9668
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9669 /* In list mode virtcol needs to be recomputed */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9670 virtcol = wp->w_virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9671 if (wp->w_p_list && lcs_tab1 == NUL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9672 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9673 wp->w_p_list = FALSE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9674 getvvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9675 wp->w_p_list = TRUE;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9676 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9677
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9678 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9679 * Some sprintfs return the length, some return a pointer.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9680 * To avoid portability problems we use strlen() here.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9681 */
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9682 vim_snprintf((char *)buffer, RULER_BUF_LEN, "%ld,",
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9683 (wp->w_buffer->b_ml.ml_flags & ML_EMPTY)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9684 ? 0L
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9685 : (long)(wp->w_cursor.lnum));
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9686 len = STRLEN(buffer);
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9687 col_print(buffer + len, RULER_BUF_LEN - len,
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9688 empty_line ? 0 : (int)wp->w_cursor.col + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9689 (int)virtcol + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9690
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9691 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9692 * Add a "50%" if there is room for it.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9693 * On the last line, don't print in the last column (scrolls the
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9694 * screen up on some terminals).
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9695 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9696 i = (int)STRLEN(buffer);
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9697 get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9698 o = i + vim_strsize(buffer + i + 1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9699 #ifdef FEAT_WINDOWS
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9700 if (wp->w_status_height == 0) /* can't use last char of screen */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9701 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9702 ++o;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9703 #ifdef FEAT_VERTSPLIT
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9704 this_ru_col = ru_col - (Columns - width);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9705 if (this_ru_col < 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9706 this_ru_col = 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9707 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9708 /* Never use more than half the window/screen width, leave the other
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9709 * half for the filename. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9710 if (this_ru_col < (WITH_WIDTH(width) + 1) / 2)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9711 this_ru_col = (WITH_WIDTH(width) + 1) / 2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9712 if (this_ru_col + o < WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9713 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9714 while (this_ru_col + o < WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9715 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9716 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9717 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9718 i += (*mb_char2bytes)(fillchar, buffer + i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9719 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9720 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9721 buffer[i++] = fillchar;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9722 ++o;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9723 }
1869
720a59d79bcd updated for version 7.2-168
vimboss
parents: 1850
diff changeset
9724 get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9725 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9726 /* Truncate at window boundary. */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9727 #ifdef FEAT_MBYTE
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9728 if (has_mbyte)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9729 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9730 o = 0;
474
a5fcf36ef512 updated for version 7.0127
vimboss
parents: 446
diff changeset
9731 for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i))
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9732 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9733 o += (*mb_ptr2cells)(buffer + i);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9734 if (this_ru_col + o > WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9735 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9736 buffer[i] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9737 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9738 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9739 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9740 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9741 else
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9742 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9743 if (this_ru_col + (int)STRLEN(buffer) > WITH_WIDTH(width))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9744 buffer[WITH_WIDTH(width) - this_ru_col] = NUL;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9745
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9746 screen_puts(buffer, row, this_ru_col + WITH_OFF(off), attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9747 i = redraw_cmdline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9748 screen_fill(row, row + 1,
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9749 this_ru_col + WITH_OFF(off) + (int)STRLEN(buffer),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9750 (int)(WITH_OFF(off) + WITH_WIDTH(width)),
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9751 fillchar, fillchar, attr);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9752 /* don't redraw the cmdline because of showing the ruler */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9753 redraw_cmdline = i;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9754 wp->w_ru_cursor = wp->w_cursor;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9755 wp->w_ru_virtcol = wp->w_virtcol;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9756 wp->w_ru_empty = empty_line;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9757 wp->w_ru_topline = wp->w_topline;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9758 wp->w_ru_line_count = wp->w_buffer->b_ml.ml_line_count;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9759 #ifdef FEAT_DIFF
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9760 wp->w_ru_topfill = wp->w_topfill;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9761 #endif
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9762 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9763 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9764 #endif
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9765
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9766 #if defined(FEAT_LINEBREAK) || defined(PROTO)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9767 /*
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9768 * Return the width of the 'number' column.
677
e649c78407e6 updated for version 7.0202
vimboss
parents: 674
diff changeset
9769 * Caller may need to check if 'number' is set.
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9770 * Otherwise it depends on 'numberwidth' and the line count.
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9771 */
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9772 int
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9773 number_width(wp)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9774 win_T *wp;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9775 {
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9776 int n;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9777 linenr_T lnum;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9778
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9779 lnum = wp->w_buffer->b_ml.ml_line_count;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9780 if (lnum == wp->w_nrwidth_line_count)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9781 return wp->w_nrwidth_width;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9782 wp->w_nrwidth_line_count = lnum;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9783
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9784 n = 0;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9785 do
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9786 {
856
8cd729851562 updated for version 7.0g
vimboss
parents: 849
diff changeset
9787 lnum /= 10;
8cd729851562 updated for version 7.0g
vimboss
parents: 849
diff changeset
9788 ++n;
13
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9789 } while (lnum > 0);
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9790
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9791 /* 'numberwidth' gives the minimal width plus one */
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9792 if (n < wp->w_p_nuw - 1)
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9793 n = wp->w_p_nuw - 1;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9794
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9795 wp->w_nrwidth_width = n;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9796 return n;
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9797 }
24d5189d3956 updated for version 7.0005
vimboss
parents: 12
diff changeset
9798 #endif