Permalink
Browse files

patch 8.0.0763: libvterm can be improved

Problem:    Libvterm can be improved.
Solution:   Various small improvements, more comments.
  • Loading branch information...
brammool committed Jul 23, 2017
1 parent c31f9ae commit 9cc5f75932b10f611d8b3f444d025053f9dbcab1
View
@@ -1,13 +1,12 @@
This is a MODIFIED version of libvterm.
The original can be found:
On the original site (tar archive and Bazaar repository):
- on the original site (tar archive and Bazaar repository):
http://www.leonerd.org.uk/code/libvterm/
Cloned on Github:
- cloned on Github:
https://github.com/neovim/libvterm
Modifications:
- Add a .gitignore file.
- Convert from C99 to C90.
- Other changes to support embedding in Vim.
-
@@ -160,7 +160,9 @@ VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *fun
/* Free and cleanup a terminal and all its data. */
void vterm_free(VTerm* vt);
/* Get the current size of the terminal and store in "rowsp" and "colsp". */
void vterm_get_size(const VTerm *vt, int *rowsp, int *colsp);
void vterm_set_size(VTerm *vt, int rows, int cols);
int vterm_get_utf8(const VTerm *vt);
@@ -195,14 +197,14 @@ void vterm_mouse_button(VTerm *vt, int button, bool pressed, VTermModifier mod);
*
* Don't confuse this with the final byte of the CSI escape; 'a' in this case.
*/
#define CSI_ARG_FLAG_MORE (1<<31)
#define CSI_ARG_MASK (~(1<<31))
#define CSI_ARG_FLAG_MORE (1<<30)
#define CSI_ARG_MASK (~(1<<30))
#define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE)
#define CSI_ARG(a) ((a) & CSI_ARG_MASK)
/* Can't use -1 to indicate a missing argument; use this instead */
#define CSI_ARG_MISSING ((1UL<<31)-1)
#define CSI_ARG_MISSING ((1<<30)-1)
#define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING)
#define CSI_ARG_OR(a,def) (CSI_ARG(a) == CSI_ARG_MISSING ? (def) : CSI_ARG(a))
@@ -248,7 +250,9 @@ void *vterm_state_get_cbdata(VTermState *state);
void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermParserCallbacks *fallbacks, void *user);
void *vterm_state_get_unrecognised_fbdata(VTermState *state);
/* Initialize the state. */
void vterm_state_reset(VTermState *state, int hard);
void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos);
void vterm_state_get_default_colors(const VTermState *state, VTermColor *default_fg, VTermColor *default_bg);
void vterm_state_get_palette_color(const VTermState *state, int index, VTermColor *col);
@@ -295,6 +299,7 @@ typedef struct {
int (*sb_popline)(int cols, VTermScreenCell *cells, void *user);
} VTermScreenCallbacks;
/* Return the screen of the vterm. */
VTermScreen *vterm_obtain_screen(VTerm *vt);
/*
@@ -317,9 +322,15 @@ typedef enum {
VTERM_DAMAGE_SCROLL /* entire screen + scrollrect */
} VTermDamageSize;
/* Invoke the relevant callbacks to update the screen. */
void vterm_screen_flush_damage(VTermScreen *screen);
void vterm_screen_set_damage_merge(VTermScreen *screen, VTermDamageSize size);
/*
* Reset the screen. Also invokes vterm_state_reset().
* Must be called before the terminal can be used.
*/
void vterm_screen_reset(VTermScreen *screen, int hard);
/* Neither of these functions NUL-terminate the buffer */
@@ -28,9 +28,11 @@ typedef enum {
VTERM_KEY_PAGEUP,
VTERM_KEY_PAGEDOWN,
/* F1 is VTERM_KEY_FUNCTION(1), F2 VTERM_KEY_FUNCTION(2), etc. */
VTERM_KEY_FUNCTION_0 = 256,
VTERM_KEY_FUNCTION_MAX = VTERM_KEY_FUNCTION_0 + 255,
/* keypad keys */
VTERM_KEY_KP_0,
VTERM_KEY_KP_1,
VTERM_KEY_KP_2,
@@ -68,6 +68,7 @@ typedef struct {
int csinum;
} keycodes_s;
/* Order here must be exactly the same as VTermKey enum! */
static keycodes_s keycodes[] = {
{ KEYCODE_NONE, 0, 0 }, /* NONE */
@@ -190,7 +190,7 @@ static size_t do_string(VTerm *vt, const char *str_frag, size_t len)
size_t vterm_input_write(VTerm *vt, const char *bytes, size_t len)
{
size_t pos = 0;
const char *string_start;
const char *string_start = NULL; /* init to avoid gcc warning */
switch(vt->parser_state) {
case NORMAL:
View
@@ -819,14 +819,9 @@ int vterm_screen_is_eol(const VTermScreen *screen, VTermPos pos)
VTermScreen *vterm_obtain_screen(VTerm *vt)
{
VTermScreen *screen;
if(vt->screen)
return vt->screen;
screen = screen_new(vt);
vt->screen = screen;
return screen;
if(!vt->screen)
vt->screen = screen_new(vt);
return vt->screen;
}
void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen)
View
@@ -1194,6 +1194,7 @@ static int on_csi(const char *leader, const long args[], int argcount, const cha
break;
case LEADER('>', 0x63): /* DEC secondary Device Attributes */
/* This returns xterm version number 100. */
vterm_push_output_sprintf_ctrl(state->vt, C1_CSI, ">%d;%d;%dc", 0, 100, 0);
break;
View
@@ -769,6 +769,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
763,
/**/
762,
/**/

0 comments on commit 9cc5f75

Please sign in to comment.