Re: [dev] [st] [PATCH] Optimize memory footprint of line buffers

From: suigin <>
Date: Wed, 22 Apr 2015 02:24:02 -0700

On Tue, Apr 21, 2015 at 07:03:57PM +0200, Roberto E. Vargas Caballero wrote:

Sorry, I didn't realize it was possible to use colors above 256,
neglected to see it in config.def.h. My bad.

> Maybe, a solution can be modify colorname to:
> 63 static const char *colorname[256] = {
> and force to the user to modify the colors between
> 0 and 256.
> Guys, are you using colors upper 256?

Another solution would be to allow people to typedef the color index
type used by Glyph in config.h, and move the definitions for Glyph,
TCursor and Term below where config.h is included in st.c?

That way, it makes it easy to customize it for a low memory profile.

An additional benefit of this method is that it would result in a
compilation error for users with out of sync config.h files, forcing
them to regenerate it or fix the problem by hand.

The defaults in config.def.h could look something like this:


/* <descriptive comment> */
typedef ushort ColorIndex;


static ColorIndex defaultfg = 7;
static ColorIndex defaultbg = 0;
static ColorIndex defaultcs = 256;


#include "config.h"


typedef struct {
        char c[UTF_SIZ];
        ushort mode;
        ColorIndex fg;
        ColorIndex bg;
} Gylph;

Received on Wed Apr 22 2015 - 11:24:02 CEST

This archive was generated by hypermail 2.3.0 : Wed Apr 22 2015 - 11:36:03 CEST