patch 8.1.1885: comments in libvterm are inconsistent
Problem: Comments in libvterm are inconsistent.
Solution: Use // comments. Als update the table of combining characters.
diff --git a/src/libvterm/include/vterm.h b/src/libvterm/include/vterm.h
index 3b77cd2..02ea91c 100644
--- a/src/libvterm/include/vterm.h
+++ b/src/libvterm/include/vterm.h
@@ -15,7 +15,7 @@
#define TRUE 1
#define FALSE 0
-/* from stdint.h */
+// from stdint.h
typedef unsigned char uint8_t;
typedef unsigned int uint32_t;
@@ -23,7 +23,7 @@
typedef struct VTermState VTermState;
typedef struct VTermScreen VTermScreen;
-/* Specifies a screen point. */
+// Specifies a screen point.
typedef struct {
int row;
int col;
@@ -48,7 +48,7 @@
}
#endif
-/* Specifies a rectangular screen area. */
+// Specifies a rectangular screen area.
typedef struct {
int start_row;
int end_row;
@@ -56,7 +56,7 @@
int end_col;
} VTermRect;
-/* Return true if the rect "r" contains the point "p". */
+// Return true if the rect "r" contains the point "p".
int vterm_rect_contains(VTermRect r, VTermPos p);
#if defined(DEFINE_INLINES) || USE_INLINE
@@ -67,8 +67,8 @@
}
#endif
-/* Move "rect" "row_delta" down and "col_delta" right.
- * Does not check boundaries. */
+// Move "rect" "row_delta" down and "col_delta" right.
+// Does not check boundaries.
void vterm_rect_move(VTermRect *rect, int row_delta, int col_delta);
#if defined(DEFINE_INLINES) || USE_INLINE
@@ -79,12 +79,12 @@
}
#endif
-/* The ansi_index is used for the lower 16 colors, which can be set to any
- * color. */
-#define VTERM_ANSI_INDEX_DEFAULT 0 /* color cleared */
+// The ansi_index is used for the lower 16 colors, which can be set to any
+// color.
+#define VTERM_ANSI_INDEX_DEFAULT 0 // color cleared
#define VTERM_ANSI_INDEX_MIN 1
#define VTERM_ANSI_INDEX_MAX 16
-#define VTERM_ANSI_INDEX_NONE 255 /* non-ANSI color, use red/green/blue */
+#define VTERM_ANSI_INDEX_NONE 255 // non-ANSI color, use red/green/blue
typedef struct {
uint8_t red, green, blue;
@@ -92,7 +92,7 @@
} VTermColor;
typedef enum {
- /* VTERM_VALUETYPE_NONE = 0 */
+ // VTERM_VALUETYPE_NONE = 0
VTERM_VALUETYPE_BOOL = 1,
VTERM_VALUETYPE_INT,
VTERM_VALUETYPE_STRING,
@@ -109,7 +109,7 @@
} VTermValue;
typedef enum {
- /* VTERM_ATTR_NONE = 0 */
+ // VTERM_ATTR_NONE = 0
VTERM_ATTR_BOLD = 1, // bool: 1, 22
VTERM_ATTR_UNDERLINE, // number: 4, 21, 24
VTERM_ATTR_ITALIC, // bool: 3, 23
@@ -124,7 +124,7 @@
} VTermAttr;
typedef enum {
- /* VTERM_PROP_NONE = 0 */
+ // VTERM_PROP_NONE = 0
VTERM_PROP_CURSORVISIBLE = 1, // bool
VTERM_PROP_CURSORBLINK, // bool
VTERM_PROP_ALTSCREEN, // bool
@@ -158,33 +158,33 @@
typedef struct {
const uint32_t *chars;
int width;
- unsigned int protected_cell:1; /* DECSCA-protected against DECSEL/DECSED */
- unsigned int dwl:1; /* DECDWL or DECDHL double-width line */
- unsigned int dhl:2; /* DECDHL double-height line (1=top 2=bottom) */
+ unsigned int protected_cell:1; // DECSCA-protected against DECSEL/DECSED
+ unsigned int dwl:1; // DECDWL or DECDHL double-width line
+ unsigned int dhl:2; // DECDHL double-height line (1=top 2=bottom)
} VTermGlyphInfo;
typedef struct {
- unsigned int doublewidth:1; /* DECDWL or DECDHL line */
- unsigned int doubleheight:2; /* DECDHL line (1=top 2=bottom) */
+ unsigned int doublewidth:1; // DECDWL or DECDHL line
+ unsigned int doubleheight:2; // DECDHL line (1=top 2=bottom)
} VTermLineInfo;
typedef struct {
- /* libvterm relies on the allocated memory to be zeroed out before it is
- * returned by the allocator. */
+ // libvterm relies on the allocated memory to be zeroed out before it is
+ // returned by the allocator.
void *(*malloc)(size_t size, void *allocdata);
void (*free)(void *ptr, void *allocdata);
} VTermAllocatorFunctions;
-/* Allocate and initialize a new terminal with default allocators. */
+// Allocate and initialize a new terminal with default allocators.
VTerm *vterm_new(int rows, int cols);
-/* Allocate and initialize a new terminal with specified allocators. */
+// Allocate and initialize a new terminal with specified allocators.
VTerm *vterm_new_with_allocator(int rows, int cols, VTermAllocatorFunctions *funcs, void *allocdata);
-/* Free and cleanup a terminal and all its data. */
+// 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". */
+// 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);
@@ -207,8 +207,8 @@
void vterm_keyboard_end_paste(VTerm *vt);
void vterm_mouse_move(VTerm *vt, int row, int col, VTermModifier mod);
-/* "button" is 1 for left, 2 for middle, 3 for right.
- * Button 4 is scroll wheel down, button 5 is scroll wheel up. */
+// "button" is 1 for left, 2 for middle, 3 for right.
+// Button 4 is scroll wheel down, button 5 is scroll wheel up.
void vterm_mouse_button(VTerm *vt, int button, int pressed, VTermModifier mod);
// ------------
@@ -229,7 +229,7 @@
#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 */
+// Can't use -1 to indicate a missing argument; use this instead
#define CSI_ARG_MISSING ((1<<30)-1)
#define CSI_ARG_IS_MISSING(a) (CSI_ARG(a) == CSI_ARG_MISSING)
@@ -261,8 +261,8 @@
int (*erase)(VTermRect rect, int selective, void *user);
int (*initpen)(void *user);
int (*setpenattr)(VTermAttr attr, VTermValue *val, void *user);
- /* Callback for setting various properties. Must return 1 if the property
- * was accepted, 0 otherwise. */
+ // Callback for setting various properties. Must return 1 if the property
+ // was accepted, 0 otherwise.
int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
int (*bell)(void *user);
int (*resize)(int rows, int cols, VTermPos *delta, void *user);
@@ -279,7 +279,7 @@
#define MOUSE_WANT_CLICK 0x01
#define MOUSE_WANT_DRAG 0x02
#define MOUSE_WANT_MOVE 0x04
- /* useful to add protocol? */
+ // useful to add protocol?
} VTermMouseState;
VTermState *vterm_obtain_state(VTerm *vt);
@@ -291,7 +291,7 @@
void vterm_state_set_unrecognised_fallbacks(VTermState *state, const VTermParserCallbacks *fallbacks, void *user);
void *vterm_state_get_unrecognised_fbdata(VTermState *state);
-/* Initialize the state. */
+// Initialize the state.
void vterm_state_reset(VTermState *state, int hard);
void vterm_state_get_cursorpos(const VTermState *state, VTermPos *cursorpos);
@@ -318,9 +318,9 @@
unsigned int blink : 1;
unsigned int reverse : 1;
unsigned int strike : 1;
- unsigned int font : 4; /* 0 to 9 */
- unsigned int dwl : 1; /* On a DECDWL or DECDHL line */
- unsigned int dhl : 2; /* On a DECDHL line (1=top 2=bottom) */
+ unsigned int font : 4; // 0 to 9
+ unsigned int dwl : 1; // On a DECDWL or DECDHL line
+ unsigned int dhl : 2; // On a DECDHL line (1=top 2=bottom)
} VTermScreenCellAttrs;
typedef struct {
@@ -331,7 +331,7 @@
VTermColor fg, bg;
} VTermScreenCell;
-/* All fields are optional, NULL when not used. */
+// All fields are optional, NULL when not used.
typedef struct {
int (*damage)(VTermRect rect, void *user);
int (*moverect)(VTermRect dest, VTermRect src, void *user);
@@ -339,14 +339,14 @@
int (*settermprop)(VTermProp prop, VTermValue *val, void *user);
int (*bell)(void *user);
int (*resize)(int rows, int cols, void *user);
- /* A line was pushed off the top of the window.
- * "cells[cols]" contains the cells of that line.
- * Return value is unused. */
+ // A line was pushed off the top of the window.
+ // "cells[cols]" contains the cells of that line.
+ // Return value is unused.
int (*sb_pushline)(int cols, const VTermScreenCell *cells, void *user);
int (*sb_popline)(int cols, VTermScreenCell *cells, void *user);
} VTermScreenCallbacks;
-/* Return the screen of the vterm. */
+// Return the screen of the vterm.
VTermScreen *vterm_obtain_screen(VTerm *vt);
/*
@@ -356,25 +356,25 @@
void vterm_screen_set_callbacks(VTermScreen *screen, const VTermScreenCallbacks *callbacks, void *user);
void *vterm_screen_get_cbdata(VTermScreen *screen);
-// Only invokes control, csi, osc, dcs
+/* Only invokes control, csi, osc, dcs */
void vterm_screen_set_unrecognised_fallbacks(VTermScreen *screen, const VTermParserCallbacks *fallbacks, void *user);
void *vterm_screen_get_unrecognised_fbdata(VTermScreen *screen);
-/* Enable support for using the alternate screen if "altscreen" is non-zero.
- * Before that switching to the alternate screen won't work.
- * Calling with "altscreen" zero has no effect. */
+// Enable support for using the alternate screen if "altscreen" is non-zero.
+// Before that switching to the alternate screen won't work.
+// Calling with "altscreen" zero has no effect.
void vterm_screen_enable_altscreen(VTermScreen *screen, int altscreen);
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_CELL, // every cell
+ VTERM_DAMAGE_ROW, // entire rows
+ VTERM_DAMAGE_SCREEN, // entire screen
+ VTERM_DAMAGE_SCROLL, // entire screen + scrollrect
VTERM_N_DAMAGES
} VTermDamageSize;
-/* Invoke the relevant callbacks to update the screen. */
+// 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);
@@ -385,7 +385,7 @@
*/
void vterm_screen_reset(VTermScreen *screen, int hard);
-/* Neither of these functions NUL-terminate the buffer */
+// Neither of these functions NUL-terminate the buffer
size_t vterm_screen_get_chars(const VTermScreen *screen, uint32_t *chars, size_t len, const VTermRect rect);
size_t vterm_screen_get_text(const VTermScreen *screen, char *str, size_t len, const VTermRect rect);
diff --git a/src/libvterm/include/vterm_keycodes.h b/src/libvterm/include/vterm_keycodes.h
index 22bdf91..e5fb5ab 100644
--- a/src/libvterm/include/vterm_keycodes.h
+++ b/src/libvterm/include/vterm_keycodes.h
@@ -7,10 +7,10 @@
VTERM_MOD_ALT = 0x02,
VTERM_MOD_CTRL = 0x04,
- VTERM_ALL_MODS_MASK = 0x07
+ VTERM_ALL_MODS_MASK = 0x07
} VTermModifier;
-/* The order here must match keycodes[] in src/keyboard.c! */
+// The order here must match keycodes[] in src/keyboard.c!
typedef enum {
VTERM_KEY_NONE,
@@ -31,11 +31,11 @@
VTERM_KEY_PAGEUP,
VTERM_KEY_PAGEDOWN,
- /* F1 is VTERM_KEY_FUNCTION(1), F2 VTERM_KEY_FUNCTION(2), etc. */
+ // 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 */
+ // keypad keys
VTERM_KEY_KP_0,
VTERM_KEY_KP_1,
VTERM_KEY_KP_2,