annotate src/libvterm/src/screen.c @ 18267:da6a7491e148 v8.1.2128

patch 8.1.2128: renamed libvterm sources makes merging difficult Commit: https://github.com/vim/vim/commit/93268054428fe3a6bbe3f89d2def2fec4eabcf5f Author: Bram Moolenaar <Bram@vim.org> Date: Thu Oct 10 13:22:54 2019 +0200 patch 8.1.2128: renamed libvterm sources makes merging difficult Problem: Renamed libvterm sources makes merging difficult. Solution: Rename back to the original name and only rename the .o files. Also clean the libvterm build artifacts. (James McCoy, closes #5027)
author Bram Moolenaar <Bram@vim.org>
date Thu, 10 Oct 2019 13:30:04 +0200
parents src/libvterm/src/termscreen.c@9c3347b21b89
children 3be01cf0a632
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 #include "vterm_internal.h"
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
3 // vim: set sw=2 :
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 #include <stdio.h>
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 #include <string.h>
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 #include "rect.h"
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 #include "utf8.h"
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 #define UNICODE_SPACE 0x20
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11 #define UNICODE_LINEFEED 0x0a
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
13 // State of the pen at some moment in time, also used in a cell
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 typedef struct
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 {
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
16 // After the bitfield
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 VTermColor fg, bg;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
18
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
19 unsigned int bold : 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
20 unsigned int underline : 2;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
21 unsigned int italic : 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
22 unsigned int blink : 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
23 unsigned int reverse : 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
24 unsigned int strike : 1;
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
25 unsigned int font : 4; // 0 to 9
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
26
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
27 // Extra state storage that isn't strictly pen-related
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
28 unsigned int protected_cell : 1;
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
29 unsigned int dwl : 1; // on a DECDWL or DECDHL line
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
30 unsigned int dhl : 2; // on a DECDHL line (1=top 2=bottom)
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
31 } ScreenPen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
32
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
33 // Internal representation of a screen cell
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
34 typedef struct
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
35 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
36 uint32_t chars[VTERM_MAX_CHARS_PER_CELL];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
37 ScreenPen pen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
38 } ScreenCell;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
39
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
40 static int vterm_screen_set_cell(VTermScreen *screen, VTermPos pos, const VTermScreenCell *cell);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
41
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
42 struct VTermScreen
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
43 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
44 VTerm *vt;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
45 VTermState *state;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
46
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
47 const VTermScreenCallbacks *callbacks;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
48 void *cbdata;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
49
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
50 VTermDamageSize damage_merge;
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
51 // start_row == -1 => no damage
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
52 VTermRect damaged;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
53 VTermRect pending_scrollrect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
54 int pending_scroll_downward, pending_scroll_rightward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
55
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
56 int rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
57 int cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
58 int global_reverse;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
59
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
60 // Primary and Altscreen. buffers[1] is lazily allocated as needed
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
61 ScreenCell *buffers[2];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
62
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
63 // buffer will == buffers[0] or buffers[1], depending on altscreen
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
64 ScreenCell *buffer;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
65
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
66 // buffer for a single screen row used in scrollback storage callbacks
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
67 VTermScreenCell *sb_buffer;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
68
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
69 ScreenPen pen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
70 };
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
71
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
72 static ScreenCell *getcell(const VTermScreen *screen, int row, int col)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
73 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
74 if(row < 0 || row >= screen->rows)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
75 return NULL;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
76 if(col < 0 || col >= screen->cols)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
77 return NULL;
18162
9c3347b21b89 patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 18064
diff changeset
78 if (screen->buffer == NULL)
9c3347b21b89 patch 8.1.2076: crash when trying to put a terminal in a popup window
Bram Moolenaar <Bram@vim.org>
parents: 18064
diff changeset
79 return NULL;
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
80 return screen->buffer + (screen->cols * row) + col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
81 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
82
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
83 static ScreenCell *realloc_buffer(VTermScreen *screen, ScreenCell *buffer, int new_rows, int new_cols)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
84 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
85 ScreenCell *new_buffer = vterm_allocator_malloc(screen->vt, sizeof(ScreenCell) * new_rows * new_cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
86 int row, col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
87
16429
a1229400434a patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents: 15249
diff changeset
88 if (new_buffer == NULL)
a1229400434a patch 8.1.1219: not checking for NULL return from alloc()
Bram Moolenaar <Bram@vim.org>
parents: 15249
diff changeset
89 return NULL;
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
90 for(row = 0; row < new_rows; row++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
91 for(col = 0; col < new_cols; col++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
92 ScreenCell *new_cell = new_buffer + row*new_cols + col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
93
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
94 if(buffer && row < screen->rows && col < screen->cols)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
95 *new_cell = buffer[row * screen->cols + col];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
96 else {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
97 new_cell->chars[0] = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
98 new_cell->pen = screen->pen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
99 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
100 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
101 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
102
15249
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
103 vterm_allocator_free(screen->vt, buffer);
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
104
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
105 return new_buffer;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
106 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
107
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
108 static void damagerect(VTermScreen *screen, VTermRect rect)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
109 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
110 VTermRect emit;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
111
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
112 switch(screen->damage_merge) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
113 case VTERM_DAMAGE_CELL:
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
114 // Always emit damage event
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
115 emit = rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
116 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
117
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
118 case VTERM_DAMAGE_ROW:
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
119 // Emit damage longer than one row. Try to merge with existing damage in
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
120 // the same row
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
121 if(rect.end_row > rect.start_row + 1) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
122 // Bigger than 1 line - flush existing, emit this
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
123 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
124 emit = rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
125 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
126 else if(screen->damaged.start_row == -1) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
127 // None stored yet
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
128 screen->damaged = rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
129 return;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
130 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
131 else if(rect.start_row == screen->damaged.start_row) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
132 // Merge with the stored line
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
133 if(screen->damaged.start_col > rect.start_col)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
134 screen->damaged.start_col = rect.start_col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
135 if(screen->damaged.end_col < rect.end_col)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
136 screen->damaged.end_col = rect.end_col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
137 return;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
138 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
139 else {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
140 // Emit the currently stored line, store a new one
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
141 emit = screen->damaged;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
142 screen->damaged = rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
143 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
144 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
145
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
146 case VTERM_DAMAGE_SCREEN:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
147 case VTERM_DAMAGE_SCROLL:
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
148 // Never emit damage event
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
149 if(screen->damaged.start_row == -1)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
150 screen->damaged = rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
151 else {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
152 rect_expand(&screen->damaged, &rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
153 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
154 return;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
155
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
156 default:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
157 DEBUG_LOG1("TODO: Maybe merge damage for level %d\n", screen->damage_merge);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
158 return;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
159 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
160
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
161 if(screen->callbacks && screen->callbacks->damage)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
162 (*screen->callbacks->damage)(emit, screen->cbdata);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
163 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
164
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
165 static void damagescreen(VTermScreen *screen)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
166 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
167 VTermRect rect = {0,0,0,0};
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
168 rect.end_row = screen->rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
169 rect.end_col = screen->cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
170
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
171 damagerect(screen, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
172 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
173
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
174 static int putglyph(VTermGlyphInfo *info, VTermPos pos, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
175 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
176 int i;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
177 int col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
178 VTermRect rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
179
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
180 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
181 ScreenCell *cell = getcell(screen, pos.row, pos.col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
182
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
183 if(!cell)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
184 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
185
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
186 for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && info->chars[i]; i++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
187 cell->chars[i] = info->chars[i];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
188 cell->pen = screen->pen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
189 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
190 if(i < VTERM_MAX_CHARS_PER_CELL)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
191 cell->chars[i] = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
192
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
193 for(col = 1; col < info->width; col++)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
194 getcell(screen, pos.row, pos.col + col)->chars[0] = (uint32_t)-1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
195
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
196 rect.start_row = pos.row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
197 rect.end_row = pos.row+1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
198 rect.start_col = pos.col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
199 rect.end_col = pos.col+info->width;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
200
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
201 cell->pen.protected_cell = info->protected_cell;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
202 cell->pen.dwl = info->dwl;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
203 cell->pen.dhl = info->dhl;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
204
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
205 damagerect(screen, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
206
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
207 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
208 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
209
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
210 static int moverect_internal(VTermRect dest, VTermRect src, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
211 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
212 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
213
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
214 if(screen->callbacks && screen->callbacks->sb_pushline &&
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
215 dest.start_row == 0 && dest.start_col == 0 && // starts top-left corner
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
216 dest.end_col == screen->cols && // full width
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
217 screen->buffer == screen->buffers[0]) { // not altscreen
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
218 VTermPos pos;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
219 for(pos.row = 0; pos.row < src.start_row; pos.row++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
220 for(pos.col = 0; pos.col < screen->cols; pos.col++)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
221 (void)vterm_screen_get_cell(screen, pos, screen->sb_buffer + pos.col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
222
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
223 (screen->callbacks->sb_pushline)(screen->cols, screen->sb_buffer, screen->cbdata);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
224 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
225 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
226
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
227 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
228 int cols = src.end_col - src.start_col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
229 int downward = src.start_row - dest.start_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
230 int init_row, test_row, inc_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
231 int row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
232
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
233 if(downward < 0) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
234 init_row = dest.end_row - 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
235 test_row = dest.start_row - 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
236 inc_row = -1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
237 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
238 else {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
239 init_row = dest.start_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
240 test_row = dest.end_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
241 inc_row = +1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
242 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
243
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
244 for(row = init_row; row != test_row; row += inc_row)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
245 memmove(getcell(screen, row, dest.start_col),
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
246 getcell(screen, row + downward, src.start_col),
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
247 cols * sizeof(ScreenCell));
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
248 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
249
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
250 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
251 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
252
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
253 static int moverect_user(VTermRect dest, VTermRect src, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
254 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
255 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
256
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
257 if(screen->callbacks && screen->callbacks->moverect) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
258 if(screen->damage_merge != VTERM_DAMAGE_SCROLL)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
259 // Avoid an infinite loop
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
260 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
261
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
262 if((*screen->callbacks->moverect)(dest, src, screen->cbdata))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
263 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
264 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
265
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
266 damagerect(screen, dest);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
267
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
268 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
269 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
270
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
271 static int erase_internal(VTermRect rect, int selective, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
272 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
273 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
274 int row, col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
275
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
276 for(row = rect.start_row; row < screen->state->rows && row < rect.end_row; row++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
277 const VTermLineInfo *info = vterm_state_get_lineinfo(screen->state, row);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
278
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
279 for(col = rect.start_col; col < rect.end_col; col++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
280 ScreenCell *cell = getcell(screen, row, col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
281
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
282 if(selective && cell->pen.protected_cell)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
283 continue;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
284
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
285 cell->chars[0] = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
286 cell->pen = screen->pen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
287 cell->pen.dwl = info->doublewidth;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
288 cell->pen.dhl = info->doubleheight;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
289 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
290 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
291
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
292 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
293 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
294
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
295 static int erase_user(VTermRect rect, int selective UNUSED, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
296 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
297 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
298
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
299 damagerect(screen, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
300
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
301 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
302 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
303
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
304 static int erase(VTermRect rect, int selective, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
305 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
306 erase_internal(rect, selective, user);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
307 return erase_user(rect, 0, user);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
308 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
309
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
310 static int scrollrect(VTermRect rect, int downward, int rightward, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
311 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
312 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
313
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
314 if(screen->damage_merge != VTERM_DAMAGE_SCROLL) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
315 vterm_scroll_rect(rect, downward, rightward,
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
316 moverect_internal, erase_internal, screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
317
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
318 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
319
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
320 vterm_scroll_rect(rect, downward, rightward,
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
321 moverect_user, erase_user, screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
322
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
323 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
324 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
325
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
326 if(screen->damaged.start_row != -1 &&
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
327 !rect_intersects(&rect, &screen->damaged)) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
328 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
329 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
330
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
331 if(screen->pending_scrollrect.start_row == -1) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
332 screen->pending_scrollrect = rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
333 screen->pending_scroll_downward = downward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
334 screen->pending_scroll_rightward = rightward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
335 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
336 else if(rect_equal(&screen->pending_scrollrect, &rect) &&
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
337 ((screen->pending_scroll_downward == 0 && downward == 0) ||
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
338 (screen->pending_scroll_rightward == 0 && rightward == 0))) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
339 screen->pending_scroll_downward += downward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
340 screen->pending_scroll_rightward += rightward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
341 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
342 else {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
343 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
344
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
345 screen->pending_scrollrect = rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
346 screen->pending_scroll_downward = downward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
347 screen->pending_scroll_rightward = rightward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
348 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
349
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
350 vterm_scroll_rect(rect, downward, rightward,
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
351 moverect_internal, erase_internal, screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
352
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
353 if(screen->damaged.start_row == -1)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
354 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
355
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
356 if(rect_contains(&rect, &screen->damaged)) {
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
357 // Scroll region entirely contains the damage; just move it
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
358 vterm_rect_move(&screen->damaged, -downward, -rightward);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
359 rect_clip(&screen->damaged, &rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
360 }
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
361 // There are a number of possible cases here, but lets restrict this to only
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
362 // the common case where we might actually gain some performance by
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
363 // optimising it. Namely, a vertical scroll that neatly cuts the damage
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
364 // region in half.
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
365 else if(rect.start_col <= screen->damaged.start_col &&
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
366 rect.end_col >= screen->damaged.end_col &&
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
367 rightward == 0) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
368 if(screen->damaged.start_row >= rect.start_row &&
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
369 screen->damaged.start_row < rect.end_row) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
370 screen->damaged.start_row -= downward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
371 if(screen->damaged.start_row < rect.start_row)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
372 screen->damaged.start_row = rect.start_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
373 if(screen->damaged.start_row > rect.end_row)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
374 screen->damaged.start_row = rect.end_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
375 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
376 if(screen->damaged.end_row >= rect.start_row &&
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
377 screen->damaged.end_row < rect.end_row) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
378 screen->damaged.end_row -= downward;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
379 if(screen->damaged.end_row < rect.start_row)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
380 screen->damaged.end_row = rect.start_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
381 if(screen->damaged.end_row > rect.end_row)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
382 screen->damaged.end_row = rect.end_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
383 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
384 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
385 else {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
386 DEBUG_LOG2("TODO: Just flush and redo damaged=" STRFrect " rect=" STRFrect "\n",
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
387 ARGSrect(screen->damaged), ARGSrect(rect));
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
388 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
389
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
390 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
391 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
392
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
393 static int movecursor(VTermPos pos, VTermPos oldpos, int visible, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
394 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
395 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
396
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
397 if(screen->callbacks && screen->callbacks->movecursor)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
398 return (*screen->callbacks->movecursor)(pos, oldpos, visible, screen->cbdata);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
399
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
400 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
401 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
402
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
403 static int setpenattr(VTermAttr attr, VTermValue *val, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
404 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
405 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
406
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
407 switch(attr) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
408 case VTERM_ATTR_BOLD:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
409 screen->pen.bold = val->boolean;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
410 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
411 case VTERM_ATTR_UNDERLINE:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
412 screen->pen.underline = val->number;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
413 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
414 case VTERM_ATTR_ITALIC:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
415 screen->pen.italic = val->boolean;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
416 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
417 case VTERM_ATTR_BLINK:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
418 screen->pen.blink = val->boolean;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
419 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
420 case VTERM_ATTR_REVERSE:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
421 screen->pen.reverse = val->boolean;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
422 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
423 case VTERM_ATTR_STRIKE:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
424 screen->pen.strike = val->boolean;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
425 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
426 case VTERM_ATTR_FONT:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
427 screen->pen.font = val->number;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
428 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
429 case VTERM_ATTR_FOREGROUND:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
430 screen->pen.fg = val->color;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
431 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
432 case VTERM_ATTR_BACKGROUND:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
433 screen->pen.bg = val->color;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
434 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
435
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
436 case VTERM_N_ATTRS:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
437 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
438 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
439
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
440 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
441 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
442
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
443 static int settermprop(VTermProp prop, VTermValue *val, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
444 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
445 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
446
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
447 switch(prop) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
448 case VTERM_PROP_ALTSCREEN:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
449 if(val->boolean && !screen->buffers[1])
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
450 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
451
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
452 screen->buffer = val->boolean ? screen->buffers[1] : screen->buffers[0];
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
453 // only send a damage event on disable; because during enable there's an
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
454 // erase that sends a damage anyway
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
455 if(!val->boolean)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
456 damagescreen(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
457 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
458 case VTERM_PROP_REVERSE:
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
459 screen->global_reverse = val->boolean;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
460 damagescreen(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
461 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
462 default:
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
463 ; // ignore
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
464 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
465
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
466 if(screen->callbacks && screen->callbacks->settermprop)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
467 return (*screen->callbacks->settermprop)(prop, val, screen->cbdata);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
468
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
469 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
470 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
471
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
472 static int bell(void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
473 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
474 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
475
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
476 if(screen->callbacks && screen->callbacks->bell)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
477 return (*screen->callbacks->bell)(screen->cbdata);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
478
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
479 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
480 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
481
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
482 static int resize(int new_rows, int new_cols, VTermPos *delta, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
483 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
484 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
485
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
486 int is_altscreen = (screen->buffers[1] && screen->buffer == screen->buffers[1]);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
487
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
488 int old_rows = screen->rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
489 int old_cols = screen->cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
490 int first_blank_row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
491
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
492 if(!is_altscreen && new_rows < old_rows) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
493 // Fewer rows - determine if we're going to scroll at all, and if so, push
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
494 // those lines to scrollback
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
495 VTermPos pos = { 0, 0 };
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
496 VTermPos cursor = screen->state->pos;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
497 // Find the first blank row after the cursor.
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
498 for(pos.row = old_rows - 1; pos.row >= new_rows; pos.row--)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
499 if(!vterm_screen_is_eol(screen, pos) || cursor.row == pos.row)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
500 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
501
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
502 first_blank_row = pos.row + 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
503 if(first_blank_row > new_rows) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
504 VTermRect rect = {0,0,0,0};
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
505 rect.end_row = old_rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
506 rect.end_col = old_cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
507 scrollrect(rect, first_blank_row - new_rows, 0, user);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
508 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
509
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
510 delta->row -= first_blank_row - new_rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
511 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
512 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
513
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
514 screen->buffers[0] = realloc_buffer(screen, screen->buffers[0], new_rows, new_cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
515 if(screen->buffers[1])
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
516 screen->buffers[1] = realloc_buffer(screen, screen->buffers[1], new_rows, new_cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
517
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
518 screen->buffer = is_altscreen ? screen->buffers[1] : screen->buffers[0];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
519
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
520 screen->rows = new_rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
521 screen->cols = new_cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
522
15249
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
523 vterm_allocator_free(screen->vt, screen->sb_buffer);
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
524
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
525 screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * new_cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
526
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
527 if(new_cols > old_cols) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
528 VTermRect rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
529 rect.start_row = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
530 rect.end_row = old_rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
531 rect.start_col = old_cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
532 rect.end_col = new_cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
533 damagerect(screen, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
534 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
535
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
536 if(new_rows > old_rows) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
537 if(!is_altscreen && screen->callbacks && screen->callbacks->sb_popline) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
538 int rows = new_rows - old_rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
539 while(rows) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
540 VTermRect rect = {0,0,0,0};
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
541 VTermPos pos = { 0, 0 };
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
542 if(!(screen->callbacks->sb_popline(screen->cols, screen->sb_buffer, screen->cbdata)))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
543 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
544
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
545 rect.end_row = screen->rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
546 rect.end_col = screen->cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
547 scrollrect(rect, -1, 0, user);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
548
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
549 for(pos.col = 0; pos.col < screen->cols; pos.col += screen->sb_buffer[pos.col].width)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
550 vterm_screen_set_cell(screen, pos, screen->sb_buffer + pos.col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
551
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
552 rect.end_row = 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
553 damagerect(screen, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
554
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
555 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
556
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
557 rows--;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
558 delta->row++;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
559 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
560 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
561
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
562 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
563 VTermRect rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
564 rect.start_row = old_rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
565 rect.end_row = new_rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
566 rect.start_col = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
567 rect.end_col = new_cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
568 damagerect(screen, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
569 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
570 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
571
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
572 if(screen->callbacks && screen->callbacks->resize)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
573 return (*screen->callbacks->resize)(new_rows, new_cols, screen->cbdata);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
574
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
575 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
576 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
577
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
578 static int setlineinfo(int row, const VTermLineInfo *newinfo, const VTermLineInfo *oldinfo, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
579 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
580 VTermScreen *screen = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
581 int col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
582 VTermRect rect;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
583
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
584 if(newinfo->doublewidth != oldinfo->doublewidth ||
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
585 newinfo->doubleheight != oldinfo->doubleheight) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
586 for(col = 0; col < screen->cols; col++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
587 ScreenCell *cell = getcell(screen, row, col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
588 cell->pen.dwl = newinfo->doublewidth;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
589 cell->pen.dhl = newinfo->doubleheight;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
590 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
591
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
592 rect.start_row = row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
593 rect.end_row = row + 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
594 rect.start_col = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
595 rect.end_col = newinfo->doublewidth ? screen->cols / 2 : screen->cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
596 damagerect(screen, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
597
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
598 if(newinfo->doublewidth) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
599 rect.start_col = screen->cols / 2;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
600 rect.end_col = screen->cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
601
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
602 erase_internal(rect, 0, user);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
603 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
604 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
605
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
606 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
607 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
608
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
609 static VTermStateCallbacks state_cbs = {
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
610 &putglyph, // putglyph
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
611 &movecursor, // movecursor
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
612 &scrollrect, // scrollrect
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
613 NULL, // moverect
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
614 &erase, // erase
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
615 NULL, // initpen
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
616 &setpenattr, // setpenattr
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
617 &settermprop, // settermprop
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
618 &bell, // bell
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
619 &resize, // resize
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
620 &setlineinfo // setlineinfo
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
621 };
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
622
15249
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
623 /*
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
624 * Allocate a new screen and return it.
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
625 * Return NULL when out of memory.
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
626 */
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
627 static VTermScreen *screen_new(VTerm *vt)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
628 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
629 VTermState *state = vterm_obtain_state(vt);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
630 VTermScreen *screen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
631 int rows, cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
632
15249
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
633 if (state == NULL)
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
634 return NULL;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
635 screen = vterm_allocator_malloc(vt, sizeof(VTermScreen));
15249
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
636 if (screen == NULL)
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
637 return NULL;
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
638
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
639 vterm_get_size(vt, &rows, &cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
640
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
641 screen->vt = vt;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
642 screen->state = state;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
643
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
644 screen->damage_merge = VTERM_DAMAGE_CELL;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
645 screen->damaged.start_row = -1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
646 screen->pending_scrollrect.start_row = -1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
647
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
648 screen->rows = rows;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
649 screen->cols = cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
650
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
651 screen->callbacks = NULL;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
652 screen->cbdata = NULL;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
653
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
654 screen->buffers[0] = realloc_buffer(screen, NULL, rows, cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
655 screen->buffer = screen->buffers[0];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
656 screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * cols);
15249
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
657 if (screen->buffer == NULL || screen->sb_buffer == NULL)
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
658 {
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
659 vterm_screen_free(screen);
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
660 return NULL;
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
661 }
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
662
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
663 vterm_state_set_callbacks(screen->state, &state_cbs, screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
664
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
665 return screen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
666 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
667
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
668 INTERNAL void vterm_screen_free(VTermScreen *screen)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
669 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
670 vterm_allocator_free(screen->vt, screen->buffers[0]);
15249
544490b69e1d patch 8.1.0633: crash when out of memory while opening a terminal window
Bram Moolenaar <Bram@vim.org>
parents: 14734
diff changeset
671 vterm_allocator_free(screen->vt, screen->buffers[1]);
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
672 vterm_allocator_free(screen->vt, screen->sb_buffer);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
673 vterm_allocator_free(screen->vt, screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
674 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
675
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
676 void vterm_screen_reset(VTermScreen *screen, int hard)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
677 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
678 screen->damaged.start_row = -1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
679 screen->pending_scrollrect.start_row = -1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
680 vterm_state_reset(screen->state, hard);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
681 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
682 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
683
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
684 static size_t _get_chars(const VTermScreen *screen, const int utf8, void *buffer, size_t len, const VTermRect rect)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
685 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
686 size_t outpos = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
687 int padding = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
688 int row, col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
689
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
690 #define PUT(c) \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
691 if(utf8) { \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
692 size_t thislen = utf8_seqlen(c); \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
693 if(buffer && outpos + thislen <= len) \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
694 outpos += fill_utf8((c), (char *)buffer + outpos); \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
695 else \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
696 outpos += thislen; \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
697 } \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
698 else { \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
699 if(buffer && outpos + 1 <= len) \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
700 ((uint32_t*)buffer)[outpos++] = (c); \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
701 else \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
702 outpos++; \
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
703 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
704
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
705 for(row = rect.start_row; row < rect.end_row; row++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
706 for(col = rect.start_col; col < rect.end_col; col++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
707 ScreenCell *cell = getcell(screen, row, col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
708 int i;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
709
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
710 if(cell->chars[0] == 0)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
711 // Erased cell, might need a space
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
712 padding++;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
713 else if(cell->chars[0] == (uint32_t)-1)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
714 // Gap behind a double-width char, do nothing
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
715 ;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
716 else {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
717 while(padding) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
718 PUT(UNICODE_SPACE);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
719 padding--;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
720 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
721 for(i = 0; i < VTERM_MAX_CHARS_PER_CELL && cell->chars[i]; i++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
722 PUT(cell->chars[i]);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
723 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
724 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
725 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
726
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
727 if(row < rect.end_row - 1) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
728 PUT(UNICODE_LINEFEED);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
729 padding = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
730 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
731 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
732
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
733 return outpos;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
734 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
735
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
736 size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
737 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
738 return _get_chars(screen, 0, chars, len, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
739 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
740
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
741 size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
742 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
743 return _get_chars(screen, 1, str, len, rect);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
744 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
745
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
746 // Copy internal to external representation of a screen cell
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
747 int vterm_screen_get_cell(const VTermScreen *screen, VTermPos pos, VTermScreenCell *cell)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
748 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
749 ScreenCell *intcell = getcell(screen, pos.row, pos.col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
750 int i;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
751
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
752 if(!intcell)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
753 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
754
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
755 for(i = 0; ; i++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
756 cell->chars[i] = intcell->chars[i];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
757 if(!intcell->chars[i])
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
758 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
759 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
760
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
761 cell->attrs.bold = intcell->pen.bold;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
762 cell->attrs.underline = intcell->pen.underline;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
763 cell->attrs.italic = intcell->pen.italic;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
764 cell->attrs.blink = intcell->pen.blink;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
765 cell->attrs.reverse = intcell->pen.reverse ^ screen->global_reverse;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
766 cell->attrs.strike = intcell->pen.strike;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
767 cell->attrs.font = intcell->pen.font;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
768
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
769 cell->attrs.dwl = intcell->pen.dwl;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
770 cell->attrs.dhl = intcell->pen.dhl;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
771
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
772 cell->fg = intcell->pen.fg;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
773 cell->bg = intcell->pen.bg;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
774
18064
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
775 if(vterm_get_special_pty_type() == 2) {
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
776 /* Get correct cell width from cell information contained in line buffer */
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
777 if(pos.col < (screen->cols - 1) &&
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
778 getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1) {
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
779 if(getcell(screen, pos.row, pos.col)->chars[0] == 0x20) {
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
780 getcell(screen, pos.row, pos.col)->chars[0] = 0;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
781 cell->width = 2;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
782 } else if(getcell(screen, pos.row, pos.col)->chars[0] == 0) {
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
783 getcell(screen, pos.row, pos.col + 1)->chars[0] = 0;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
784 cell->width = 1;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
785 } else {
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
786 cell->width = 2;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
787 }
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
788 } else
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
789 cell->width = 1;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
790 } else {
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
791 if(pos.col < (screen->cols - 1) &&
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
792 getcell(screen, pos.row, pos.col + 1)->chars[0] == (uint32_t)-1)
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
793 cell->width = 2;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
794 else
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
795 cell->width = 1;
8b4f9be5db73 patch 8.1.2027: MS-Windows: problem with ambiwidth characters
Bram Moolenaar <Bram@vim.org>
parents: 17777
diff changeset
796 }
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
797
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
798 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
799 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
800
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
801 // Copy external to internal representation of a screen cell
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
802 /* static because it's only used internally for sb_popline during resize */
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
803 static int vterm_screen_set_cell(VTermScreen *screen, VTermPos pos, const VTermScreenCell *cell)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
804 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
805 ScreenCell *intcell = getcell(screen, pos.row, pos.col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
806 int i;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
807
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
808 if(!intcell)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
809 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
810
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
811 for(i = 0; ; i++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
812 intcell->chars[i] = cell->chars[i];
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
813 if(!cell->chars[i])
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
814 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
815 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
816
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
817 intcell->pen.bold = cell->attrs.bold;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
818 intcell->pen.underline = cell->attrs.underline;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
819 intcell->pen.italic = cell->attrs.italic;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
820 intcell->pen.blink = cell->attrs.blink;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
821 intcell->pen.reverse = cell->attrs.reverse ^ screen->global_reverse;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
822 intcell->pen.strike = cell->attrs.strike;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
823 intcell->pen.font = cell->attrs.font;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
824
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
825 intcell->pen.fg = cell->fg;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
826 intcell->pen.bg = cell->bg;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
827
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
828 if(cell->width == 2)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
829 getcell(screen, pos.row, pos.col + 1)->chars[0] = (uint32_t)-1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
830
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
831 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
832 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
833
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
834 int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
835 {
17777
811a12a78164 patch 8.1.1885: comments in libvterm are inconsistent
Bram Moolenaar <Bram@vim.org>
parents: 16429
diff changeset
836 // This cell is EOL if this and every cell to the right is black
14734
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
837 for(; pos.col < screen->cols; pos.col++) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
838 ScreenCell *cell = getcell(screen, pos.row, pos.col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
839 if(cell->chars[0] != 0)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
840 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
841 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
842
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
843 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
844 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
845
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
846 VTermScreen *vterm_obtain_screen(VTerm *vt)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
847 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
848 if(!vt->screen)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
849 vt->screen = screen_new(vt);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
850 return vt->screen;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
851 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
852
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
853 void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
854 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
855
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
856 if(!screen->buffers[1] && altscreen) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
857 int rows, cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
858 vterm_get_size(screen->vt, &rows, &cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
859
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
860 screen->buffers[1] = realloc_buffer(screen, NULL, rows, cols);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
861 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
862 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
863
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
864 void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
865 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
866 screen->callbacks = callbacks;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
867 screen->cbdata = user;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
868 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
869
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
870 void *vterm_screen_get_cbdata(VTermScreen *screen)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
871 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
872 return screen->cbdata;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
873 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
874
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
875 void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
876 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
877 vterm_state_set_unrecognised_fallbacks(screen->state, fallbacks, user);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
878 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
879
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
880 void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
881 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
882 return vterm_state_get_unrecognised_fbdata(screen->state);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
883 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
884
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
885 void vterm_screen_flush_damage(VTermScreen *screen)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
886 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
887 if(screen->pending_scrollrect.start_row != -1) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
888 vterm_scroll_rect(screen->pending_scrollrect, screen->pending_scroll_downward, screen->pending_scroll_rightward,
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
889 moverect_user, erase_user, screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
890
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
891 screen->pending_scrollrect.start_row = -1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
892 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
893
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
894 if(screen->damaged.start_row != -1) {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
895 if(screen->callbacks && screen->callbacks->damage)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
896 (*screen->callbacks->damage)(screen->damaged, screen->cbdata);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
897
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
898 screen->damaged.start_row = -1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
899 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
900 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
901
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
902 void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
903 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
904 vterm_screen_flush_damage(screen);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
905 screen->damage_merge = size;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
906 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
907
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
908 static int attrs_differ(VTermAttrMask attrs, ScreenCell *a, ScreenCell *b)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
909 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
910 if((attrs & VTERM_ATTR_BOLD_MASK) && (a->pen.bold != b->pen.bold))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
911 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
912 if((attrs & VTERM_ATTR_UNDERLINE_MASK) && (a->pen.underline != b->pen.underline))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
913 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
914 if((attrs & VTERM_ATTR_ITALIC_MASK) && (a->pen.italic != b->pen.italic))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
915 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
916 if((attrs & VTERM_ATTR_BLINK_MASK) && (a->pen.blink != b->pen.blink))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
917 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
918 if((attrs & VTERM_ATTR_REVERSE_MASK) && (a->pen.reverse != b->pen.reverse))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
919 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
920 if((attrs & VTERM_ATTR_STRIKE_MASK) && (a->pen.strike != b->pen.strike))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
921 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
922 if((attrs & VTERM_ATTR_FONT_MASK) && (a->pen.font != b->pen.font))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
923 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
924 if((attrs & VTERM_ATTR_FOREGROUND_MASK) && !vterm_color_equal(a->pen.fg, b->pen.fg))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
925 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
926 if((attrs & VTERM_ATTR_BACKGROUND_MASK) && !vterm_color_equal(a->pen.bg, b->pen.bg))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
927 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
928
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
929 return 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
930 }
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
931
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
932 int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
933 {
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
934 int col;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
935
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
936 ScreenCell *target = getcell(screen, pos.row, pos.col);
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
937
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
938 // TODO: bounds check
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
939 extent->start_row = pos.row;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
940 extent->end_row = pos.row + 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
941
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
942 if(extent->start_col < 0)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
943 extent->start_col = 0;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
944 if(extent->end_col < 0)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
945 extent->end_col = screen->cols;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
946
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
947 for(col = pos.col - 1; col >= extent->start_col; col--)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
948 if(attrs_differ(attrs, target, getcell(screen, pos.row, col)))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
949 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
950 extent->start_col = col + 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
951
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
952 for(col = pos.col + 1; col < extent->end_col; col++)
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
953 if(attrs_differ(attrs, target, getcell(screen, pos.row, col)))
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
954 break;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
955 extent->end_col = col - 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
956
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
957 return 1;
2c72fa16aa70 patch 8.1.0379: build dependencies are incomplete
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
958 }