Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Does not ignore whitespace on current line when switching tabs #180

Open
1 task done
Aerijo opened this issue Aug 16, 2018 · 2 comments
Open
1 task done

Does not ignore whitespace on current line when switching tabs #180

Aerijo opened this issue Aug 16, 2018 · 2 comments
Labels

Comments

@Aerijo
Copy link

Aerijo commented Aug 16, 2018

Prerequisites

Description

The Ignore Whitespace on Current Line setting is not respected.

Steps to Reproduce

  1. Ensure autosave on lose focus is enabled
  2. Open two editor tabs
  3. In the first, set the language to JavaScript, paste in the following, and place your cursor where the pipe is (delete the pipe)
{
  |
}
  1. Switch to the other tab, and then back to this one

Expected behavior: [What you expect to happen]
No change

Actual behavior: [What actually happens]
Whitespace eaten

Reproduces how often: [What percentage of the time does it reproduce?]
70%

I can't reliably reproduce every time, but it will happen when I try enough times.

Versions

Atom    : 1.30.0-beta2
Electron: 2.0.5
Chrome  : 61.0.3163.100
Node    : 8.9.3

whitespace 0.37.6

Additional Information

Seems to be a regression introduced by #169. It uses the getActiveTextEditor API, meaning to grab the file we are leaving, but instead grabs the editor we arrive at. It then sees that the buffer is not the same as the actual editor, and doesn't look for any cursors.

Probably related is that saving is async, so the event is likely firing after we switch tabs (or something to that effect).

@Aerijo
Copy link
Author

Aerijo commented Aug 17, 2018

I can't reproduce on Stable 1.28.2

@Aerijo
Copy link
Author

Aerijo commented Aug 17, 2018

So I looked closer at the test cases in #169, and it's number 3 that is the issue. From it's description, I believe it's meant to be for when saving all files with the command prompt. This makes sense, but unfortunately conflicts with autosave as you change tabs.

I guess the question might be is this expected? I obviously don't like it killing whitespace while I'm writing a function & switch to another tab to look at something. But I don't know if these events can be distinguished, or even if other people actually want this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant