Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f4622eb

Browse filesBrowse files
committed
multigrid: rename grid->ScreenLines and other grid arrays
1 parent ad621db commit f4622eb
Copy full SHA for f4622eb

File tree

Expand file treeCollapse file tree

9 files changed

+171
-182
lines changed
Filter options
Expand file treeCollapse file tree

9 files changed

+171
-182
lines changed

‎src/nvim/api/vim.c

Copy file name to clipboardExpand all lines: src/nvim/api/vim.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,9 +1924,9 @@ Array nvim__inspect_cell(Integer row, Integer col, Error *err)
19241924
|| col < 0 || col >= default_grid.Columns) {
19251925
return ret;
19261926
}
1927-
size_t off = default_grid.LineOffset[(size_t)row] + (size_t)col;
1928-
ADD(ret, STRING_OBJ(cstr_to_string((char *)default_grid.ScreenLines[off])));
1929-
int attr = default_grid.ScreenAttrs[off];
1927+
size_t off = default_grid.line_offset[(size_t)row] + (size_t)col;
1928+
ADD(ret, STRING_OBJ(cstr_to_string((char *)default_grid.chars[off])));
1929+
int attr = default_grid.attrs[off];
19301930
ADD(ret, DICTIONARY_OBJ(hl_get_attr_by_id(attr, true, err)));
19311931
// will not work first time
19321932
if (!highlight_use_hlstate()) {

‎src/nvim/edit.c

Copy file name to clipboardExpand all lines: src/nvim/edit.c
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,7 +1494,7 @@ void edit_putchar(int c, int highlight)
14941494
{
14951495
int attr;
14961496

1497-
if (curwin->w_grid.ScreenLines != NULL || default_grid.ScreenLines != NULL) {
1497+
if (curwin->w_grid.chars != NULL || default_grid.chars != NULL) {
14981498
update_topline(); // just in case w_topline isn't valid
14991499
validate_cursor();
15001500
if (highlight) {

‎src/nvim/eval.c

Copy file name to clipboardExpand all lines: src/nvim/eval.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14027,7 +14027,7 @@ static void f_screenattr(typval_T *argvars, typval_T *rettv, FunPtr fptr)
1402714027
|| col < 0 || col >= default_grid.Columns) {
1402814028
c = -1;
1402914029
} else {
14030-
c = default_grid.ScreenAttrs[default_grid.LineOffset[row] + col];
14030+
c = default_grid.attrs[default_grid.line_offset[row] + col];
1403114031
}
1403214032
rettv->vval.v_number = c;
1403314033
}
@@ -14046,8 +14046,8 @@ static void f_screenchar(typval_T *argvars, typval_T *rettv, FunPtr fptr)
1404614046
|| col < 0 || col >= default_grid.Columns) {
1404714047
c = -1;
1404814048
} else {
14049-
off = default_grid.LineOffset[row] + col;
14050-
c = utf_ptr2char(default_grid.ScreenLines[off]);
14049+
off = default_grid.line_offset[row] + col;
14050+
c = utf_ptr2char(default_grid.chars[off]);
1405114051
}
1405214052
rettv->vval.v_number = c;
1405314053
}

‎src/nvim/globals.h

Copy file name to clipboardExpand all lines: src/nvim/globals.h
+3-6Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ EXTERN struct nvim_stats_s {
9292
* Number of Rows and Columns in the screen.
9393
* Must be long to be able to use them as options in option.c.
9494
* Note: Use default_grid.Rows and default_grid.Columns to access items in
95-
* default_grid.ScreenLines[]. They may have different values when the screen
95+
* default_grid.chars[]. They may have different values when the screen
9696
* wasn't (re)allocated yet after setting Rows or Columns (e.g., when starting
9797
* up).
9898
*/
@@ -190,11 +190,8 @@ EXTERN int compl_cont_status INIT(= 0);
190190
# define CONT_LOCAL 32 /* for ctrl_x_mode 0, ^X^P/^X^N do a local
191191
* expansion, (eg use complete=.) */
192192

193-
/*
194-
* Functions for putting characters in the command line,
195-
* while keeping ScreenLines[] updated.
196-
*/
197-
EXTERN int cmdmsg_rl INIT(= FALSE); /* cmdline is drawn right to left */
193+
// state for putting characters in the message area
194+
EXTERN int cmdmsg_rl INIT(= false); // cmdline is drawn right to left
198195
EXTERN int msg_col;
199196
EXTERN int msg_row;
200197
EXTERN int msg_scrolled; /* Number of screen lines that windows have

‎src/nvim/grid_defs.h

Copy file name to clipboardExpand all lines: src/nvim/grid_defs.h
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ typedef int16_t sattr_T;
1313

1414
/// ScreenGrid represents a resizable rectuangular grid displayed by UI clients.
1515
///
16-
/// ScreenLines contains the UTF-8 text that is currently displayed on the grid.
16+
/// chars[] contains the UTF-8 text that is currently displayed on the grid.
1717
/// It is stored as a single block of cells. When redrawing a part of the grid,
1818
/// the new state can be compared with the existing state of the grid. This way
1919
/// we can avoid sending bigger updates than neccessary to the Ul layer.
@@ -26,20 +26,20 @@ typedef int16_t sattr_T;
2626
/// and the right cell should only contain the empty string. When a part of the
2727
/// screen is cleared, the cells should be filled with a single whitespace char.
2828
///
29-
/// ScreenAttrs[] contains the highlighting attribute for each cell.
30-
/// LineOffset[n] is the offset from ScreenLines[] and ScreenAttrs[] for the
29+
/// attrs[] contains the highlighting attribute for each cell.
30+
/// line_offset[n] is the offset from chars[] and attrs[] for the
3131
/// start of line 'n'. These offsets are in general not linear, as full screen
32-
/// scrolling is implemented by rotating the offsets in the LineOffset array.
33-
/// LineWraps[] is an array of boolean flags indicating if the screen line wraps
34-
/// to the next line. It can only be true if a window occupies the entire screen
35-
/// width.
32+
/// scrolling is implemented by rotating the offsets in the line_offset array.
33+
/// line_wraps[] is an array of boolean flags indicating if the screen line
34+
/// wraps to the next line. It can only be true if a window occupies the entire
35+
/// screen width.
3636
typedef struct {
3737
handle_T handle;
3838

39-
schar_T *ScreenLines;
40-
sattr_T *ScreenAttrs;
41-
unsigned *LineOffset;
42-
char_u *LineWraps;
39+
schar_T *chars;
40+
sattr_T *attrs;
41+
unsigned *line_offset;
42+
char_u *line_wraps;
4343

4444
// the size of the allocated grid.
4545
int Rows;

‎src/nvim/mouse.c

Copy file name to clipboardExpand all lines: src/nvim/mouse.c
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ int jump_to_mouse(int flags,
110110
// Remember the character under the mouse, it might be a '-' or '+' in the
111111
// fold column. NB: only works for ASCII chars!
112112
if (row >= 0 && row < Rows && col >= 0 && col <= Columns
113-
&& default_grid.ScreenLines != NULL) {
114-
mouse_char = default_grid.ScreenLines[default_grid.LineOffset[row]
115-
+ (unsigned)col][0];
113+
&& default_grid.chars != NULL) {
114+
mouse_char = default_grid.chars[default_grid.line_offset[row]
115+
+ (unsigned)col][0];
116116
} else {
117117
mouse_char = ' ';
118118
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.