@@ -34,7 +34,7 @@ typename Line<Cell>::InflatedBuffer Line<Cell>::reflow(ColumnCount newColumnCoun
3434 {
3535 switch (crispy::strongCompare (newColumnCount, ColumnCount::cast_from (trivialBuffer ().text .size ())))
3636 {
37- case Comparison::Greater: trivialBuffer ().displayWidth = newColumnCount; return {};
37+ case Comparison::Greater: trivialBuffer ().resize ( newColumnCount) ; return {};
3838 case Comparison::Equal: return {};
3939 case Comparison::Less:;
4040 }
@@ -99,8 +99,7 @@ inline void Line<Cell>::resize(ColumnCount count)
9999 {
100100 if (isTrivialBuffer ())
101101 {
102- TrivialBuffer& buffer = trivialBuffer ();
103- buffer.displayWidth = count;
102+ trivialBuffer ().resize (count);
104103 return ;
105104 }
106105 }
@@ -168,7 +167,7 @@ InflatedLineBuffer<Cell> inflate(TrivialLineBuffer const& input)
168167 auto lastChar = char32_t { 0 };
169168 auto utf8DecoderState = unicode::utf8_decoder_state {};
170169 auto gapPending = 0 ;
171-
170+ size_t cellNr = 0 ;
172171 for (char const ch: input.text .view ())
173172 {
174173 unicode::ConvertResult const r = unicode::from_utf8 (utf8DecoderState, static_cast <uint8_t >(ch));
@@ -189,6 +188,7 @@ InflatedLineBuffer<Cell> inflate(TrivialLineBuffer const& input)
189188 columns.emplace_back (Cell {});
190189 columns.back ().setHyperlink (input.hyperlink );
191190 columns.back ().write (input.textAttributes , nextChar, static_cast <uint8_t >(charWidth));
191+ columns.back ().setTab (input.tabstops [cellNr]);
192192 gapPending = charWidth - 1 ;
193193 }
194194 else
@@ -207,6 +207,7 @@ InflatedLineBuffer<Cell> inflate(TrivialLineBuffer const& input)
207207 }
208208 }
209209 lastChar = nextChar;
210+ ++cellNr;
210211 }
211212
212213 while (gapPending > 0 )
@@ -218,10 +219,31 @@ InflatedLineBuffer<Cell> inflate(TrivialLineBuffer const& input)
218219 assert (columns.size () == unbox<size_t >(input.usedColumns ));
219220
220221 while (columns.size () < unbox<size_t >(input.displayWidth ))
222+ {
221223 columns.emplace_back (Cell { input.fillAttributes });
224+ columns.back ().setTab (input.tabstops [cellNr]);
225+ ++cellNr;
226+ }
222227
223228 return columns;
224229}
230+
231+ template <typename Cell>
232+ void Line<Cell>::setTab(ColumnOffset start, ColumnCount n, bool tab)
233+ {
234+ if (isInflatedBuffer ())
235+ {
236+ for (; n > ColumnCount (0 ); --n)
237+ useCellAt (start++).setTab (tab);
238+ }
239+ else
240+ {
241+ auto & buffer = trivialBuffer ();
242+ for (; n > ColumnCount (0 ); --n)
243+ buffer.tabstops [(start++).as <size_t >()] = true ;
244+ // assert(false);
245+ }
246+ }
225247} // end namespace terminal
226248
227249#include < vtbackend/cell/CompactCell.h>
0 commit comments