The situation of text handling functions like append_str(), format_lines(), formatted_line() are no less than complete mess.
Most functions are tightly related to PagerState.
They depend on each other like a web which makes them really difficult to understand for newcomers. Most of them are extremely long with not so good documentation. It becomes very easy to introduce bugs like #66. Most importantly it becomes very difficult to track where things might have gone wrong.
Through this, we intent to eliminate all of these issues once and for all.
[x] Generalize make_append_str() to the point where it not only formats incoming text to be appended but to the entire data inside minus (Maybe give it a better name after then).
[x] Refactor formatted_line() and make it independent of PagerState.
[x] Refactor format_lines() to the point where it's just a special case of make_append_str() where the text to format is the entire data of given to minus till that point.
[x] Move most of the stuff to the core/utils/text.rs module.
[x] Add better documentation for text module.
[x] Fix all failing tests due to all the refactoring.
The situation of text handling functions like
append_str()
,format_lines()
,formatted_line()
are no less than complete mess.Most functions are tightly related to
PagerState
. They depend on each other like a web which makes them really difficult to understand for newcomers. Most of them are extremely long with not so good documentation. It becomes very easy to introduce bugs like #66. Most importantly it becomes very difficult to track where things might have gone wrong.Through this, we intent to eliminate all of these issues once and for all.
make_append_str()
to the point where it not only formats incoming text to be appended but to the entire data inside minus (Maybe give it a better name after then).formatted_line()
and make it independent ofPagerState
.format_lines()
to the point where it's just a special case ofmake_append_str()
where the text to format is the entire data of given to minus till that point.core/utils/text.rs
module.text
module.