B26 just started bouncing

Vince's Avatar


01 Sep, 2017 05:18 PM

Been using B26 for about an hour on my long file (like the sample I sent). It just started bouncing, i.e. moving the editor text vertically when typing. I'm scrolled all the way to the end on the editor side, i.e. the last line in the file is the bottom line of the screen. The cursor is almost at the end of the file, around 15-16 lines from the bottom. I started typing, and it moved the line I was typing on to the bottom of the screen.

Like before, once it starts happening it keeps happening, and it happens anywhere in the file, i.e. the bouncing happens anywhere in the file after the first screen (it can't scroll any further there).

I've closed and re-opened the file. I'll let you know if happens again. (The file is up to 756 lines, around 71K.)

  1. Support Staff 1 Posted by Fletcher on 01 Sep, 2017 07:27 PM

    Fletcher's Avatar

    I can't reproduce the jumping, but did discover something else that may or may not be related.

    I added a complex list to the end of the test document you sent and noticed that the range of text that had the highlighting updated toggled through several different ranges, leading to unusual highlighting results that would cycle through a few configurations. Long story short, there was a situation whereby multibyte UTF-8 characters were not being properly accounting for.

    I fixed that, which fixes the unusual highlighting I saw, and which may fix the issues you had seen around a list.

    I don't know that this is related to the jumping, but if it was causing enough strangeness in the highlighting that it was throwing the layout off, I guess it's possible??

    If you find a way to reliably trigger the bouncing in B26 (or the upcoming B27), let me know and I'll keep digging.

  2. Support Staff 2 Posted by Fletcher on 01 Sep, 2017 07:45 PM

    Fletcher's Avatar

    Can you send me a screenshot of your appearance preferences and your editing preferences?

  3. 3 Posted by Vince Rice on 01 Sep, 2017 08:00 PM

    Vince Rice's Avatar
  4. Support Staff 4 Posted by Fletcher on 02 Sep, 2017 05:16 PM

    Fletcher's Avatar

    To clarify, when you say bouncing -- is the screen bouncing around, but the letters you type end up in the proper place in the document? Or is the cursor moving around causing the keystrokes to be recorded in the wrong place?

    I had an issue during testing this morning where the cursor was being moved, causing keystrokes to end up in the wrong place, but I am 99% sure that was because of the changes I was making after b26 to facilitate enabling spell check correction, and not related to what you saw. But better to ask.

  5. 5 Posted by Vince on 02 Sep, 2017 05:42 PM

    Vince's Avatar

    Same as it's been this whole time; I just used the same term to be consistent.

    The line I'm typing on is, say, line 30 out of 60 on the screen. I start typing; the whole document is shifted such that what used to be line 30 is now line 58. Same type of behavior that Typewriter mode has (although it's typically moving everything to the center). When this happens, it's always moving the line I'm typing on to the bottom of the screen, i.e. within a line or two of the bottom of the screen.

    And, as I've previously noted, sometimes this happens when I type the first letter, sometimes it happens after I hit Enter. And it's (AFAICT) completely random; I'll have been working in a document for 30 seconds or 30 minutes, and suddenly it starts moving everything. But once it happens, it happens almost every time (I would say every time, but there's probably been an exception), making MMD unusable (for me). I have to close and re-open the document.

    I'm guessing it's size and/or complexity of document-related; if so, what I'm working on is a pretty good-sized document (78K+, 13K words, 80K characters, 271 paragraphs) and thus I'm seeing it more often. But if people are writing novels with it, mine's still not that big. :)

  6. Support Staff 6 Posted by Fletcher on 02 Sep, 2017 08:08 PM

    Fletcher's Avatar

    Found two possible culprits -- there was a possible conflict when using auto save mode, and another that could cause false positive adjustments when typing caused an additional line of text to be created in the editor pane.

    Should be fixed for b28!

  7. Fletcher closed this discussion on 02 Sep, 2017 08:08 PM.

  8. Vince re-opened this discussion on 03 Sep, 2017 07:12 AM

  9. 7 Posted by Vince on 03 Sep, 2017 07:12 AM

    Vince's Avatar

    Sorry for the bad news, but I just loaded my file in B28, scrolled around for a bit (Preview still not synced initially), and the very first letter I typed caused the shift/bounce. And every subsequent edit throughout the file.

    But after playing with it a bit, I think I've figured out that it's related to Preview scrolling. In my large file, when the last line of the editor side is at the bottom of the screen, there are still two paragraphs (two line numbers, but eight lines of text or so) off the screen to the bottom on the Preview side.

    If I scroll to the bottom on the editor side, put my cursor where I want to edit (say two-thirds up the screen) and start editing, it works fine.
    However, if I scroll to the bottom on the editor side, then scroll the Preview side to get the bottom line of the Preview (which in turn causes the editor side to scroll up and add white space at the bottom of the screen), the any edit on the editor side does the bounce.

    That is repeatable. Open the file, scroll to the bottom on the editor side, start editing, no problem. Open the file, scroll to the bottom on the Preview side so there is whitespace below on the editor side, then scroll the editor side so the bottom is the bottom again, then edit (anywhere), it bounces, and does so from that point forward. Because of the initial sync problem, you might have to scroll the editor first, then scroll the Preview side, but once the Preview side causes whitespace at the bottom of the editor side, the editor side will bounce on edit.

  10. Support Staff 8 Posted by Fletcher on 03 Sep, 2017 10:50 AM

    Fletcher's Avatar

    Since you can now repeatedly make it happen, can you send a video so I
    can see exactly what is happening?

    When I use your test file, I still don't see anything unusual repeating
    the process you describe.

    When scrolling the preview such that the editor moves beyond its natural
    boundaries, there is an initial jump with the first keystroke to put the
    editing pane back where it belongs (since, as you describe, it was
    scrolled upwards "too" much). But after the first keystroke, all is
    well. (Unless I start typing while the scroll is still in motion, which
    as discussed earlier is going to cause "jumps" while the scroll is still
    in motion.)

  11. 9 Posted by Vince Rice on 03 Sep, 2017 03:55 PM

    Vince Rice's Avatar

    No, read what I wrote again.
    > Open the file, scroll to the bottom on the Preview side so there is whitespace below on the editor side, then scroll the editor side so the bottom is the bottom again, then edit (anywhere), it bounces

    I put the editor side back in normal position before I start editing. This isn't "normal" bouncing — give me some credit, I've been reporting this problem for two weeks, I'm pretty familiar with it by now. :) I'm not typing when the scrolling is in motion. I'm doing exactly what I've always been doing — just normal editing. I just figured out something that happens before I'm typing that appears to cause the problem about 99.9% of the time.

    I have the same problem with a video that I did before; first, it's too big, I can't email it, and second, I'll have to try to repeat this with my test file, I still can't give you pictures of my real one.

  12. 10 Posted by Vince on 03 Sep, 2017 07:25 PM

    Vince's Avatar

    I had some time and tried it on the test file (which I don't believe I've touched since I sent it to you).

    Open the file. Scroll to the bottom on the editor side; "Twelth Topic" is displayed on the bottom of the left, I have "Ninth Topic" on the bottom line on the Preview side. IOW, three topics, about six lines, below the screen on the right.

    Put your cursor at, for example, the lorum just above Seventh Topic on the editor side. Type a character. I have no problem, i.e. nothing untoward happens except the character appearing. Normal behavior.

    Now, scroll the Preview side so that you can at least see Twelfth Topic, which will of course put blank space on the bottom of the editor side. I've gone a little farther, and attached a screenshot of what it looks like.

    Now, scroll on the editor side and go to the bottom. Things should look like exactly like they did above; the last line in the file is on the last line of the screen (white space gone), and the Preview side shows "Ninth Topic" (for me) again. Your cursor should still be at the lorum above the Seventh Topic (you haven't typed, just scrolled). Type a character. For me, that line immediately jumps to the next line from the bottom of the screen, which, for me, was over half the screen height. IOW, the "bounce".

    I can repeat that all day long. Well, at least for the last five minutes. :)

    So, if the above and the screenshot isn't enough, I can do a video, you just have to tell me how to get it to you. I can't email it, and the site says "files up to 10MB," which is not nearly enough.

  13. 11 Posted by Vince on 03 Sep, 2017 07:26 PM

    Vince's Avatar

    And of course the screenshot didn't come through again. Your site has real problems with attachments. :) Trying again.

  14. Support Staff 12 Posted by Fletcher on 03 Sep, 2017 10:01 PM

    Fletcher's Avatar

    How tall is the window you use?

    I was able to recreate this once, but now I can't. It's not clear what's changed.

    I did find an issue that could cause the cursor to move to a different character offset if there was a spelling error that was automatically corrected. But nothing related to scrolling per se.

  15. 13 Posted by Vince Rice on 03 Sep, 2017 11:56 PM

    Vince Rice's Avatar

    In my test document, starting at the top of the document, I see from First Topic to the first line of the last paragraph before the third sub-topic. IOW I see all but one line of the second sub-topic. That's 49 lines in the file, but since several of them wrap, it's probably more like 80 lines total.

    If I scroll all the way to the end and force the last line of the file (Twelfth Topic) to be the very bottom line of the screen (that's not where scrolling all the way to the end puts it; when scrolling, there's always two or three lines of blank space beneath it), the top line is the third-subtopic of the Sixth topic. But it's about half-way off screen.

  16. 14 Posted by Vince on 04 Sep, 2017 12:01 AM

    Vince's Avatar

    But it doesn't seem to matter. I just shortened the window by almost half. With the Twelfth Topic as the last line on the screen, the top line is now that lorum just above the Seventh topic.

    And the behavior was the same — scroll to the bottom on the left, no problem, scroll a little past the bottom on the right, then re-position to the bottom on the left, instant bounce.

  17. Support Staff 15 Posted by Fletcher on 04 Sep, 2017 12:06 AM

    Fletcher's Avatar

    If you have a video, you can use this to upload:


    Maybe I can see something that will point me in the right direction.

  18. Support Staff 16 Posted by Fletcher on 04 Sep, 2017 02:58 AM

    Fletcher's Avatar

    I assume it's still happening in b30??

  19. 17 Posted by Vince on 04 Sep, 2017 04:15 AM

    Vince's Avatar

    It wasn't available yet when I was testing earlier today. I just dl'd it and, interestingly, it didn't do it the first two times I tried, which are the first two times it hasn't done it since B28(7?). But, I just closed and re-opened the file, and it did it straightaway. I'll work on a video tomorrow; it's late here and I'm done for the day.

  20. 18 Posted by Vince on 04 Sep, 2017 04:57 AM

    Vince's Avatar

    All right, I couldn't resist. It's uploading. It did it immediately this time; I didn't show the opening of the file, but that's all that's happened before the video, no typing, scrolling, nothing. Hope it helps!

  21. Support Staff 19 Posted by Fletcher on 04 Sep, 2017 11:01 AM

    Fletcher's Avatar

    Thanks for the video.

    Does it happen when the window is smaller? I don't have a monitor that large to be able to precisely reproduce (1920x1080p is the largest I can do -- when testing this I usually make the window as large as I can, but also test smaller versions as well).

    I still haven't been able to reproduce it since yesterday.

    What happens after that? The video showed the initial repositioning and then ended. Does it continue to jump while you type?

  22. Support Staff 20 Posted by Fletcher on 04 Sep, 2017 11:06 AM

    Fletcher's Avatar

    ....Except when I turn on the scroll bars to be always visible like yours. Then it happens.

    (And that's why I've been asking for the video for so long..... It's always the things people don't think to tell me (or even notice) that end up being important).

    In system preferences, set scroll bars to only appear "when scrolling". See if that resolves the problem.

  23. 21 Posted by Vince on 04 Sep, 2017 02:19 PM

    Vince's Avatar

    I already answered the first question yesterday:

    But it doesn't seem to matter. I just shortened the window by almost half. With the Twelfth Topic as the last line on the screen, the top line is now that lorum just above the Seventh topic.

    And I don't have scroll bars always visible. It's "automatically based on mouse or trackpad". There are no scroll bars as I'm looking at the app right now.

    And the proper way to form that sentence is "…It's always the things I don't think to ask about that end up being important." :) You persist in sounding like you're blaming your user. Words matter — the onus for this problem is on you, not me. I've answered every question you've asked, and a lot you haven't. If you didn't think to ask some, that's not my problem.

  24. Support Staff 22 Posted by Fletcher on 04 Sep, 2017 04:35 PM

    Fletcher's Avatar

    I think this is now fixed in b31

  25. Support Staff 23 Posted by Fletcher on 04 Sep, 2017 04:36 PM

    Fletcher's Avatar

    Just an FYI for anyone following the thread or finding it later (and to serve as a reminder to me):

    (Written stream of consciousness as I tried to figure it out, and finally did part way through....)

    I can now (generally) reproduce the issue. Unfortunately it disappears when running the debug version of the app in Xcode. Generally, this has meant that the problem was a "race condition" between two threads requiring proper timing for the issue to appear.

    In this case:

    • Everything that seems relevant is occuring on the main thread, so not likely to be a race condition

    • Typing 1 key every second or two still produces the problem

    • Noncontiguous Layout on the NSTextView is NO (when enabled, this allows portions of the text to be laid out for display while skipping other parts. This causes the "space jump" issue on the text view (which I believe is to the similar behavior in WebView's when a space is added to the text)) Setting it to YES didn't help, and causes other issues

    • The only scrolling that is being called is scrollRangeToVisible: -- I wrap it only to enable debugging, otherwise this is an Apple provided method. I added debugging statements to everything scroll related for NSTextView that I could find, and nothing else is being called. The character range for this call is correct (incremementing by 1 for each character I type since I'm typing in one place)

    • The issue occurs on 10.12.6 and 10.13 beta (I have not tested on 10.11)

    • The issue occurs whether synchronized scrolling is always on or not

    • BUT it was necessary to use sync scrolling to scroll the text view above it's natural bounds (by scrolling the webview all the way up) to trigger the behavior. I could not get it to occur without doing this first

    • Once triggered, scrolling can remain entirely inside bounds and the behavior can continue

    I think it is finally resolved. As above, I could find nothing wrong in the textview. The sync scroll requirement finally let me to look elsewhere.

    The problems seems to be using the following to scroll the editor or web view when sync scrolling:

    [[self contentView] scrollToPoint:curOffset];
    [self reflectScrolledClipView:[self contentView]];

    I changed to the following:

    [[self documentView] scrollPoint:curOffset];
    [self reflectScrolledClipView:[self contentView]];

    This seems to fix the issue. I can no longer replicate it. We'll see if anyone else can.

  26. 24 Posted by Vince Rice on 04 Sep, 2017 06:47 PM

    Vince Rice's Avatar

    I haven't stress tested it with an extended editing session, but I haven't been able to make it happen in 4-5 attempts (closing and re-opening the file each time) of doing the same steps that has been causing it the last several versions. So, yea!!

    It's Labor Day here in the States (I don't know where you are, physically), so I'll get back to a more extended "test" (i.e. by doing real work) on it tomorrow.

    Great job, and thanks for the explanation, it's interesting. If I knew more about Mac development (I know just enough to be dangerous), it would probably be even more interesting. :)

  27. Support Staff 25 Posted by Fletcher on 04 Sep, 2017 06:55 PM

    Fletcher's Avatar

    Also in the states, so working on Labor Day for me. but working from home still beats working at the hospital in many ways, so no complaints.

    I just knew you were going to email to let me know the problem still existed for you, so failure to recreate thus far is still good news!

    Thanks again for the video -- that helped me get to the right track to fix this.

    I've always been intrigued by the stories of how problems are solved, even if the problem is not one I thoroughly understand. And reading those from others on the web have often helped me figure out the right direction for my own difficulties, even if the details are different. Hopefully this will help some other programmer sometime.

    The remaining things on my to do list are either not high priority, or features I want to add to future versions. So I hope to wrap things up with "4.0" in the next few days and submit to App Store.

    Again, thanks for helping me to sort through this one. It wins the prize for being the most troublesome bug to track down that I've had to deal with.

  28. Fletcher closed this discussion on 04 Sep, 2017 06:55 PM.

  29. Vince Rice re-opened this discussion on 05 Sep, 2017 07:10 PM

  30. 26 Posted by Vince Rice on 05 Sep, 2017 07:10 PM

    Vince Rice's Avatar

    Just a (good) update — I've been using it a couple of hours on my big file, and no bouncing. I don't think I've gone that long without bouncing since I started the beta. So yea again!

  31. Support Staff 27 Posted by Fletcher on 05 Sep, 2017 07:13 PM

    Fletcher's Avatar

    I saw that you updated this thread and my heart dropped..... ;)

    Glad it's a good update! I don't know that I have it in me to look for yet another cause for this issue....

  32. Fletcher closed this discussion on 05 Sep, 2017 07:13 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac