@@ 23,10 23,9 @@ void Buffer::draw(Canvas canvas) {
m_canvas = canvas;
auto line = m_text.get_line(m_first_visible_line_nb);
- auto screen_line = 1;
+ auto screen_line = 0;
for(; screen_line < canvas.height(); line = line.next()) {
- uint cur_row = screen_line - m_first_visible_line_nb;
bool isCurLine = line.number() == current_line_nb;
auto bgcolor = isCurLine ? clbg : bg;
@@ 35,24 34,23 @@ void Buffer::draw(Canvas canvas) {
for(uint y = 0; y < line.height(*this); y++) {
// Draw background
int gutter_width = Gutter::width(*this);
- tb_change_cell(gutter_width, cur_row + y, ' ', 15, bgcolor + 1);
+ tb_change_cell(gutter_width, screen_line, ' ', 15, bgcolor + 1);
for(int x = gutter_width + 1; x < tb_width() - 1; x++) {
- tb_change_cell(x, cur_row + y, ' ', 15, bgcolor);
+ tb_change_cell(x, screen_line, ' ', 15, bgcolor);
}
// Draw text
- line.printFrom(start, gutter_width + 1, cur_row + y, bgcolor);
+ line.printFrom(start, gutter_width + 1, screen_line, bgcolor);
start += max_line_width();
// Draw [...] if not current line
if(!isCurLine && line.height(*this) > 1) {
- Canvas::print(L"...", tb_width() - 3, cur_row, 15, bg);
+ Canvas::print(L"...", tb_width() - 3, screen_line, 15, bg);
screen_line++;
break;
- }
- else {
+ } else {
// Make sure text isn't going too far
- tb_change_cell(tb_width() - 1, cur_row + y, ' ', 15, bgcolor);
+ tb_change_cell(tb_width() - 1, screen_line, ' ', 15, bgcolor);
}
screen_line++;