Skip to content

Commit

Permalink
Don't set modified if content matches
Browse files Browse the repository at this point in the history
  • Loading branch information
piascikj committed Aug 6, 2023
1 parent 8e02187 commit 086ac14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
10 changes: 8 additions & 2 deletions lib/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,8 @@ File.prototype.extractCheckboxTasks = function (config, pos, content) {
this.content = newContent

this.setModified(true)
console.log('extractCheckboxTasks setModified true for file:', this.path)

}
}

Expand Down Expand Up @@ -689,10 +691,12 @@ File.prototype.modifyTask = function (task, config, noEmit) {
text,
...description,
...linesAfter,
]
].join(lineEnd)

this.setContent(newContent.join(lineEnd))
if (this.getContent().trim() === newContent.trim()) return
this.setContent(newContent)
this.setModified(true)
console.log('modifyTask setModified true for file:', this.path)
if (!noEmit) {
this.emit('task.modified', task)
this.emit('file.modified', this)
Expand Down Expand Up @@ -752,6 +756,7 @@ File.prototype.modifyCodeOrHashTask = function (re, task, config, noEmit) {
this.modifyDescription(task, config)
}
this.setModified(true)
console.log('modifyCodeOrHashTask setModified true for file:', this.path)
if (!noEmit) {
this.emit('task.modified', task)
this.emit('file.modified', self)
Expand Down Expand Up @@ -786,6 +791,7 @@ File.prototype.modifyTaskFromHtml = function (task, html) {

this.setContent(beforeDescContent + descContent + afterDescContent)
this.setModified(true)
console.log('modifyTaskFromHtml setModified true for file:', this.path)
}

File.prototype.modifyTaskFromContent = function (task, content, config) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imdone-core",
"version": "1.32.2",
"version": "1.32.3",
"description": "imdone-core",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 086ac14

Please sign in to comment.