MODE_8BIT = 8192,
MODE_BLINK = 16384,
MODE_FBLINK = 32768,
+ MODE_FOCUS = 65536,
};
enum escape_state {
static void
selsort(void) {
- sel.nb.x = sel.ob.y < sel.oe.y ? sel.ob.x : sel.oe.x;
+ if(sel.ob.y == sel.oe.y) {
+ sel.nb.x = MIN(sel.ob.x, sel.oe.x);
+ sel.ne.x = MAX(sel.ob.x, sel.oe.x);
+ } else {
+ sel.nb.x = sel.ob.y < sel.oe.y ? sel.ob.x : sel.oe.x;
+ sel.ne.x = sel.ob.y < sel.oe.y ? sel.oe.x : sel.ob.x;
+ }
sel.nb.y = MIN(sel.ob.y, sel.oe.y);
- sel.ne.x = sel.ob.y < sel.oe.y ? sel.oe.x : sel.ob.x;
sel.ne.y = MAX(sel.ob.y, sel.oe.y);
}
static inline bool
selected(int x, int y) {
if(sel.ne.y == y && sel.nb.y == y)
- return BETWEEN(x, sel.nb.x, sel.ne.y);
+ return BETWEEN(x, sel.nb.x, sel.ne.x);
if(sel.type == SEL_RECTANGULAR) {
return ((sel.nb.y <= y && y <= sel.ne.y)
sel.oe.x = x2col(e->xbutton.x);
sel.oe.y = y2row(e->xbutton.y);
- if (sel.ob.y < sel.oe.y
+ if(sel.ob.y < sel.oe.y
|| (sel.ob.y == sel.oe.y && sel.ob.x < sel.oe.x)) {
selsnap(sel.snap, &sel.ob.x, &sel.ob.y, -1);
selsnap(sel.snap, &sel.oe.x, &sel.oe.y, +1);
selsnap(sel.snap, &sel.oe.x, &sel.oe.y, -1);
selsnap(sel.snap, &sel.ob.x, &sel.ob.y, +1);
}
-
selsort();
sel.type = SEL_REGULAR;
selcopy();
}
sel.mode = 0;
- term.dirty[sel.oe.y] = 1;
+ tsetdirt(sel.nb.y, sel.ne.y);
}
}
MODBIT(term.mode, set, MODE_MOUSEMOTION);
MODBIT(term.mode, 0, MODE_MOUSEBTN);
break;
+ case 1003: /* 1003: enable all mouse reports */
+ MODBIT(term.mode, set, MODE_MOUSE);
+ break;
+ case 1004:
+ MODBIT(term.mode, set, MODE_FOCUS);
+ break;
case 1006:
MODBIT(term.mode, set, MODE_MOUSESGR);
break;
case 1048:
tcursor((set) ? CURSOR_SAVE : CURSOR_LOAD);
break;
+ /* Not implemented mouse modes. See comments there. */
+ case 9: /* X10 compatibility mode */
+ case 1001: /* mouse highlight mode; can hang the
+ terminal by design when implemented. */
+ case 1005: /* UTF-8 mouse mode; will confuse
+ applications not supporting UTF-8
+ and luit. */
+ case 1015: /* urxvt mangled mouse mode; incompatible
+ and can be mistaken for other control
+ codes. */
default:
fprintf(stderr,
"erresc: unknown private set/reset mode %d\n",
XSetICFocus(xw.xic);
xw.state |= WIN_FOCUSED;
xseturgency(0);
+ if(IS_SET(MODE_FOCUS))
+ ttywrite("\033[I", 3);
} else {
XUnsetICFocus(xw.xic);
xw.state &= ~WIN_FOCUSED;
+ if(IS_SET(MODE_FOCUS))
+ ttywrite("\033[O", 3);
}
}