+ if ((attr & TATTR_ACTCURS) && cfg.cursor_type != 0) {
+ attr &= ~TATTR_ACTCURS;
+ }
+ do_text_internal(ctx, x, y, text, len, attr, lattr);
+
+ if (lattr != LATTR_NORM) {
+ x *= 2;
+ if (x >= cols)
+ return;
+ if (x + len*2 > cols)
+ len = (cols-x)/2; /* trim to LH half */
+ len *= 2;
+ }
+
+ if (cfg.cursor_type == 0) {
+ /*
+ * An active block cursor will already have been done by
+ * the above do_text call, so we only need to do anything
+ * if it's passive.
+ */
+ if (passive) {
+ gdk_gc_set_foreground(gc, &inst->cols[NCOLOURS-1]);
+ gdk_draw_rectangle(inst->pixmap, gc, 0,
+ x*inst->font_width+cfg.window_border,
+ y*inst->font_height+cfg.window_border,
+ len*inst->font_width-1, inst->font_height-1);
+ }
+ } else {
+ int uheight;
+ int startx, starty, dx, dy, length, i;
+
+ int char_width;
+
+ if ((attr & ATTR_WIDE) || lattr != LATTR_NORM)
+ char_width = 2*inst->font_width;
+ else
+ char_width = inst->font_width;
+
+ if (cfg.cursor_type == 1) {
+ uheight = inst->fonts[0]->ascent + 1;
+ if (uheight >= inst->font_height)
+ uheight = inst->font_height - 1;
+
+ startx = x * inst->font_width + cfg.window_border;
+ starty = y * inst->font_height + cfg.window_border + uheight;
+ dx = 1;
+ dy = 0;
+ length = len * char_width;
+ } else {
+ int xadjust = 0;
+ if (attr & TATTR_RIGHTCURS)
+ xadjust = char_width - 1;
+ startx = x * inst->font_width + cfg.window_border + xadjust;
+ starty = y * inst->font_height + cfg.window_border;
+ dx = 0;
+ dy = 1;
+ length = inst->font_height;
+ }
+