take into account tab characters when counting line row heights

This commit is contained in:
Josh Holtrop 2016-12-21 18:36:47 -05:00
parent f7d0c8189a
commit 9733d577a7

View File

@ -27,16 +27,29 @@ int BufferPane::rows_in_line(const Buffer::Iterator & start_of_line)
{
break;
}
int c_width = character_width(code_point);
if (((screen_column + c_width) > m_columns) &&
(c_width <= m_columns))
else if (code_point == '\t')
{
rows++;
screen_column = c_width;
uint8_t tabstop = m_buffer->tabstop();
screen_column += tabstop - screen_column % tabstop;
if (screen_column > m_columns)
{
screen_column -= m_columns;
rows++;
}
}
else
{
screen_column += c_width;
int c_width = character_width(code_point);
if (((screen_column + c_width) > m_columns) &&
(c_width <= m_columns))
{
rows++;
screen_column = c_width;
}
else
{
screen_column += c_width;
}
}
}
return rows;
@ -62,16 +75,29 @@ int BufferPane::rows_in_line_with_iterator_offset(const Buffer::Iterator & start
}
break;
}
int c_width = character_width(code_point);
if (((screen_column + c_width) > m_columns) &&
(c_width <= m_columns))
else if (code_point == '\t')
{
rows++;
screen_column = c_width;
uint8_t tabstop = m_buffer->tabstop();
screen_column += tabstop - screen_column % tabstop;
if (screen_column > m_columns)
{
screen_column -= m_columns;
rows++;
}
}
else
{
screen_column += c_width;
int c_width = character_width(code_point);
if (((screen_column + c_width) > m_columns) &&
(c_width <= m_columns))
{
rows++;
screen_column = c_width;
}
else
{
screen_column += c_width;
}
}
}
return rows;