AmendHub

Download (as of this amendment):

jcs

/

amend

/

amendments

/

198

editor: Simplify TE focus changing, make window larger for log TE


jcs made amendment 198 18 days ago
--- editor.c Fri Oct 2 08:24:04 2026 +++ editor.c Sun Oct 4 12:50:11 2026 @@ -51,7 +51,7 @@ editor_init(struct browser *browser, struct repo_amend struct editor *editor; struct focusable *focusable; char date[32]; - Rect bounds = { 0 }, te_bounds = { 0 }; + Rect bounds, te_bounds; TextStyle style; short fh, off; struct tm *ttm = NULL; @@ -64,9 +64,8 @@ editor_init(struct browser *browser, struct repo_amend window_rect(browser->win, &bounds); bounds.top += MBarHeight; InsetRect(&bounds, 2, 2); - off = (bounds.bottom - bounds.top) / 5; - bounds.top += off; - bounds.bottom -= off; + bounds.top += PADDING; + bounds.bottom -= PADDING; memcpy(&filename, browser->repo->bile->filename, sizeof(filename)); PtoCstr(filename); @@ -310,11 +309,9 @@ editor_mouse_down(struct focusable *focusable, EventRe r = (*(editor->author_te))->viewRect; if (PtInRect(p, &r)) { if (editor->last_te != editor->author_te) { + TEDeactivate(editor->last_te); editor->last_te = editor->author_te; - TEDeactivate(editor->author_email_te); - TEDeactivate(editor->date_te); - TEDeactivate(editor->log_te); - TEActivate(editor->author_te); + TEActivate(editor->last_te); } TEClick(p, ((event->modifiers & shiftKey) != 0), editor->author_te); editor_update_menu(editor); @@ -324,11 +321,9 @@ editor_mouse_down(struct focusable *focusable, EventRe r = (*(editor->author_email_te))->viewRect; if (PtInRect(p, &r)) { if (editor->last_te != editor->author_email_te) { + TEDeactivate(editor->last_te); editor->last_te = editor->author_email_te; - TEDeactivate(editor->author_te); - TEDeactivate(editor->date_te); - TEDeactivate(editor->log_te); - TEActivate(editor->author_email_te); + TEActivate(editor->last_te); } TEClick(p, ((event->modifiers & shiftKey) != 0), editor->author_email_te); @@ -339,10 +334,9 @@ editor_mouse_down(struct focusable *focusable, EventRe r = (*(editor->date_te))->viewRect; if (PtInRect(p, &r)) { if (editor->last_te != editor->date_te) { + TEDeactivate(editor->last_te); editor->last_te = editor->date_te; - TEDeactivate(editor->author_te); - TEDeactivate(editor->log_te); - TEActivate(editor->date_te); + TEActivate(editor->last_te); } TEClick(p, ((event->modifiers & shiftKey) != 0), editor->date_te); editor_update_menu(editor); @@ -352,10 +346,9 @@ editor_mouse_down(struct focusable *focusable, EventRe r = (*(editor->log_te))->viewRect; if (PtInRect(p, &r)) { if (editor->last_te != editor->log_te) { + TEDeactivate(editor->last_te); editor->last_te = editor->log_te; - TEDeactivate(editor->author_te); - TEDeactivate(editor->date_te); - TEActivate(editor->log_te); + TEActivate(editor->last_te); } TEClick(p, ((event->modifiers & shiftKey) != 0), editor->log_te); editor_update_menu(editor);