From 309b02419455b93321af7d1911d36b5acef40db1 Mon Sep 17 00:00:00 2001 From: "Michael D. Lowis" Date: Tue, 21 May 2019 13:22:55 -0400 Subject: [PATCH] keep focus in tag region when it collapses --- TODO.md | 1 - src/tide.c | 6 ++++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/TODO.md b/TODO.md index 79e52ab..06bae82 100644 --- a/TODO.md +++ b/TODO.md @@ -4,7 +4,6 @@ ## STAGING -* tide: move mouse when tag region collapses * tfetch: read rules from rcfile in home and curr dir * tfetch: ls results instead of pcmanfm on right click directory * tide: gap buffer does not handle UTF-8 currently diff --git a/src/tide.c b/src/tide.c index 53f3e91..e590bac 100644 --- a/src/tide.c +++ b/src/tide.c @@ -192,6 +192,7 @@ static void xredraw(XConf* x) { size_t tagregsz = (tagrows * x->tagfont->height) + 7; size_t editrows = (x->height - tagregsz) / x->font->height ; /* draw the regions to the window */ + int olddiv = Divider; drawcsr csr = { .w = x->width, .h = x->height }; csr.x += ScrollWidth + 1; draw_statbox(x, win_view(EDIT)->buffer.status); @@ -203,6 +204,11 @@ static void xredraw(XConf* x) { draw_rect(x, WinBdr, x->width-1, 0, 1, x->height); XCopyArea(x->display, x->pixmap, x->self, x->gc, 0, 0, x->width, x->height, 0, 0); SyncMouse = false; + if (Divider < olddiv && Focused == TAGS) { + int ptrx = 0, ptry = 0; + x11_getptr(x, &ptrx, &ptry); + XWarpPointer(X.display, X.self, X.self, 0, 0, X.width, X.height, ptrx, Divider-2); + } XFlush(x->display); } -- 2.55.0