Skip to content

Commit

Permalink
patch 8.0.1639: libvterm code lags behind master
Browse files Browse the repository at this point in the history
Problem:    Libvterm code lags behind master.
Solution:   Sync to head, solve merge problems.
  • Loading branch information
brammool committed Mar 25, 2018
1 parent e7499dd commit b5b49a3
Show file tree
Hide file tree
Showing 20 changed files with 390 additions and 262 deletions.
18 changes: 18 additions & 0 deletions src/libvterm/README
Expand Up @@ -10,3 +10,21 @@ Modifications:
- Add a .gitignore file.
- Convert from C99 to C90.
- Other changes to support embedding in Vim.


To merge in changes from Github, do this:
- Commit any pending changes.
- Setup the merge tool:
git config merge.tool vimdiff
git config merge.conflictstyle diff3
git config mergetool.prompt false
- Run the merge tool:
git mergetool
This will open a four-way diff between:
LOCAL - your current version
BASE - version as it was at your last sync
REMOTE - version at head on Github
MERGED - best-effort merge of LOCAL and REMOTE
Now find places where automatic merge didn't work, they are marked with
<<<<<<<<, ======= and >>>>>>>
Fix those places in MERGED, remove the markers, and save the file :wqall.
13 changes: 7 additions & 6 deletions src/libvterm/bin/unterm.c
Expand Up @@ -95,8 +95,8 @@ static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevce
sgr[sgri++] = 90 + (index - 8);
else {
sgr[sgri++] = 38;
sgr[sgri++] = 5 | (1<<31);
sgr[sgri++] = index | (1<<31);
sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE;
sgr[sgri++] = index | CSI_ARG_FLAG_MORE;
}
}

Expand All @@ -112,8 +112,8 @@ static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevce
sgr[sgri++] = 100 + (index - 8);
else {
sgr[sgri++] = 48;
sgr[sgri++] = 5 | (1<<31);
sgr[sgri++] = index | (1<<31);
sgr[sgri++] = 5 | CSI_ARG_FLAG_MORE;
sgr[sgri++] = index | CSI_ARG_FLAG_MORE;
}
}

Expand All @@ -125,9 +125,9 @@ static void dump_cell(const VTermScreenCell *cell, const VTermScreenCell *prevce
int i;
for(i = 0; i < sgri; i++)
printf(!i ? "%d" :
sgr[i] & (1<<31) ? ":%d" :
CSI_ARG_HAS_MORE(sgr[i]) ? ":%d" :
";%d",
sgr[i] & ~(1<<31));
CSI_ARG(sgr[i]));
}
printf("m");
}
Expand Down Expand Up @@ -283,5 +283,6 @@ int main(int argc, char *argv[])
close(fd);

vterm_free(vt);

return 0;
}
8 changes: 6 additions & 2 deletions src/libvterm/bin/vterm-ctrl.c
Expand Up @@ -53,6 +53,7 @@ static char *helptext[] = {
"curblink [off|on|query]",
"curshape [block|under|bar|query]",
"mouse [off|click|clickdrag|motion]",
"reportfocus [off|on|query]",
"altscreen [off|on|query]",
"bracketpaste [off|on|query]",
"icontitle [STR]",
Expand Down Expand Up @@ -81,9 +82,9 @@ static int seticanon(int icanon, int echo)
return ret;
}

static void await_c1(int c1)
static void await_c1(unsigned char c1)
{
int c;
unsigned char c;

/* await CSI - 8bit or 2byte 7bit form */
int in_esc = FALSE;
Expand Down Expand Up @@ -340,6 +341,9 @@ int main(int argc, char *argv[])
printf("\x1b[?1003h"); break;
}
}
else if(streq(arg, "reportfocus")) {
do_dec_mode(1004, getboolq(&argi, argc, argv), "reportfocus");
}
else if(streq(arg, "altscreen")) {
do_dec_mode(1049, getboolq(&argi, argc, argv), "altscreen");
}
Expand Down
1 change: 1 addition & 0 deletions src/libvterm/bin/vterm-dump.c
Expand Up @@ -227,5 +227,6 @@ int main(int argc, char *argv[])

close(fd);
vterm_free(vt);

return 0;
}
3 changes: 3 additions & 0 deletions src/libvterm/doc/URLs
Expand Up @@ -9,3 +9,6 @@ Digital VT100 User Guide:

Digital VT220 Programmer Reference Manual
http://vt100.net/docs/vt220-rm/

Summary of ANSI standards for ASCII terminals
http://www.inwap.com/pdp10/ansicode.txt
1 change: 1 addition & 0 deletions src/libvterm/doc/seqs.txt
Expand Up @@ -151,6 +151,7 @@ between states.
DECSM 1000 = Mouse click/release tracking
DECSM 1002 = Mouse click/release/drag tracking
DECSM 1003 = Mouse all movements tracking
DECSM 1004 = Focus in/out reporting
DECSM 1005 = Mouse protocol extended (UTF-8) - not recommended
DECSM 1006 = Mouse protocol SGR
DECSM 1015 = Mouse protocol rxvt
Expand Down
34 changes: 25 additions & 9 deletions src/libvterm/include/vterm.h
Expand Up @@ -96,7 +96,9 @@ typedef enum {
VTERM_VALUETYPE_BOOL = 1,
VTERM_VALUETYPE_INT,
VTERM_VALUETYPE_STRING,
VTERM_VALUETYPE_COLOR
VTERM_VALUETYPE_COLOR,

VTERM_N_VALUETYPES
} VTermValueType;

typedef union {
Expand All @@ -116,7 +118,9 @@ typedef enum {
VTERM_ATTR_STRIKE, /* bool: 9, 29 */
VTERM_ATTR_FONT, /* number: 10-19 */
VTERM_ATTR_FOREGROUND, /* color: 30-39 90-97 */
VTERM_ATTR_BACKGROUND /* color: 40-49 100-107 */
VTERM_ATTR_BACKGROUND, /* color: 40-49 100-107 */

VTERM_N_ATTRS
} VTermAttr;

typedef enum {
Expand All @@ -129,20 +133,26 @@ typedef enum {
VTERM_PROP_REVERSE, /* bool */
VTERM_PROP_CURSORSHAPE, /* number */
VTERM_PROP_MOUSE, /* number */
VTERM_PROP_CURSORCOLOR /* string */
VTERM_PROP_CURSORCOLOR, /* string */

VTERM_N_PROPS
} VTermProp;

enum {
VTERM_PROP_CURSORSHAPE_BLOCK = 1,
VTERM_PROP_CURSORSHAPE_UNDERLINE,
VTERM_PROP_CURSORSHAPE_BAR_LEFT
VTERM_PROP_CURSORSHAPE_BAR_LEFT,

VTERM_N_PROP_CURSORSHAPES
};

enum {
VTERM_PROP_MOUSE_NONE = 0,
VTERM_PROP_MOUSE_CLICK,
VTERM_PROP_MOUSE_DRAG,
VTERM_PROP_MOUSE_MOVE
VTERM_PROP_MOUSE_MOVE,

VTERM_N_PROP_MOUSES
};

typedef struct {
Expand Down Expand Up @@ -213,8 +223,8 @@ void vterm_mouse_button(VTerm *vt, int button, int 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<<30)
#define CSI_ARG_MASK (~(1<<30))
#define CSI_ARG_FLAG_MORE (1U<<31)
#define CSI_ARG_MASK (~(1U<<31))

#define CSI_ARG_HAS_MORE(a) ((a) & CSI_ARG_FLAG_MORE)
#define CSI_ARG(a) ((a) & CSI_ARG_MASK)
Expand Down Expand Up @@ -293,6 +303,8 @@ void vterm_state_set_palette_color(VTermState *state, int index, const VTermColo
void vterm_state_set_bold_highbright(VTermState *state, int bold_is_highbright);
int vterm_state_get_penattr(const VTermState *state, VTermAttr attr, VTermValue *val);
int vterm_state_set_termprop(VTermState *state, VTermProp prop, VTermValue *val);
void vterm_state_focus_in(VTermState *state);
void vterm_state_focus_out(VTermState *state);
const VTermLineInfo *vterm_state_get_lineinfo(const VTermState *state, int row);

/* ------------
Expand Down Expand Up @@ -357,7 +369,9 @@ typedef enum {
VTERM_DAMAGE_CELL, /* every cell */
VTERM_DAMAGE_ROW, /* entire rows */
VTERM_DAMAGE_SCREEN, /* entire screen */
VTERM_DAMAGE_SCROLL /* entire screen + scrollrect */
VTERM_DAMAGE_SCROLL, /* entire screen + scrollrect */

VTERM_N_DAMAGES
} VTermDamageSize;

/* Invoke the relevant callbacks to update the screen. */
Expand All @@ -384,7 +398,9 @@ typedef enum {
VTERM_ATTR_STRIKE_MASK = 1 << 5,
VTERM_ATTR_FONT_MASK = 1 << 6,
VTERM_ATTR_FOREGROUND_MASK = 1 << 7,
VTERM_ATTR_BACKGROUND_MASK = 1 << 8
VTERM_ATTR_BACKGROUND_MASK = 1 << 8,

VTERM_ALL_ATTRS_MASK = (1 << 9) - 1
} VTermAttrMask;

int vterm_screen_get_attrs_extent(const VTermScreen *screen, VTermRect *extent, VTermPos pos, VTermAttrMask attrs);
Expand Down
7 changes: 5 additions & 2 deletions src/libvterm/include/vterm_keycodes.h
Expand Up @@ -5,7 +5,9 @@ typedef enum {
VTERM_MOD_NONE = 0x00,
VTERM_MOD_SHIFT = 0x01,
VTERM_MOD_ALT = 0x02,
VTERM_MOD_CTRL = 0x04
VTERM_MOD_CTRL = 0x04,

VTERM_ALL_MODS_MASK = 0x07
} VTermModifier;

/* The order here must match keycodes[] in src/keyboard.c! */
Expand Down Expand Up @@ -53,7 +55,8 @@ typedef enum {
VTERM_KEY_KP_ENTER,
VTERM_KEY_KP_EQUAL,

VTERM_KEY_MAX /* Must be last */
VTERM_KEY_MAX, /* Must be last */
VTERM_N_KEYS = VTERM_KEY_MAX
} VTermKey;

#define VTERM_KEY_FUNCTION(n) (VTERM_KEY_FUNCTION_0+(n))
Expand Down
6 changes: 3 additions & 3 deletions src/libvterm/src/mouse.c
Expand Up @@ -63,9 +63,9 @@ void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod)

if((state->mouse_flags & MOUSE_WANT_DRAG && state->mouse_buttons) ||
(state->mouse_flags & MOUSE_WANT_MOVE)) {
int button = state->mouse_buttons & 0x01 ? 1 :
state->mouse_buttons & 0x02 ? 2 :
state->mouse_buttons & 0x04 ? 3 : 4;
int button = state->mouse_buttons & MOUSE_BUTTON_LEFT ? 1 :
state->mouse_buttons & MOUSE_BUTTON_MIDDLE ? 2 :
state->mouse_buttons & MOUSE_BUTTON_RIGHT ? 3 : 4;
output_mouse(state, button-1 + 0x20, 1, mod, col, row);
}
}
Expand Down

0 comments on commit b5b49a3

Please sign in to comment.