scols_symbols_set_right
scols_symbols_set_vertical
scols_symbols_set_title_padding
+scols_symbols_set_cell_padding
scols_unref_symbols
</SECTION>
extern int scols_symbols_set_vertical(struct libscols_symbols *sb, const char *str);
extern int scols_symbols_set_right(struct libscols_symbols *sb, const char *str);
extern int scols_symbols_set_title_padding(struct libscols_symbols *sb, const char *str);
+extern int scols_symbols_set_cell_padding(struct libscols_symbols *sb, const char *str);
/* cell.c */
extern int scols_reset_cell(struct libscols_cell *ce);
SMARTCOLS_2.29 {
global:
scols_column_is_wrapnl;
+ scols_symbols_set_cell_padding;
} SMARTCOLS_2.28;
char *vert;
char *right;
char *title_padding;
+ char *cell_padding;
};
/*
/**
* scols_symbols_set_title_padding:
* @sb: a pointer to a struct libscols_symbols instance
- * @str: a string which will represent the symbols which wraps title output
+ * @str: a string which will represent the symbols which fill title output
*
* The current implementation uses only the first byte from the padding string.
* A multibyte chars are not supported yet.
return strdup_to_struct_member(sb, title_padding, str);
}
+/**
+ * scols_symbols_set_cell_padding:
+ * @sb: a pointer to a struct libscols_symbols instance
+ * @str: a string which will represent the symbols which fill cells
+ *
+ * The padding char has to take up just one cell on the terminal.
+ *
+ * Returns: 0, a negative value in case of an error.
+ *
+ * Since: 2.29
+ */
+int scols_symbols_set_cell_padding(struct libscols_symbols *sb, const char *str)
+{
+ return strdup_to_struct_member(sb, cell_padding, str);
+}
+
/**
* scols_copy_symbols:
* @sb: a pointer to a struct libscols_symbols instance
rc = scols_symbols_set_right(ret, sb->right);
if (!rc)
rc = scols_symbols_set_title_padding(ret, sb->title_padding);
+ if (!rc)
+ rc = scols_symbols_set_cell_padding(ret, sb->cell_padding);
if (!rc)
return ret;
scols_symbols_set_right(tb->symbols, "`-");
}
scols_symbols_set_title_padding(tb->symbols, " ");
+ scols_symbols_set_cell_padding(tb->symbols, " ");
}
return 0;
#include "carefulputc.h"
#include "smartcolsP.h"
+#define colsep(tb) ((tb)->colsep ? (tb)->colsep : " ")
+#define linesep(tb) ((tb)->linesep ? (tb)->linesep : "\n")
+#define cellpadding(tb) ((tb) && (tb)->symbols && (tb)->symbols->cell_padding ? (tb)->symbols->cell_padding : " ")
+
+
/* This is private struct to work with output data */
struct libscols_buffer {
char *begin; /* begin of the buffer */
return 0;
}
-#define colsep(tb) ((tb)->colsep ? (tb)->colsep : " ")
-#define linesep(tb) ((tb)->linesep ? (tb)->linesep : "\n")
-
static int has_pending_data(struct libscols_table *tb)
{
/* fill rest of cell with space */
for(; len_pad < cl->width; ++len_pad)
- fputc(' ', tb->out);
+ fputs(cellpadding(tb), tb->out);
fputs(colsep(tb), tb->out);
}
return 0;
for (i = len; i < width; i++)
- fputc(' ', tb->out); /* padding */
+ fputs(cellpadding(tb), tb->out); /* padding */
fputs(colsep(tb), tb->out); /* columns separator */
return 0;
if (color)
fputs(color, tb->out);
for (i = len; i < width; i++)
- fputc(' ', tb->out);
+ fputs(cellpadding(tb), tb->out);
fputs(data, tb->out);
if (color)
fputs(UL_COLOR_RESET, tb->out);
fputs(data, tb->out);
}
for (i = len; i < width; i++)
- fputc(' ', tb->out); /* padding */
+ fputs(cellpadding(tb), tb->out); /* padding */
if (is_last_column(cl))
return 0;