#define COLWID 240 /* satisfy snprintf, which is faster than sprintf */
-static unsigned max_rightward = 0x12345678; /* space for RIGHT stuff */
-static unsigned max_leftward = 0x12345678; /* space for LEFT stuff */
+static unsigned max_rightward = OUTBUF_SIZE-1; /* space for RIGHT stuff */
+static unsigned max_leftward = OUTBUF_SIZE-1; /* space for LEFT stuff */
return len; /* returns number of cells */
// only use '+' when not on a multi-byte char, else show uid
- if ((unsigned)outbuf[max_rightward-1] < 127) {
+ if (max_rightward >= 1 && (unsigned)outbuf[max_rightward-1] < 127) {
len = max_rightward-1;
outbuf[len++] = '+';
outbuf[len] = 0;
max_rightward = active_cols - ( (correct>actual) ? correct : actual );
}
}
+ if(max_rightward <= 0) max_rightward = 0;
+ else if(max_rightward >= OUTBUF_SIZE) max_rightward = OUTBUF_SIZE-1;
+
max_leftward = fmt->width + actual - correct; /* TODO check this */
+ if(max_leftward <= 0) max_leftward = 0;
+ else if(max_leftward >= OUTBUF_SIZE) max_leftward = OUTBUF_SIZE-1;
// fprintf(stderr, "cols: %d, max_rightward: %d, max_leftward: %d, actual: %d, correct: %d\n",
// active_cols, max_rightward, max_leftward, actual, correct);