diff options
| author | Randy Palamar <randy@rnpnr.xyz> | 2024-05-21 11:27:08 -0600 |
|---|---|---|
| committer | Randy Palamar <randy@rnpnr.xyz> | 2024-05-21 20:21:46 -0600 |
| commit | 7554ecd77efc29601b7b44deca602724917ce019 (patch) | |
| tree | 9e8e7d0ca7f0b173f98c224a25f6f626dcece8ac /vis-prompt.c | |
| parent | 7e85064ac77ea43e84d88eb910b0adb6f07d5d12 (diff) | |
| download | vis-7554ecd77efc29601b7b44deca602724917ce019.tar.gz vis-7554ecd77efc29601b7b44deca602724917ce019.tar.xz | |
remove some view pointer chasing
Same as previous commit each window only has a single View. No
need for it to be stored elsewhere in memory.
Diffstat (limited to 'vis-prompt.c')
| -rw-r--r-- | vis-prompt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/vis-prompt.c b/vis-prompt.c index dd67161..86699f2 100644 --- a/vis-prompt.c +++ b/vis-prompt.c @@ -49,7 +49,7 @@ static void prompt_restore(Win *win) { static const char *prompt_enter(Vis *vis, const char *keys, const Arg *arg) { Win *prompt = vis->win; - View *view = prompt->view; + View *view = &prompt->view; Text *txt = prompt->file->text; Win *win = prompt->parent; char *cmd = NULL; @@ -114,8 +114,8 @@ static const char *prompt_enter(Vis *vis, const char *keys, const Arg *arg) { static const char *prompt_esc(Vis *vis, const char *keys, const Arg *arg) { Win *prompt = vis->win; - if (prompt->view->selection_count > 1) { - view_selections_dispose_all(prompt->view); + if (prompt->view.selection_count > 1) { + view_selections_dispose_all(&prompt->view); } else { prompt_restore(prompt); prompt_hide(prompt); @@ -126,7 +126,7 @@ static const char *prompt_esc(Vis *vis, const char *keys, const Arg *arg) { static const char *prompt_up(Vis *vis, const char *keys, const Arg *arg) { vis_motion(vis, VIS_MOVE_LINE_UP); vis_window_mode_unmap(vis->win, VIS_MODE_INSERT, "<Up>"); - view_options_set(vis->win->view, UI_OPTION_SYMBOL_EOF); + view_options_set(&vis->win->view, UI_OPTION_SYMBOL_EOF); return keys; } @@ -164,7 +164,7 @@ void vis_prompt_show(Vis *vis, const char *title) { return; Text *txt = prompt->file->text; text_appendf(txt, "%s\n", title); - Selection *sel = view_selections_primary_get(prompt->view); + Selection *sel = view_selections_primary_get(&prompt->view); view_cursors_scroll_to(sel, text_size(txt)-1); prompt->parent = active; prompt->parent_mode = vis->mode; @@ -198,6 +198,6 @@ void vis_message_show(Vis *vis, const char *msg) { size_t pos = text_size(txt); text_appendf(txt, "%s\n", msg); text_save(txt, NULL); - view_cursors_to(win->view->selection, pos); + view_cursors_to(win->view.selection, pos); vis_window_focus(win); } |
