mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Fix use of BookmarkSection::size()
The value was 9 instead of 10, which forced its users to use unusual code.
This commit is contained in:
parent
e1261817d2
commit
b64b1aa85e
@ -325,7 +325,7 @@ bool BookmarksSection::isValid(unsigned int i) const
|
||||
|
||||
bool BookmarksSection::hasValid() const
|
||||
{
|
||||
for (size_t i = 1; i <= size(); ++i) {
|
||||
for (size_t i = 1; i < bookmarks.size(); ++i) {
|
||||
if (isValid(i))
|
||||
return true;
|
||||
}
|
||||
|
@ -246,7 +246,7 @@ public:
|
||||
bool hasValid() const;
|
||||
|
||||
///
|
||||
unsigned int size() const { return max_bookmarks; }
|
||||
unsigned int size() const { return bookmarks.size(); }
|
||||
|
||||
/// clear all bookmarks
|
||||
void clear();
|
||||
|
@ -1684,9 +1684,10 @@ void GuiApplication::dispatch(FuncRequest const & cmd, DispatchResult & dr)
|
||||
break;
|
||||
|
||||
case LFUN_WINDOW_CLOSE:
|
||||
// FIXME: this is done also in GuiView::closeBuffer()!
|
||||
// update bookmark pit of the current buffer before window close
|
||||
for (size_t i = 0; i < theSession().bookmarks().size(); ++i)
|
||||
gotoBookmark(i+1, false, false);
|
||||
for (size_t i = 1; i < theSession().bookmarks().size(); ++i)
|
||||
gotoBookmark(i, false, false);
|
||||
// clear the last opened list, because
|
||||
// maybe this will end the session
|
||||
theSession().lastOpened().clear();
|
||||
|
@ -3297,9 +3297,10 @@ bool GuiView::closeBuffer(Buffer & buf)
|
||||
if (success) {
|
||||
// goto bookmark to update bookmark pit.
|
||||
// FIXME: we should update only the bookmarks related to this buffer!
|
||||
// FIXME: this is done also in LFUN_WINDOW_CLOSE!
|
||||
LYXERR(Debug::DEBUG, "GuiView::closeBuffer()");
|
||||
for (unsigned int i = 0; i < theSession().bookmarks().size(); ++i)
|
||||
guiApp->gotoBookmark(i + 1, false, false);
|
||||
for (unsigned int i = 1; i < theSession().bookmarks().size(); ++i)
|
||||
guiApp->gotoBookmark(i, false, false);
|
||||
|
||||
if (saveBufferIfNeeded(buf, false)) {
|
||||
buf.removeAutosaveFile();
|
||||
|
Loading…
Reference in New Issue
Block a user