Repository: spyder-ide/spyder

Issue:
Spyder becomes sluggish if too much content is printed in the console
Hello

I use Spyder IDE 5.3.2.
Sometimes I cannot move the edge bars of panes.
Even if they move the movement is very restricted.
I also observe that close all but this option does not function correctly in the editor pane.

best regards



Discussion:
Hey @mfatih7, thanks for reporting. You said:

> Sometimes I cannot move the edge bars of panes.

I don't understand what you mean by this. Please upload a video or an animated gif to see what that error is about.

> I also observe that close all but this option does not function correctly in the editor pane.

Again, what do you mean by this? In other words, what's exactly the functionality that's not working correctly? And under what circumstances does it occur?

Please try to be more specific. Otherwise we won't be able to address your report.
Hello

The bugs occur somehow randomly and rarely.

The positions of the panes are standard.
I mean they are like the panes on the video below.
https://www.youtube.com/watch?v=E2Dap5SfXkI&t=2s

When a couple of python scripts are opened in the editor pane, and when I try to use "close all but this" option none of them is closed. Even if I try to use the same option again nothing occurs.

And when the panes are placed as in the video above I try to minimize the editor pane and maximize Ipython console by dragging the sidebar (between them) to the left. The bar doesn't come to the left. The mouse cursor changes its shape and turns into the dragging style. However, it is not possible to drag the bar to the left.

Most probably the errors occur when something is running on the console or after a run is completed on the console.














> When a couple of python scripts are opened in the editor pane, and when I try to use "close all but this" option none of them is closed. Even if I try to use the same option again nothing occurs.

I'm sorry but I can't reproduce this bug. I mean, when I select "close all but this", it works as expected for me.

> And when the panes are placed as in the video above I try to minimize the editor pane and maximize Ipython console by dragging the sidebar (between them) to the left. The bar doesn't come to the left. The mouse cursor changes its shape and turns into the dragging style. However, it is not possible to drag the bar to the left.

I can't reproduce this either, sorry.

> The bugs occur somehow randomly and rarely.

Ok, this means that unless you find the specific circumstances that trigger these bugs and then describe them to us in a step-by-step fashion, we won't be able to fix them. In other words, we need to have a clear way to reproduce the problems you're experiencing so that we can check and fix them in our side.
Thank you

If I encounter the problems in a reproducible way I will give feedback.

Great! Thanks a lot for understanding.
Ok, now I have something more valuable.

When a long run is processed with lots of rows printed in the console Pane, it becomes harder to drag the sidebar between the editor pane and the console pane.  I mean dragging speed of the sidebar decreases significantly. Almost it is not possible to move it.

After I press Ctrl+L to clear the console the dragging speed becomes normal.

Preferences->IPython Console->Display->Source Code Buffer set to 50000 lines.
@mfatih7, ok, thanks a lot for coming up with a way to reproduce your problem. Now I understand what happens: the entire Spyder interface becomes sluggish because there's way too much content printed in the console.

Unfortunately, that's a limitation of Qt, the graphical toolkit on top of which Spyder is built, and there's no workaround to avoid it. So the best we can do is to add an upper limit to the max amount of buffer lines in the console, so users don't encounter this bug in the future.

I think 10000 lines should be enough, but let us know if Spyder is still sluggish when that much content is printed to consider a lower limit.

Resolving patch:
diff --git a/spyder/plugins/ipythonconsole/confpage.py b/spyder/plugins/ipythonconsole/confpage.py
--- a/spyder/plugins/ipythonconsole/confpage.py
+++ b/spyder/plugins/ipythonconsole/confpage.py
@@ -15,9 +15,12 @@
                             QTabWidget, QVBoxLayout)
 
 # Local imports
+from spyder.api.translations import get_translation
 from spyder.api.preferences import PluginConfigPage
-from spyder.config.base import _
-from spyder.py3compat import PY2
+
+
+# For translations
+_ = get_translation('spyder')
 
 
 class IPythonConsoleConfigPage(PluginConfigPage):
@@ -69,9 +72,13 @@ def setup_page(self):
 
         # Source Code Group
         source_code_group = QGroupBox(_("Source code"))
+
+        # Note: The maximum here is set to a relatively small value because
+        # larger ones make Spyder sluggish.
+        # Fixes spyder-ide/spyder#19091
         buffer_spin = self.create_spinbox(
                 _("Buffer:  "), _(" lines"),
-                'buffer_size', min_=-1, max_=1000000, step=100,
+                'buffer_size', min_=-1, max_=5000, step=100,
                 tip=_("Set the maximum number of lines of text shown in the\n"
                       "console before truncation. Specifying -1 disables it\n"
                       "(not recommended!)"))


Test patch: