aboutsummaryrefslogtreecommitdiff
path: root/ui-terminal.c
diff options
context:
space:
mode:
authorRandy Palamar <randy@rnpnr.xyz>2024-05-21 11:27:08 -0600
committerRandy Palamar <randy@rnpnr.xyz>2024-05-21 20:21:46 -0600
commit7554ecd77efc29601b7b44deca602724917ce019 (patch)
tree9e8e7d0ca7f0b173f98c224a25f6f626dcece8ac /ui-terminal.c
parent7e85064ac77ea43e84d88eb910b0adb6f07d5d12 (diff)
downloadvis-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 'ui-terminal.c')
-rw-r--r--ui-terminal.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ui-terminal.c b/ui-terminal.c
index d19724a..d540308 100644
--- a/ui-terminal.c
+++ b/ui-terminal.c
@@ -58,7 +58,7 @@ static void ui_window_resize(UiWin *win, int width, int height) {
bool status = win->options & UI_OPTION_STATUSBAR;
win->width = width;
win->height = height;
- view_resize(win->win->view, width - win->sidebar_width, status ? height - 1 : height);
+ view_resize(&win->win->view, width - win->sidebar_width, status ? height - 1 : height);
}
static void ui_window_move(UiWin *win, int x, int y) {
@@ -204,7 +204,7 @@ static void ui_draw_string(Ui *tui, int x, int y, const char *str, UiWin *win, e
static void ui_window_draw(UiWin *win) {
Ui *ui = win->ui;
- View *view = win->win->view;
+ View *view = &win->win->view;
int width = win->width, height = win->height;
const Line *line = view->topline;
bool status = win->options & UI_OPTION_STATUSBAR;
@@ -351,7 +351,7 @@ void ui_draw(Ui *tui) {
void ui_redraw(Ui *tui) {
ui_term_backend_clear(tui);
for (UiWin *win = tui->windows; win; win = win->next)
- win->win->view->need_update = true;
+ win->win->view.need_update = true;
}
void ui_resize(Ui *tui) {
@@ -405,8 +405,8 @@ void ui_window_focus(UiWin *new) {
if (new->options & UI_OPTION_STATUSBAR)
new->ui->selwin = new;
if (old)
- old->win->view->need_update = true;
- new->win->view->need_update = true;
+ old->win->view.need_update = true;
+ new->win->view.need_update = true;
}
void ui_window_options_set(UiWin *win, enum UiOption options) {
@@ -500,7 +500,7 @@ UiWin *ui_window_new(Ui *tui, Win *w, enum UiOption options) {
styles[UI_STYLE_STATUS].attr |= CELL_ATTR_REVERSE;
styles[UI_STYLE_STATUS_FOCUSED].attr |= CELL_ATTR_REVERSE|CELL_ATTR_BOLD;
styles[UI_STYLE_INFO].attr |= CELL_ATTR_BOLD;
- w->view->ui = win;
+ w->view.ui = win;
if (tui->windows)
tui->windows->prev = win;