Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Atom changes open files when file simultaneously edited and saved in external applications that renames and replaces on save  #17186

@jborovicka

Description

@jborovicka

Edit by @rsese

  1. Open some file in Atom atom --safe file
  2. Open the same file in Vim
  3. Edit and save the file in Vim

Expect the file to be updated in Atom with the changes from (3), actual is that the tab in Atom now shows file~ and has the content of the file before (3).

Reproduces on Windows 10 with Atom 1.26.1.

From #17186 (comment):

Simple way to recreate with a git-for-windows bash shell:

touch banana.txt
atom banana.txt
sleep 5  # Give atom time to open the file
# Simulate an external file save
mv banana.txt banana.txt.backup
touch banana.txt

Atom will end up with "banana.txt.backup" opened up, when the expected behavior is to have the new "banana.txt" either automatically loaded or for atom to warn that the file was modified.

Prerequisites

Description

When a file (say test.tex) is simultaneously open in Atom and Scientific Workplace 5.5 (SW), and the file is edited and saved in SW, the window in Atom changes from test.tex to test.bak, instead of refreshing the content of test.tex.

Notice that the simultaneous editing and refreshing works correctly when using SW and WinEdt simultaneously, or when using WinEdt and Atom simultaneously. But not when using SW and Atom.

Steps to Reproduce

To reproduce, make sure that the "Create backup (.bak) Files" option is switched on in SW under Tools -> User Setup -> Files (this is the default choice).

  1. Create a file test.tex in an empty directory, e.g., containing
    \documentclass{article}
    \begin{document}
    Some text.
    \end{document}

  2. Open the file using Atom. Left pane contains the content of the directory (only test.tex), right pane the content of the file.

  3. Open the file using SW. Now the file is opened in both editors. SW created a temporary file test.aaa in the directory but we can ignore that one.

  4. Edit the file in Atom and save. When moving focus back to SW, a dialog window in SW announces that the file has been overwritten and request reload. Click Yes. This is expected. The file on the hard drive is correctly modified.

  5. Now edit the file in SW and save. SW correctly saves the file and creates a backup (.bak) file with the previous content. This is expected. HOWEVER, at the same time, the file test.tex opened in Atom automatically changes to test.bak (the caption in the header of the window changes), and its contents indeed correspond to the test.bak file created by SW, This is incorrect behavior.

Expected behavior: When the file test.tex is edited and saved in SW, Atom should refresh the opened file.

Actual behavior: The opened file in Atom changes from test.tex to test.bak.

Reproduces how often: Always.

Versions

Same behavior in Atom 1.24.0 and Atom 1.26.0, both clean installations, with no extra packages and including in safe mode.

Windows 10, Scientific Workplace 5.5

Atom : 1.24.0
Electron: 1.6.16
Chrome : 56.0.2924.87
Node : 7.4.0

Atom : 1.26.0
Electron: 1.7.11
Chrome : 58.0.3029.110
Node : 7.9.0

Additional Information

N/A

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions