Make application aware it saved the buffer and not something else (#4314)

Make application aware it saved the buffer and something else
This commit is contained in:
49fl
2024-10-25 18:07:50 -04:00
committed by GitHub
parent 9772869545
commit 4925251c29
2 changed files with 10 additions and 0 deletions

View File

@ -140,6 +140,13 @@ const FileTreeItem = ({
async (eventType, path) => {
// Don't try to read a file that was removed.
if (isCurrentFile && eventType !== 'unlink') {
// Prevents a cyclic read / write causing editor problems such as
// misplaced cursor positions.
if (codeManager.writeCausedByAppCheckedInFileTreeFileSystemWatcher) {
codeManager.writeCausedByAppCheckedInFileTreeFileSystemWatcher = false
return
}
let code = await window.electron.readFile(path, { encoding: 'utf-8' })
code = normalizeLineEndings(code)
codeManager.updateCodeStateEditor(code)