Skip to content

Commit

Permalink
#3257
Browse files Browse the repository at this point in the history
  • Loading branch information
alabuzhev committed Jun 19, 2016
1 parent 4482f4a commit 6b6fb71
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 15 deletions.
4 changes: 4 additions & 0 deletions far/changelog
@@ -1,3 +1,7 @@
drkns 20.06.2016 00:15:19 +0200 - build 4718

1. #0003257: (far 3.0.4700.x64) Исключительная ситуация во Viewer при поиске HEX-значений

t-rex 19.06.2016 21:15:20 +0200 - build 4717

1. Mantis#2467: Застряёт регэксп поиск с заменой в редакторе
Expand Down
8 changes: 8 additions & 0 deletions far/dialog.cpp
Expand Up @@ -6221,3 +6221,11 @@ void Dialog::ShowConsoleTitle()
{
ConsoleTitle::SetFarTitle(DialogMode.Check(DMODE_KEEPCONSOLETITLE)? m_ConsoleTitle : GetTitle());
}

string Dialog::ExtractHexString(const string& DialogHexString)
{
auto Result{ DialogHexString };
RemoveTrailingSpaces(Result); // BUGBUG: trailing spaces in DI_FIXEDIT. TODO: Fix in Dialog class.
Result.erase(std::remove(ALL_RANGE(Result), L' '), Result.end());
return Result;
}
2 changes: 2 additions & 0 deletions far/dialog.hpp
Expand Up @@ -225,6 +225,8 @@ class Dialog: public Modal
return Items[ListId].ListPtr->GetUserDataPtr<T>(static_cast<int>(ItemId));
}

static string ExtractHexString(const string& DialogHexString);

protected:
size_t InitDialogObjects(size_t ID = (size_t)-1);

Expand Down
9 changes: 3 additions & 6 deletions far/findfile.cpp
Expand Up @@ -468,7 +468,7 @@ void background_searcher::InitInFileSearch()
// Формируем hex-строку для поиска
if (SearchHex)
{
hexFindString = HexStringToBlob(strFindStr.data());
hexFindString = HexStringToBlob(strFindStr.data(), 0);
}

// Инициализируем данные для аглоритма поиска
Expand Down Expand Up @@ -777,9 +777,7 @@ intptr_t FindFiles::MainDlgProc(Dialog* Dlg, intptr_t Msg, intptr_t Param1, void
}
else
{
string strSrc(Src);
RemoveTrailingSpaces(strSrc); // BUGBUG: trailing spaces in DI_FIXEDIT. TODO: Fix in Dialog class.
const auto Blob = HexStringToBlob(strSrc.data(), L' ');
const auto Blob = HexStringToBlob(Dialog::ExtractHexString(Src).data(), 0);
strDataStr.assign(ALL_CONST_RANGE(Blob));
}

Expand Down Expand Up @@ -3111,8 +3109,7 @@ FindFiles::FindFiles():

if (SearchHex)
{
strFindStr = FindAskDlg[FAD_EDIT_HEX].strData;
RemoveTrailingSpaces(strFindStr);
strFindStr = Dialog::ExtractHexString(FindAskDlg[FAD_EDIT_HEX].strData);
}
else
strFindStr = FindAskDlg[FAD_EDIT_TEXT].strData;
Expand Down
4 changes: 0 additions & 4 deletions far/global.cpp
Expand Up @@ -132,10 +132,6 @@ void global::StoreSearchString(const string& Str, bool Hex)
{
m_SearchHex = Hex;
m_SearchString = Str;
if (m_SearchHex)
{
m_SearchString.erase(std::remove(ALL_RANGE(m_SearchString), L' '), m_SearchString.end());
}
}


Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,4717)m4_dnl
m4_define(BUILD,4718)m4_dnl
7 changes: 3 additions & 4 deletions far/viewer.cpp
Expand Up @@ -2719,8 +2719,8 @@ static auto hex2ss(const wchar_t *from, size_t len, intptr_t *pos = nullptr)
string strFrom(from, len);
RemoveTrailingSpaces(strFrom);
if (pos)
*pos /= 3;
return HexStringToBlob(strFrom.data(), L' ');
*pos /= 2;
return HexStringToBlob(strFrom.data(), 0);
}

void Viewer::SearchTextTransform(string &to, const wchar_t *from, size_t from_len, bool hex2text, intptr_t &pos)
Expand Down Expand Up @@ -3425,8 +3425,7 @@ void Viewer::Search(int Next,int FirstChar)

if (SearchHex)
{
strSearchStr = SearchDlg[SD_EDIT_HEX].strData;
RemoveTrailingSpaces(strSearchStr); // BUGBUG: trailing spaces in DI_FIXEDIT. TODO: Fix in Dialog class.
strSearchStr = Dialog::ExtractHexString(SearchDlg[SD_EDIT_HEX].strData);
}
else
{
Expand Down

0 comments on commit 6b6fb71

Please sign in to comment.