* Alternatively, BEL (\a) can be used instead of ST.
*/
#define UL_HYPERLINK_START UL_OSC8
-#define UL_HYPERLINK_PARAMS ";;"
+#define UL_HYPERLINK_PARAMS ";;" /* Reserved for future extendability by the OSC8 */
#define UL_HYPERLINK_LINK UL_ST
#define UL_HYPERLINK_END (UL_OSC8 ";;" UL_ST)
<SECTION>
<FILE>column</FILE>
libscols_column
+scols_column_get_annotation
scols_column_get_color
scols_column_get_data_type
scols_column_get_flags
scols_column_is_tree
scols_column_is_trunc
scols_column_is_wrap
+scols_column_refer_annotation
scols_column_set_cmpfunc
scols_column_set_color
scols_column_set_data_func
goto err;
if (scols_cell_copy_content(&ret->header, &cl->header))
goto err;
+ if (scols_column_refer_annotation(ret, cl->annotation))
+ goto err;
- ret->width = cl->width;
- ret->width_hint = cl->width_hint;
- ret->flags = cl->flags;
- ret->is_groups = cl->is_groups;
+ ret->width = cl->width;
+ ret->width_hint = cl->width_hint;
+ ret->flags = cl->flags;
+ ret->is_groups = cl->is_groups;
memcpy(&ret->wstat, &cl->wstat, sizeof(cl->wstat));
return scols_cell_get_data(&cl->header);
}
+/**
+ * scols_column_refer_annotation:
+ * @cl: a pointer to a struct libscols_column instance
+ * @annotation: column annotation
+ *
+ * Returns: 0, a negative value in case of an error.
+ *
+ * Since: 2.42
+ */
+int scols_column_refer_annotation(struct libscols_column *cl, const char *annotation)
+{
+ if (!annotation)
+ return -1;
+
+ cl->annotation = (char *) annotation;
+ return 0;
+}
+
+/**
+ * scols_column_get_annotation:
+ * @cl: a pointer to a struct libscols_column instance
+ *
+ * Returns: A pointer to a column annotation, which is stored in column annotation
+ *
+ * Since: 2.42
+ */
+const char *scols_column_get_annotation(struct libscols_column *cl)
+{
+ return cl->annotation;
+}
+
/**
* scols_column_set_headercolor:
* @cl: a pointer to a struct libscols_column instance
extern const char *scols_column_get_name_as_shellvar(struct libscols_column *cl);
extern int scols_shellvar_name(const char *name, char **buf, size_t *bufsz);
+extern int scols_column_refer_annotation(struct libscols_column *cl, const char *annotation);
+extern const char *scols_column_get_annotation(struct libscols_column *cl);
+
extern int scols_column_set_properties(struct libscols_column *cl, const char *opts);
extern int scols_column_set_cmpfunc(struct libscols_column *cl,
scols_filter_has_holder;
scols_column_set_headercolor;
scols_column_get_headercolor;
+ scols_column_refer_annotation;
+ scols_column_get_annotation;
} SMARTCOLS_2.41;
struct libscols_cell *ce;
size_t len = 0, i, width, bytes;
char *data = NULL;
- const char *name = NULL, *uri = NULL;
+ const char *name = NULL, *annot = NULL, *uri = NULL;
int is_last;
assert(tb);
if (cl->uri || ce->uri)
uri = mk_cell_uri(cl, ce, buf);
+ if (cl->annotation)
+ annot = scols_column_get_annotation(cl);
+
/* Encode. Note that 'len' and 'width' are number of glyphs not bytes.
*/
if (scols_table_is_noencoding(tb))
fputc(data[i], tb->out);
}
ul_fputs_hyperlink(uri, link, tb->out);
- } else
+ } else if (!ln && annot && *annot) {
+ /* Printing the header with a column annotation as tooltip */
+ ul_fputs_hyperlink(annot, data, tb->out);
+ } else {
fputs(data, tb->out);
+ }
}
/* minout -- don't fill */
int flags;
char *color; /* default column color */
+ char *annotation; /* column annotation */
char *uri; /* default column URI prefix */
struct ul_buffer uri_buf; /* temporary buffer to compose URIs */
char *safechars; /* do not encode this bytes */