void vis_window_swap(Win *a, Win *b) { if (a == b || !a || !b) return; Vis *vis = a->vis; Win *tmp = a->next; a->next = b->next; b->next = tmp; if (a->next) a->next->prev = a; if (b->next) b->next->prev = b; tmp = a->prev; a->prev = b->prev; b->prev = tmp; if (a->prev) a->prev->next = a; if (b->prev) b->prev->next = b; if (vis->windows == a) vis->windows = b; else if (vis->windows == b) vis->windows = a; vis->ui->window_swap(a->ui, b->ui); if (vis->win == a) vis_window_focus(b); else if (vis->win == b) vis_window_focus(a); }
void vis_window_prev(Vis *vis) { Win *sel = vis->win; if (!sel) return; sel = sel->prev; if (!sel) for (sel = vis->windows; sel->next; sel = sel->next); vis_window_focus(sel); }
void vis_message_show(Vis *vis, const char *msg) { if (!msg) return; if (!vis->message_window) vis->message_window = window_new_file(vis, vis->error_file, UI_OPTION_STATUSBAR); Win *win = vis->message_window; if (!win) return; Text *txt = win->file->text; size_t pos = text_size(txt); text_appendf(txt, "%s\n", msg); text_save(txt, NULL); view_cursor_to(win->view, pos); vis_window_focus(win); }
void vis_window_next(Vis *vis) { Win *sel = vis->win; if (!sel) return; vis_window_focus(sel->next ? sel->next : vis->windows); }