D17459: SearchBar: Add Cancel button to stop long running tasks

loh tar noreply at phabricator.kde.org
Mon Dec 10 14:43:19 GMT 2018

loh.tar added a comment.

  > That always leads to evil things, like e.g. what happens if you press the X button of the view/window during that.
  I assume you have read that article a longer time ago and have these paragraph regarding `Manual event processing` in mind.
  > This approach has significant drawbacks. For example...
  There are three listed
  1. you can't distribute computing power among different tasks
  2. makes the application react with delays to events
  3. the code is difficult to read and analyze
  I can't see any hint in the whole article that would avoid to choose some action. It's all about keeping the GUI snappy. And that is always done by enter the event loop.
  I think the points 1+2 are not important here. Point 3 do I not understand, at least the "read" part, but I think we have here not much more to analyze than if the Cancel-button works or not.
  The S&SR process is not broken in some unclear state. There will only probably remaining matches not replaced.
  You mean what happens e.g. when the user continue to edit while the S&R is running. I have just tried it with our good known fat file. It's funny. You can scroll, edit and almost watch how it progress.
  There may the need to add some blocking for that. Is it possible to flag the document as "read only" without to break the started S&R?
  There may the need to block other things too, like your mentioned view/window close.
  One hint there was that timers are not fire without the event loop. I have tried this, and yes, no effect to check if a single shot timer isActive() or not. So I updated/fix the modulo check slightly because I noticed a lag in some cases. But may still not the best solution.
  ATM is my conclusion: Your suggested re-design may fix probably responsive lags but not the problem to block ugly actions. Because this whole patch is only in rare cases really needed I would like avoid the effort to re-design the logic.

  R39 KTextEditor


To: loh.tar, #ktexteditor, #vdg, cullmann
Cc: cullmann, abetts, kwrite-devel, kde-frameworks-devel, #ktexteditor, hase, michaelh, ngraham, bruns, demsking, sars, dhaumann
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kwrite-devel/attachments/20181210/47696d25/attachment.html>

More information about the KWrite-Devel mailing list