pretend there is no history if input string is encrypted

This commit is contained in:
Andrzej Rybczak
2009-05-13 00:29:54 +02:00
parent 0c34b37328
commit c22653fc38

View File

@@ -395,7 +395,7 @@ string Window::GetString(const string &base, size_t length, size_t width, bool e
std::wstring wbase = ToWString(base); std::wstring wbase = ToWString(base);
std::wstring *tmp = &wbase; std::wstring *tmp = &wbase;
size_t history_offset = itsHistory ? itsHistory->size() : -1; size_t history_offset = itsHistory && !encrypted ? itsHistory->size() : -1;
string tmp_in; string tmp_in;
wchar_t wc_in; wchar_t wc_in;
@@ -469,7 +469,7 @@ string Window::GetString(const string &base, size_t length, size_t width, bool e
{ {
case ERR: case ERR:
case KEY_UP: case KEY_UP:
if (itsHistory && history_offset > 0) if (itsHistory && !encrypted && history_offset > 0)
{ {
do do
tmp = &(*itsHistory)[--history_offset]; tmp = &(*itsHistory)[--history_offset];
@@ -478,7 +478,7 @@ string Window::GetString(const string &base, size_t length, size_t width, bool e
} }
break; break;
case KEY_DOWN: case KEY_DOWN:
if (itsHistory && itsHistory->size() > 0) if (itsHistory && !encrypted && itsHistory->size() > 0)
{ {
if (history_offset < itsHistory->size()-1) if (history_offset < itsHistory->size()-1)
{ {
@@ -593,7 +593,7 @@ string Window::GetString(const string &base, size_t length, size_t width, bool e
while (input != 10); while (input != 10);
curs_set(0); curs_set(0);
if (itsHistory) if (itsHistory && !encrypted)
{ {
size_t old_size = itsHistory->size(); size_t old_size = itsHistory->size();
if (!tmp->empty() && (itsHistory->empty() || itsHistory->back() != *tmp)) if (!tmp->empty() && (itsHistory->empty() || itsHistory->back() != *tmp))