aboutsummaryrefslogtreecommitdiff
path: root/view.h
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2023-10-19 07:19:00 -0600
committerRandy Palamar <randy@rnpnr.xyz>2024-03-25 21:09:42 -0600
commit95bf9f59f8a9a37148bdc0787db378d62c7cd032 (patch)
tree01c8c6e8f51260cef7fa048d0f7472ab93a4a327 /view.h
parent49442e5178296a58f8ca2e267a93b89c5cca8e5b (diff)
downloadvis-95bf9f59f8a9a37148bdc0787db378d62c7cd032.tar.gz
vis-95bf9f59f8a9a37148bdc0787db378d62c7cd032.tar.xz
ui: refactor style handling
The old style handling had a lot edge cases where one of the colours or the attribute wouldn't get applied correctly. This commit adds a new style_set() method to the Ui which should be called instead of manually touching a cell's style. This also means that the Cell struct can be made opaque since all the handling is now done inside the ui-terminal files. With this it is now viable to combine the light and dark 16 colour themes into a single base-16 theme. This theme works very well with the Linux virtual console and will now be the default theme regardless of if the terminal supports 256 colours or not. This should address the common complaints about vis not respecting the users default terminal colours. fixes #1151: Theming is sometimes partially applied or ignored see #1103: terminal no longer has transparency/opacity see #1040: Transparent background and setting options by default
Diffstat (limited to 'view.h')
-rw-r--r--view.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/view.h b/view.h
index 95df58b..68eeb4b 100644
--- a/view.h
+++ b/view.h
@@ -6,6 +6,7 @@
typedef struct View View;
typedef struct Selection Selection;
+typedef struct Cell Cell;
#include "text.h"
#include "ui.h"
@@ -16,7 +17,7 @@ typedef struct {
Mark cursor;
} SelectionRegion;
-typedef struct {
+struct Cell {
char data[16]; /* utf8 encoded character displayed in this cell (might be more than
one Unicode codepoint. might also not be the same as in the
underlying text, for example tabs get expanded */
@@ -26,7 +27,7 @@ typedef struct {
occupied by the same character have a length of 0. */
int width; /* display width i.e. number of columns occupied by this character */
CellStyle style; /* colors and attributes used to display this cell */
-} Cell;
+};
typedef struct Line Line;
struct Line { /* a line on the screen, *not* in the file */