Cursor / typing synchronization lag

I keep encountering the following bug, and couldn’t find any report of a similar problem anywhere. I’m editing a longish chapter (11,000 words). I click the cursor in the position I want to add or delete text, and start typing (or hitting the delete button). But the cursor doesn’t move immediately, which means the text I type or the deletions I make occur at the previous cursor location. The cursor finally moves somewhere around the 3rd or 4th keystroke, and the rest of the text is entered at the new location.

Needless to say, this regularly screws me up, because I end up inserting garbage (or worse, deleting text!) where I didn’t want it. I then have to stop and backtrack to fix the problem. Undo does the right thing, luckily, but sometimes I don’t immediately notice the problem, which means I then have to do a lot of repair work to find and fix the errors.

I’m running Scrivener 2.6 on Mac OS 10.10.5.
Having other apps open or not doesn’t seem to affect the problem - it seems to come and go at random.

Here’s what I get from the logs in the Console:

2015-09-03 10:49:47.865 AM Scrivener[2019]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 10:49:47.883 AM Scrivener[2019]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 11:04:46.703 AM launchservicesd[71]: Application App:“Scrivener” asn:0x0-12e12e pid:2019 refs=8 @ 0x7fd39a1c6380 tried to be brought forward, but isn’t in fPermittedFrontApps ( ( “LSApplication:0x0-0x1001 pid=86 “loginwindow””)), so denying. : LASSession.cp #1521 SetFrontApplication() q=LSSession 100005/0x186a5 queue
2015-09-03 11:04:46.703 AM WindowServer[135]: [cps/setfront] Failed setting the front application to Scrivener, psn 0x0-0x12e12e, securitySessionID=0x186a5, err=-13066
2015-09-03 6:02:42.574 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:41.832 PM sandboxd[140]: ([390]) Scrivener(390) deny file-read-data /Users/sme/Library/PreferencePanes
2015-09-03 6:06:41.851 PM sandboxd[140]: ([390]) Scrivener(390) deny file-read-data /Users/sme/Library/PreferencePanes
2015-09-03 6:06:43.514 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:43.530 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:43.547 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:43.564 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:43.582 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:43.599 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:43.712 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:06:43.824 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.
2015-09-03 6:08:45.312 PM Scrivener[390]: NSSoftLinking - The ShareKit framework’s library couldn’t be loaded from /System/Library/PrivateFrameworks/ShareKit.framework/Versions/A/ShareKit.

Is this a periodic problem, where the effect could be described not so much as persistent lag, but occasional complete blockages for a few seconds at a time, after which everything you typed or did gets kind of scrambled up at once in the editor, like its trying to catch up?

If that’s what you mean, I don’t think that’s even related to Scrivener, I’ve seen problems like that on some Macs and not others, and when I do see it, it tends to be a system-wide problem (at least among programs that are coded using Apple’s development tools, so that excludes stuff like Word, Evernote, Chrome, Firefox, etc.). At one point I managed to track down a “culprit”, a background program I use for text expansion would periodically refresh its indexes and it doing so coincided with all of the lag spikes (they’ve since fixed that problem and it doesn’t seize up the system any more). But that was only one machine, I’ve seen the problem on others (including the one I’m using right now) where that software isn’t the trigger. So my guess is, it’s probably something far, far deeper in the operating system itself that isn’t properly balancing resources.

Wild guess though, and no idea how to really fix it. Best advice is to keep Activity Monitor (with the All Processes filter, in case it is coming from the system or another user account) and Console running so you can quickly tab to them when the problem happens. Hopefully you’ll spot the traces of something doing a big chunk of work.

Yes, that captures it. It’s like it sometimes gets held up and then is trying to catch up. I’ve only experienced the problem with Scrivener, but then most of the other apps I do a lot of typing in are the ones you list (Office, Safari, and apple’s own apps).

If it’s somewhere deep in the OS, should I try a clean install of Yosemite?

There are some things you can do to try and narrow it down with less effort perhaps. I tracked down the Typinator issue using activity monitor and console logs (it was logging its indexing activity, so that made it easy to spot the correlation). Given that I would also try logging in without any background software by holding down the Shift key after you enter your account password and keeping it held down until you’re fully logged in (which won’t take long since only Finder and the core windowing environment has to start up). Then just try your best to not run anything else other than Finder and Scrivener for a session and see if the problem vanishes.

If it does, that probably makes your job easy, it must be something that is starting up on your account automatically. I currently have this problem on this machine (also running 10.10.5) and I have yet to really track down what the trigger is. For me it’s the whole system that goes unresponsive though, I can’t click, Cmd-Tab works and a few other “low level” things like that, but nothing happens in other programs (even non-native like Firefox) when I try to use them. Then after about a second or two of that it all comes back and works fine for a few hours. It’s infrequent enough that I haven’t really been motivated to track it down yet.