* implement tctl command
* implement mouse warping on search, jump to line, and focus change
* gap buffer does not handle UTF-8 currently
-* mouse selection handling when mouse moves outside region
* Line - Get the current line number(s) containing the selection
* refactor selection handling to avoid swapping manually (use buf_selbeg and buf_selend)
* encode EOL setting in log entries?
static void get_position(WinRegion id, int x, int y, size_t* row, size_t* col) {
int starty = (id == EDIT ? Divider+3 : 0);
int startx = ScrollWidth+3;
+ int maxy = (id == EDIT
+ ? (Divider + (win_view(EDIT)->nrows * X.font->height))
+ : Divider - 4
+ );
+ x = (x < 0 ? 0 : (x > X.width ? X.width : x));
+ y = (y < starty ? starty : (y > maxy ? maxy : y));
*row = (y - starty) / X.font->height;
- *col = x - startx;
+ *col = (startx <= x ? x - startx : 0);
}
static struct XSel* selfetch(Atom atom) {