static const char *later(Vis *vis, const char *keys, const Arg *arg) { size_t pos = text_later(vis_text(vis), MAX(vis_count_get(vis), 1)); if (pos != EPOS) { view_cursor_to(vis_view(vis), pos); /* redraw all windows in case some display the same file */ vis_draw(vis); } return keys; }
bool editor_window_split(Win *original) { Win *win = window_new_file(original->editor, original->file); if (!win) return false; win->file = original->file; win->file->refcount++; view_syntax_set(win->view, view_syntax_get(original->view)); view_cursor_to(win->view, view_cursor_get(original->view)); editor_draw(win->editor); return true; }
static const char *redo(Vis *vis, const char *keys, const Arg *arg) { size_t pos = text_redo(vis_text(vis)); if (pos != EPOS) { View *view = vis_view(vis); if (view_cursors_count(view) == 1) view_cursor_to(view, pos); /* redraw all windows in case some display the same file */ vis_draw(vis); } return keys; }
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); }
bool vis_window_split(Win *original) { Win *win = window_new_file(original->vis, original->file, UI_OPTION_STATUSBAR); if (!win) return false; for (size_t i = 0; i < LENGTH(win->modes); i++) { if (original->modes[i].bindings) win->modes[i].bindings = map_new(); if (win->modes[i].bindings) map_copy(win->modes[i].bindings, original->modes[i].bindings); } win->file = original->file; win->file->refcount++; vis_window_syntax_set(win, vis_window_syntax_get(original)); view_options_set(win->view, view_options_get(original->view)); view_cursor_to(win->view, view_cursor_get(original->view)); return true; }
static const char *cursors_remove(Vis *vis, const char *keys, const Arg *arg) { View *view = vis_view(vis); view_cursors_dispose(view_cursor(view)); view_cursor_to(view, view_cursor_get(view)); return keys; }