diff --git a/src/status_checker.cpp b/src/status_checker.cpp index ba9aa191..be95ffe6 100644 --- a/src/status_checker.cpp +++ b/src/status_checker.cpp @@ -139,7 +139,7 @@ void NcmpcppErrorCallback(Connection *Mpd, int errorid, const char *msg, void *) { wFooter->SetGetStringHelper(NULL); Statusbar() << "Password: "; - string password = wFooter->GetString(); + string password = wFooter->GetString(-1, 0, 1); Mpd->SetPassword(password); Mpd->SendPassword(); Mpd->UpdateStatus(); diff --git a/src/window.cpp b/src/window.cpp index 47498eef..bf921085 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -350,7 +350,7 @@ void Window::WriteXY(int x, int y, bool cte, const char *format, ...) const wclrtoeol(itsWindow); } -string Window::GetString(const string &base, size_t length, size_t width) const +string Window::GetString(const string &base, size_t length, size_t width, bool encrypted) const { int input; size_t beginning, maxbeginning, minx, x, real_x, y, maxx, real_maxx; @@ -414,7 +414,11 @@ string Window::GetString(const string &base, size_t length, size_t width) const } mvwhline(itsWindow, y, minx, 32, width+1); - mvwprintw(itsWindow, y, minx, "%ls", tmp.substr(beginning, width+1).c_str()); + + if (encrypted) + mvwprintw(itsWindow, y, minx, "%ls", tmp.substr(beginning, width+1).c_str()); + else + mvwhline(itsWindow, y, minx, '*', maxx-minx); if (itsGetStringHelper) itsGetStringHelper(); diff --git a/src/window.h b/src/window.h index 4fd9f006..abe37b7c 100644 --- a/src/window.h +++ b/src/window.h @@ -97,8 +97,8 @@ class Window const std::string &GetTitle() const; Color GetColor() const; Border GetBorder() const; - std::string GetString(const std::string &, size_t = -1, size_t = 0) const; - string GetString(unsigned int length = -1, int width = 0) const { return GetString("", length, width); } + std::string GetString(const std::string &, size_t = -1, size_t = 0, bool = 0) const; + string GetString(size_t length = -1, size_t width = 0, bool encrypted = 0) const { return GetString("", length, width, encrypted); } void GetXY(int &, int &); void GotoXY(int, int); const int &X() const;