Merge branch 'hotfix/0.7.5'
This commit is contained in:
commit
25ff6c9be3
4 changed files with 25 additions and 9 deletions
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"id": "better-word-count",
|
||||
"name": "Better Word Count",
|
||||
"version": "0.7.4",
|
||||
"version": "0.7.5",
|
||||
"description": "Counts the words of selected text in the editor.",
|
||||
"author": "Luke Leppan",
|
||||
"authorUrl": "https://lukeleppan.com",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "better-word-count",
|
||||
"version": "0.7.4",
|
||||
"version": "0.7.5",
|
||||
"description": "Counts the words of selected text in the editor.",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
|
|
@ -32,6 +32,12 @@ export interface TodayCounts {
|
|||
sentences: number;
|
||||
}
|
||||
|
||||
export interface TotalCounts {
|
||||
words: number;
|
||||
characters: number;
|
||||
sentences: number;
|
||||
}
|
||||
|
||||
export class DataManager {
|
||||
private vault: Vault;
|
||||
private metadataCache: MetadataCache;
|
||||
|
@ -171,6 +177,14 @@ export class DataManager {
|
|||
return this.todayCounts;
|
||||
}
|
||||
|
||||
getTotalCounts(): TotalCounts {
|
||||
return {
|
||||
words: this.history[this.today].totalWords,
|
||||
characters: this.history[this.today].totalCharacters,
|
||||
sentences: this.history[this.today].totalSentences,
|
||||
};
|
||||
}
|
||||
|
||||
async updateFromFile() {
|
||||
this.history = Object.assign(
|
||||
JSON.parse(await this.vault.adapter.read(".vault-stats"))
|
||||
|
|
|
@ -65,13 +65,13 @@ export class BarManager {
|
|||
newText = newText + getSentenceCount(text);
|
||||
break;
|
||||
case 3:
|
||||
newText = newText + this.dataManager.getTodayCounts().words;
|
||||
newText = newText + this.dataManager.getTotalCounts().words;
|
||||
break;
|
||||
case 4:
|
||||
newText = newText + this.dataManager.getTodayCounts().characters;
|
||||
newText = newText + this.dataManager.getTotalCounts().characters;
|
||||
break;
|
||||
case 5:
|
||||
newText = newText + this.dataManager.getTodayCounts().sentences;
|
||||
newText = newText + this.dataManager.getTotalCounts().sentences;
|
||||
break;
|
||||
case 6:
|
||||
newText = newText + this.dataCollector.getTotalFileCount();
|
||||
|
@ -92,7 +92,7 @@ export class BarManager {
|
|||
this.statusBar.displayText(newText);
|
||||
}
|
||||
|
||||
updateAltStatusBar(): void {
|
||||
async updateAltStatusBar(): Promise<void> {
|
||||
let newText = "";
|
||||
const expression: Expression = parse(this.settings.statusBarAltQuery);
|
||||
if (this.settings.collectStats) {
|
||||
|
@ -118,13 +118,15 @@ export class BarManager {
|
|||
newText = newText + getSentenceCount("");
|
||||
break;
|
||||
case 3:
|
||||
newText = newText + this.dataManager.getTodayCounts().words;
|
||||
newText = newText + (await this.dataCollector.getTotalWordCount());
|
||||
break;
|
||||
case 4:
|
||||
newText = newText + this.dataManager.getTodayCounts().characters;
|
||||
newText =
|
||||
newText + (await this.dataCollector.getTotalCharacterCount());
|
||||
break;
|
||||
case 5:
|
||||
newText = newText + this.dataManager.getTodayCounts().sentences;
|
||||
newText =
|
||||
newText + (await this.dataCollector.getTotalSentenceCount());
|
||||
break;
|
||||
case 6:
|
||||
newText = newText + this.dataCollector.getTotalFileCount();
|
||||
|
|
Loading…
Reference in a new issue