<table><tr><td style="">rjvbb added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D5037" rel="noreferrer">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D5037#95031" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;" rel="noreferrer">D5037#95031</a>, <a href="https://phabricator.kde.org/p/anthonyfieroni/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;" rel="noreferrer">@anthonyfieroni</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>Ok, note this situation, hold modifier before first ever wheel event => you call m_lastWheelEvent.elapsed on unstarted timer</p></div>
</blockquote>

<p>This is true, and things can indeed be improved a bit there.</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p>and function returns true (m_accidentalModifier == false, m_lastWheelEventUnmodified == false)</p></blockquote>

<p>Am I missing something? For me that is exactly what the function should return, and the internal state is correct too. This works because the initial values for the 2 boolean state variables are set appropriately. In this case <tt style="background: #ebebeb; font-size: 13px;">deltaT</tt> may be assigned a random value (because ElapsedSince::elapsed() is undefined) but that value won't be used.</p>

<p>I can rewrite the code slightly so that the timer isn't used when not started but it won't make a difference for the end result, it will just add a few lines and an additional runtime check. Will do that ASAP.</p>

<p>I'd say try the patch and see if you can break its (now of after I upload the rewritten version). I just tried generating wheel events with the control modifier set from event 1. I even "primed" the text zoom via the keyboard shortcuts to prevent initial zooming hickups. I don't notice anything weird: the zoom works just as you'd expect.</p>

<p>Let me repeat if this wasn't clear: the purpose of this patch is only to prevent accidental zooming because you push the Control key while a scroll is still in progress. There's no way we can decide if a Control press is accidental when nothing else is going on.</p>

<p>In fact, we don't even know if what I now call an accidental Control press is really accidental. It's a reasonable assumption (I think) and it's still easy enough to trigger wheel-zooming with this protection in place. But it is possible that in a certain number of cases that we now treat as regular scroll events the user actually wanted zooming, not scrolling. I just have to hope that it is easier for those users to adapt to the behaviour with protection than it is for users like me to adapt to not having it :)</p></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5037" rel="noreferrer">https://phabricator.kde.org/D5037</a></div></div><br /><div><strong>To: </strong>rjvbb, KTextEditor<br /><strong>Cc: </strong>luebking, anthonyfieroni, dhaumann, kwrite-devel, KTextEditor, Frameworks, head7, cullmann, kfunk, sars<br /></div>