Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phantom changes to file preferences: word wrap preference altered when file is open, reverted when closed #430

Closed
ervumlens opened this issue Jul 17, 2015 · 7 comments
Assignees
Milestone

Comments

@ervumlens
Copy link

Spoiler alert: I include the lines of code that cause the problem (at least in part).
Also: This may be related in a roundabout way to #175, although the symptoms are different.

Problem
If a file has long lines, its file-level preference for word wrapping is changed whenever it is opened. Because it's changed with every open, that file will always open with word wrap enabled no matter what preferences are set, no matter where they are set.

<blink>The problem is easy to reproduce</blink> But because word-wrap bug reports are sometimes spurious, I made sure to include all the obvious gotchas here.

Steps to Reproduce — Part 1

  1. Open Komodo preferences. Ensure that "word wrap" is set to "none."
  2. Ensure that "view → word wrap" is disabled.
  3. Create a new project. Open project preferences. Ensure that "word wrap" is set to "none."
  4. Create a new, blank file. Close the file.
  5. Open the new file's preferences in Places. Ensure that "word wrap" is set to "none."
  6. Open the new file again. Copy into it the contents from https://raw.githubusercontent.com/ajaxorg/ace-builds/master/src-noconflict/worker-coffee.js. This file has a few giant lines that make it a good test case.
  7. Before closing, open the new file's preferences in Places. Ensure that "word wrap" is still set to "none."
  8. Save and close the file.
  9. Open the new file's preferences in Places. Ensure that "word wrap" is still set to "none."
  10. Open the new file.

Expected
Word wrapping is disabled both on the screen and in the file preferences.

Actual
Word wrapping is enabled both on the screen and in the file preferences. But hey, who cares? It's a new file. 🎸

image1

Steps to Reproduce — Part 2

  1. Close the file.
  2. Open the new file's preferences in Places.

Expected
Word wrapping is disabled.

Actual
Word wrapping is, as expected, disabled. 👍

image2

Steps to Reproduce — Part 3

  1. Open the file again.

Expected
Word wrapping is disabled both on the screen and in the file preferences.

Actual
Word wrapping is enabled both on the screen and in the file preferences. 👎 We're not a new file any more.

image3

Steps to Reproduce — Part 4

  1. With the file still open, change the file's "word wrap" preference to "none". Save the preferences.
  2. Close the file.
  3. Open the file again.

Expected
Word wrapping is disabled both on the screen and in the file preferences.

Actual
Word wrapping is enabled both on the screen and in the file preferences. 👎 We're not a new file and we have a preference set.

image4

Code
koDocument.py#L644-L649

This code is always hit when opening a long-lined file, despite promises to the contrary:

        # Bug 93790: If the file is new to Komodo, and has any long lines,
        # where long > 2000 chars, turn word-wrap on
        if hasLongLine:
            self.prefs.setLongPref('editWrapType', True)
            for view in self._views:
                view.scimoz.wrapMode = view.scimoz.SC_WRAP_WORD

Some strategic logging shows this to be the case.

The guard code (not shown) isn't working. As the comments here and elsewhere suggest, the preference change should not occur with a file that has been opened previously.

P.S. I just found another use-case with a similar problem, but not with long lines (I'll comment about it below if I can find a visible error). I suspect there's something broadly wrong with this code.

@ervumlens
Copy link
Author

Using "view → word wrap" rather than the file preference doesn't correct the error. In fact, the word wrap menu item sometimes fails:

image5

Note that "word wrap" is not checked, but the text is word wrapped.

@ervumlens ervumlens changed the title Phantom changes to file preferences: word wrap altered when file is open, reverted when closed Phantom changes to file preferences: word wrap preference altered when file is open, reverted when closed Jul 17, 2015
@Naatan Naatan added this to the 9.2.1 milestone Jul 17, 2015
@Naatan
Copy link
Member

Naatan commented Jul 17, 2015

Reproduced. This looks like a fun one ..

Thanks @ervumlens

@ervumlens
Copy link
Author

I'm glad I could help narrow it down. This was the first problem I ran into with Komodo. I noticed Komodo forum posts describing similar problems, so I figured there was no point in logging a bug until I had something useful to share.

Regarding the intentional, one-time preference change: I hope you'll agree that the typical user doesn't expect this to happen. Would you consider adding a notification or similar to tell the user "Yes, we just turned on word wrap. No, it's not a bug," to mitigate some of the surprise?

@Naatan
Copy link
Member

Naatan commented Jul 20, 2015

@cgchoffman I saw you were looking at this the other day, could you add your findings to the ticket?

@Naatan
Copy link
Member

Naatan commented Jul 20, 2015

@ervumlens I agree a notification would make a lot of sense.

@th3coop
Copy link
Member

th3coop commented Jul 20, 2015

I didn't find much to add. I was messing around, trying to find a way to block that code if the file wasn't new to Komodo but I suspect that that check occurs before that code is hit any way. I didn't have tons of time to look into this.

@Naatan Naatan modified the milestones: 9.2.1, 9.2.2 Aug 14, 2015
@Naatan Naatan modified the milestones: 9.3, 9.2.2 Oct 5, 2015
@Naatan Naatan self-assigned this Oct 5, 2015
@mitchell-as
Copy link
Contributor

For performance reasons we automatically turn on word wrap for new files when lines of length 2000+ are detected. The problem is that "File Properties" is reporting two different values: one when the file is open, and another when the file is closed. Need to investigate further.

@tonyattwood
Copy link

Hello,

I'm extremely grateful to you for all you have done, please read my message for you here http://fast.softwarevalueoptimisation.com/e4qxfxuh

Warmest, tony.attwood@ntlworld.com

@tonyattwood
Copy link

Hello,
Here is an amazing article that you may find really useful, olease read it here http://fair.seocostaricaexperts.com/e4udv
Typos courtesy of my iPhone, tony.attwood@ntlworld.com

@tonyattwood
Copy link

Hey,

I came across that interesting stuff and I guess it's something really crazy, just take a look http://venue.oleymi.com/e4mfu

Yours, tony.attwood

@tonyattwood
Copy link

Hello,

I've watched a really great movie a couple of days ago, it inspired mea lot, you may watch the trailer here http://gyprywohi.idanz.org/e4tbh

Speak to you later, tony.attwood

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

No branches or pull requests

5 participants