mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-23 22:04:55 +02:00
Fix "copy" command bug in find result panel
While find result panel has a lot of results, and user has not scrolled down yet, this bug can be reproduce easily by command "select all" then copy - not all the found results are copied into clipboard.
This commit is contained in:
parent
ecfbf906c6
commit
96fc4bc714
@ -2505,13 +2505,13 @@ void Finder::openAll()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Finder::isLineActualSearchResult(int line) const
|
bool Finder::isLineActualSearchResult(const generic_string & s) const
|
||||||
{
|
{
|
||||||
const int foldLevel = _scintView.execute(SCI_GETFOLDLEVEL, line) & SC_FOLDLEVELNUMBERMASK;
|
const long firstColon = s.find(TEXT("\tLine "));
|
||||||
return foldLevel == SC_FOLDLEVELBASE + 3;
|
return (firstColon == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
generic_string Finder::prepareStringForClipboard(generic_string s) const
|
generic_string & Finder::prepareStringForClipboard(generic_string & s) const
|
||||||
{
|
{
|
||||||
// Input: a string like "\tLine 3: search result".
|
// Input: a string like "\tLine 3: search result".
|
||||||
// Output: "search result"
|
// Output: "search result"
|
||||||
@ -2527,7 +2527,8 @@ generic_string Finder::prepareStringForClipboard(generic_string s) const
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Plus 2 in order to deal with ": ".
|
// Plus 2 in order to deal with ": ".
|
||||||
return s.substr(2 + firstColon);
|
s = s.substr(2 + firstColon);
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2558,9 +2559,10 @@ void Finder::copy()
|
|||||||
std::vector<generic_string> lines;
|
std::vector<generic_string> lines;
|
||||||
for (size_t line = fromLine; line <= toLine; ++line)
|
for (size_t line = fromLine; line <= toLine; ++line)
|
||||||
{
|
{
|
||||||
if (isLineActualSearchResult(line))
|
generic_string lineStr = _scintView.getLine(line);
|
||||||
|
if (isLineActualSearchResult(lineStr))
|
||||||
{
|
{
|
||||||
lines.push_back(prepareStringForClipboard(_scintView.getLine(line)));
|
lines.push_back(prepareStringForClipboard(lineStr));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const generic_string toClipboard = stringJoin(lines, TEXT("\r\n"));
|
const generic_string toClipboard = stringJoin(lines, TEXT("\r\n"));
|
||||||
|
@ -178,8 +178,8 @@ private:
|
|||||||
_scintView.execute(SCI_SETREADONLY, isReadOnly);
|
_scintView.execute(SCI_SETREADONLY, isReadOnly);
|
||||||
};
|
};
|
||||||
|
|
||||||
bool isLineActualSearchResult(int line) const;
|
bool isLineActualSearchResult(const generic_string & s) const;
|
||||||
generic_string prepareStringForClipboard(generic_string s) const;
|
generic_string & prepareStringForClipboard(generic_string & s) const;
|
||||||
|
|
||||||
static FoundInfo EmptyFoundInfo;
|
static FoundInfo EmptyFoundInfo;
|
||||||
static SearchResultMarking EmptySearchResultMarking;
|
static SearchResultMarking EmptySearchResultMarking;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user