Skip to content

Commit

Permalink
patch 9.0.1927: patch 1916 (fixed terminal size) not optimal
Browse files Browse the repository at this point in the history
Problem:  patch 1916 (fixed terminal size) not optimal
Solution: Add defines to make it easier changeable later

Signed-off-by: Christian Brabandt <[email protected]>
  • Loading branch information
chrisbra committed Sep 21, 2023
1 parent 696270b commit ceee7a8
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
4 changes: 4 additions & 0 deletions src/libvterm/include/vterm.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ typedef unsigned char uint8_t;
typedef unsigned short uint16_t;
typedef unsigned int uint32_t;

// VIM: define max screen cols and rows
#define VTERM_MAX_COLS 1000
#define VTERM_MAX_ROWS 1000

#define VTERM_VERSION_MAJOR 0
#define VTERM_VERSION_MINOR 3
#define VTERM_VERSION_PATCH 3
Expand Down
8 changes: 4 additions & 4 deletions src/libvterm/src/screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -776,14 +776,14 @@ static int resize(int new_rows, int new_cols, VTermStateFields *fields, void *us
if(screen->sb_buffer)
vterm_allocator_free(screen->vt, screen->sb_buffer);

if (new_cols > 1000)
new_cols = 1000;
if (new_cols > VTERM_MAX_COLS)
new_cols = VTERM_MAX_COLS;

screen->sb_buffer = vterm_allocator_malloc(screen->vt, sizeof(VTermScreenCell) * new_cols);
}

if (new_rows > 1000)
new_rows = 1000;
if (new_rows > VTERM_MAX_ROWS)
new_rows = VTERM_MAX_ROWS;

resize_buffer(screen, 0, new_rows, new_cols, !altscreen_active, fields);
if(screen->buffers[BUFIDX_ALTSCREEN])
Expand Down
8 changes: 4 additions & 4 deletions src/terminal.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,10 @@ parse_termwinsize(win_T *wp, int *rows, int *cols)
}
*rows = atoi((char *)wp->w_p_tws);
*cols = atoi((char *)p + 1);
if (*rows > 1000)
*rows = 1000;
if (*cols > 1000)
*cols = 1000;
if (*rows > VTERM_MAX_ROWS)
*rows = VTERM_MAX_ROWS;
if (*cols > VTERM_MAX_COLS)
*cols = VTERM_MAX_COLS;
return minsize;
}

Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1927,
/**/
1926,
/**/
Expand Down

0 comments on commit ceee7a8

Please sign in to comment.