Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve presentation of matching results and related #451

Merged
merged 8 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/LineData.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
struct LineDataLine
{
DWORD number;
DWORD column;
std::wstring text;
};

Expand Down
7 changes: 4 additions & 3 deletions src/Resources/grepWin.rc
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,10 @@ CAPTION "grepWin Settings"
FONT 9, "Segoe UI", 400, 0, 0x1
BEGIN
GROUPBOX "Editor",IDC_EDITORGROUP,7,7,303,61
LTEXT "Command line to start an editor at a specific line:",IDC_STATIC1,13,19,288,8
LTEXT "Command line to start an editor at a specific line and in line offset:",IDC_STATIC1,13,19,288,8
EDITTEXT IDC_EDITORCMD,13,31,269,14,ES_AUTOHSCROLL
PUSHBUTTON "...",IDC_SEARCHPATHBROWSE,286,31,15,14
LTEXT "%path% is replaced with the path of the file, %line% with the line to jump to",IDC_STATIC2,13,47,288,17
LTEXT "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset",IDC_STATIC2,13,47,288,17
LTEXT "Language:",IDC_STATIC4,7,72,135,8
COMBOBOX IDC_LANGUAGE,170,71,140,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
LTEXT "number of NULL bytes per MB allowed for a file to still be considered text instead of binary",IDC_STATIC3,7,85,241,17
Expand Down Expand Up @@ -376,6 +376,7 @@ BEGIN
IDS_REGEXINVALID "invalid regex!"
IDS_SIZE "Size"
IDS_LINE "Line"
IDS_COLUMN "Column"
IDS_MATCHES "Matches"
IDS_TEXT "Text"
IDS_PATH "Path"
Expand All @@ -395,7 +396,7 @@ BEGIN
IDS_COPYRESULT "Copy text result to clipboard"
IDS_COPYRESULTS "Copy text results to clipboard"
IDS_XMOREMATCHES "%ld more matches"
IDS_CONTEXTLINE "Line %5ld : %30s\n"
IDS_CONTEXTLINE "Line %5ld : %s\n"
IDS_INFOLABELFILE "scanning file '%s'"
IDS_ERR_RELATIVEPATH "Relative paths are not allowed. Please enter an absolute path!"
IDS_ERR_INVALID_PATH "Invalid path!"
Expand Down
568 changes: 375 additions & 193 deletions src/SearchDlg.cpp

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/SearchDlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ class CSearchDlg : public CDialog
void FillResultList();
bool AddFoundEntry(CSearchInfo* pInfo, bool bOnlyListControl = false);
void ShowContextMenu(HWND hWnd, int x, int y);
LRESULT ColorizeMatchResultProc(LPNMLVCUSTOMDRAW lpLVCD);
void DoListNotify(LPNMITEMACTIVATE lpNMItemActivate);
void OpenFileAtListIndex(int listIndex);
void UpdateInfoLabel();
Expand Down
2 changes: 2 additions & 0 deletions src/SearchInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ class CSearchInfo
std::wstring filePath;
__int64 fileSize;
std::vector<DWORD> matchLinesNumbers;
std::vector<DWORD> matchColumnsNumbers;
std::vector<DWORD> matchLengths;
std::vector<std::wstring> matchLines;
__int64 matchCount;
CTextFile::UnicodeType encoding;
Expand Down
7 changes: 7 additions & 0 deletions src/ShellContextMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,8 @@ UINT CShellContextMenu::ShowContextMenu(HWND hWnd, POINT pt)
wchar_t buf[40] = {0};
swprintf_s(buf, L"%ld", it2->number);
SearchReplace(cmd, L"%line%", buf);
swprintf_s(buf, L"%ld", it2->column);
SearchReplace(cmd, L"%column%", buf);

STARTUPINFO startupInfo;
PROCESS_INFORMATION processInfo;
Expand All @@ -365,9 +367,14 @@ UINT CShellContextMenu::ShowContextMenu(HWND hWnd, POINT pt)
wchar_t buf[40] = {0};
swprintf_s(buf, L"%ld", it->matchLinesNumbers[0]);
SearchReplace(cmd, L"%line%", buf);
swprintf_s(buf, L"%ld", it->matchColumnsNumbers[0]);
SearchReplace(cmd, L"%column%", buf);
}
else
{
SearchReplace(cmd, L"%line%", L"0");
SearchReplace(cmd, L"%column%", L"0");
}

STARTUPINFO startupInfo;
PROCESS_INFORMATION processInfo;
Expand Down
8 changes: 4 additions & 4 deletions src/grepWin.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<EnableDpiAwareness>true</EnableDpiAwareness>
Expand All @@ -140,7 +140,7 @@
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<EnableDpiAwareness>true</EnableDpiAwareness>
Expand Down Expand Up @@ -172,7 +172,7 @@
<SetChecksum>true</SetChecksum>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<EnableDpiAwareness>true</EnableDpiAwareness>
Expand Down Expand Up @@ -202,7 +202,7 @@
<OptimizeReferences>true</OptimizeReferences>
<SetChecksum>true</SetChecksum>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>shlwapi.lib;Urlmon.lib;UxTheme.lib;Msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Manifest>
<EnableDpiAwareness>true</EnableDpiAwareness>
Expand Down
1 change: 1 addition & 0 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
#define IDS_COPY_COLUMN 177
#define IDS_COPY_COLUMN_SEL 178
#define IDS_REGEXEXCEPTION 179
#define IDS_COLUMN 180
#define IDC_SEARCHTEXT 1000
#define IDC_REGEXRADIO 1001
#define IDC_TEXTRADIO 1002
Expand Down
12 changes: 8 additions & 4 deletions translations/Afrikaans.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ msgid "%ld more matches"
msgstr "%ld meer gevind"

#. Resource IDs: (1069)
msgid "%path% is replaced with the path of the file, %line% with the line to jump to"
msgid "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset"
msgstr "%path% word vervang met die pad van die lêer, %line% met die lyn om na te spring, %pattern% met die soekreeks."

#. Resource IDs: (119)
Expand Down Expand Up @@ -124,8 +124,12 @@ msgstr "Vang Soektog"
msgid "Check for updates"
msgstr "Kyk vir opdaterings"

#. Resource IDs: (180)
msgid "Column"
msgstr ""

#. Resource IDs: (1068)
msgid "Command line to start an editor at a specific line:"
msgid "Command line to start an editor at a specific line and in line offset:"
msgstr "Opdragreël om 'n redakteur op 'n spesifieke reël te begin:"

#. Resource IDs: (1060)
Expand Down Expand Up @@ -307,8 +311,8 @@ msgstr "Lyn"

#. Resource IDs: (150)
#, c-format
msgid "Line %5ld : %30s\n"
msgstr "Lyn %5ld : %30s\n"
msgid "Line %5ld : %s\n"
msgstr "Lyn %5ld : %s\n"

#. Resource IDs: (135)
msgid "Matches"
Expand Down
12 changes: 8 additions & 4 deletions translations/Belarusian.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ msgid "%ld more matches"
msgstr "больш %ld супадзенняў"

#. Resource IDs: (1069)
msgid "%path% is replaced with the path of the file, %line% with the line to jump to"
msgid "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset"
msgstr ""

#. Resource IDs: (119)
Expand Down Expand Up @@ -124,8 +124,12 @@ msgstr ""
msgid "Check for updates"
msgstr ""

#. Resource IDs: (180)
msgid "Column"
msgstr ""

#. Resource IDs: (1068)
msgid "Command line to start an editor at a specific line:"
msgid "Command line to start an editor at a specific line and in line offset:"
msgstr "Каманда для адкрыцця рэдактара на выбраным радку:"

#. Resource IDs: (1060)
Expand Down Expand Up @@ -307,8 +311,8 @@ msgstr "Радок"

#. Resource IDs: (150)
#, c-format
msgid "Line %5ld : %30s\n"
msgstr "Радок %5ld : %30s\n"
msgid "Line %5ld : %s\n"
msgstr "Радок %5ld : %s\n"

#. Resource IDs: (135)
msgid "Matches"
Expand Down
16 changes: 10 additions & 6 deletions translations/Chinese Simplified.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ msgid "%ld more matches"
msgstr "还有 %ld 个匹配"

#. Resource IDs: (1069)
msgid "%path% is replaced with the path of the file, %line% with the line to jump to"
msgstr "%path% 将被替换为文件的路径, %line% 将被替换为要转至的行号."
msgid "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset"
msgstr "%path% 将被替换为文件的路径, %line% 将被替换为要转至的行号, %column% 为行内偏移量."

#. Resource IDs: (119)
msgid "&About grepWin..."
Expand Down Expand Up @@ -124,9 +124,13 @@ msgstr "输入替换搜索"
msgid "Check for updates"
msgstr "检查更新"

#. Resource IDs: (180)
msgid "Column"
msgstr "行内偏移"

#. Resource IDs: (1068)
msgid "Command line to start an editor at a specific line:"
msgstr "用于在指定的行来启动编辑器的命令行:"
msgid "Command line to start an editor at a specific line and in line offset:"
msgstr "用于在指定的行和行内偏移来启动编辑器的命令行:"

#. Resource IDs: (1060)
msgid "Content"
Expand Down Expand Up @@ -307,8 +311,8 @@ msgstr "行号"

#. Resource IDs: (150)
#, c-format
msgid "Line %5ld : %30s\n"
msgstr "行 %5ld : %30s\n"
msgid "Line %5ld : %s\n"
msgstr "行 %5ld : %s\n"

#. Resource IDs: (135)
msgid "Matches"
Expand Down
16 changes: 10 additions & 6 deletions translations/Chinese Traditional.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ msgid "%ld more matches"
msgstr "還有 %ld 個匹配"

#. Resource IDs: (1069)
msgid "%path% is replaced with the path of the file, %line% with the line to jump to"
msgstr "%path% 將被取代為檔案的路徑, %line% 將被取代為要轉至的行號."
msgid "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset"
msgstr "%path% 將被取代為檔案的路徑, %line% 將被取代為要轉至的行號, %column% 為行内偏移量."

#. Resource IDs: (119)
msgid "&About grepWin..."
Expand Down Expand Up @@ -124,9 +124,13 @@ msgstr "捕捉搜尋"
msgid "Check for updates"
msgstr "檢查更新"

#. Resource IDs: (180)
msgid "Column"
msgstr "行内偏移"

#. Resource IDs: (1068)
msgid "Command line to start an editor at a specific line:"
msgstr "用於在指定的行來啟動編輯器的命令:"
msgid "Command line to start an editor at a specific line and in line offset:"
msgstr "用於在指定的行和行内偏移來啟動編輯器的命令:"

#. Resource IDs: (1060)
msgid "Content"
Expand Down Expand Up @@ -307,8 +311,8 @@ msgstr "行號"

#. Resource IDs: (150)
#, c-format
msgid "Line %5ld : %30s\n"
msgstr "行 %5ld : %30s\n"
msgid "Line %5ld : %s\n"
msgstr "行 %5ld : %s\n"

#. Resource IDs: (135)
msgid "Matches"
Expand Down
12 changes: 8 additions & 4 deletions translations/Dutch.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ msgid "%ld more matches"
msgstr "%ld meer overeenkomsten"

#. Resource IDs: (1069)
msgid "%path% is replaced with the path of the file, %line% with the line to jump to"
msgid "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset"
msgstr "%path% wordt vervangen door het pad van het bestand, %line% door de juiste regel"

#. Resource IDs: (119)
Expand Down Expand Up @@ -124,8 +124,12 @@ msgstr "Zoekopdracht vastleggen"
msgid "Check for updates"
msgstr "Controleren op updates"

#. Resource IDs: (180)
msgid "Column"
msgstr ""

#. Resource IDs: (1068)
msgid "Command line to start an editor at a specific line:"
msgid "Command line to start an editor at a specific line and in line offset:"
msgstr "Opdrachtregel om een Editor op een specifieke regel te openen"

#. Resource IDs: (1060)
Expand Down Expand Up @@ -307,8 +311,8 @@ msgstr "Regel"

#. Resource IDs: (150)
#, c-format
msgid "Line %5ld : %30s\n"
msgstr "Regel %5ld : %30s\n"
msgid "Line %5ld : %s\n"
msgstr "Regel %5ld : %s\n"

#. Resource IDs: (135)
msgid "Matches"
Expand Down
10 changes: 7 additions & 3 deletions translations/English.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ msgid "%ld more matches"
msgstr ""

#. Resource IDs: (1069)
msgid "%path% is replaced with the path of the file, %line% with the line to jump to"
msgid "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset"
msgstr ""

#. Resource IDs: (119)
Expand Down Expand Up @@ -124,8 +124,12 @@ msgstr ""
msgid "Check for updates"
msgstr ""

#. Resource IDs: (180)
msgid "Column"
msgstr ""

#. Resource IDs: (1068)
msgid "Command line to start an editor at a specific line:"
msgid "Command line to start an editor at a specific line and in line offset:"
msgstr ""

#. Resource IDs: (1060)
Expand Down Expand Up @@ -307,7 +311,7 @@ msgstr ""

#. Resource IDs: (150)
#, c-format
msgid "Line %5ld : %30s\n"
msgid "Line %5ld : %s\n"
msgstr ""

#. Resource IDs: (135)
Expand Down
12 changes: 8 additions & 4 deletions translations/French.lang
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ msgid "%ld more matches"
msgstr "%ld autres correspondances"

#. Resource IDs: (1069)
msgid "%path% is replaced with the path of the file, %line% with the line to jump to"
msgid "%path% is replaced with the path of the file, %line% with the line to jump to, %column% with in line offset"
msgstr "%path% est remplacé par le chemin du fichier, %line% par la ligne à atteindre"

#. Resource IDs: (119)
Expand Down Expand Up @@ -124,8 +124,12 @@ msgstr ""
msgid "Check for updates"
msgstr ""

#. Resource IDs: (180)
msgid "Column"
msgstr ""

#. Resource IDs: (1068)
msgid "Command line to start an editor at a specific line:"
msgid "Command line to start an editor at a specific line and in line offset:"
msgstr "Commande de lancement d'un éditeur à une ligne spécifique :"

#. Resource IDs: (1060)
Expand Down Expand Up @@ -307,8 +311,8 @@ msgstr "Ligne"

#. Resource IDs: (150)
#, c-format
msgid "Line %5ld : %30s\n"
msgstr "Ligne %5ld : %30s\n"
msgid "Line %5ld : %s\n"
msgstr "Ligne %5ld : %s\n"

#. Resource IDs: (135)
msgid "Matches"
Expand Down
Loading
Loading