Additional formatting tweaks (#5909)

This commit is contained in:
Clint Rutkas
2020-08-13 15:32:12 -07:00
committed by GitHub
parent 38b0d427f8
commit 23a9fa40e7
15 changed files with 129 additions and 137 deletions

View File

@@ -24,7 +24,10 @@ namespace PowerLauncher.Storage
{
int years = (span.Days / 365);
if (span.Days % 365 != 0)
{
years += 1;
}
return $"about {years} {(years == 1 ? "year" : "years")} ago";
}
@@ -32,20 +35,38 @@ namespace PowerLauncher.Storage
{
int months = (span.Days / 30);
if (span.Days % 31 != 0)
{
months += 1;
}
return $"about {months} {(months == 1 ? "month" : "months")} ago";
}
if (span.Days > 0)
{
return $"about {span.Days} {(span.Days == 1 ? "day" : "days")} ago";
}
if (span.Hours > 0)
{
return $"about {span.Hours} {(span.Hours == 1 ? "hour" : "hours")} ago";
}
if (span.Minutes > 0)
{
return $"about {span.Minutes} {(span.Minutes == 1 ? "minute" : "minutes")} ago";
}
if (span.Seconds > 5)
{
return $"about {span.Seconds} seconds ago";
}
if (span.Seconds <= 5)
{
return "just now";
}
return string.Empty;
}
}

View File

@@ -16,7 +16,11 @@ namespace PowerLauncher.Storage
public void Add(string query)
{
if (string.IsNullOrEmpty(query)) return;
if (string.IsNullOrEmpty(query))
{
return;
}
if (Items.Count > _maxHistory)
{
Items.RemoveAt(0);
@@ -31,7 +35,7 @@ namespace PowerLauncher.Storage
Items.Add(new HistoryItem
{
Query = query,
ExecutedDateTime = DateTime.Now
ExecutedDateTime = DateTime.Now,
});
}
}

View File

@@ -40,7 +40,7 @@ namespace PowerLauncher.Storage
{
PluginID = result.PluginID,
Title = result.Title,
SubTitle = result.SubTitle
SubTitle = result.SubTitle,
};
records[result.OriginQuery.RawQuery] = record;
}