Download raw body.
tog: always open help in fullscreen
I went to change tog help so that the view takes over the calling view as stsp suggested. However, I looked at some other apps first to see how it's usually handled and it seems that help views typically consume the full screen irrespective of what splits or view configuration is displayed when called. For example, tig opens help in fullscreen regardless of what views are open, and cycling views is disabled till help is exited. I admittedly find tig somewhat unintuitive but to be fair I first tried it a couple weeks ago so I'm not at all familiar with it. I have `set pager_index_lines=6` in mutt so that mail is opened in a horizontal split but help is opened in fullscreen. I don't use many other TUIs that have splits, but ones I use regularly like catgirl, hackernews, and nnn command a fullscreen (or a dialog that mostly obscures the calling view) for help until it's closed. Vim seems to be the outlier here in that it opens help in a horizontal split, while vi(1) uses a fullsreen. With that in mind, I thought I'd try this with tog first, and get some feedback. The below diff makes tog always open help in fullscreen irrespective of the current view configuration. And cycling views is disabled till help is exited. This seems to be the standard and, imo, it feels more intuitive than our current behaviour, and makes help distinct from the other views. As an added bonues it's also a minimal change! diff /home/mark/src/got commit - 34a842a42b1cd020ca656445c0b65e67a97bff1a path + /home/mark/src/got blob - 5c09963ecada6bf7e25973970995b395066f23c5 file + tog/tog.c --- tog/tog.c +++ tog/tog.c @@ -1233,14 +1233,15 @@ view_request_new(struct tog_view **requested, struct t *requested = NULL; - if (view_is_parent_view(view)) + if (view_is_parent_view(view) && request != TOG_VIEW_HELP) view_get_split(view, &y, &x); err = view_dispatch_request(&new_view, view, request, y, x); if (err) return err; - if (view_is_parent_view(view) && view->mode == TOG_VIEW_SPLIT_HRZN) { + if (view_is_parent_view(view) && view->mode == TOG_VIEW_SPLIT_HRZN && + request != TOG_VIEW_HELP) { err = view_init_hsplit(view, y); if (err) return err; @@ -1249,9 +1250,10 @@ view_request_new(struct tog_view **requested, struct t view->focussed = 0; new_view->focussed = 1; new_view->mode = view->mode; - new_view->nlines = view->lines - y; + new_view->nlines = request == TOG_VIEW_HELP ? + view->lines : view->lines - y; - if (view_is_parent_view(view)) { + if (view_is_parent_view(view) && request != TOG_VIEW_HELP) { view_transfer_size(new_view, view); err = view_close_child(view); if (err) @@ -8991,7 +8993,7 @@ view_dispatch_request(struct tog_view **new_view, stru view_close(*new_view); break; case TOG_VIEW_HELP: - *new_view = view_open(0, 0, y, x, TOG_VIEW_HELP); + *new_view = view_open(0, 0, 0, 0, TOG_VIEW_HELP); if (*new_view == NULL) return got_error_from_errno("view_open"); err = open_help_view(*new_view, view); -- Mark Jamsek <fnc.bsdbox.org> GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68
tog: always open help in fullscreen