Skip to content

Commit

Permalink
Remember top level directory when browsing directory mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
connermcd committed Nov 27, 2015
1 parent 726538a commit 20ca651
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
28 changes: 21 additions & 7 deletions src/window/directorywindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,13 @@
using namespace Ui;

DirectoryWindow::DirectoryWindow(Main::Settings const & settings, Ui::Screen & screen, Mpc::Directory & directory, Mpc::Client & client, Mpc::ClientState & clientState, Ui::Search const & search) :
SelectWindow (settings, screen, "directory"),
settings_ (settings),
client_ (client),
clientState_ (clientState),
search_ (search),
directory_ (directory)
SelectWindow (settings, screen, "directory"),
settings_ (settings),
client_ (client),
clientState_ (clientState),
search_ (search),
directory_ (directory),
selectedDirectory_ (0)
{
SoftRedrawOnSetting(Setting::ShowPath);
SoftRedrawOnSetting(Setting::ShowLists);
Expand Down Expand Up @@ -288,7 +289,15 @@ void DirectoryWindow::Left(Ui::Player & player, uint32_t count)
if (directory_.Get(0)->name_ == "..")
{
directory_.ChangeDirectory(*directory_.Get(0));
ScrollTo(0);

if (directory_.Get(0)->name_ != "..")
{
ScrollTo(selectedDirectory_);
}
else
{
ScrollTo(0);
}
}
}
}
Expand All @@ -297,6 +306,11 @@ void DirectoryWindow::Right(Ui::Player & player, uint32_t count)
{
if (CurrentLine() < directory_.Size())
{
if (directory_.Get(0)->name_ != "..")
{
selectedDirectory_ = CurrentLine();
}

directory_.ChangeDirectory(*directory_.Get(CurrentLine()));
ScrollTo(0);
}
Expand Down
1 change: 1 addition & 0 deletions src/window/directorywindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ namespace Ui
Mpc::ClientState & clientState_;
Ui::Search const & search_;
Mpc::Directory & directory_;
uint32_t selectedDirectory_;
};
}
#endif
Expand Down

0 comments on commit 20ca651

Please sign in to comment.