mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Clear bookmarks when workspace closes + fixed bookmark jump direction
This commit is contained in:
parent
09c31d5db1
commit
bc286885dc
2 changed files with 47 additions and 45 deletions
|
@ -343,8 +343,52 @@ namespace IDE
|
|||
int32 currentFolderIdx = mFolderIdx;
|
||||
int32 currentBookmarkIdx = mBookmarkIdx;
|
||||
|
||||
Bookmark nextBookmark = null;
|
||||
Bookmark prevBookmark = null;
|
||||
|
||||
repeat
|
||||
{
|
||||
mBookmarkIdx--;
|
||||
|
||||
if (mBookmarkIdx < 0)
|
||||
{
|
||||
if (!currentFolderOnly)
|
||||
{
|
||||
mFolderIdx--;
|
||||
|
||||
if (mFolderIdx < 0)
|
||||
{
|
||||
// wrap to last folder
|
||||
mFolderIdx = (int32)mBookmarkFolders.Count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Select last bookmark in current folder
|
||||
mBookmarkIdx = (int32)mBookmarkFolders[mFolderIdx].mBookmarkList.Count - 1;
|
||||
}
|
||||
|
||||
if (mBookmarkIdx >= 0)
|
||||
prevBookmark = mBookmarkFolders[mFolderIdx].mBookmarkList[mBookmarkIdx];
|
||||
else
|
||||
prevBookmark = null;
|
||||
}
|
||||
// skip disabled bookmarks, stop when we reach starting point
|
||||
while ((prevBookmark == null || prevBookmark.mIsDisabled) && ((currentFolderIdx != mFolderIdx) || (currentBookmarkIdx != mBookmarkIdx) && mBookmarkIdx != -1));
|
||||
|
||||
// If prevBookmark is disabled no bookmark is enabled.
|
||||
if (prevBookmark != null && !prevBookmark.mIsDisabled)
|
||||
GotoBookmark(prevBookmark);
|
||||
}
|
||||
|
||||
public void NextBookmark(bool currentFolderOnly = false)
|
||||
{
|
||||
if (mBookmarkCount == 0)
|
||||
return;
|
||||
|
||||
int32 currentFolderIdx = mFolderIdx;
|
||||
int32 currentBookmarkIdx = mBookmarkIdx;
|
||||
|
||||
Bookmark nextBookmark = null;
|
||||
|
||||
repeat
|
||||
{
|
||||
mBookmarkIdx++;
|
||||
|
@ -379,50 +423,6 @@ namespace IDE
|
|||
GotoBookmark(nextBookmark);
|
||||
}
|
||||
|
||||
public void NextBookmark(bool currentFolderOnly = false)
|
||||
{
|
||||
if (mBookmarkCount == 0)
|
||||
return;
|
||||
|
||||
int32 currentFolderIdx = mFolderIdx;
|
||||
int32 currentBookmarkIdx = mBookmarkIdx;
|
||||
|
||||
Bookmark nextBookmark = null;
|
||||
|
||||
repeat
|
||||
{
|
||||
mBookmarkIdx--;
|
||||
|
||||
if (mBookmarkIdx < 0)
|
||||
{
|
||||
if (!currentFolderOnly)
|
||||
{
|
||||
mFolderIdx--;
|
||||
|
||||
if (mFolderIdx < 0)
|
||||
{
|
||||
// wrap to last folder
|
||||
mFolderIdx = (int32)mBookmarkFolders.Count - 1;
|
||||
}
|
||||
}
|
||||
|
||||
// Select last bookmark in current folder
|
||||
mBookmarkIdx = (int32)mBookmarkFolders[mFolderIdx].mBookmarkList.Count - 1;
|
||||
}
|
||||
|
||||
if (mBookmarkIdx >= 0)
|
||||
nextBookmark = mBookmarkFolders[mFolderIdx].mBookmarkList[mBookmarkIdx];
|
||||
else
|
||||
nextBookmark = null;
|
||||
}
|
||||
// skip disabled bookmarks, stop when we reach starting point
|
||||
while ((nextBookmark == null || nextBookmark.mIsDisabled) && ((currentFolderIdx != mFolderIdx) || (currentBookmarkIdx != mBookmarkIdx) && mBookmarkIdx != -1));
|
||||
|
||||
// If nextBookmark is disabled no bookmark is enabled.
|
||||
if (nextBookmark != null && !nextBookmark.mIsDisabled)
|
||||
GotoBookmark(nextBookmark);
|
||||
}
|
||||
|
||||
public void GotoBookmark(Bookmark bookmark)
|
||||
{
|
||||
mFolderIdx = (int32)mBookmarkFolders.IndexOf(bookmark.mFolder);
|
||||
|
|
|
@ -2423,6 +2423,8 @@ namespace IDE
|
|||
|
||||
mBookmarksPanel.Clear();
|
||||
|
||||
mBookmarkManager.Clear();
|
||||
|
||||
OutputLine("Workspace closed.");
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue