Fix a crash in :inspect when switching from page 2 to a different item

Switching to a different item cleared the data, but didn't clear the
cache of where the page breaks are located. The subsequent call to
`get_data_paged(int which_page)` has a bounds check for the page number,
so it's sufficient to just clear the page breaks, which is already ok
as it resets the object to the same state as a newly-created instance.

Forward-ported but currently untestable in master, as the page-selection
buttons are only shown when there's a large amount of text, which triggers
the known regression (the credits-crash bug).

(cherry picked from commit 7cb5f09bcf)
This commit is contained in:
Steve Cotton 2023-08-16 12:40:40 +02:00 committed by Steve Cotton
parent a5cd9d02eb
commit 1836530ba6
2 changed files with 3 additions and 0 deletions

View file

@ -0,0 +1,2 @@
### Miscellaneous and Bug Fixes
* Fix a crash in the `:inspect` window when pagination is used (issue #7851).

View file

@ -92,6 +92,7 @@ public:
void clear_data()
{
data.clear();
pages.clear();
}
void set_data(const std::string& new_data)