<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>423161</bug_id>
          
          <creation_ts>2020-06-18 14:17:49 +0000</creation_ts>
          <short_desc>Search results blink when updating</short_desc>
          <delta_ts>2022-01-21 19:07:26 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>4</classification_id>
          <classification>Plasma</classification>
          <product>plasmashell</product>
          <component>Application Launcher (Kickoff) widget</component>
          <version>5.20.90</version>
          <rep_platform>Manjaro</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>usability</keywords>
          <priority>NOR</priority>
          <bug_severity>minor</bug_severity>
          <target_milestone>1.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Claudius Ellsel">claudius.ellsel</reporter>
          <assigned_to name="Eduardo">eduardo.cruz</assigned_to>
          <cc>eduardo.cruz</cc>
    
    <cc>kde.podagric</cc>
    
    <cc>kde</cc>
    
    <cc>nate</cc>
    
    <cc>plasma-bugs-null</cc>
    
    <cc>qydwhotmail</cc>
          
          <cf_commitlink>https://invent.kde.org/frameworks/krunner/commit/a1d553a18515e02d42b2c1602549bedc958ef853</cf_commitlink>
          <cf_versionfixedin>5.25</cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1938110</commentid>
    <comment_count>0</comment_count>
    <who name="Claudius Ellsel">claudius.ellsel</who>
    <bug_when>2020-06-18 14:17:49 +0000</bug_when>
    <thetext>SUMMARY
Why searching for an application the search results refresh. During that they disappear for some short time and reappear leading to some blinking experience.

STEPS TO REPRODUCE
1. Press META
2. Type a letter
3. Type another letter

OBSERVED RESULT
After typing a followup letter the search results refresh (disappearing and reappearing refreshed)

EXPECTED RESULT
Have the list of results refresh without completely blanking the list and having items reappear, but more smoothly.

SOFTWARE/OS VERSIONS
Operating System: Manjaro Linux
KDE Plasma Version: 5.19.0
KDE Frameworks Version: 5.70.0
Qt Version: 5.15.0
Kernel Version: 5.6.17-1-MANJARO
OS Type: 64-bit
Processors: 4 × Intel® Xeon® CPU E3-1225 v3 @ 3.20GHz
Memory: 3.8 GiB of RAM
Graphics Processor: Mesa DRI Intel® HD Graphics P4600/P4700

ADDITIONAL INFORMATION
When using a certain time for the pauses between the letters no blinking actually happens. Most times I don&apos;t type in that constant intervals of pauses,  so that is not really helpful, but might give some hint.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1938511</commentid>
    <comment_count>1</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2020-06-19 17:55:12 +0000</bug_when>
    <thetext>Confirmed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1997561</commentid>
    <comment_count>2</comment_count>
    <who name="Claudius Ellsel">claudius.ellsel</who>
    <bug_when>2021-01-25 17:02:04 +0000</bug_when>
    <thetext>Just wanted to confirm this is still happening with the new Kickoff.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2085203</commentid>
    <comment_count>3</comment_count>
    <who name="Eduardo">eduardo.cruz</who>
    <bug_when>2021-12-14 05:54:53 +0000</bug_when>
    <thetext>I’m annoyed by this especially because an ENTER keypress is disregarded during the “blink” period. If I type an app name very fast and press ENTER, nothing happens.

I’m interested in fixing this myself. I need to learn how to setup a proper environment to build, run and debug plasmashell. If I manage to do this, I will investigate it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087737</commentid>
    <comment_count>4</comment_count>
    <who name="Eduardo">eduardo.cruz</who>
    <bug_when>2021-12-23 13:35:57 +0000</bug_when>
    <thetext>I found the probable culprit code, it&apos;s in krunner/src/runnermanager.cpp in the function scheduleMatchesChanged(). For every character typed, it emits matchesChanged() with an empty matches list before scheduling a second call to it with the matches actually filled.

I don&apos;t know why it did that, I will study the code deeper so I can fix it without causing any regression. Hopefully I will submit a MR in the next few days, so I&apos;m assigning this bug report to myself.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087739</commentid>
    <comment_count>5</comment_count>
    <who name="Kai Uwe Broulik">kde</who>
    <bug_when>2021-12-23 13:45:51 +0000</bug_when>
    <thetext>I guess, this is &quot;by design&quot;, you start a new query and that resets the list. However, Milou (the backend powering the standalone KRunner) has explicit code for this:

&gt;    // We clear the model ourselves in the reset timer, ignore any empty matchset
&gt;    if (matches.isEmpty() &amp;&amp; m_resetTimer.isActive() &amp;&amp; !m_hasMatches) {
&gt;       return;
&gt;  }

This avoids the flickering/teporary clearing of the list. Perhaps something similar could be implemented in Kickoff. Ideally, of course, Kickoff was ported to used the model from Milou.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2087743</commentid>
    <comment_count>6</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2021-12-23 14:40:09 +0000</bug_when>
    <thetext>Would be good to port it to use Milou indeed.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2088010</commentid>
    <comment_count>7</comment_count>
    <who name="Bug Janitor Service">bug-janitor</who>
    <bug_when>2021-12-24 19:43:11 +0000</bug_when>
    <thetext>A possibly relevant merge request was started @ https://invent.kde.org/frameworks/krunner/-/merge_requests/82</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2096574</commentid>
    <comment_count>8</comment_count>
    <who name="Alexander Lohnau">alexander.lohnau</who>
    <bug_when>2022-01-21 18:29:14 +0000</bug_when>
    <thetext>Git commit a1d553a18515e02d42b2c1602549bedc958ef853 by Alexander Lohnau, on behalf of Eduardo Cruz.
Committed on 21/01/2022 at 18:29.
Pushed by alex into branch &apos;master&apos;.

Fix flickering in Application Launcher for every character typed

This fixes the flickering that happened on the Application Launcher for every character typed.

Before:
![before](/uploads/cfd6dff218256a4de398deb9982e40df/before.gif)
After:
![after](/uploads/34a6aff7cc79dcb51f102c07573353ae/after.gif)

`RunnerManagerPrivate::scheduleMatchesChanged()` method forwards its events only once every 250ms. The issue was that it &quot;wasted&quot; the very first refresh cycle by forwarding the initially empty matches result set. It only forwarded meaningful results after 250ms, that&apos;s why the Application Launcher showed an empty list for 250ms for every character typed.

We are now stalling for the duration of the timeout (250ms) before starting to display results for a new query, so we kind of &quot;ignore&quot; the empty/near-empty result set (unless it actually hits the timeout with no more results coming in the meantime). This avoids refreshing the client with the initially empty (or near-empty) result set, so users won&apos;t see the empty list if more meaningful results come in the next 250ms (and they usually do come!).

I also saw that when the search job was done, the engine still waited for the running timeout until it displayed the last results it found. I changed that as well, so now we intercept the running timer, cancel it, and refresh immediately as soon as the job is done. So if the total query runs in less than 250ms, it won&apos;t even have to wait that: it will refresh only once (as intended), with the full result set, and as fast as possible.

As a result of all this, the application launcher feels much more responsive now, I believe it is a meaningful improvement in user experience.

Also benefits the standalone krunner since it will now respond faster than 250ms for simple quick queries.

M  +6    -0    autotests/CMakeLists.txt
A  +109  -0    autotests/runnermanagertest.cpp     [License: LGPL(v2.1+)]
M  +13   -0    autotests/testremoterunner.cpp
M  +6    -6    src/runnercontext.cpp
M  +30   -8    src/runnermanager.cpp

https://invent.kde.org/frameworks/krunner/commit/a1d553a18515e02d42b2c1602549bedc958ef853</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2096593</commentid>
    <comment_count>9</comment_count>
    <who name="Nate Graham">nate</who>
    <bug_when>2022-01-21 19:07:26 +0000</bug_when>
    <thetext>This is so awesome! What an improvement!</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>