diff --git a/README.md b/README.md index 413f4e7..19cddc2 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,10 @@ This plugin is the same as the built-in **Word Count** plugin, except when you s - Added all word, char, sentence count when not viewing a markdown file. - @lishid - Helped solve the performace issue. +- @THeK3nger + - Fixed issue that occured when renaming files. +- @bakuzan + - Fixed issue that caused errors at start up. ### Special Thanks diff --git a/manifest.json b/manifest.json index 5e5289d..a7b282c 100644 --- a/manifest.json +++ b/manifest.json @@ -1,7 +1,7 @@ { "id": "better-word-count", "name": "Better Word Count", - "version": "0.9.1", + "version": "0.9.2", "description": "Counts the words of selected text in the editor.", "author": "Luke Leppan", "authorUrl": "https://lukeleppan.com", diff --git a/package.json b/package.json index 46a2fec..b970db8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "better-word-count", - "version": "0.9.1", + "version": "0.9.2", "description": "Counts the words of selected text in the editor.", "main": "main.js", "scripts": { diff --git a/src/stats/StatsManager.ts b/src/stats/StatsManager.ts index 2934c25..a8f59b9 100644 --- a/src/stats/StatsManager.ts +++ b/src/stats/StatsManager.ts @@ -24,6 +24,12 @@ export default class StatsManager { false ); + this.vault.on("rename", (new_name, old_path) => { + const content = this.vaultStats.modifiedFiles[old_path]; + delete this.vaultStats.modifiedFiles[old_path]; + this.vaultStats.modifiedFiles[new_name.path] = content; + }); + this.vault.adapter.exists(STATS_FILE).then(async (exists) => { if (!exists) { const vaultSt: VaultStatistics = {