Skip to content

Commit

Permalink
don't use printw
Browse files Browse the repository at this point in the history
  • Loading branch information
yshavit committed Apr 10, 2023
1 parent ce9d20b commit bdd61b4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/ui/guesses_ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,15 @@ impl<const N: usize, const R: usize> GuessesUI<N, R> {
let window_state = WindowState::new(&self.window);

window_state.set_color(color_for_knowledge(guess_ch.knowledge()));
_ = self.window.printw(style.top);
_ = self.window.mvprintw(
_ = self.window.addstr(style.top);
_ = self.window.mvaddstr(
window_state.orig_y + 1,
window_state.orig_x,
format!("{}{}{}", style.vert, guessed_char, style.vert),
);
_ = self
.window
.mvprintw(window_state.orig_y + 2, window_state.orig_x, style.bot);
.mvaddstr(window_state.orig_y + 2, window_state.orig_x, style.bot);
}

fn draw_active_marker(&self) {
Expand Down
18 changes: 9 additions & 9 deletions src/ui/text_scroll_pane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ impl TextScroll {
match use_title {
None => {
self.window.mvaddstr(0, 0, "┌");
self.window.printw(&main_pane_h_bar);
self.window.printw("┬─┐");
self.window.addstr(&main_pane_h_bar);
self.window.addstr("┬─┐");
}
Some(title) => {
let title_width = (max_x - 2) as usize;
Expand All @@ -113,18 +113,18 @@ impl TextScroll {
Cow::Owned(truncated)
};
self.window.mvaddstr(0, 0, "╭");
self.window.printw(&main_pane_h_bar);
self.window.printw("──");
self.window.printw("╮");
self.window.addstr(&main_pane_h_bar);
self.window.addstr("──");
self.window.addstr("╮");
// main_pain_width is the total width minus 4. We don't lose any space from the
// scroll bar for the title, but we still want total width minus 4: 1 on each side
// for the vertical bars, and then 1 each on each side for padding.

self.window
.mvaddstr(1, 0, format!("│{:<title_width$}│", title_truncated));
self.window.mvaddstr(2, 0, "┝");
self.window.printw(rep_str('━', main_pane_width_usize));
self.window.printw("┯━┥");
self.window.addstr(rep_str('━', main_pane_width_usize));
self.window.addstr("┯━┥");
}
};
let first_body_row = self.window.get_cur_y();
Expand Down Expand Up @@ -186,8 +186,8 @@ impl TextScroll {
}
// footer
self.window.mvaddstr(max_y - 1, 0, "└");
self.window.printw(&main_pane_h_bar);
self.window.printw("┴─┘");
self.window.addstr(&main_pane_h_bar);
self.window.addstr("┴─┘");
}
}

Expand Down

0 comments on commit bdd61b4

Please sign in to comment.