Commit 34b67366 authored by Kohei Yoshida's avatar Kohei Yoshida

Clip the row range for the vertical iterator. Not tested yet.

parent 53565e84
Pipeline #38142009 passed with stage
in 4 minutes and 54 seconds
......@@ -215,6 +215,9 @@ class iterator_core_vertical : public model_iterator::impl
column_store_t::const_position_type m_current_pos;
column_store_t::const_position_type m_end_pos;
row_t m_row_first;
row_t m_row_last;
void update_current() const
{
column_store_t::const_iterator blk_pos = m_current_pos.first;
......@@ -251,7 +254,9 @@ class iterator_core_vertical : public model_iterator::impl
public:
iterator_core_vertical(const model_context& cxt, sheet_t sheet, const abs_rc_range_t& range) :
m_update_current_cell(true)
m_update_current_cell(true),
m_row_first(0),
m_row_last(row_unset)
{
m_cols = cxt.get_columns(sheet);
if (!m_cols)
......@@ -263,6 +268,8 @@ public:
if (m_it_cols_begin == m_it_cols_end)
return;
m_row_last = (*m_cols)[0]->size() - 1;
if (range.valid())
{
col_t last_col = m_cols->size() - 1;
......@@ -288,6 +295,25 @@ public:
return;
}
}
if (range.last.row != row_unset && range.last.row < m_row_last)
{
// Shrink the tail end.
m_row_last = range.last.row;
}
if (range.first.row != row_unset)
{
if (range.first.row <= m_row_last)
m_row_first = range.first.row;
else
{
// First row is past the last row. Set it to an empty
// range and bail out.
m_it_cols_begin = m_it_cols_end;
return;
}
}
}
const column_store_t& col = **m_it_cols;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment