Truncate names of files/folders that are being grep'ed

This commit is contained in:
Humdinger
2014-01-29 12:57:38 +01:00
parent cff5000f79
commit 4c56a102ca
2 changed files with 11 additions and 2 deletions
+9 -2
View File
@@ -144,6 +144,7 @@ GrepWindow::GrepWindow(BMessage* message)
_LoadPrefs();
_TileIfMultipleWindows();
fSearchBoxWidth = fSearchText->Bounds().Width();
Show();
}
@@ -157,6 +158,7 @@ GrepWindow::~GrepWindow()
void GrepWindow::FrameResized(float width, float height)
{
fSearchBoxWidth = fSearchText->Bounds().Width();
BWindow::FrameResized(width, height);
fModel->fFrame = Frame();
_SavePrefs();
@@ -1035,8 +1037,13 @@ GrepWindow::_OnNodeMonitorPulse()
void
GrepWindow::_OnReportFileName(BMessage* message)
{
if (fModel->fState != STATE_UPDATE)
fSearchText->SetText(message->FindString("filename"));
if (fModel->fState != STATE_UPDATE) {
BString name = message->FindString("filename");
fSearchText->TruncateString(&name, B_TRUNCATE_MIDDLE,
fSearchBoxWidth - 10);
fSearchText->SetText(name);
}
}
+2
View File
@@ -141,6 +141,8 @@ private:
bigtime_t fLastNodeMonitorEvent;
ChangesIterator* fChangesIterator;
BMessageRunner* fChangesPulse;
float fSearchBoxWidth;
BFilePanel* fFilePanel;
};