Underline is broken, clearing terminal fixed

let shell deal with it amirite?
This commit is contained in:
Rekketstone 2025-01-16 11:29:27 -07:00
parent 4c06bb7562
commit a14cca9a99

View File

@ -65,7 +65,7 @@ static int using_alternate = 0;
#define ATTR_BOLD (1 << 0)
#define ATTR_ITALIC (1 << 1)
#define ATTR_REVERSE (1 << 2)
#define ATTR_UNDERLINE (1 << 3)
// #define ATTR_UNDERLINE (1 << 3) // Underline currently is buggy
#define ATTR_DIM (1 << 4)
#define ATTR_BLINK (1 << 5)
@ -332,10 +332,10 @@ static void draw_char(Display *display, Drawable d, int x, int y) {
XDrawString(display, d, gc, x * CHAR_WIDTH, (y + 1) * CHAR_HEIGHT - 2, str,
1);
if (attrs & ATTR_UNDERLINE) {
XDrawLine(display, d, gc, x * CHAR_WIDTH, (y + 1) * CHAR_HEIGHT - 1,
(x + 1) * CHAR_WIDTH, (y + 1) * CHAR_HEIGHT - 1);
}
// if (attrs & ATTR_UNDERLINE) {
// XDrawLine(display, d, gc, x * CHAR_WIDTH, (y + 1) * CHAR_HEIGHT - 1,
// (x + 1) * CHAR_WIDTH, (y + 1) * CHAR_HEIGHT - 1);
// }
}
static void draw_terminal(Display *display, Window window) {
@ -690,9 +690,9 @@ static void parse_ansi_code(const char *buf, int *idx, int max_len) {
current_attr |= ATTR_DIM;
} else if (params[i] == 3) {
current_attr |= ATTR_ITALIC;
} else if (params[i] == 4) {
current_attr |= ATTR_UNDERLINE;
} else if (params[i] == 5) {
// } else if (params[i] == 4) {
// current_attr |= ATTR_UNDERLINE;
} else if (params[i] == 5) { // Slow blink
current_attr |= ATTR_BLINK;
} else if (params[i] == 7) {
current_attr |= ATTR_REVERSE;
@ -700,8 +700,10 @@ static void parse_ansi_code(const char *buf, int *idx, int max_len) {
current_attr &= ~ATTR_BOLD;
} else if (params[i] == 23) {
current_attr &= ~ATTR_ITALIC;
} else if (params[i] == 24) {
current_attr &= ~ATTR_UNDERLINE;
// } else if (params[i] == 24) {
// current_attr &= ~ATTR_UNDERLINE;
} else if (params[i] == 25) {
current_attr &= ~ATTR_BLINK;
} else if (params[i] == 27) {
current_attr &= ~ATTR_REVERSE;
} else if (params[i] >= 30 && params[i] <= 37) { // Foreground colors
@ -806,7 +808,6 @@ static void key_press_cb(XKeyEvent *event, void *data) {
if (event->state & ControlMask) {
if ((keysym & 0x1f) == ('L' & 0x1f)) {
write(*master, "\f", 1);
clear_terminal(event->display, event->window);
return;
}
if ((keysym & 0x1f) == ('C' & 0x1f)) {