annotate src/drawscreen.c @ 29234:96ff6c230a66 v8.2.5136

patch 8.2.5136: debugger test fails when run with valgrind Commit: https://github.com/vim/vim/commit/e366ed4f2c6fa8cb663f1b9599b39d57ddbd8a2a Author: Bram Moolenaar <Bram@vim.org> Date: Sun Jun 19 20:13:56 2022 +0100 patch 8.2.5136: debugger test fails when run with valgrind Problem: Debugger test fails when run with valgrind. Solution: Wait longer when using valgrind.
author Bram Moolenaar <Bram@vim.org>
date Sun, 19 Jun 2022 21:15:03 +0200
parents 48b36959a4fc
children 9dce192d1ac2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1 /* vi:set ts=8 sts=4 sw=4 noet:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3 * VIM - Vi IMproved by Bram Moolenaar
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
4 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
5 * Do ":help uganda" in Vim to read copying and usage conditions.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
6 * Do ":help credits" in Vim to see a list of people who contributed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
7 * See README.txt for an overview of the Vim source code.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
8 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
9
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
10 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
11 * drawscreen.c: Code for updating all the windows on the screen.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
12 * This is the top level, drawline.c is the middle and screen.c the lower
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
13 * level.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
14 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
15 * update_screen() is the function that updates all windows and status lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
16 * It is called form the main loop when must_redraw is non-zero. It may be
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
17 * called from other places when an immediate screen update is needed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
18 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
19 * The part of the buffer that is displayed in a window is set with:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
20 * - w_topline (first buffer line in window)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
21 * - w_topfill (filler lines above the first line)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
22 * - w_leftcol (leftmost window cell in window),
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
23 * - w_skipcol (skipped window cells of first line)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
24 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
25 * Commands that only move the cursor around in a window, do not need to take
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
26 * action to update the display. The main loop will check if w_topline is
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
27 * valid and update it (scroll the window) when needed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
28 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
29 * Commands that scroll a window change w_topline and must call
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
30 * check_cursor() to move the cursor into the visible part of the window, and
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
31 * call redraw_later(VALID) to have the window displayed by update_screen()
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
32 * later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
33 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
34 * Commands that change text in the buffer must call changed_bytes() or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
35 * changed_lines() to mark the area that changed and will require updating
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
36 * later. The main loop will call update_screen(), which will update each
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
37 * window that shows the changed buffer. This assumes text above the change
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
38 * can remain displayed as it is. Text after the change may need updating for
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
39 * scrolling, folding and syntax highlighting.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
40 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
41 * Commands that change how a window is displayed (e.g., setting 'list') or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
42 * invalidate the contents of a window in another way (e.g., change fold
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
43 * settings), must call redraw_later(NOT_VALID) to have the whole window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
44 * redisplayed by update_screen() later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
45 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
46 * Commands that change how a buffer is displayed (e.g., setting 'tabstop')
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
47 * must call redraw_curbuf_later(NOT_VALID) to have all the windows for the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
48 * buffer redisplayed by update_screen() later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
49 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
50 * Commands that change highlighting and possibly cause a scroll too must call
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
51 * redraw_later(SOME_VALID) to update the whole window but still use scrolling
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
52 * to avoid redrawing everything. But the length of displayed lines must not
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
53 * change, use NOT_VALID then.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
54 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
55 * Commands that move the window position must call redraw_later(NOT_VALID).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
56 * TODO: should minimize redrawing by scrolling when possible.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
57 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
58 * Commands that change everything (e.g., resizing the screen) must call
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
59 * redraw_all_later(NOT_VALID) or redraw_all_later(CLEAR).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
60 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
61 * Things that are handled indirectly:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
62 * - When messages scroll the screen up, msg_scrolled will be set and
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
63 * update_screen() called to redraw.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
64 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
65
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
66 #include "vim.h"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
67
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
68 static void win_update(win_T *wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
69 #ifdef FEAT_STL_OPT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
70 static void redraw_custom_statusline(win_T *wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
71 #endif
19542
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
72 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
73 static int did_update_one_window;
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
74 #endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
75
19916
dcec86d796bc patch 8.2.0514: several global functions are used in only one file
Bram Moolenaar <Bram@vim.org>
parents: 19542
diff changeset
76 static void win_redr_status(win_T *wp, int ignore_pum);
dcec86d796bc patch 8.2.0514: several global functions are used in only one file
Bram Moolenaar <Bram@vim.org>
parents: 19542
diff changeset
77
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
78 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
79 * Based on the current value of curwin->w_topline, transfer a screenfull
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
80 * of stuff from Filemem to ScreenLines[], and update curwin->w_botline.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
81 * Return OK when the screen was updated, FAIL if it was not done.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
82 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
83 int
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
84 update_screen(int type_arg)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
85 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
86 int type = type_arg;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
87 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
88 static int did_intro = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
89 #ifdef FEAT_GUI
19542
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
90 int did_one = FALSE;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
91 int did_undraw = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
92 int gui_cursor_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
93 int gui_cursor_row = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
94 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
95 int no_update = FALSE;
24527
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
96 int save_pum_will_redraw = pum_will_redraw;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
97
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
98 // Don't do anything if the screen structures are (not yet) valid.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
99 if (!screen_valid(TRUE))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
100 return FAIL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
101
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
102 if (type == VALID_NO_UPDATE)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
103 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
104 no_update = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
105 type = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
106 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
107
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
108 #ifdef FEAT_EVAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
109 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
110 buf_T *buf;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
111
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
112 // Before updating the screen, notify any listeners of changed text.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
113 FOR_ALL_BUFFERS(buf)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
114 invoke_listeners(buf);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
115 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
116 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
117
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
118 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
119 // May have postponed updating diffs.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
120 if (need_diff_redraw)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
121 diff_redraw(TRUE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
122 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
123
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
124 if (must_redraw)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
125 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
126 if (type < must_redraw) // use maximal type
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
127 type = must_redraw;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
128
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
129 // must_redraw is reset here, so that when we run into some weird
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
130 // reason to redraw while busy redrawing (e.g., asynchronous
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
131 // scrolling), or update_topline() in win_update() will cause a
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
132 // scroll, the screen will be redrawn later or in win_update().
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
133 must_redraw = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
134 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
135
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
136 // May need to update w_lines[].
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
137 if (curwin->w_lines_valid == 0 && type < NOT_VALID
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
138 #ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
139 && !term_do_update_window(curwin)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
140 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
141 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
142 type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
143
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
144 // Postpone the redrawing when it's not needed and when being called
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
145 // recursively.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
146 if (!redrawing() || updating_screen)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
147 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
148 redraw_later(type); // remember type for next time
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
149 must_redraw = type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
150 if (type > INVERTED_ALL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
151 curwin->w_lines_valid = 0; // don't use w_lines[].wl_size now
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
152 return FAIL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
153 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
154 updating_screen = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
155
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
156 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
157 // Update popup_mask if needed. This may set w_redraw_top and w_redraw_bot
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
158 // in some windows.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
159 may_update_popup_mask(type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
160 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
161
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
162 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
163 ++display_tick; // let syntax code know we're in a next round of
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
164 // display updating
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
165 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
166 if (no_update)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
167 ++no_win_do_lines_ins;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
168
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
169 // if the screen was scrolled up when displaying a message, scroll it down
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
170 if (msg_scrolled)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
171 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
172 clear_cmdline = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
173 if (msg_scrolled > Rows - 5) // clearing is faster
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
174 type = CLEAR;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
175 else if (type != CLEAR)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
176 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
177 check_for_delay(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
178 if (screen_ins_lines(0, 0, msg_scrolled, (int)Rows, 0, NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
179 == FAIL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
180 type = CLEAR;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
181 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
182 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
183 if (wp->w_winrow < msg_scrolled)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
184 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
185 if (W_WINROW(wp) + wp->w_height > msg_scrolled
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
186 && wp->w_redr_type < REDRAW_TOP
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
187 && wp->w_lines_valid > 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
188 && wp->w_topline == wp->w_lines[0].wl_lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
189 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
190 wp->w_upd_rows = msg_scrolled - W_WINROW(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
191 wp->w_redr_type = REDRAW_TOP;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
192 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
193 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
194 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
195 wp->w_redr_type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
196 if (W_WINROW(wp) + wp->w_height + wp->w_status_height
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
197 <= msg_scrolled)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
198 wp->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
199 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
200 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
201 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
202 if (!no_update)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
203 redraw_cmdline = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
204 redraw_tabline = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
205 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
206 msg_scrolled = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
207 need_wait_return = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
208 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
209
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
210 // reset cmdline_row now (may have been changed temporarily)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
211 compute_cmdrow();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
212
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
213 // Check for changed highlighting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
214 if (need_highlight_changed)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
215 highlight_changed();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
216
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
217 if (type == CLEAR) // first clear screen
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
218 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
219 screenclear(); // will reset clear_cmdline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
220 type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
221 // must_redraw may be set indirectly, avoid another redraw later
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
222 must_redraw = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
223 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
224
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
225 if (clear_cmdline) // going to clear cmdline (done below)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
226 check_for_delay(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
227
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
228 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
229 // Force redraw when width of 'number' or 'relativenumber' column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
230 // changes.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
231 if (curwin->w_redr_type < NOT_VALID
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
232 && curwin->w_nrwidth != ((curwin->w_p_nu || curwin->w_p_rnu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
233 ? number_width(curwin) : 0))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
234 curwin->w_redr_type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
235 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
236
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
237 // Only start redrawing if there is really something to do.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
238 if (type == INVERTED)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
239 update_curswant();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
240 if (curwin->w_redr_type < type
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
241 && !((type == VALID
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
242 && curwin->w_lines[0].wl_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
243 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
244 && curwin->w_topfill == curwin->w_old_topfill
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
245 && curwin->w_botfill == curwin->w_old_botfill
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
246 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
247 && curwin->w_topline == curwin->w_lines[0].wl_lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
248 || (type == INVERTED
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
249 && VIsual_active
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
250 && curwin->w_old_cursor_lnum == curwin->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
251 && curwin->w_old_visual_mode == VIsual_mode
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
252 && (curwin->w_valid & VALID_VIRTCOL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
253 && curwin->w_old_curswant == curwin->w_curswant)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
254 ))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
255 curwin->w_redr_type = type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
256
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
257 // Redraw the tab pages line if needed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
258 if (redraw_tabline || type >= NOT_VALID)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
259 draw_tabline();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
260
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
261 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
262 // Correct stored syntax highlighting info for changes in each displayed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
263 // buffer. Each buffer must only be done once.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
264 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
265 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
266 if (wp->w_buffer->b_mod_set)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
267 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
268 win_T *wwp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
269
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
270 // Check if we already did this buffer.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
271 for (wwp = firstwin; wwp != wp; wwp = wwp->w_next)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
272 if (wwp->w_buffer == wp->w_buffer)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
273 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
274 if (wwp == wp && syntax_present(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
275 syn_stack_apply_changes(wp->w_buffer);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
276 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
277 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
278 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
279
24527
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
280 if (pum_redraw_in_same_position())
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
281 // Avoid flicker if the popup menu is going to be redrawn in the same
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
282 // position.
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
283 pum_will_redraw = TRUE;
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
284
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
285 // Go from top to bottom through the windows, redrawing the ones that need
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
286 // it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
287 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
19542
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
288 did_update_one_window = FALSE;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
289 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
290 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
291 screen_search_hl.rm.regprog = NULL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
292 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
293 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
294 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
295 if (wp->w_redr_type != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
296 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
297 cursor_off();
19542
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
298 #ifdef FEAT_GUI
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
299 if (!did_one)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
300 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
301 did_one = TRUE;
19542
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
302
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
303 // Remove the cursor before starting to do anything, because
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
304 // scrolling may make it difficult to redraw the text under
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
305 // it.
24428
9299d21d1d5d patch 8.2.2754: :sleep! does not always hide the cursor
Bram Moolenaar <Bram@vim.org>
parents: 24289
diff changeset
306 // Also remove the cursor if it needs to be hidden due to an
9299d21d1d5d patch 8.2.2754: :sleep! does not always hide the cursor
Bram Moolenaar <Bram@vim.org>
parents: 24289
diff changeset
307 // ongoing cursor-less sleep.
9299d21d1d5d patch 8.2.2754: :sleep! does not always hide the cursor
Bram Moolenaar <Bram@vim.org>
parents: 24289
diff changeset
308 if (gui.in_use && (wp == curwin || cursor_is_sleeping()))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
309 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
310 gui_cursor_col = gui.cursor_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
311 gui_cursor_row = gui.cursor_row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
312 gui_undraw_cursor();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
313 did_undraw = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
314 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
315 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
316 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
317 win_update(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
318 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
319
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
320 // redraw status line after the window to minimize cursor movement
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
321 if (wp->w_redr_status)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
322 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
323 cursor_off();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
324 win_redr_status(wp, TRUE); // any popup menu will be redrawn below
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
325 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
326 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
327 #if defined(FEAT_SEARCH_EXTRA)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
328 end_search_hl();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
329 #endif
24527
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
330
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
331 // May need to redraw the popup menu.
24527
a878e5e892cf patch 8.2.2803: flicker when the popup menu has an info popup
Bram Moolenaar <Bram@vim.org>
parents: 24521
diff changeset
332 pum_will_redraw = save_pum_will_redraw;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
333 pum_may_redraw();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
334
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
335 // Reset b_mod_set flags. Going through all windows is probably faster
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
336 // than going through all buffers (there could be many buffers).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
337 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
338 wp->w_buffer->b_mod_set = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
339
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
340 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
341 // Display popup windows on top of the windows and command line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
342 update_popups(win_update);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
343 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
344
26544
30abd8e55ee5 patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents: 26466
diff changeset
345 #ifdef FEAT_TERMINAL
30abd8e55ee5 patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents: 26466
diff changeset
346 FOR_ALL_WINDOWS(wp)
30abd8e55ee5 patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents: 26466
diff changeset
347 // If this window contains a terminal, after redrawing all windows, the
30abd8e55ee5 patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents: 26466
diff changeset
348 // dirty row range can be reset.
30abd8e55ee5 patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents: 26466
diff changeset
349 term_did_update_window(wp);
30abd8e55ee5 patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents: 26466
diff changeset
350 #endif
30abd8e55ee5 patch 8.2.3801: if a terminal shows in two windows, only one is redrawn
Bram Moolenaar <Bram@vim.org>
parents: 26466
diff changeset
351
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
352 after_updating_screen(TRUE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
353
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
354 // Clear or redraw the command line. Done last, because scrolling may
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
355 // mess up the command line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
356 if (clear_cmdline || redraw_cmdline || redraw_mode)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
357 showmode();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
358
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
359 if (no_update)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
360 --no_win_do_lines_ins;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
361
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
362 // May put up an introductory message when not editing a file
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
363 if (!did_intro)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
364 maybe_intro_message();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
365 did_intro = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
366
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
367 #ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
368 // Redraw the cursor and update the scrollbars when all screen updating is
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
369 // done.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
370 if (gui.in_use)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
371 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
372 if (did_undraw && !gui_mch_is_blink_off())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
373 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
374 mch_disable_flush();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
375 out_flush(); // required before updating the cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
376 mch_enable_flush();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
377
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
378 // Put the GUI position where the cursor was, gui_update_cursor()
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
379 // uses that.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
380 gui.col = gui_cursor_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
381 gui.row = gui_cursor_row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
382 gui.col = mb_fix_col(gui.col, gui.row);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
383 gui_update_cursor(FALSE, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
384 gui_may_flush();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
385 screen_cur_col = gui.col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
386 screen_cur_row = gui.row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
387 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
388 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
389 out_flush();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
390 gui_update_scrollbars(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
391 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
392 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
393 return OK;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
394 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
395
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
396 /*
24275
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
397 * Return the row for drawing the statusline and the ruler of window "wp".
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
398 */
24289
8938c0c98149 patch 8.2.2685: custom statusline not drawn correctly with WinBar
Bram Moolenaar <Bram@vim.org>
parents: 24275
diff changeset
399 int
24275
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
400 statusline_row(win_T *wp)
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
401 {
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
402 #if defined(FEAT_PROP_POPUP)
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
403 // If the window is really zero height the winbar isn't displayed.
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
404 if (wp->w_frame->fr_height == wp->w_status_height && !popup_is_popup(wp))
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
405 return wp->w_winrow;
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
406 #endif
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
407 return W_WINROW(wp) + wp->w_height;
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
408 }
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
409
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
410 /*
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
411 * Redraw the status line of window wp.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
412 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
413 * If inversion is possible we use it. Else '=' characters are used.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
414 * If "ignore_pum" is TRUE, also redraw statusline when the popup menu is
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
415 * displayed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
416 */
19916
dcec86d796bc patch 8.2.0514: several global functions are used in only one file
Bram Moolenaar <Bram@vim.org>
parents: 19542
diff changeset
417 static void
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
418 win_redr_status(win_T *wp, int ignore_pum UNUSED)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
419 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
420 int row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
421 char_u *p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
422 int len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
423 int fillchar;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
424 int attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
425 int this_ru_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
426 static int busy = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
427
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
428 // It's possible to get here recursively when 'statusline' (indirectly)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
429 // invokes ":redrawstatus". Simply ignore the call then.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
430 if (busy)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
431 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
432 busy = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
433
24275
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
434 row = statusline_row(wp);
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
435
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
436 wp->w_redr_status = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
437 if (wp->w_status_height == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
438 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
439 // no status line, can only be last window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
440 redraw_cmdline = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
441 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
442 else if (!redrawing()
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
443 // don't update status line when popup menu is visible and may be
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
444 // drawn over it, unless it will be redrawn later
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
445 || (!ignore_pum && pum_visible()))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
446 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
447 // Don't redraw right now, do it later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
448 wp->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
449 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
450 #ifdef FEAT_STL_OPT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
451 else if (*p_stl != NUL || *wp->w_p_stl != NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
452 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
453 // redraw custom status line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
454 redraw_custom_statusline(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
455 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
456 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
457 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
458 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
459 fillchar = fillchar_status(&attr, wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
460
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
461 get_trans_bufname(wp->w_buffer);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
462 p = NameBuff;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
463 len = (int)STRLEN(p);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
464
27090
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26544
diff changeset
465 if ((bt_help(wp->w_buffer)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
466 #ifdef FEAT_QUICKFIX
27090
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26544
diff changeset
467 || wp->w_p_pvw
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
468 #endif
27090
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26544
diff changeset
469 || bufIsChanged(wp->w_buffer)
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26544
diff changeset
470 || wp->w_buffer->b_p_ro)
5e65d802bd52 patch 8.2.4074: going over the end of NameBuff
Bram Moolenaar <Bram@vim.org>
parents: 26544
diff changeset
471 && len < MAXPATHL - 1)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
472 *(p + len++) = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
473 if (bt_help(wp->w_buffer))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
474 {
25907
637588377056 patch 8.2.3487: illegal memory access if buffer name is very long
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
475 vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[Help]"));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
476 len += (int)STRLEN(p + len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
477 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
478 #ifdef FEAT_QUICKFIX
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
479 if (wp->w_p_pvw)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
480 {
25907
637588377056 patch 8.2.3487: illegal memory access if buffer name is very long
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
481 vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[Preview]"));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
482 len += (int)STRLEN(p + len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
483 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
484 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
485 if (bufIsChanged(wp->w_buffer)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
486 #ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
487 && !bt_terminal(wp->w_buffer)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
488 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
489 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
490 {
25907
637588377056 patch 8.2.3487: illegal memory access if buffer name is very long
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
491 vim_snprintf((char *)p + len, MAXPATHL - len, "%s", "[+]");
637588377056 patch 8.2.3487: illegal memory access if buffer name is very long
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
492 len += (int)STRLEN(p + len);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
493 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
494 if (wp->w_buffer->b_p_ro)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
495 {
25907
637588377056 patch 8.2.3487: illegal memory access if buffer name is very long
Bram Moolenaar <Bram@vim.org>
parents: 25487
diff changeset
496 vim_snprintf((char *)p + len, MAXPATHL - len, "%s", _("[RO]"));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
497 len += (int)STRLEN(p + len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
498 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
499
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
500 this_ru_col = ru_col - (Columns - wp->w_width);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
501 if (this_ru_col < (wp->w_width + 1) / 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
502 this_ru_col = (wp->w_width + 1) / 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
503 if (this_ru_col <= 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
504 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
505 p = (char_u *)"<"; // No room for file name!
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
506 len = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
507 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
508 else if (has_mbyte)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
509 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
510 int clen = 0, i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
511
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
512 // Count total number of display cells.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
513 clen = mb_string2cells(p, -1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
514
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
515 // Find first character that will fit.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
516 // Going from start to end is much faster for DBCS.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
517 for (i = 0; p[i] != NUL && clen >= this_ru_col - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
518 i += (*mb_ptr2len)(p + i))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
519 clen -= (*mb_ptr2cells)(p + i);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
520 len = clen;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
521 if (i > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
522 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
523 p = p + i - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
524 *p = '<';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
525 ++len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
526 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
527
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
528 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
529 else if (len > this_ru_col - 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
530 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
531 p += len - (this_ru_col - 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
532 *p = '<';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
533 len = this_ru_col - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
534 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
535
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
536 screen_puts(p, row, wp->w_wincol, attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
537 screen_fill(row, row + 1, len + wp->w_wincol,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
538 this_ru_col + wp->w_wincol, fillchar, fillchar, attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
539
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
540 if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL)
27426
41e0dcf38521 patch 8.2.4241: some type casts are redundant
Bram Moolenaar <Bram@vim.org>
parents: 27158
diff changeset
541 && (this_ru_col - len) > (int)(STRLEN(NameBuff) + 1))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
542 screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
543 - 1 + wp->w_wincol), attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
544
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
545 #ifdef FEAT_CMDL_INFO
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
546 win_redr_ruler(wp, TRUE, ignore_pum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
547 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
548 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
549
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
550 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
551 * May need to draw the character below the vertical separator.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
552 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
553 if (wp->w_vsep_width != 0 && wp->w_status_height != 0 && redrawing())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
554 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
555 if (stl_connected(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
556 fillchar = fillchar_status(&attr, wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
557 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
558 fillchar = fillchar_vsep(&attr);
24275
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
559 screen_putchar(fillchar, row, W_ENDCOL(wp), attr);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
560 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
561 busy = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
562 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
563
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
564 #ifdef FEAT_STL_OPT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
565 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
566 * Redraw the status line according to 'statusline' and take care of any
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
567 * errors encountered.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
568 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
569 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
570 redraw_custom_statusline(win_T *wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
571 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
572 static int entered = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
573 int saved_did_emsg = did_emsg;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
574
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
575 // When called recursively return. This can happen when the statusline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
576 // contains an expression that triggers a redraw.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
577 if (entered)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
578 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
579 entered = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
580
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
581 did_emsg = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
582 win_redr_custom(wp, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
583 if (did_emsg)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
584 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
585 // When there is an error disable the statusline, otherwise the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
586 // display is messed up with errors and a redraw triggers the problem
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
587 // again and again.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
588 set_string_option_direct((char_u *)"statusline", -1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
589 (char_u *)"", OPT_FREE | (*wp->w_p_stl != NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
590 ? OPT_LOCAL : OPT_GLOBAL), SID_ERROR);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
591 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
592 did_emsg |= saved_did_emsg;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
593 entered = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
594 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
595 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
596
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
597 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
598 * Show current status info in ruler and various other places
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
599 * If always is FALSE, only show ruler if position has changed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
600 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
601 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
602 showruler(int always)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
603 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
604 if (!always && !redrawing())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
605 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
606 if (pum_visible())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
607 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
608 // Don't redraw right now, do it later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
609 curwin->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
610 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
611 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
612 #if defined(FEAT_STL_OPT)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
613 if ((*p_stl != NUL || *curwin->w_p_stl != NUL) && curwin->w_status_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
614 redraw_custom_statusline(curwin);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
615 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
616 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
617 #ifdef FEAT_CMDL_INFO
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
618 win_redr_ruler(curwin, always, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
619 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
620
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
621 if (need_maketitle
26336
a2e6da79274d patch 8.2.3699: the +title feature adds a lot of #ifdef but little code
Bram Moolenaar <Bram@vim.org>
parents: 26003
diff changeset
622 #ifdef FEAT_STL_OPT
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
623 || (p_icon && (stl_syntax & STL_IN_ICON))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
624 || (p_title && (stl_syntax & STL_IN_TITLE))
26336
a2e6da79274d patch 8.2.3699: the +title feature adds a lot of #ifdef but little code
Bram Moolenaar <Bram@vim.org>
parents: 26003
diff changeset
625 #endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
626 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
627 maketitle();
26336
a2e6da79274d patch 8.2.3699: the +title feature adds a lot of #ifdef but little code
Bram Moolenaar <Bram@vim.org>
parents: 26003
diff changeset
628
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
629 // Redraw the tab pages line if needed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
630 if (redraw_tabline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
631 draw_tabline();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
632 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
633
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
634 #if defined(FEAT_CMDL_INFO) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
635 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
636 win_redr_ruler(win_T *wp, int always, int ignore_pum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
637 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
638 #define RULER_BUF_LEN 70
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
639 char_u buffer[RULER_BUF_LEN];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
640 int row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
641 int fillchar;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
642 int attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
643 int empty_line = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
644 colnr_T virtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
645 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
646 size_t len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
647 int o;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
648 int this_ru_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
649 int off = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
650 int width;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
651
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
652 // If 'ruler' off or redrawing disabled, don't do anything
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
653 if (!p_ru)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
654 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
655
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
656 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
657 * Check if cursor.lnum is valid, since win_redr_ruler() may be called
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
658 * after deleting lines, before cursor.lnum is corrected.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
659 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
660 if (wp->w_cursor.lnum > wp->w_buffer->b_ml.ml_line_count)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
661 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
662
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
663 // Don't draw the ruler while doing insert-completion, it might overwrite
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
664 // the (long) mode message.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
665 if (wp == lastwin && lastwin->w_status_height == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
666 if (edit_submode != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
667 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
668 // Don't draw the ruler when the popup menu is visible, it may overlap.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
669 // Except when the popup menu will be redrawn anyway.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
670 if (!ignore_pum && pum_visible())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
671 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
672
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
673 #ifdef FEAT_STL_OPT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
674 if (*p_ruf)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
675 {
18949
5c405689da3e patch 8.2.0035: saving and restoring called_emsg is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
676 int called_emsg_before = called_emsg;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
677
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
678 win_redr_custom(wp, TRUE);
18949
5c405689da3e patch 8.2.0035: saving and restoring called_emsg is clumsy
Bram Moolenaar <Bram@vim.org>
parents: 18763
diff changeset
679 if (called_emsg > called_emsg_before)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
680 set_string_option_direct((char_u *)"rulerformat", -1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
681 (char_u *)"", OPT_FREE, SID_ERROR);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
682 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
683 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
684 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
685
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
686 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
687 * Check if not in Insert mode and the line is empty (will show "0-1").
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
688 */
28773
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
689 if ((State & MODE_INSERT) == 0
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
690 && *ml_get_buf(wp->w_buffer, wp->w_cursor.lnum, FALSE) == NUL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
691 empty_line = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
692
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
693 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
694 * Only draw the ruler when something changed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
695 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
696 validate_virtcol_win(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
697 if ( redraw_cmdline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
698 || always
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
699 || wp->w_cursor.lnum != wp->w_ru_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
700 || wp->w_cursor.col != wp->w_ru_cursor.col
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
701 || wp->w_virtcol != wp->w_ru_virtcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
702 || wp->w_cursor.coladd != wp->w_ru_cursor.coladd
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
703 || wp->w_topline != wp->w_ru_topline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
704 || wp->w_buffer->b_ml.ml_line_count != wp->w_ru_line_count
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
705 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
706 || wp->w_topfill != wp->w_ru_topfill
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
707 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
708 || empty_line != wp->w_ru_empty)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
709 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
710 cursor_off();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
711 if (wp->w_status_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
712 {
24275
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
713 row = statusline_row(wp);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
714 fillchar = fillchar_status(&attr, wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
715 off = wp->w_wincol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
716 width = wp->w_width;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
717 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
718 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
719 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
720 row = Rows - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
721 fillchar = ' ';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
722 attr = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
723 width = Columns;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
724 off = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
725 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
726
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
727 // In list mode virtcol needs to be recomputed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
728 virtcol = wp->w_virtcol;
23952
44be09b25619 patch 8.2.2518: 'listchars' should be window-local
Bram Moolenaar <Bram@vim.org>
parents: 23932
diff changeset
729 if (wp->w_p_list && wp->w_lcs_chars.tab1 == NUL)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
730 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
731 wp->w_p_list = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
732 getvvcol(wp, &wp->w_cursor, NULL, &virtcol, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
733 wp->w_p_list = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
734 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
735
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
736 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
737 * Some sprintfs return the length, some return a pointer.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
738 * To avoid portability problems we use strlen() here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
739 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
740 vim_snprintf((char *)buffer, RULER_BUF_LEN, "%ld,",
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
741 (wp->w_buffer->b_ml.ml_flags & ML_EMPTY)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
742 ? 0L
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
743 : (long)(wp->w_cursor.lnum));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
744 len = STRLEN(buffer);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
745 col_print(buffer + len, RULER_BUF_LEN - len,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
746 empty_line ? 0 : (int)wp->w_cursor.col + 1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
747 (int)virtcol + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
748
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
749 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
750 * Add a "50%" if there is room for it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
751 * On the last line, don't print in the last column (scrolls the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
752 * screen up on some terminals).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
753 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
754 i = (int)STRLEN(buffer);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
755 get_rel_pos(wp, buffer + i + 1, RULER_BUF_LEN - i - 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
756 o = i + vim_strsize(buffer + i + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
757 if (wp->w_status_height == 0) // can't use last char of screen
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
758 ++o;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
759 this_ru_col = ru_col - (Columns - width);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
760 if (this_ru_col < 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
761 this_ru_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
762 // Never use more than half the window/screen width, leave the other
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
763 // half for the filename.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
764 if (this_ru_col < (width + 1) / 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
765 this_ru_col = (width + 1) / 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
766 if (this_ru_col + o < width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
767 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
768 // need at least 3 chars left for get_rel_pos() + NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
769 while (this_ru_col + o < width && RULER_BUF_LEN > i + 4)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
770 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
771 if (has_mbyte)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
772 i += (*mb_char2bytes)(fillchar, buffer + i);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
773 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
774 buffer[i++] = fillchar;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
775 ++o;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
776 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
777 get_rel_pos(wp, buffer + i, RULER_BUF_LEN - i);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
778 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
779 // Truncate at window boundary.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
780 if (has_mbyte)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
781 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
782 o = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
783 for (i = 0; buffer[i] != NUL; i += (*mb_ptr2len)(buffer + i))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
784 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
785 o += (*mb_ptr2cells)(buffer + i);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
786 if (this_ru_col + o > width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
787 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
788 buffer[i] = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
789 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
790 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
791 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
792 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
793 else if (this_ru_col + (int)STRLEN(buffer) > width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
794 buffer[width - this_ru_col] = NUL;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
795
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
796 screen_puts(buffer, row, this_ru_col + off, attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
797 i = redraw_cmdline;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
798 screen_fill(row, row + 1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
799 this_ru_col + off + (int)STRLEN(buffer),
27426
41e0dcf38521 patch 8.2.4241: some type casts are redundant
Bram Moolenaar <Bram@vim.org>
parents: 27158
diff changeset
800 (off + width),
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
801 fillchar, fillchar, attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
802 // don't redraw the cmdline because of showing the ruler
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
803 redraw_cmdline = i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
804 wp->w_ru_cursor = wp->w_cursor;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
805 wp->w_ru_virtcol = wp->w_virtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
806 wp->w_ru_empty = empty_line;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
807 wp->w_ru_topline = wp->w_topline;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
808 wp->w_ru_line_count = wp->w_buffer->b_ml.ml_line_count;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
809 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
810 wp->w_ru_topfill = wp->w_topfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
811 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
812 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
813 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
814 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
815
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
816 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
817 * To be called when "updating_screen" was set before and now the postponed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
818 * side effects may take place.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
819 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
820 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
821 after_updating_screen(int may_resize_shell UNUSED)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
822 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
823 updating_screen = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
824 #ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
825 if (may_resize_shell)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
826 gui_may_resize_shell();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
827 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
828 #ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
829 term_check_channel_closed_recently();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
830 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
831
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
832 #ifdef HAVE_DROP_FILE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
833 // If handle_drop() was called while updating_screen was TRUE need to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
834 // handle the drop now.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
835 handle_any_postponed_drop();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
836 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
837 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
838
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
839 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
840 * Update all windows that are editing the current buffer.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
841 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
842 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
843 update_curbuf(int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
844 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
845 redraw_curbuf_later(type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
846 update_screen(type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
847 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
848
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
849 #if defined(FEAT_MENU) || defined(FEAT_FOLDING)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
850 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
851 * Copy "text" to ScreenLines using "attr".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
852 * Returns the next screen column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
853 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
854 static int
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
855 text_to_screenline(win_T *wp, char_u *text, int col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
856 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
857 int off = (int)(current_ScreenLine - ScreenLines);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
858
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
859 if (has_mbyte)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
860 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
861 int cells;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
862 int u8c, u8cc[MAX_MCO];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
863 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
864 int idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
865 int c_len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
866 char_u *p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
867 # ifdef FEAT_ARABIC
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
868 int prev_c = 0; // previous Arabic character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
869 int prev_c1 = 0; // first composing char for prev_c
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
870 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
871
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
872 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
873 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
874 idx = off;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
875 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
876 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
877 idx = off + col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
878
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
879 // Store multibyte characters in ScreenLines[] et al. correctly.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
880 for (p = text; *p != NUL; )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
881 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
882 cells = (*mb_ptr2cells)(p);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
883 c_len = (*mb_ptr2len)(p);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
884 if (col + cells > wp->w_width
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
885 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
886 - (wp->w_p_rl ? col : 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
887 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
888 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
889 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
890 ScreenLines[idx] = *p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
891 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
892 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
893 u8c = utfc_ptr2char(p, u8cc);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
894 if (*p < 0x80 && u8cc[0] == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
895 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
896 ScreenLinesUC[idx] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
897 #ifdef FEAT_ARABIC
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
898 prev_c = u8c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
899 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
900 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
901 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
902 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
903 #ifdef FEAT_ARABIC
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
904 if (p_arshape && !p_tbidi && ARABIC_CHAR(u8c))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
905 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
906 // Do Arabic shaping.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
907 int pc, pc1, nc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
908 int pcc[MAX_MCO];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
909 int firstbyte = *p;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
910
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
911 // The idea of what is the previous and next
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
912 // character depends on 'rightleft'.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
913 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
914 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
915 pc = prev_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
916 pc1 = prev_c1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
917 nc = utf_ptr2char(p + c_len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
918 prev_c1 = u8cc[0];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
919 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
920 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
921 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
922 pc = utfc_ptr2char(p + c_len, pcc);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
923 nc = prev_c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
924 pc1 = pcc[0];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
925 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
926 prev_c = u8c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
927
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
928 u8c = arabic_shape(u8c, &firstbyte, &u8cc[0],
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
929 pc, pc1, nc);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
930 ScreenLines[idx] = firstbyte;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
931 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
932 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
933 prev_c = u8c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
934 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
935 // Non-BMP character: display as ? or fullwidth ?.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
936 ScreenLinesUC[idx] = u8c;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
937 for (i = 0; i < Screen_mco; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
938 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
939 ScreenLinesC[i][idx] = u8cc[i];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
940 if (u8cc[i] == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
941 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
942 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
943 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
944 if (cells > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
945 ScreenLines[idx + 1] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
946 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
947 else if (enc_dbcs == DBCS_JPNU && *p == 0x8e)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
948 // double-byte single width character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
949 ScreenLines2[idx] = p[1];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
950 else if (cells > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
951 // double-width character
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
952 ScreenLines[idx + 1] = p[1];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
953 col += cells;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
954 idx += cells;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
955 p += c_len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
956 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
957 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
958 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
959 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
960 int len = (int)STRLEN(text);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
961
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
962 if (len > wp->w_width - col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
963 len = wp->w_width - col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
964 if (len > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
965 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
966 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
967 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
968 mch_memmove(current_ScreenLine, text, len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
969 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
970 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
971 mch_memmove(current_ScreenLine + col, text, len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
972 col += len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
973 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
974 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
975 return col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
976 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
977 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
978
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
979 #ifdef FEAT_MENU
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
980 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
981 * Draw the window toolbar.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
982 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
983 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
984 redraw_win_toolbar(win_T *wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
985 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
986 vimmenu_T *menu;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
987 int item_idx = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
988 int item_count = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
989 int col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
990 int next_col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
991 int off = (int)(current_ScreenLine - ScreenLines);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
992 int fill_attr = syn_name2attr((char_u *)"ToolbarLine");
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
993 int button_attr = syn_name2attr((char_u *)"ToolbarButton");
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
994
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
995 vim_free(wp->w_winbar_items);
19934
3ff714d765ba patch 8.2.0523: loops are repeated
Bram Moolenaar <Bram@vim.org>
parents: 19916
diff changeset
996 FOR_ALL_CHILD_MENUS(wp->w_winbar, menu)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
997 ++item_count;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
998 wp->w_winbar_items = ALLOC_CLEAR_MULT(winbar_item_T, item_count + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
999
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1000 // TODO: use fewer spaces if there is not enough room
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1001 for (menu = wp->w_winbar->children;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1002 menu != NULL && col < wp->w_width; menu = menu->next)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1003 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1004 space_to_screenline(off + col, fill_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1005 if (++col >= wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1006 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1007 if (col > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1008 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1009 space_to_screenline(off + col, fill_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1010 if (++col >= wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1011 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1012 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1013
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1014 wp->w_winbar_items[item_idx].wb_startcol = col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1015 space_to_screenline(off + col, button_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1016 if (++col >= wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1017 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1018
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1019 next_col = text_to_screenline(wp, menu->name, col);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1020 while (col < next_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1021 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1022 ScreenAttrs[off + col] = button_attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1023 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1024 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1025 wp->w_winbar_items[item_idx].wb_endcol = col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1026 wp->w_winbar_items[item_idx].wb_menu = menu;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1027 ++item_idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1028
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1029 if (col >= wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1030 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1031 space_to_screenline(off + col, button_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1032 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1033 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1034 while (col < wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1035 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1036 space_to_screenline(off + col, fill_attr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1037 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1038 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1039 wp->w_winbar_items[item_idx].wb_menu = NULL; // end marker
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1040
27426
41e0dcf38521 patch 8.2.4241: some type casts are redundant
Bram Moolenaar <Bram@vim.org>
parents: 27158
diff changeset
1041 screen_line(wp->w_winrow, wp->w_wincol, wp->w_width, wp->w_width, 0);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1042 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1043 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1044
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1045 #if defined(FEAT_FOLDING) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1046 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1047 * Copy "buf[len]" to ScreenLines["off"] and set attributes to "attr".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1048 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1049 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1050 copy_text_attr(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1051 int off,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1052 char_u *buf,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1053 int len,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1054 int attr)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1055 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1056 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1057
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1058 mch_memmove(ScreenLines + off, buf, (size_t)len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1059 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1060 vim_memset(ScreenLinesUC + off, 0, sizeof(u8char_T) * (size_t)len);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1061 for (i = 0; i < len; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1062 ScreenAttrs[off + i] = attr;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1063 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1064
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1065 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1066 * Display one folded line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1067 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1068 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1069 fold_line(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1070 win_T *wp,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1071 long fold_count,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1072 foldinfo_T *foldinfo,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1073 linenr_T lnum,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1074 int row)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1075 {
24043
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1076 // Max value of 'foldcolumn' is 12 and maximum number of bytes in a
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1077 // multi-byte character is MAX_MCO.
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1078 char_u buf[MAX_MCO * 12 + 1];
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1079 pos_T *top, *bot;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1080 linenr_T lnume = lnum + fold_count - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1081 int len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1082 char_u *text;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1083 int fdc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1084 int col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1085 int txtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1086 int off = (int)(current_ScreenLine - ScreenLines);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1087 int ri;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1088
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1089 // Build the fold line:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1090 // 1. Add the cmdwin_type for the command-line window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1091 // 2. Add the 'foldcolumn'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1092 // 3. Add the 'number' or 'relativenumber' column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1093 // 4. Compose the text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1094 // 5. Add the text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1095 // 6. set highlighting for the Visual area an other text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1096 col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1097
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1098 // 1. Add the cmdwin_type for the command-line window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1099 // Ignores 'rightleft', this window is never right-left.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1100 #ifdef FEAT_CMDWIN
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1101 if (cmdwin_type != 0 && wp == curwin)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1102 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1103 ScreenLines[off] = cmdwin_type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1104 ScreenAttrs[off] = HL_ATTR(HLF_AT);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1105 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1106 ScreenLinesUC[off] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1107 ++col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1108 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1109 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1110
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1111 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1112 # define RL_MEMSET(p, v, l) \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1113 do { \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1114 if (wp->w_p_rl) \
27752
c1d1639b52dd patch 8.2.4402: missing parenthesis may cause unexpected problems
Bram Moolenaar <Bram@vim.org>
parents: 27712
diff changeset
1115 for (ri = 0; ri < (l); ++ri) \
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1116 ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1117 else \
27752
c1d1639b52dd patch 8.2.4402: missing parenthesis may cause unexpected problems
Bram Moolenaar <Bram@vim.org>
parents: 27712
diff changeset
1118 for (ri = 0; ri < (l); ++ri) \
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1119 ScreenAttrs[off + (p) + ri] = v; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1120 } while (0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1121 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1122 # define RL_MEMSET(p, v, l) \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1123 do { \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1124 for (ri = 0; ri < l; ++ri) \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1125 ScreenAttrs[off + (p) + ri] = v; \
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1126 } while (0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1127 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1128
24043
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1129 // 2. Add the 'foldcolumn'
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1130 // Reduce the width when there is not enough space.
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1131 fdc = compute_foldcolumn(wp, col);
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1132 if (fdc > 0)
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1133 {
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1134 char_u *p;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1135 int i;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1136 int idx;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1137
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1138 fill_foldcolumn(buf, wp, TRUE, lnum);
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1139 p = buf;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1140 for (i = 0; i < fdc; i++)
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1141 {
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1142 int ch;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1143
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1144 if (has_mbyte)
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1145 ch = mb_ptr2char_adv(&p);
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1146 else
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1147 ch = *p++;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1148 #ifdef FEAT_RIGHTLEFT
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1149 if (wp->w_p_rl)
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1150 idx = off + wp->w_width - i - 1 - col;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1151 else
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1152 #endif
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1153 idx = off + col + i;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1154 if (enc_utf8)
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1155 {
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1156 if (ch >= 0x80)
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1157 {
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1158 ScreenLinesUC[idx] = ch;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1159 ScreenLinesC[0][idx] = 0;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1160 ScreenLines[idx] = 0x80;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1161 }
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1162 else
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1163 {
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1164 ScreenLines[idx] = ch;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1165 ScreenLinesUC[idx] = 0;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1166 }
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1167 }
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1168 else
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1169 ScreenLines[idx] = ch;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1170 }
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1171
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1172 RL_MEMSET(col, HL_ATTR(HLF_FC), fdc);
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1173 col += fdc;
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1174 }
15408ab5fed7 patch 8.2.2563: cannot use multibyte characters for folding in 'fillchars'
Bram Moolenaar <Bram@vim.org>
parents: 23952
diff changeset
1175
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1176 // Set all attributes of the 'number' or 'relativenumber' column and the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1177 // text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1178 RL_MEMSET(col, HL_ATTR(HLF_FL), wp->w_width - col);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1179
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1180 #ifdef FEAT_SIGNS
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1181 // If signs are being displayed, add two spaces.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1182 if (signcolumn_on(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1183 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1184 len = wp->w_width - col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1185 if (len > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1186 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1187 if (len > 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1188 len = 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1189 # ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1190 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1191 // the line number isn't reversed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1192 copy_text_attr(off + wp->w_width - len - col,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1193 (char_u *)" ", len, HL_ATTR(HLF_FL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1194 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1195 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1196 copy_text_attr(off + col, (char_u *)" ", len, HL_ATTR(HLF_FL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1197 col += len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1198 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1199 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1200 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1201
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1202 // 3. Add the 'number' or 'relativenumber' column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1203 if (wp->w_p_nu || wp->w_p_rnu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1204 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1205 len = wp->w_width - col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1206 if (len > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1207 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1208 int w = number_width(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1209 long num;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1210 char *fmt = "%*ld ";
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1211
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1212 if (len > w + 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1213 len = w + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1214
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1215 if (wp->w_p_nu && !wp->w_p_rnu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1216 // 'number' + 'norelativenumber'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1217 num = (long)lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1218 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1219 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1220 // 'relativenumber', don't use negative numbers
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1221 num = labs((long)get_cursor_rel_lnum(wp, lnum));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1222 if (num == 0 && wp->w_p_nu && wp->w_p_rnu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1223 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1224 // 'number' + 'relativenumber': cursor line shows absolute
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1225 // line number
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1226 num = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1227 fmt = "%-*ld ";
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1228 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1229 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1230
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1231 sprintf((char *)buf, fmt, w, num);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1232 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1233 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1234 // the line number isn't reversed
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1235 copy_text_attr(off + wp->w_width - len - col, buf, len,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1236 HL_ATTR(HLF_FL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1237 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1238 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1239 copy_text_attr(off + col, buf, len, HL_ATTR(HLF_FL));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1240 col += len;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1241 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1242 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1243
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1244 // 4. Compose the folded-line string with 'foldtext', if set.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1245 text = get_foldtext(wp, lnum, lnume, foldinfo, buf);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1246
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1247 txtcol = col; // remember where text starts
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1248
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1249 // 5. move the text to current_ScreenLine. Fill up with "fill_fold".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1250 // Right-left text is put in columns 0 - number-col, normal text is put
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1251 // in columns number-col - window-width.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1252 col = text_to_screenline(wp, text, col);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1253
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1254 // Fill the rest of the line with the fold filler
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1255 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1256 if (wp->w_p_rl)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1257 col -= txtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1258 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1259 while (col < wp->w_width
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1260 #ifdef FEAT_RIGHTLEFT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1261 - (wp->w_p_rl ? txtcol : 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1262 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1263 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1264 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1265 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1266 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1267 if (fill_fold >= 0x80)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1268 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1269 ScreenLinesUC[off + col] = fill_fold;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1270 ScreenLinesC[0][off + col] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1271 ScreenLines[off + col] = 0x80; // avoid storing zero
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1272 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1273 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1274 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1275 ScreenLinesUC[off + col] = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1276 ScreenLines[off + col] = fill_fold;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1277 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1278 col++;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1279 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1280 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1281 ScreenLines[off + col++] = fill_fold;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1282 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1283
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1284 if (text != buf)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1285 vim_free(text);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1286
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1287 // 6. set highlighting for the Visual area an other text.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1288 // If all folded lines are in the Visual area, highlight the line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1289 if (VIsual_active && wp->w_buffer == curwin->w_buffer)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1290 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1291 if (LTOREQ_POS(curwin->w_cursor, VIsual))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1292 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1293 // Visual is after curwin->w_cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1294 top = &curwin->w_cursor;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1295 bot = &VIsual;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1296 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1297 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1298 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1299 // Visual is before curwin->w_cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1300 top = &VIsual;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1301 bot = &curwin->w_cursor;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1302 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1303 if (lnum >= top->lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1304 && lnume <= bot->lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1305 && (VIsual_mode != 'v'
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1306 || ((lnum > top->lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1307 || (lnum == top->lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1308 && top->col == 0))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1309 && (lnume < bot->lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1310 || (lnume == bot->lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1311 && (bot->col - (*p_sel == 'e'))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1312 >= (colnr_T)STRLEN(ml_get_buf(wp->w_buffer, lnume, FALSE)))))))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1313 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1314 if (VIsual_mode == Ctrl_V)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1315 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1316 // Visual block mode: highlight the chars part of the block
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1317 if (wp->w_old_cursor_fcol + txtcol < (colnr_T)wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1318 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1319 if (wp->w_old_cursor_lcol != MAXCOL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1320 && wp->w_old_cursor_lcol + txtcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1321 < (colnr_T)wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1322 len = wp->w_old_cursor_lcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1323 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1324 len = wp->w_width - txtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1325 RL_MEMSET(wp->w_old_cursor_fcol + txtcol, HL_ATTR(HLF_V),
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1326 len - (int)wp->w_old_cursor_fcol);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1327 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1328 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1329 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1330 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1331 // Set all attributes of the text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1332 RL_MEMSET(txtcol, HL_ATTR(HLF_V), wp->w_width - txtcol);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1333 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1334 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1335 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1336
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1337 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1338 // Show colorcolumn in the fold line, but let cursorcolumn override it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1339 if (wp->w_p_cc_cols)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1340 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1341 int i = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1342 int j = wp->w_p_cc_cols[i];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1343 int old_txtcol = txtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1344
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1345 while (j > -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1346 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1347 txtcol += j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1348 if (wp->w_p_wrap)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1349 txtcol -= wp->w_skipcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1350 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1351 txtcol -= wp->w_leftcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1352 if (txtcol >= 0 && txtcol < wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1353 ScreenAttrs[off + txtcol] = hl_combine_attr(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1354 ScreenAttrs[off + txtcol], HL_ATTR(HLF_MC));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1355 txtcol = old_txtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1356 j = wp->w_p_cc_cols[++i];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1357 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1358 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1359
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1360 // Show 'cursorcolumn' in the fold line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1361 if (wp->w_p_cuc)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1362 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1363 txtcol += wp->w_virtcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1364 if (wp->w_p_wrap)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1365 txtcol -= wp->w_skipcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1366 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1367 txtcol -= wp->w_leftcol;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1368 if (txtcol >= 0 && txtcol < wp->w_width)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1369 ScreenAttrs[off + txtcol] = hl_combine_attr(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1370 ScreenAttrs[off + txtcol], HL_ATTR(HLF_CUC));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1371 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1372 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1373
27426
41e0dcf38521 patch 8.2.4241: some type casts are redundant
Bram Moolenaar <Bram@vim.org>
parents: 27158
diff changeset
1374 screen_line(row + W_WINROW(wp), wp->w_wincol, wp->w_width, wp->w_width, 0);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1375
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1376 // Update w_cline_height and w_cline_folded if the cursor line was
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1377 // updated (saves a call to plines() later).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1378 if (wp == curwin
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1379 && lnum <= curwin->w_cursor.lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1380 && lnume >= curwin->w_cursor.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1381 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1382 curwin->w_cline_row = row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1383 curwin->w_cline_height = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1384 curwin->w_cline_folded = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1385 curwin->w_valid |= (VALID_CHEIGHT|VALID_CROW);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1386 }
25106
febccc86897e patch 8.2.3090: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25102
diff changeset
1387
febccc86897e patch 8.2.3090: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25102
diff changeset
1388 # ifdef FEAT_CONCEAL
febccc86897e patch 8.2.3090: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25102
diff changeset
1389 // When the line was not folded w_wrow may have been set, recompute it.
25151
f60fa4221b11 patch 8.2.3112: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25116
diff changeset
1390 if (wp == curwin
f60fa4221b11 patch 8.2.3112: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25116
diff changeset
1391 && wp->w_cursor.lnum >= lnum
f60fa4221b11 patch 8.2.3112: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25116
diff changeset
1392 && wp->w_cursor.lnum <= lnume
f60fa4221b11 patch 8.2.3112: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25116
diff changeset
1393 && conceal_cursor_line(wp))
25106
febccc86897e patch 8.2.3090: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25102
diff changeset
1394 curs_columns(TRUE);
febccc86897e patch 8.2.3090: in rare cases the cursor may be somewhere in a folded line
Bram Moolenaar <Bram@vim.org>
parents: 25102
diff changeset
1395 # endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1396 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1397 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1398
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1399 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1400 * Update a single window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1401 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1402 * This may cause the windows below it also to be redrawn (when clearing the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1403 * screen or scrolling lines).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1404 *
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1405 * How the window is redrawn depends on wp->w_redr_type. Each type also
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1406 * implies the one below it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1407 * NOT_VALID redraw the whole window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1408 * SOME_VALID redraw the whole window but do scroll when possible
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1409 * REDRAW_TOP redraw the top w_upd_rows window lines, otherwise like VALID
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1410 * INVERTED redraw the changed part of the Visual area
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1411 * INVERTED_ALL redraw the whole Visual area
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1412 * VALID 1. scroll up/down to adjust for a changed w_topline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1413 * 2. update lines at the top when scrolled down
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1414 * 3. redraw changed text:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1415 * - if wp->w_buffer->b_mod_set set, update lines between
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1416 * b_mod_top and b_mod_bot.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1417 * - if wp->w_redraw_top non-zero, redraw lines between
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1418 * wp->w_redraw_top and wp->w_redr_bot.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1419 * - continue redrawing when syntax status is invalid.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1420 * 4. if scrolled up, update lines at the bottom.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1421 * This results in three areas that may need updating:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1422 * top: from first row to top_end (when scrolled down)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1423 * mid: from mid_start to mid_end (update inversion or changed text)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1424 * bot: from bot_start to last row (when scrolled up)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1425 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1426 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1427 win_update(win_T *wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1428 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1429 buf_T *buf = wp->w_buffer;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1430 int type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1431 int top_end = 0; // Below last row of the top area that needs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1432 // updating. 0 when no top area updating.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1433 int mid_start = 999;// first row of the mid area that needs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1434 // updating. 999 when no mid area updating.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1435 int mid_end = 0; // Below last row of the mid area that needs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1436 // updating. 0 when no mid area updating.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1437 int bot_start = 999;// first row of the bot area that needs
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1438 // updating. 999 when no bot area updating
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1439 int scrolled_down = FALSE; // TRUE when scrolled down when
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1440 // w_topline got smaller a bit
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1441 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1442 int top_to_mod = FALSE; // redraw above mod_top
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1443 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1444
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1445 int row; // current window row to display
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1446 linenr_T lnum; // current buffer lnum to display
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1447 int idx; // current index in w_lines[]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1448 int srow; // starting row of the current line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1449
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1450 int eof = FALSE; // if TRUE, we hit the end of the file
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1451 int didline = FALSE; // if TRUE, we finished the last line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1452 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1453 long j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1454 static int recursive = FALSE; // being called recursively
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
1455 linenr_T old_botline = wp->w_botline;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
1456 #ifdef FEAT_CONCEAL
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
1457 int old_wrow = wp->w_wrow;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
1458 int old_wcol = wp->w_wcol;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
1459 #endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1460 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1461 long fold_count;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1462 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1463 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1464 // remember what happened to the previous line, to know if
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1465 // check_visual_highlight() can be used
28133
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27752
diff changeset
1466 # define DID_NONE 1 // didn't update a line
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27752
diff changeset
1467 # define DID_LINE 2 // updated a normal line
373f1afadfa3 patch 8.2.4591: cursor line not updated when a callback moves the cursor
Bram Moolenaar <Bram@vim.org>
parents: 27752
diff changeset
1468 # define DID_FOLD 3 // updated a folded line
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1469 int did_update = DID_NONE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1470 linenr_T syntax_last_parsed = 0; // last parsed text line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1471 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1472 linenr_T mod_top = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1473 linenr_T mod_bot = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1474 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1475 int save_got_int;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1476 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1477
19542
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1478 #if defined(FEAT_SEARCH_EXTRA) || defined(FEAT_CLIPBOARD)
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1479 // This needs to be done only for the first window when update_screen() is
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1480 // called.
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1481 if (!did_update_one_window)
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1482 {
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1483 did_update_one_window = TRUE;
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1484 # ifdef FEAT_SEARCH_EXTRA
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1485 start_search_hl();
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1486 # endif
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1487 # ifdef FEAT_CLIPBOARD
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1488 // When Visual area changed, may have to update selection.
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1489 if (clip_star.available && clip_isautosel_star())
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1490 clip_update_selection(&clip_star);
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1491 if (clip_plus.available && clip_isautosel_plus())
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1492 clip_update_selection(&clip_plus);
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1493 # endif
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1494 }
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1495 #endif
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
1496
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1497 type = wp->w_redr_type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1498
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1499 if (type == NOT_VALID)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1500 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1501 wp->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1502 wp->w_lines_valid = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1503 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1504
24275
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
1505 // Window frame is zero-height: nothing to draw.
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
1506 if (wp->w_height + WINBAR_HEIGHT(wp) == 0
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
1507 || (wp->w_frame->fr_height == wp->w_status_height
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
1508 #if defined(FEAT_PROP_POPUP)
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
1509 && !popup_is_popup(wp)
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
1510 #endif
6062e10a7e72 patch 8.2.2679: status line missing for non-current window with winbar
Bram Moolenaar <Bram@vim.org>
parents: 24043
diff changeset
1511 ))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1512 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1513 wp->w_redr_type = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1514 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1515 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1516
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1517 // Window is zero-width: Only need to draw the separator.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1518 if (wp->w_width == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1519 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1520 // draw the vertical separator right of this window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1521 draw_vsep_win(wp, 0);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1522 wp->w_redr_type = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1523 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1524 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1525
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1526 #ifdef FEAT_TERMINAL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1527 // If this window contains a terminal, redraw works completely differently.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1528 if (term_do_update_window(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1529 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1530 term_update_window(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1531 # ifdef FEAT_MENU
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1532 // Draw the window toolbar, if there is one.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1533 if (winbar_height(wp) > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1534 redraw_win_toolbar(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1535 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1536 wp->w_redr_type = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1537 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1538 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1539 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1540
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1541 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1542 init_search_hl(wp, &screen_search_hl);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1543 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1544
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1545 #ifdef FEAT_LINEBREAK
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1546 // Force redraw when width of 'number' or 'relativenumber' column
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1547 // changes.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1548 i = (wp->w_p_nu || wp->w_p_rnu) ? number_width(wp) : 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1549 if (wp->w_nrwidth != i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1550 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1551 type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1552 wp->w_nrwidth = i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1553 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1554 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1555 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1556
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1557 if (buf->b_mod_set && buf->b_mod_xlines != 0 && wp->w_redraw_top != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1558 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1559 // When there are both inserted/deleted lines and specific lines to be
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1560 // redrawn, w_redraw_top and w_redraw_bot may be invalid, just redraw
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1561 // everything (only happens when redrawing is off for while).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1562 type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1563 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1564 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1565 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1566 // Set mod_top to the first line that needs displaying because of
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1567 // changes. Set mod_bot to the first line after the changes.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1568 mod_top = wp->w_redraw_top;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1569 if (wp->w_redraw_bot != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1570 mod_bot = wp->w_redraw_bot + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1571 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1572 mod_bot = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1573 if (buf->b_mod_set)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1574 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1575 if (mod_top == 0 || mod_top > buf->b_mod_top)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1576 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1577 mod_top = buf->b_mod_top;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1578 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1579 // Need to redraw lines above the change that may be included
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1580 // in a pattern match.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1581 if (syntax_present(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1582 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1583 mod_top -= buf->b_s.b_syn_sync_linebreaks;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1584 if (mod_top < 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1585 mod_top = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1586 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1587 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1588 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1589 if (mod_bot == 0 || mod_bot < buf->b_mod_bot)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1590 mod_bot = buf->b_mod_bot;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1591
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1592 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1593 // When 'hlsearch' is on and using a multi-line search pattern, a
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1594 // change in one line may make the Search highlighting in a
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1595 // previous line invalid. Simple solution: redraw all visible
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1596 // lines above the change.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1597 // Same for a match pattern.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1598 if (screen_search_hl.rm.regprog != NULL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1599 && re_multiline(screen_search_hl.rm.regprog))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1600 top_to_mod = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1601 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1602 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1603 matchitem_T *cur = wp->w_match_head;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1604
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1605 while (cur != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1606 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1607 if (cur->match.regprog != NULL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1608 && re_multiline(cur->match.regprog))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1609 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1610 top_to_mod = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1611 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1612 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1613 cur = cur->next;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1614 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1615 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1616 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1617 }
29050
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1618
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1619 #ifdef FEAT_SEARCH_EXTRA
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1620 if (search_hl_has_cursor_lnum > 0)
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1621 {
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1622 // CurSearch was used last time, need to redraw the line with it to
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1623 // avoid having two matches highlighted with CurSearch.
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1624 if (mod_top == 0 || mod_top > search_hl_has_cursor_lnum)
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1625 mod_top = search_hl_has_cursor_lnum;
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1626 if (mod_bot == 0 || mod_bot < search_hl_has_cursor_lnum + 1)
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1627 mod_bot = search_hl_has_cursor_lnum + 1;
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1628 }
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1629 #endif
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1630
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1631 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1632 if (mod_top != 0 && hasAnyFolding(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1633 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1634 linenr_T lnumt, lnumb;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1635
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1636 // A change in a line can cause lines above it to become folded or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1637 // unfolded. Find the top most buffer line that may be affected.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1638 // If the line was previously folded and displayed, get the first
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1639 // line of that fold. If the line is folded now, get the first
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1640 // folded line. Use the minimum of these two.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1641
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1642 // Find last valid w_lines[] entry above mod_top. Set lnumt to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1643 // the line below it. If there is no valid entry, use w_topline.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1644 // Find the first valid w_lines[] entry below mod_bot. Set lnumb
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1645 // to this line. If there is no valid entry, use MAXLNUM.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1646 lnumt = wp->w_topline;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1647 lnumb = MAXLNUM;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1648 for (i = 0; i < wp->w_lines_valid; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1649 if (wp->w_lines[i].wl_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1650 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1651 if (wp->w_lines[i].wl_lastlnum < mod_top)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1652 lnumt = wp->w_lines[i].wl_lastlnum + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1653 if (lnumb == MAXLNUM && wp->w_lines[i].wl_lnum >= mod_bot)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1654 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1655 lnumb = wp->w_lines[i].wl_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1656 // When there is a fold column it might need updating
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1657 // in the next line ("J" just above an open fold).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1658 if (compute_foldcolumn(wp, 0) > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1659 ++lnumb;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1660 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1661 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1662
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1663 (void)hasFoldingWin(wp, mod_top, &mod_top, NULL, TRUE, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1664 if (mod_top > lnumt)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1665 mod_top = lnumt;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1666
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1667 // Now do the same for the bottom line (one above mod_bot).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1668 --mod_bot;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1669 (void)hasFoldingWin(wp, mod_bot, NULL, &mod_bot, TRUE, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1670 ++mod_bot;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1671 if (mod_bot < lnumb)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1672 mod_bot = lnumb;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1673 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1674 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1675
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1676 // When a change starts above w_topline and the end is below
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1677 // w_topline, start redrawing at w_topline.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1678 // If the end of the change is above w_topline: do like no change was
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1679 // made, but redraw the first line to find changes in syntax.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1680 if (mod_top != 0 && mod_top < wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1681 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1682 if (mod_bot > wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1683 mod_top = wp->w_topline;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1684 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1685 else if (syntax_present(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1686 top_end = 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1687 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1688 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1689
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1690 // When line numbers are displayed need to redraw all lines below
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1691 // inserted/deleted lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1692 if (mod_top != 0 && buf->b_mod_xlines != 0 && wp->w_p_nu)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1693 mod_bot = MAXLNUM;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1694 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1695 wp->w_redraw_top = 0; // reset for next time
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1696 wp->w_redraw_bot = 0;
29050
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1697 #ifdef FEAT_SEARCH_EXTRA
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1698 search_hl_has_cursor_lnum = 0;
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1699 #endif
a2710736125a patch 8.2.5047: CurSearch highlight is often wrong
Bram Moolenaar <Bram@vim.org>
parents: 28773
diff changeset
1700
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1701
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1702 // When only displaying the lines at the top, set top_end. Used when
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1703 // window has scrolled down for msg_scrolled.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1704 if (type == REDRAW_TOP)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1705 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1706 j = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1707 for (i = 0; i < wp->w_lines_valid; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1708 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1709 j += wp->w_lines[i].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1710 if (j >= wp->w_upd_rows)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1711 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1712 top_end = j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1713 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1714 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1715 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1716 if (top_end == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1717 // not found (cannot happen?): redraw everything
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1718 type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1719 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1720 // top area defined, the rest is VALID
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1721 type = VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1722 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1723
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1724 // Trick: we want to avoid clearing the screen twice. screenclear() will
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1725 // set "screen_cleared" to TRUE. The special value MAYBE (which is still
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1726 // non-zero and thus not FALSE) will indicate that screenclear() was not
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1727 // called.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1728 if (screen_cleared)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1729 screen_cleared = MAYBE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1730
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1731 // If there are no changes on the screen that require a complete redraw,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1732 // handle three cases:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1733 // 1: we are off the top of the screen by a few lines: scroll down
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1734 // 2: wp->w_topline is below wp->w_lines[0].wl_lnum: may scroll up
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1735 // 3: wp->w_topline is wp->w_lines[0].wl_lnum: find first entry in
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1736 // w_lines[] that needs updating.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1737 if ((type == VALID || type == SOME_VALID
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1738 || type == INVERTED || type == INVERTED_ALL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1739 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1740 && !wp->w_botfill && !wp->w_old_botfill
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1741 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1742 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1743 {
21590
5f4a188dead8 patch 8.2.1345: Redraw error when using visual block and scroll
Bram Moolenaar <Bram@vim.org>
parents: 20201
diff changeset
1744 if (mod_top != 0
5f4a188dead8 patch 8.2.1345: Redraw error when using visual block and scroll
Bram Moolenaar <Bram@vim.org>
parents: 20201
diff changeset
1745 && wp->w_topline == mod_top
5f4a188dead8 patch 8.2.1345: Redraw error when using visual block and scroll
Bram Moolenaar <Bram@vim.org>
parents: 20201
diff changeset
1746 && (!wp->w_lines[0].wl_valid
28201
bdd6df4832ba patch 8.2.4626: Visual area not updated when removing sign in Visual mode
Bram Moolenaar <Bram@vim.org>
parents: 28177
diff changeset
1747 || wp->w_topline == wp->w_lines[0].wl_lnum))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1748 {
21590
5f4a188dead8 patch 8.2.1345: Redraw error when using visual block and scroll
Bram Moolenaar <Bram@vim.org>
parents: 20201
diff changeset
1749 // w_topline is the first changed line and window is not scrolled,
5f4a188dead8 patch 8.2.1345: Redraw error when using visual block and scroll
Bram Moolenaar <Bram@vim.org>
parents: 20201
diff changeset
1750 // the scrolling from changed lines will be done further down.
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1751 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1752 else if (wp->w_lines[0].wl_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1753 && (wp->w_topline < wp->w_lines[0].wl_lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1754 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1755 || (wp->w_topline == wp->w_lines[0].wl_lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1756 && wp->w_topfill > wp->w_old_topfill)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1757 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1758 ))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1759 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1760 // New topline is above old topline: May scroll down.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1761 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1762 if (hasAnyFolding(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1763 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1764 linenr_T ln;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1765
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1766 // count the number of lines we are off, counting a sequence
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1767 // of folded lines as one
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1768 j = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1769 for (ln = wp->w_topline; ln < wp->w_lines[0].wl_lnum; ++ln)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1770 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1771 ++j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1772 if (j >= wp->w_height - 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1773 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1774 (void)hasFoldingWin(wp, ln, NULL, &ln, TRUE, NULL);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1775 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1776 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1777 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1778 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1779 j = wp->w_lines[0].wl_lnum - wp->w_topline;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1780 if (j < wp->w_height - 2) // not too far off
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1781 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1782 i = plines_m_win(wp, wp->w_topline, wp->w_lines[0].wl_lnum - 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1783 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1784 // insert extra lines for previously invisible filler lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1785 if (wp->w_lines[0].wl_lnum != wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1786 i += diff_check_fill(wp, wp->w_lines[0].wl_lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1787 - wp->w_old_topfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1788 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1789 if (i < wp->w_height - 2) // less than a screen off
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1790 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1791 // Try to insert the correct number of lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1792 // If not the last window, delete the lines at the bottom.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1793 // win_ins_lines may fail when the terminal can't do it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1794 if (i > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1795 check_for_delay(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1796 if (win_ins_lines(wp, 0, i, FALSE, wp == firstwin) == OK)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1797 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1798 if (wp->w_lines_valid != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1799 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1800 // Need to update rows that are new, stop at the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1801 // first one that scrolled down.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1802 top_end = i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1803 scrolled_down = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1804
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1805 // Move the entries that were scrolled, disable
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1806 // the entries for the lines to be redrawn.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1807 if ((wp->w_lines_valid += j) > wp->w_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1808 wp->w_lines_valid = wp->w_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1809 for (idx = wp->w_lines_valid; idx - j >= 0; idx--)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1810 wp->w_lines[idx] = wp->w_lines[idx - j];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1811 while (idx >= 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1812 wp->w_lines[idx--].wl_valid = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1813 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1814 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1815 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1816 mid_start = 0; // redraw all lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1817 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1818 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1819 mid_start = 0; // redraw all lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1820 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1821 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1822 mid_start = 0; // redraw all lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1823 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1824 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1825 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1826 // New topline is at or below old topline: May scroll up.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1827 // When topline didn't change, find first entry in w_lines[] that
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1828 // needs updating.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1829
27158
a89cf47ba8ed patch 8.2.4108: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27154
diff changeset
1830 // Try to find wp->w_topline in wp->w_lines[].wl_lnum. The check
a89cf47ba8ed patch 8.2.4108: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27154
diff changeset
1831 // for "Rows" is in case "wl_size" is incorrect somehow.
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1832 j = -1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1833 row = 0;
27158
a89cf47ba8ed patch 8.2.4108: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27154
diff changeset
1834 for (i = 0; i < wp->w_lines_valid && i < Rows; i++)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1835 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1836 if (wp->w_lines[i].wl_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1837 && wp->w_lines[i].wl_lnum == wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1838 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1839 j = i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1840 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1841 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1842 row += wp->w_lines[i].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1843 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1844 if (j == -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1845 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1846 // if wp->w_topline is not in wp->w_lines[].wl_lnum redraw all
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1847 // lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1848 mid_start = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1849 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1850 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1851 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1852 // Try to delete the correct number of lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1853 // wp->w_topline is at wp->w_lines[i].wl_lnum.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1854 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1855 // If the topline didn't change, delete old filler lines,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1856 // otherwise delete filler lines of the new topline...
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1857 if (wp->w_lines[0].wl_lnum == wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1858 row += wp->w_old_topfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1859 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1860 row += diff_check_fill(wp, wp->w_topline);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1861 // ... but don't delete new filler lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1862 row -= wp->w_topfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1863 #endif
27158
a89cf47ba8ed patch 8.2.4108: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27154
diff changeset
1864 if (row > Rows) // just in case
a89cf47ba8ed patch 8.2.4108: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27154
diff changeset
1865 row = Rows;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1866 if (row > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1867 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1868 check_for_delay(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1869 if (win_del_lines(wp, 0, row, FALSE, wp == firstwin, 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1870 == OK)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1871 bot_start = wp->w_height - row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1872 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1873 mid_start = 0; // redraw all lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1874 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1875 if ((row == 0 || bot_start < 999) && wp->w_lines_valid != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1876 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1877 // Skip the lines (below the deleted lines) that are still
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1878 // valid and don't need redrawing. Copy their info
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1879 // upwards, to compensate for the deleted lines. Set
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1880 // bot_start to the first row that needs redrawing.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1881 bot_start = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1882 idx = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1883 for (;;)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1884 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1885 wp->w_lines[idx] = wp->w_lines[j];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1886 // stop at line that didn't fit, unless it is still
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1887 // valid (no lines deleted)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1888 if (row > 0 && bot_start + row
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1889 + (int)wp->w_lines[j].wl_size > wp->w_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1890 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1891 wp->w_lines_valid = idx + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1892 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1893 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1894 bot_start += wp->w_lines[idx++].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1895
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1896 // stop at the last valid entry in w_lines[].wl_size
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1897 if (++j >= wp->w_lines_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1898 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1899 wp->w_lines_valid = idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1900 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1901 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1902 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1903 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1904 // Correct the first entry for filler lines at the top
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1905 // when it won't get updated below.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1906 if (wp->w_p_diff && bot_start > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1907 wp->w_lines[0].wl_size =
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1908 plines_win_nofill(wp, wp->w_topline, TRUE)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1909 + wp->w_topfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1910 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1911 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1912 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1913 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1914
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1915 // When starting redraw in the first line, redraw all lines. When
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1916 // there is only one window it's probably faster to clear the screen
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1917 // first.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1918 if (mid_start == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1919 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1920 mid_end = wp->w_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1921 if (ONE_WINDOW && !WIN_IS_POPUP(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1922 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1923 // Clear the screen when it was not done by win_del_lines() or
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1924 // win_ins_lines() above, "screen_cleared" is FALSE or MAYBE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1925 // then.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1926 if (screen_cleared != TRUE)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1927 screenclear();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1928 // The screen was cleared, redraw the tab pages line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1929 if (redraw_tabline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1930 draw_tabline();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1931 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1932 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1933
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1934 // When win_del_lines() or win_ins_lines() caused the screen to be
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1935 // cleared (only happens for the first window) or when screenclear()
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1936 // was called directly above, "must_redraw" will have been set to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1937 // NOT_VALID, need to reset it here to avoid redrawing twice.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1938 if (screen_cleared == TRUE)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1939 must_redraw = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1940 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1941 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1942 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1943 // Not VALID or INVERTED: redraw all lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1944 mid_start = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1945 mid_end = wp->w_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1946 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1947
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1948 if (type == SOME_VALID)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1949 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1950 // SOME_VALID: redraw all lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1951 mid_start = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1952 mid_end = wp->w_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1953 type = NOT_VALID;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1954 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1955
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1956 // check if we are updating or removing the inverted part
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1957 if ((VIsual_active && buf == curwin->w_buffer)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1958 || (wp->w_old_cursor_lnum != 0 && type != NOT_VALID))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1959 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1960 linenr_T from, to;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1961
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1962 if (VIsual_active)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1963 {
28169
bef82285dda0 patch 8.2.4610: some conditions are always true
Bram Moolenaar <Bram@vim.org>
parents: 28133
diff changeset
1964 if (VIsual_mode != wp->w_old_visual_mode
bef82285dda0 patch 8.2.4610: some conditions are always true
Bram Moolenaar <Bram@vim.org>
parents: 28133
diff changeset
1965 || type == INVERTED_ALL)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1966 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1967 // If the type of Visual selection changed, redraw the whole
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1968 // selection. Also when the ownership of the X selection is
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1969 // gained or lost.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1970 if (curwin->w_cursor.lnum < VIsual.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1971 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1972 from = curwin->w_cursor.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1973 to = VIsual.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1974 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1975 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1976 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1977 from = VIsual.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1978 to = curwin->w_cursor.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1979 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1980 // redraw more when the cursor moved as well
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1981 if (wp->w_old_cursor_lnum < from)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1982 from = wp->w_old_cursor_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1983 if (wp->w_old_cursor_lnum > to)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1984 to = wp->w_old_cursor_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1985 if (wp->w_old_visual_lnum < from)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1986 from = wp->w_old_visual_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1987 if (wp->w_old_visual_lnum > to)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1988 to = wp->w_old_visual_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1989 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1990 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1991 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1992 // Find the line numbers that need to be updated: The lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1993 // between the old cursor position and the current cursor
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1994 // position. Also check if the Visual position changed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1995 if (curwin->w_cursor.lnum < wp->w_old_cursor_lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1996 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1997 from = curwin->w_cursor.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1998 to = wp->w_old_cursor_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
1999 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2000 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2001 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2002 from = wp->w_old_cursor_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2003 to = curwin->w_cursor.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2004 if (from == 0) // Visual mode just started
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2005 from = to;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2006 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2007
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2008 if (VIsual.lnum != wp->w_old_visual_lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2009 || VIsual.col != wp->w_old_visual_col)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2010 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2011 if (wp->w_old_visual_lnum < from
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2012 && wp->w_old_visual_lnum != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2013 from = wp->w_old_visual_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2014 if (wp->w_old_visual_lnum > to)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2015 to = wp->w_old_visual_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2016 if (VIsual.lnum < from)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2017 from = VIsual.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2018 if (VIsual.lnum > to)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2019 to = VIsual.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2020 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2021 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2022
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2023 // If in block mode and changed column or curwin->w_curswant:
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2024 // update all lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2025 // First compute the actual start and end column.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2026 if (VIsual_mode == Ctrl_V)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2027 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2028 colnr_T fromc, toc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2029 #if defined(FEAT_LINEBREAK)
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
2030 int save_ve_flags = curwin->w_ve_flags;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2031
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2032 if (curwin->w_p_lbr)
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
2033 curwin->w_ve_flags = VE_ALL;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2034 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2035 getvcols(wp, &VIsual, &curwin->w_cursor, &fromc, &toc);
25116
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2036 ++toc;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2037 #if defined(FEAT_LINEBREAK)
25487
c26ff3203b43 patch 8.2.3280: 'virtualedit' local to buffer is not the best solution
Bram Moolenaar <Bram@vim.org>
parents: 25380
diff changeset
2038 curwin->w_ve_flags = save_ve_flags;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2039 #endif
25102
b7062becbfb5 patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 24527
diff changeset
2040 // Highlight to the end of the line, unless 'virtualedit' has
b7062becbfb5 patch 8.2.3088: with 'virtualedit' set to "block" Visual highlight is wrong
Bram Moolenaar <Bram@vim.org>
parents: 24527
diff changeset
2041 // "block".
25116
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2042 if (curwin->w_curswant == MAXCOL)
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2043 {
25380
ac88cd21ae88 patch 8.2.3227: 'virtualedit' can only be set globally
Bram Moolenaar <Bram@vim.org>
parents: 25334
diff changeset
2044 if (get_ve_flags() & VE_BLOCK)
25116
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2045 {
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2046 pos_T pos;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2047 int cursor_above =
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2048 curwin->w_cursor.lnum < VIsual.lnum;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2049
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2050 // Need to find the longest line.
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2051 toc = 0;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2052 pos.coladd = 0;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2053 for (pos.lnum = curwin->w_cursor.lnum; cursor_above
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2054 ? pos.lnum <= VIsual.lnum
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2055 : pos.lnum >= VIsual.lnum;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2056 pos.lnum += cursor_above ? 1 : -1)
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2057 {
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2058 colnr_T t;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2059
25192
0588ea998908 patch 8.2.3132: compiler warns for size_t to colnr_T conversion.
Bram Moolenaar <Bram@vim.org>
parents: 25151
diff changeset
2060 pos.col = (int)STRLEN(ml_get_buf(wp->w_buffer,
25116
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2061 pos.lnum, FALSE));
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2062 getvvcol(wp, &pos, NULL, NULL, &t);
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2063 if (toc < t)
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2064 toc = t;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2065 }
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2066 ++toc;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2067 }
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2068 else
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2069 toc = MAXCOL;
56817e74d106 patch 8.2.3095: with 'virtualedit' set to "block" block selection is wrong
Bram Moolenaar <Bram@vim.org>
parents: 25106
diff changeset
2070 }
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2071
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2072 if (fromc != wp->w_old_cursor_fcol
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2073 || toc != wp->w_old_cursor_lcol)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2074 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2075 if (from > VIsual.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2076 from = VIsual.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2077 if (to < VIsual.lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2078 to = VIsual.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2079 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2080 wp->w_old_cursor_fcol = fromc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2081 wp->w_old_cursor_lcol = toc;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2082 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2083 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2084 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2085 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2086 // Use the line numbers of the old Visual area.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2087 if (wp->w_old_cursor_lnum < wp->w_old_visual_lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2088 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2089 from = wp->w_old_cursor_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2090 to = wp->w_old_visual_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2091 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2092 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2093 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2094 from = wp->w_old_visual_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2095 to = wp->w_old_cursor_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2096 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2097 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2098
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2099 // There is no need to update lines above the top of the window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2100 if (from < wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2101 from = wp->w_topline;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2102
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2103 // If we know the value of w_botline, use it to restrict the update to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2104 // the lines that are visible in the window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2105 if (wp->w_valid & VALID_BOTLINE)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2106 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2107 if (from >= wp->w_botline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2108 from = wp->w_botline - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2109 if (to >= wp->w_botline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2110 to = wp->w_botline - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2111 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2112
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2113 // Find the minimal part to be updated.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2114 // Watch out for scrolling that made entries in w_lines[] invalid.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2115 // E.g., CTRL-U makes the first half of w_lines[] invalid and sets
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2116 // top_end; need to redraw from top_end to the "to" line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2117 // A middle mouse click with a Visual selection may change the text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2118 // above the Visual area and reset wl_valid, do count these for
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2119 // mid_end (in srow).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2120 if (mid_start > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2121 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2122 lnum = wp->w_topline;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2123 idx = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2124 srow = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2125 if (scrolled_down)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2126 mid_start = top_end;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2127 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2128 mid_start = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2129 while (lnum < from && idx < wp->w_lines_valid) // find start
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2130 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2131 if (wp->w_lines[idx].wl_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2132 mid_start += wp->w_lines[idx].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2133 else if (!scrolled_down)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2134 srow += wp->w_lines[idx].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2135 ++idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2136 # ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2137 if (idx < wp->w_lines_valid && wp->w_lines[idx].wl_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2138 lnum = wp->w_lines[idx].wl_lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2139 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2140 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2141 ++lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2142 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2143 srow += mid_start;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2144 mid_end = wp->w_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2145 for ( ; idx < wp->w_lines_valid; ++idx) // find end
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2146 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2147 if (wp->w_lines[idx].wl_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2148 && wp->w_lines[idx].wl_lnum >= to + 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2149 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2150 // Only update until first row of this line
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2151 mid_end = srow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2152 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2153 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2154 srow += wp->w_lines[idx].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2155 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2156 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2157 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2158
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2159 if (VIsual_active && buf == curwin->w_buffer)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2160 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2161 wp->w_old_visual_mode = VIsual_mode;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2162 wp->w_old_cursor_lnum = curwin->w_cursor.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2163 wp->w_old_visual_lnum = VIsual.lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2164 wp->w_old_visual_col = VIsual.col;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2165 wp->w_old_curswant = curwin->w_curswant;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2166 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2167 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2168 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2169 wp->w_old_visual_mode = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2170 wp->w_old_cursor_lnum = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2171 wp->w_old_visual_lnum = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2172 wp->w_old_visual_col = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2173 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2174
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2175 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2176 // reset got_int, otherwise regexp won't work
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2177 save_got_int = got_int;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2178 got_int = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2179 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2180 #ifdef SYN_TIME_LIMIT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2181 // Set the time limit to 'redrawtime'.
29218
48b36959a4fc patch 8.2.5128: syntax disabled when using synID() in searchpair() skip expr
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
2182 redrawtime_limit_set = TRUE;
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
2183 init_regexp_timeout(p_rdt);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2184 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2185 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2186 win_foldinfo.fi_level = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2187 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2188
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2189 #ifdef FEAT_MENU
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2190 // Draw the window toolbar, if there is one.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2191 // TODO: only when needed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2192 if (winbar_height(wp) > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2193 redraw_win_toolbar(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2194 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2195
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2196 // Update all the window rows.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2197 idx = 0; // first entry in w_lines[].wl_size
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2198 row = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2199 srow = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2200 lnum = wp->w_topline; // first line shown in window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2201 for (;;)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2202 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2203 // stop updating when reached the end of the window (check for _past_
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2204 // the end of the window is at the end of the loop)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2205 if (row == wp->w_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2206 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2207 didline = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2208 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2209 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2210
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2211 // stop updating when hit the end of the file
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2212 if (lnum > buf->b_ml.ml_line_count)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2213 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2214 eof = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2215 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2216 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2217
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2218 // Remember the starting row of the line that is going to be dealt
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2219 // with. It is used further down when the line doesn't fit.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2220 srow = row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2221
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2222 // Update a line when it is in an area that needs updating, when it
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2223 // has changes or w_lines[idx] is invalid.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2224 // "bot_start" may be halfway a wrapped line after using
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2225 // win_del_lines(), check if the current line includes it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2226 // When syntax folding is being used, the saved syntax states will
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2227 // already have been updated, we can't see where the syntax state is
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2228 // the same again, just update until the end of the window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2229 if (row < top_end
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2230 || (row >= mid_start && row < mid_end)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2231 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2232 || top_to_mod
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2233 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2234 || idx >= wp->w_lines_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2235 || (row + wp->w_lines[idx].wl_size > bot_start)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2236 || (mod_top != 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2237 && (lnum == mod_top
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2238 || (lnum >= mod_top
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2239 && (lnum < mod_bot
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2240 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2241 || did_update == DID_FOLD
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2242 || (did_update == DID_LINE
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2243 && syntax_present(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2244 && (
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2245 # ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2246 (foldmethodIsSyntax(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2247 && hasAnyFolding(wp)) ||
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2248 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2249 syntax_check_changed(lnum)))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2250 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2251 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2252 // match in fixed position might need redraw
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2253 // if lines were inserted or deleted
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2254 || (wp->w_match_head != NULL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2255 && buf->b_mod_xlines != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2256 #endif
18440
d6cb1e706fb7 patch 8.1.2214: too much is redrawn when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 18124
diff changeset
2257 ))))
d6cb1e706fb7 patch 8.1.2214: too much is redrawn when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 18124
diff changeset
2258 #ifdef FEAT_SYN_HL
28177
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2259 || (wp->w_p_cul && lnum == wp->w_cursor.lnum)
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2260 || lnum == wp->w_last_cursorline
18440
d6cb1e706fb7 patch 8.1.2214: too much is redrawn when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 18124
diff changeset
2261 #endif
d6cb1e706fb7 patch 8.1.2214: too much is redrawn when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 18124
diff changeset
2262 )
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2263 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2264 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2265 if (lnum == mod_top)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2266 top_to_mod = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2267 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2268
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2269 // When at start of changed lines: May scroll following lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2270 // up or down to minimize redrawing.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2271 // Don't do this when the change continues until the end.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2272 // Don't scroll when dollar_vcol >= 0, keep the "$".
25334
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 25192
diff changeset
2273 // Don't scroll when redrawing the top, scrolled already above.
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2274 if (lnum == mod_top
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2275 && mod_bot != MAXLNUM
25334
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 25192
diff changeset
2276 && !(dollar_vcol >= 0 && mod_bot == mod_top + 1)
c11fc61b0872 patch 8.2.3204: display garbled when 'cursorline' is set and lines wrap
Bram Moolenaar <Bram@vim.org>
parents: 25192
diff changeset
2277 && row >= top_end)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2278 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2279 int old_rows = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2280 int new_rows = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2281 int xtra_rows;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2282 linenr_T l;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2283
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2284 // Count the old number of window rows, using w_lines[], which
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2285 // should still contain the sizes for the lines as they are
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2286 // currently displayed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2287 for (i = idx; i < wp->w_lines_valid; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2288 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2289 // Only valid lines have a meaningful wl_lnum. Invalid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2290 // lines are part of the changed area.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2291 if (wp->w_lines[i].wl_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2292 && wp->w_lines[i].wl_lnum == mod_bot)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2293 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2294 old_rows += wp->w_lines[i].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2295 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2296 if (wp->w_lines[i].wl_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2297 && wp->w_lines[i].wl_lastlnum + 1 == mod_bot)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2298 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2299 // Must have found the last valid entry above mod_bot.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2300 // Add following invalid entries.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2301 ++i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2302 while (i < wp->w_lines_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2303 && !wp->w_lines[i].wl_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2304 old_rows += wp->w_lines[i++].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2305 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2306 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2307 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2308 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2309
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2310 if (i >= wp->w_lines_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2311 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2312 // We can't find a valid line below the changed lines,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2313 // need to redraw until the end of the window.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2314 // Inserting/deleting lines has no use.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2315 bot_start = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2316 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2317 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2318 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2319 // Able to count old number of rows: Count new window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2320 // rows, and may insert/delete lines
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2321 j = idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2322 for (l = lnum; l < mod_bot; ++l)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2323 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2324 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2325 if (hasFoldingWin(wp, l, NULL, &l, TRUE, NULL))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2326 ++new_rows;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2327 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2328 #endif
26003
37852c2bf3d4 patch 8.2.3535: if-else indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents: 25907
diff changeset
2329 {
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2330 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2331 if (l == wp->w_topline)
26003
37852c2bf3d4 patch 8.2.3535: if-else indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents: 25907
diff changeset
2332 new_rows += plines_win_nofill(wp, l, TRUE)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2333 + wp->w_topfill;
26003
37852c2bf3d4 patch 8.2.3535: if-else indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents: 25907
diff changeset
2334 else
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2335 #endif
26003
37852c2bf3d4 patch 8.2.3535: if-else indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents: 25907
diff changeset
2336 new_rows += plines_win(wp, l, TRUE);
37852c2bf3d4 patch 8.2.3535: if-else indenting is confusing
Bram Moolenaar <Bram@vim.org>
parents: 25907
diff changeset
2337 }
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2338 ++j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2339 if (new_rows > wp->w_height - row - 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2340 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2341 // it's getting too much, must redraw the rest
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2342 new_rows = 9999;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2343 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2344 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2345 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2346 xtra_rows = new_rows - old_rows;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2347 if (xtra_rows < 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2348 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2349 // May scroll text up. If there is not enough
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2350 // remaining text or scrolling fails, must redraw the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2351 // rest. If scrolling works, must redraw the text
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2352 // below the scrolled text.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2353 if (row - xtra_rows >= wp->w_height - 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2354 mod_bot = MAXLNUM;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2355 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2356 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2357 check_for_delay(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2358 if (win_del_lines(wp, row,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2359 -xtra_rows, FALSE, FALSE, 0) == FAIL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2360 mod_bot = MAXLNUM;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2361 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2362 bot_start = wp->w_height + xtra_rows;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2363 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2364 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2365 else if (xtra_rows > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2366 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2367 // May scroll text down. If there is not enough
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2368 // remaining text of scrolling fails, must redraw the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2369 // rest.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2370 if (row + xtra_rows >= wp->w_height - 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2371 mod_bot = MAXLNUM;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2372 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2373 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2374 check_for_delay(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2375 if (win_ins_lines(wp, row + old_rows,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2376 xtra_rows, FALSE, FALSE) == FAIL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2377 mod_bot = MAXLNUM;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2378 else if (top_end > row + old_rows)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2379 // Scrolled the part at the top that requires
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2380 // updating down.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2381 top_end += xtra_rows;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2382 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2383 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2384
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2385 // When not updating the rest, may need to move w_lines[]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2386 // entries.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2387 if (mod_bot != MAXLNUM && i != j)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2388 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2389 if (j < i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2390 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2391 int x = row + new_rows;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2392
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2393 // move entries in w_lines[] upwards
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2394 for (;;)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2395 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2396 // stop at last valid entry in w_lines[]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2397 if (i >= wp->w_lines_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2398 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2399 wp->w_lines_valid = j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2400 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2401 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2402 wp->w_lines[j] = wp->w_lines[i];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2403 // stop at a line that won't fit
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2404 if (x + (int)wp->w_lines[j].wl_size
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2405 > wp->w_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2406 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2407 wp->w_lines_valid = j + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2408 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2409 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2410 x += wp->w_lines[j++].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2411 ++i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2412 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2413 if (bot_start > x)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2414 bot_start = x;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2415 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2416 else // j > i
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2417 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2418 // move entries in w_lines[] downwards
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2419 j -= i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2420 wp->w_lines_valid += j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2421 if (wp->w_lines_valid > wp->w_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2422 wp->w_lines_valid = wp->w_height;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2423 for (i = wp->w_lines_valid; i - j >= idx; --i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2424 wp->w_lines[i] = wp->w_lines[i - j];
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2425
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2426 // The w_lines[] entries for inserted lines are
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2427 // now invalid, but wl_size may be used above.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2428 // Reset to zero.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2429 while (i >= idx)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2430 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2431 wp->w_lines[i].wl_size = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2432 wp->w_lines[i--].wl_valid = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2433 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2434 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2435 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2436 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2437 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2438
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2439 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2440 // When lines are folded, display one line for all of them.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2441 // Otherwise, display normally (can be several display lines when
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2442 // 'wrap' is on).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2443 fold_count = foldedCount(wp, lnum, &win_foldinfo);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2444 if (fold_count != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2445 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2446 fold_line(wp, fold_count, &win_foldinfo, lnum, row);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2447 ++row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2448 --fold_count;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2449 wp->w_lines[idx].wl_folded = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2450 wp->w_lines[idx].wl_lastlnum = lnum + fold_count;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2451 # ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2452 did_update = DID_FOLD;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2453 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2454 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2455 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2456 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2457 if (idx < wp->w_lines_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2458 && wp->w_lines[idx].wl_valid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2459 && wp->w_lines[idx].wl_lnum == lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2460 && lnum > wp->w_topline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2461 && !(dy_flags & (DY_LASTLINE | DY_TRUNCATE))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2462 && !WIN_IS_POPUP(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2463 && srow + wp->w_lines[idx].wl_size > wp->w_height
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2464 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2465 && diff_check_fill(wp, lnum) == 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2466 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2467 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2468 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2469 // This line is not going to fit. Don't draw anything here,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2470 // will draw "@ " lines below.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2471 row = wp->w_height + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2472 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2473 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2474 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2475 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2476 prepare_search_hl(wp, &screen_search_hl, lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2477 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2478 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2479 // Let the syntax stuff know we skipped a few lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2480 if (syntax_last_parsed != 0 && syntax_last_parsed + 1 < lnum
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2481 && syntax_present(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2482 syntax_end_parsing(syntax_last_parsed + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2483 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2484
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2485 // Display one line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2486 row = win_line(wp, lnum, srow, wp->w_height,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2487 mod_top == 0, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2488
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2489 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2490 wp->w_lines[idx].wl_folded = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2491 wp->w_lines[idx].wl_lastlnum = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2492 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2493 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2494 did_update = DID_LINE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2495 syntax_last_parsed = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2496 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2497 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2498
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2499 wp->w_lines[idx].wl_lnum = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2500 wp->w_lines[idx].wl_valid = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2501
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2502 // Past end of the window or end of the screen. Note that after
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2503 // resizing wp->w_height may be end up too big. That's a problem
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2504 // elsewhere, but prevent a crash here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2505 if (row > wp->w_height || row + wp->w_winrow >= Rows)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2506 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2507 // we may need the size of that too long line later on
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2508 if (dollar_vcol == -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2509 wp->w_lines[idx].wl_size = plines_win(wp, lnum, TRUE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2510 ++idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2511 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2512 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2513 if (dollar_vcol == -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2514 wp->w_lines[idx].wl_size = row - srow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2515 ++idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2516 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2517 lnum += fold_count + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2518 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2519 ++lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2520 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2521 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2522 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2523 {
28236
3f6c0a5c99bb patch 8.2.4644: redrawing too often when 'relativenumber' is set
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
2524 if (wp->w_p_rnu && wp->w_last_cursor_lnum_rnu != wp->w_cursor.lnum)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2525 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2526 #ifdef FEAT_FOLDING
28236
3f6c0a5c99bb patch 8.2.4644: redrawing too often when 'relativenumber' is set
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
2527 // 'relativenumber' set and the cursor moved vertically: The
3f6c0a5c99bb patch 8.2.4644: redrawing too often when 'relativenumber' is set
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
2528 // text doesn't need to be drawn, but the number column does.
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2529 fold_count = foldedCount(wp, lnum, &win_foldinfo);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2530 if (fold_count != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2531 fold_line(wp, fold_count, &win_foldinfo, lnum, row);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2532 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2533 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2534 (void)win_line(wp, lnum, srow, wp->w_height, TRUE, TRUE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2535 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2536
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2537 // This line does not need to be drawn, advance to the next one.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2538 row += wp->w_lines[idx++].wl_size;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2539 if (row > wp->w_height) // past end of screen
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2540 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2541 #ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2542 lnum = wp->w_lines[idx - 1].wl_lastlnum + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2543 #else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2544 ++lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2545 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2546 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2547 did_update = DID_NONE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2548 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2549 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2550
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2551 if (lnum > buf->b_ml.ml_line_count)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2552 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2553 eof = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2554 break;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2555 }
27154
6d7fe3af5aa2 patch 8.2.4106: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
2556
6d7fe3af5aa2 patch 8.2.4106: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
2557 // Safety check: if any of the wl_size values is wrong we might go over
6d7fe3af5aa2 patch 8.2.4106: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
2558 // the end of w_lines[].
6d7fe3af5aa2 patch 8.2.4106: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
2559 if (idx >= Rows)
6d7fe3af5aa2 patch 8.2.4106: going over the end of the w_lines array
Bram Moolenaar <Bram@vim.org>
parents: 27090
diff changeset
2560 break;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2561 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2562
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2563 // End of loop over all window lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2564
28177
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2565 #ifdef FEAT_SYN_HL
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2566 // Now that the window has been redrawn with the old and new cursor line,
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2567 // update w_last_cursorline.
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2568 wp->w_last_cursorline = wp->w_p_cul ? wp->w_cursor.lnum : 0;
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2569 #endif
28236
3f6c0a5c99bb patch 8.2.4644: redrawing too often when 'relativenumber' is set
Bram Moolenaar <Bram@vim.org>
parents: 28224
diff changeset
2570 wp->w_last_cursor_lnum_rnu = wp->w_p_rnu ? wp->w_cursor.lnum : 0;
28177
f04a3ec65e2d patch 8.2.4614: redrawing too much when 'cursorline' is set
Bram Moolenaar <Bram@vim.org>
parents: 28169
diff changeset
2571
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2572 #ifdef FEAT_VTP
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2573 // Rewrite the character at the end of the screen line.
20201
304015471ae9 patch 8.2.0656: MS-Windows: redrawing right screen edge may not be needed
Bram Moolenaar <Bram@vim.org>
parents: 19934
diff changeset
2574 // See the version that was fixed.
304015471ae9 patch 8.2.0656: MS-Windows: redrawing right screen edge may not be needed
Bram Moolenaar <Bram@vim.org>
parents: 19934
diff changeset
2575 if (use_vtp() && get_conpty_fix_type() < 1)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2576 {
27523
4c7bb6fd383f patch 8.2.4289: warnings reported by MSVC
Bram Moolenaar <Bram@vim.org>
parents: 27426
diff changeset
2577 int k;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2578
27523
4c7bb6fd383f patch 8.2.4289: warnings reported by MSVC
Bram Moolenaar <Bram@vim.org>
parents: 27426
diff changeset
2579 for (k = 0; k < Rows; ++k)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2580 if (enc_utf8)
27523
4c7bb6fd383f patch 8.2.4289: warnings reported by MSVC
Bram Moolenaar <Bram@vim.org>
parents: 27426
diff changeset
2581 if ((*mb_off2cells)(LineOffset[k] + Columns - 2,
4c7bb6fd383f patch 8.2.4289: warnings reported by MSVC
Bram Moolenaar <Bram@vim.org>
parents: 27426
diff changeset
2582 LineOffset[k] + screen_Columns) > 1)
4c7bb6fd383f patch 8.2.4289: warnings reported by MSVC
Bram Moolenaar <Bram@vim.org>
parents: 27426
diff changeset
2583 screen_draw_rectangle(k, Columns - 2, 1, 2, FALSE);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2584 else
27523
4c7bb6fd383f patch 8.2.4289: warnings reported by MSVC
Bram Moolenaar <Bram@vim.org>
parents: 27426
diff changeset
2585 screen_draw_rectangle(k, Columns - 1, 1, 1, FALSE);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2586 else
27523
4c7bb6fd383f patch 8.2.4289: warnings reported by MSVC
Bram Moolenaar <Bram@vim.org>
parents: 27426
diff changeset
2587 screen_char(LineOffset[k] + Columns - 1, k, Columns - 1);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2588 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2589 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2590
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2591 if (idx > wp->w_lines_valid)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2592 wp->w_lines_valid = idx;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2593
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2594 #ifdef FEAT_SYN_HL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2595 // Let the syntax stuff know we stop parsing here.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2596 if (syntax_last_parsed != 0 && syntax_present(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2597 syntax_end_parsing(syntax_last_parsed + 1);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2598 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2599
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2600 // If we didn't hit the end of the file, and we didn't finish the last
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2601 // line we were working on, then the line didn't fit.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2602 wp->w_empty_rows = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2603 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2604 wp->w_filler_rows = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2605 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2606 if (!eof && !didline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2607 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2608 if (lnum == wp->w_topline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2609 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2610 // Single line that does not fit!
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2611 // Don't overwrite it, it can be edited.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2612 wp->w_botline = lnum + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2613 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2614 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2615 else if (diff_check_fill(wp, lnum) >= wp->w_height - srow)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2616 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2617 // Window ends in filler lines.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2618 wp->w_botline = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2619 wp->w_filler_rows = wp->w_height - srow;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2620 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2621 #endif
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
2622 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2623 else if (WIN_IS_POPUP(wp))
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2624 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2625 // popup line that doesn't fit is left as-is
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2626 wp->w_botline = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2627 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2628 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2629 else if (dy_flags & DY_TRUNCATE) // 'display' has "truncate"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2630 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2631 int scr_row = W_WINROW(wp) + wp->w_height - 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2632
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2633 // Last line isn't finished: Display "@@@" in the last screen line.
28386
cf41a1f469f6 patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents: 28236
diff changeset
2634 screen_puts_len((char_u *)"@@", wp->w_width > 2 ? 2 : wp->w_width,
cf41a1f469f6 patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents: 28236
diff changeset
2635 scr_row, wp->w_wincol, HL_ATTR(HLF_AT));
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2636 screen_fill(scr_row, scr_row + 1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2637 (int)wp->w_wincol + 2, (int)W_ENDCOL(wp),
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2638 '@', ' ', HL_ATTR(HLF_AT));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2639 set_empty_rows(wp, srow);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2640 wp->w_botline = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2641 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2642 else if (dy_flags & DY_LASTLINE) // 'display' has "lastline"
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2643 {
28386
cf41a1f469f6 patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents: 28236
diff changeset
2644 int start_col = (int)W_ENDCOL(wp) - 3;
cf41a1f469f6 patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents: 28236
diff changeset
2645
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2646 // Last line isn't finished: Display "@@@" at the end.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2647 screen_fill(W_WINROW(wp) + wp->w_height - 1,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2648 W_WINROW(wp) + wp->w_height,
28386
cf41a1f469f6 patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents: 28236
diff changeset
2649 start_col < wp->w_wincol ? wp->w_wincol : start_col,
cf41a1f469f6 patch 8.2.4718: @@@ in the last line sometimes drawn in the wrong place
Bram Moolenaar <Bram@vim.org>
parents: 28236
diff changeset
2650 (int)W_ENDCOL(wp),
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2651 '@', '@', HL_ATTR(HLF_AT));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2652 set_empty_rows(wp, srow);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2653 wp->w_botline = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2654 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2655 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2656 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2657 win_draw_end(wp, '@', ' ', TRUE, srow, wp->w_height, HLF_AT);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2658 wp->w_botline = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2659 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2660 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2661 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2662 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2663 draw_vsep_win(wp, row);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2664 if (eof) // we hit the end of the file
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2665 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2666 wp->w_botline = buf->b_ml.ml_line_count + 1;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2667 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2668 j = diff_check_fill(wp, wp->w_botline);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2669 if (j > 0 && !wp->w_botfill)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2670 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2671 // Display filler lines at the end of the file.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2672 if (char2cells(fill_diff) > 1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2673 i = '-';
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2674 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2675 i = fill_diff;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2676 if (row + j > wp->w_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2677 j = wp->w_height - row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2678 win_draw_end(wp, i, i, TRUE, row, row + (int)j, HLF_DED);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2679 row += j;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2680 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2681 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2682 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2683 else if (dollar_vcol == -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2684 wp->w_botline = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2685
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2686 // Make sure the rest of the screen is blank
23932
4549133c1e77 patch 8.2.2508: cannot change the character displayed in non existing lines
Bram Moolenaar <Bram@vim.org>
parents: 21877
diff changeset
2687 // write the 'fill_eob' character to rows that aren't part of the file
18586
78e43be18f6b patch 8.1.2287: using EndOfBuffer highlight in popup does not look good
Bram Moolenaar <Bram@vim.org>
parents: 18440
diff changeset
2688 if (WIN_IS_POPUP(wp))
78e43be18f6b patch 8.1.2287: using EndOfBuffer highlight in popup does not look good
Bram Moolenaar <Bram@vim.org>
parents: 18440
diff changeset
2689 win_draw_end(wp, ' ', ' ', FALSE, row, wp->w_height, HLF_AT);
78e43be18f6b patch 8.1.2287: using EndOfBuffer highlight in popup does not look good
Bram Moolenaar <Bram@vim.org>
parents: 18440
diff changeset
2690 else
23932
4549133c1e77 patch 8.2.2508: cannot change the character displayed in non existing lines
Bram Moolenaar <Bram@vim.org>
parents: 21877
diff changeset
2691 win_draw_end(wp, fill_eob, ' ', FALSE, row, wp->w_height, HLF_EOB);
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2692 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2693
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2694 #ifdef SYN_TIME_LIMIT
29071
b90bca860b5a patch 8.2.5057: using gettimeofday() for timeout is very inefficient
Bram Moolenaar <Bram@vim.org>
parents: 29050
diff changeset
2695 disable_regexp_timeout();
29218
48b36959a4fc patch 8.2.5128: syntax disabled when using synID() in searchpair() skip expr
Bram Moolenaar <Bram@vim.org>
parents: 29071
diff changeset
2696 redrawtime_limit_set = FALSE;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2697 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2698
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2699 // Reset the type of redrawing required, the window has been updated.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2700 wp->w_redr_type = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2701 #ifdef FEAT_DIFF
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2702 wp->w_old_topfill = wp->w_topfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2703 wp->w_old_botfill = wp->w_botfill;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2704 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2705
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2706 if (dollar_vcol == -1)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2707 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2708 // There is a trick with w_botline. If we invalidate it on each
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2709 // change that might modify it, this will cause a lot of expensive
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2710 // calls to plines() in update_topline() each time. Therefore the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2711 // value of w_botline is often approximated, and this value is used to
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2712 // compute the value of w_topline. If the value of w_botline was
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2713 // wrong, check that the value of w_topline is correct (cursor is on
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2714 // the visible part of the text). If it's not, we need to redraw
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2715 // again. Mostly this just means scrolling up a few lines, so it
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2716 // doesn't look too bad. Only do this for the current window (where
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2717 // changes are relevant).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2718 wp->w_valid |= VALID_BOTLINE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2719 if (wp == curwin && wp->w_botline != old_botline && !recursive)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2720 {
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2721 win_T *wwp;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2722 #if defined(FEAT_CONCEAL)
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2723 linenr_T old_topline = wp->w_topline;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2724 int new_wcol = wp->w_wcol;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2725 #endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2726 recursive = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2727 curwin->w_valid &= ~VALID_TOPLINE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2728 update_topline(); // may invalidate w_botline again
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2729
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2730 #if defined(FEAT_CONCEAL)
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2731 if (old_wcol != new_wcol && (wp->w_valid & (VALID_WCOL|VALID_WROW))
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2732 != (VALID_WCOL|VALID_WROW))
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2733 {
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2734 // A win_line() call applied a fix to screen cursor column to
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
2735 // accommodate concealment of cursor line, but in this call to
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2736 // update_topline() the cursor's row or column got invalidated.
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2737 // If they are left invalid, setcursor() will recompute them
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2738 // but there won't be any further win_line() call to re-fix the
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2739 // column and the cursor will end up misplaced. So we call
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2740 // cursor validation now and reapply the fix again (or call
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2741 // win_line() to do it for us).
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2742 validate_cursor();
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2743 if (wp->w_wcol == old_wcol && wp->w_wrow == old_wrow
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2744 && old_topline == wp->w_topline)
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2745 wp->w_wcol = new_wcol;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2746 else
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2747 redrawWinline(wp, wp->w_cursor.lnum);
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2748 }
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2749 #endif
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2750 // New redraw either due to updated topline or due to wcol fix.
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2751 if (wp->w_redr_type != 0)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2752 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2753 // Don't update for changes in buffer again.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2754 i = curbuf->b_mod_set;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2755 curbuf->b_mod_set = FALSE;
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2756 j = curbuf->b_mod_xlines;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2757 curbuf->b_mod_xlines = 0;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2758 win_update(curwin);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2759 curbuf->b_mod_set = i;
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2760 curbuf->b_mod_xlines = j;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2761 }
18601
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2762 // Other windows might have w_redr_type raised in update_topline().
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2763 must_redraw = 0;
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2764 FOR_ALL_WINDOWS(wwp)
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2765 if (wwp->w_redr_type > must_redraw)
e4b03b369c41 patch 8.1.2294: cursor pos wrong with concealing and search causes a scroll
Bram Moolenaar <Bram@vim.org>
parents: 18586
diff changeset
2766 must_redraw = wwp->w_redr_type;
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2767 recursive = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2768 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2769 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2770
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2771 #if defined(FEAT_SYN_HL) || defined(FEAT_SEARCH_EXTRA)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2772 // restore got_int, unless CTRL-C was hit while redrawing
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2773 if (!got_int)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2774 got_int = save_got_int;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2775 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2776 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2777
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2778 #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_GUI)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2779 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2780 * Prepare for updating one or more windows.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2781 * Caller must check for "updating_screen" already set to avoid recursiveness.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2782 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2783 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2784 update_prepare(void)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2785 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2786 cursor_off();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2787 updating_screen = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2788 #ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2789 // Remove the cursor before starting to do anything, because scrolling may
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2790 // make it difficult to redraw the text under it.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2791 if (gui.in_use)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2792 gui_undraw_cursor();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2793 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2794 #ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2795 start_search_hl();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2796 #endif
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
2797 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2798 // Update popup_mask if needed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2799 may_update_popup_mask(must_redraw);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2800 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2801 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2802
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2803 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2804 * Finish updating one or more windows.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2805 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2806 static void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2807 update_finish(void)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2808 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2809 if (redraw_cmdline || redraw_mode)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2810 showmode();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2811
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2812 # ifdef FEAT_SEARCH_EXTRA
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2813 end_search_hl();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2814 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2815
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2816 after_updating_screen(TRUE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2817
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2818 # ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2819 // Redraw the cursor and update the scrollbars when all screen updating is
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2820 // done.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2821 if (gui.in_use)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2822 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2823 out_flush_cursor(FALSE, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2824 gui_update_scrollbars(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2825 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2826 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2827 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2828 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2829
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2830 #if defined(FEAT_NETBEANS_INTG) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2831 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2832 update_debug_sign(buf_T *buf, linenr_T lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2833 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2834 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2835 int doit = FALSE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2836
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2837 # ifdef FEAT_FOLDING
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2838 win_foldinfo.fi_level = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2839 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2840
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2841 // update/delete a specific sign
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2842 redraw_buf_line_later(buf, lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2843
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2844 // check if it resulted in the need to redraw a window
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2845 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2846 if (wp->w_redr_type != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2847 doit = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2848
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2849 // Return when there is nothing to do, screen updating is already
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2850 // happening (recursive call), messages on the screen or still starting up.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2851 if (!doit || updating_screen
28773
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
2852 || State == MODE_ASKMORE || State == MODE_HITRETURN
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2853 || msg_scrolled
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2854 #ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2855 || gui.starting
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2856 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2857 || starting)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2858 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2859
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2860 // update all windows that need updating
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2861 update_prepare();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2862
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2863 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2864 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2865 if (wp->w_redr_type != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2866 win_update(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2867 if (wp->w_redr_status)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2868 win_redr_status(wp, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2869 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2870
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2871 update_finish();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2872 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2873 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2874
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2875 #if defined(FEAT_GUI) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2876 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2877 * Update a single window, its status line and maybe the command line msg.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2878 * Used for the GUI scrollbar.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2879 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2880 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2881 updateWindow(win_T *wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2882 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2883 // return if already busy updating
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2884 if (updating_screen)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2885 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2886
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2887 update_prepare();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2888
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2889 #ifdef FEAT_CLIPBOARD
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2890 // When Visual area changed, may have to update selection.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2891 if (clip_star.available && clip_isautosel_star())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2892 clip_update_selection(&clip_star);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2893 if (clip_plus.available && clip_isautosel_plus())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2894 clip_update_selection(&clip_plus);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2895 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2896
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2897 win_update(wp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2898
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2899 // When the screen was cleared redraw the tab pages line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2900 if (redraw_tabline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2901 draw_tabline();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2902
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2903 if (wp->w_redr_status
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2904 # ifdef FEAT_CMDL_INFO
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2905 || p_ru
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2906 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2907 # ifdef FEAT_STL_OPT
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2908 || *p_stl != NUL || *wp->w_p_stl != NUL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2909 # endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2910 )
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2911 win_redr_status(wp, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2912
18763
49b78d6465e5 patch 8.1.2371: FEAT_TEXT_PROP is a confusing name
Bram Moolenaar <Bram@vim.org>
parents: 18601
diff changeset
2913 #ifdef FEAT_PROP_POPUP
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2914 // Display popup windows on top of everything.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2915 update_popups(win_update);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2916 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2917
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2918 update_finish();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2919 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2920 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2921
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2922 #if defined(FEAT_TERMRESPONSE) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2923 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2924 * Redraw as soon as possible. When the command line is not scrolled redraw
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2925 * right away and restore what was on the command line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2926 * Return a code indicating what happened.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2927 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2928 int
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2929 redraw_asap(int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2930 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2931 int rows;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2932 int cols = screen_Columns;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2933 int r;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2934 int ret = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2935 schar_T *screenline; // copy from ScreenLines[]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2936 sattr_T *screenattr; // copy from ScreenAttrs[]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2937 int i;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2938 u8char_T *screenlineUC = NULL; // copy from ScreenLinesUC[]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2939 u8char_T *screenlineC[MAX_MCO]; // copy from ScreenLinesC[][]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2940 schar_T *screenline2 = NULL; // copy from ScreenLines2[]
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2941
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2942 redraw_later(type);
28773
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
2943 if (msg_scrolled || (State != MODE_NORMAL && State != MODE_NORMAL_BUSY)
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
2944 || exiting)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2945 return ret;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2946
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2947 // Allocate space to save the text displayed in the command line area.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2948 rows = screen_Rows - cmdline_row;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2949 screenline = LALLOC_MULT(schar_T, rows * cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2950 screenattr = LALLOC_MULT(sattr_T, rows * cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2951 if (screenline == NULL || screenattr == NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2952 ret = 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2953 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2954 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2955 screenlineUC = LALLOC_MULT(u8char_T, rows * cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2956 if (screenlineUC == NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2957 ret = 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2958 for (i = 0; i < p_mco; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2959 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2960 screenlineC[i] = LALLOC_MULT(u8char_T, rows * cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2961 if (screenlineC[i] == NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2962 ret = 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2963 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2964 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2965 if (enc_dbcs == DBCS_JPNU)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2966 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2967 screenline2 = LALLOC_MULT(schar_T, rows * cols);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2968 if (screenline2 == NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2969 ret = 2;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2970 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2971
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2972 if (ret != 2)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2973 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2974 // Save the text displayed in the command line area.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2975 for (r = 0; r < rows; ++r)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2976 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2977 mch_memmove(screenline + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2978 ScreenLines + LineOffset[cmdline_row + r],
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2979 (size_t)cols * sizeof(schar_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2980 mch_memmove(screenattr + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2981 ScreenAttrs + LineOffset[cmdline_row + r],
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2982 (size_t)cols * sizeof(sattr_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2983 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2984 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2985 mch_memmove(screenlineUC + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2986 ScreenLinesUC + LineOffset[cmdline_row + r],
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2987 (size_t)cols * sizeof(u8char_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2988 for (i = 0; i < p_mco; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2989 mch_memmove(screenlineC[i] + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2990 ScreenLinesC[i] + LineOffset[cmdline_row + r],
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2991 (size_t)cols * sizeof(u8char_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2992 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2993 if (enc_dbcs == DBCS_JPNU)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2994 mch_memmove(screenline2 + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2995 ScreenLines2 + LineOffset[cmdline_row + r],
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2996 (size_t)cols * sizeof(schar_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2997 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2998
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
2999 update_screen(0);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3000 ret = 3;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3001
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3002 if (must_redraw == 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3003 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3004 int off = (int)(current_ScreenLine - ScreenLines);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3005
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3006 // Restore the text displayed in the command line area.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3007 for (r = 0; r < rows; ++r)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3008 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3009 mch_memmove(current_ScreenLine,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3010 screenline + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3011 (size_t)cols * sizeof(schar_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3012 mch_memmove(ScreenAttrs + off,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3013 screenattr + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3014 (size_t)cols * sizeof(sattr_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3015 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3016 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3017 mch_memmove(ScreenLinesUC + off,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3018 screenlineUC + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3019 (size_t)cols * sizeof(u8char_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3020 for (i = 0; i < p_mco; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3021 mch_memmove(ScreenLinesC[i] + off,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3022 screenlineC[i] + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3023 (size_t)cols * sizeof(u8char_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3024 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3025 if (enc_dbcs == DBCS_JPNU)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3026 mch_memmove(ScreenLines2 + off,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3027 screenline2 + r * cols,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3028 (size_t)cols * sizeof(schar_T));
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3029 screen_line(cmdline_row + r, 0, cols, cols, 0);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3030 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3031 ret = 4;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3032 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3033 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3034
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3035 vim_free(screenline);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3036 vim_free(screenattr);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3037 if (enc_utf8)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3038 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3039 vim_free(screenlineUC);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3040 for (i = 0; i < p_mco; ++i)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3041 vim_free(screenlineC[i]);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3042 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3043 if (enc_dbcs == DBCS_JPNU)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3044 vim_free(screenline2);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3045
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3046 // Show the intro message when appropriate.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3047 maybe_intro_message();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3048
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3049 setcursor();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3050
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3051 return ret;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3052 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3053 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3054
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3055 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3056 * Invoked after an asynchronous callback is called.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3057 * If an echo command was used the cursor needs to be put back where
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3058 * it belongs. If highlighting was changed a redraw is needed.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3059 * If "call_update_screen" is FALSE don't call update_screen() when at the
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3060 * command line.
26466
d413104a94c8 patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents: 26336
diff changeset
3061 * If "redraw_message" is TRUE.
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3062 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3063 void
26466
d413104a94c8 patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents: 26336
diff changeset
3064 redraw_after_callback(int call_update_screen, int do_message)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3065 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3066 ++redrawing_for_callback;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3067
28773
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
3068 if (State == MODE_HITRETURN || State == MODE_ASKMORE
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
3069 || State == MODE_SETWSIZE || State == MODE_EXTERNCMD
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
3070 || State == MODE_CONFIRM || exmode_active)
26466
d413104a94c8 patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents: 26336
diff changeset
3071 {
d413104a94c8 patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents: 26336
diff changeset
3072 if (do_message)
d413104a94c8 patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents: 26336
diff changeset
3073 repeat_message();
d413104a94c8 patch 8.2.3763: when editing the cmdline a callback may cause a scroll up
Bram Moolenaar <Bram@vim.org>
parents: 26336
diff changeset
3074 }
28773
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
3075 else if (State & MODE_CMDLINE)
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3076 {
27597
4eb2bf8b2f27 patch 8.2.4325: 'wildmenu' only shows few matches
Bram Moolenaar <Bram@vim.org>
parents: 27523
diff changeset
3077 #ifdef FEAT_WILDMENU
4eb2bf8b2f27 patch 8.2.4325: 'wildmenu' only shows few matches
Bram Moolenaar <Bram@vim.org>
parents: 27523
diff changeset
3078 if (pum_visible())
4eb2bf8b2f27 patch 8.2.4325: 'wildmenu' only shows few matches
Bram Moolenaar <Bram@vim.org>
parents: 27523
diff changeset
3079 cmdline_pum_display();
4eb2bf8b2f27 patch 8.2.4325: 'wildmenu' only shows few matches
Bram Moolenaar <Bram@vim.org>
parents: 27523
diff changeset
3080 #endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3081 // Don't redraw when in prompt_for_number().
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3082 if (cmdline_row > 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3083 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3084 // Redrawing only works when the screen didn't scroll. Don't clear
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3085 // wildmenu entries.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3086 if (msg_scrolled == 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3087 #ifdef FEAT_WILDMENU
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3088 && wild_menu_showing == 0
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3089 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3090 && call_update_screen)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3091 update_screen(0);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3092
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3093 // Redraw in the same position, so that the user can continue
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3094 // editing the command.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3095 redrawcmdline_ex(FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3096 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3097 }
28773
d770568e6c98 patch 8.2.4911: the mode #defines are not clearly named
Bram Moolenaar <Bram@vim.org>
parents: 28386
diff changeset
3098 else if (State & (MODE_NORMAL | MODE_INSERT | MODE_TERMINAL))
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3099 {
28224
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 28201
diff changeset
3100 update_topline();
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 28201
diff changeset
3101 validate_cursor();
c99005ffa8c3 patch 8.2.4638: superfluous check if a redraw is needed for 'cursorline'
Bram Moolenaar <Bram@vim.org>
parents: 28201
diff changeset
3102
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3103 // keep the command line if possible
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3104 update_screen(VALID_NO_UPDATE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3105 setcursor();
24521
3efc5cb6a404 patch 8.2.2800: after a timer displays text a hit-enter prompt is given
Bram Moolenaar <Bram@vim.org>
parents: 24428
diff changeset
3106
3efc5cb6a404 patch 8.2.2800: after a timer displays text a hit-enter prompt is given
Bram Moolenaar <Bram@vim.org>
parents: 24428
diff changeset
3107 if (msg_scrolled == 0)
3efc5cb6a404 patch 8.2.2800: after a timer displays text a hit-enter prompt is given
Bram Moolenaar <Bram@vim.org>
parents: 24428
diff changeset
3108 {
3efc5cb6a404 patch 8.2.2800: after a timer displays text a hit-enter prompt is given
Bram Moolenaar <Bram@vim.org>
parents: 24428
diff changeset
3109 // don't want a hit-enter prompt when something else is displayed
3efc5cb6a404 patch 8.2.2800: after a timer displays text a hit-enter prompt is given
Bram Moolenaar <Bram@vim.org>
parents: 24428
diff changeset
3110 msg_didany = FALSE;
3efc5cb6a404 patch 8.2.2800: after a timer displays text a hit-enter prompt is given
Bram Moolenaar <Bram@vim.org>
parents: 24428
diff changeset
3111 need_wait_return = FALSE;
3efc5cb6a404 patch 8.2.2800: after a timer displays text a hit-enter prompt is given
Bram Moolenaar <Bram@vim.org>
parents: 24428
diff changeset
3112 }
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3113 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3114 cursor_on();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3115 #ifdef FEAT_GUI
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3116 if (gui.in_use && !gui_mch_is_blink_off())
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3117 // Don't update the cursor when it is blinking and off to avoid
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3118 // flicker.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3119 out_flush_cursor(FALSE, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3120 else
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3121 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3122 out_flush();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3123
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3124 --redrawing_for_callback;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3125 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3126
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3127 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3128 * Redraw the current window later, with update_screen(type).
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3129 * Set must_redraw only if not already set to a higher value.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3130 * E.g. if must_redraw is CLEAR, type NOT_VALID will do nothing.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3131 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3132 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3133 redraw_later(int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3134 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3135 redraw_win_later(curwin, type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3136 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3137
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3138 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3139 redraw_win_later(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3140 win_T *wp,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3141 int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3142 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3143 if (!exiting && wp->w_redr_type < type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3144 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3145 wp->w_redr_type = type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3146 if (type >= NOT_VALID)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3147 wp->w_lines_valid = 0;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3148 if (must_redraw < type) // must_redraw is the maximum of all windows
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3149 must_redraw = type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3150 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3151 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3152
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3153 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3154 * Force a complete redraw later. Also resets the highlighting. To be used
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3155 * after executing a shell command that messes up the screen.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3156 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3157 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3158 redraw_later_clear(void)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3159 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3160 redraw_all_later(CLEAR);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3161 reset_screen_attr();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3162 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3163
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3164 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3165 * Mark all windows to be redrawn later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3166 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3167 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3168 redraw_all_later(int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3169 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3170 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3171
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3172 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3173 redraw_win_later(wp, type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3174 // This may be needed when switching tabs.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3175 if (must_redraw < type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3176 must_redraw = type;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3177 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3178
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3179 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3180 * Mark all windows that are editing the current buffer to be updated later.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3181 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3182 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3183 redraw_curbuf_later(int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3184 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3185 redraw_buf_later(curbuf, type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3186 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3187
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3188 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3189 redraw_buf_later(buf_T *buf, int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3190 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3191 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3192
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3193 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3194 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3195 if (wp->w_buffer == buf)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3196 redraw_win_later(wp, type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3197 }
19542
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
3198 #if defined(FEAT_TERMINAL) && defined(FEAT_PROP_POPUP)
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
3199 // terminal in popup window is not in list of windows
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
3200 if (curwin->w_buffer == buf)
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
3201 redraw_win_later(curwin, type);
9e428147e4ee patch 8.2.0328: no redraw when leaving term-normal mode in popup terminal
Bram Moolenaar <Bram@vim.org>
parents: 18949
diff changeset
3202 #endif
18124
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3203 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3204
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3205 #if defined(FEAT_SIGNS) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3206 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3207 redraw_buf_line_later(buf_T *buf, linenr_T lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3208 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3209 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3210
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3211 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3212 if (wp->w_buffer == buf && lnum >= wp->w_topline
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3213 && lnum < wp->w_botline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3214 redrawWinline(wp, lnum);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3215 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3216 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3217
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3218 #if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3219 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3220 redraw_buf_and_status_later(buf_T *buf, int type)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3221 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3222 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3223
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3224 #ifdef FEAT_WILDMENU
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3225 if (wild_menu_showing != 0)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3226 // Don't redraw while the command line completion is displayed, it
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3227 // would disappear.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3228 return;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3229 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3230 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3231 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3232 if (wp->w_buffer == buf)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3233 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3234 redraw_win_later(wp, type);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3235 wp->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3236 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3237 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3238 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3239 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3240
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3241 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3242 * mark all status lines for redraw; used after first :cd
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3243 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3244 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3245 status_redraw_all(void)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3246 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3247 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3248
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3249 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3250 if (wp->w_status_height)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3251 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3252 wp->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3253 redraw_later(VALID);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3254 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3255 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3256
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3257 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3258 * mark all status lines of the current buffer for redraw
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3259 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3260 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3261 status_redraw_curbuf(void)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3262 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3263 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3264
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3265 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3266 if (wp->w_status_height != 0 && wp->w_buffer == curbuf)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3267 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3268 wp->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3269 redraw_later(VALID);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3270 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3271 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3272
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3273 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3274 * Redraw all status lines that need to be redrawn.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3275 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3276 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3277 redraw_statuslines(void)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3278 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3279 win_T *wp;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3280
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3281 FOR_ALL_WINDOWS(wp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3282 if (wp->w_redr_status)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3283 win_redr_status(wp, FALSE);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3284 if (redraw_tabline)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3285 draw_tabline();
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3286 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3287
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3288 #if defined(FEAT_WILDMENU) || defined(PROTO)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3289 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3290 * Redraw all status lines at the bottom of frame "frp".
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3291 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3292 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3293 win_redraw_last_status(frame_T *frp)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3294 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3295 if (frp->fr_layout == FR_LEAF)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3296 frp->fr_win->w_redr_status = TRUE;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3297 else if (frp->fr_layout == FR_ROW)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3298 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3299 FOR_ALL_FRAMES(frp, frp->fr_child)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3300 win_redraw_last_status(frp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3301 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3302 else // frp->fr_layout == FR_COL
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3303 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3304 frp = frp->fr_child;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3305 while (frp->fr_next != NULL)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3306 frp = frp->fr_next;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3307 win_redraw_last_status(frp);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3308 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3309 }
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3310 #endif
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3311
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3312 /*
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3313 * Changed something in the current window, at buffer line "lnum", that
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3314 * requires that line and possibly other lines to be redrawn.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3315 * Used when entering/leaving Insert mode with the cursor on a folded line.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3316 * Used to remove the "$" from a change command.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3317 * Note that when also inserting/deleting lines w_redraw_top and w_redraw_bot
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3318 * may become invalid and the whole window will have to be redrawn.
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3319 */
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3320 void
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3321 redrawWinline(
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3322 win_T *wp,
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3323 linenr_T lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3324 {
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3325 if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3326 wp->w_redraw_top = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3327 if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum)
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3328 wp->w_redraw_bot = lnum;
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3329 redraw_win_later(wp, VALID);
2a806e3c39f6 patch 8.1.2057: the screen.c file is much too big
Bram Moolenaar <Bram@vim.org>
parents:
diff changeset
3330 }