Repository: spyder-ide/spyder

Issue:
The scrollflag is missing in Spyder 4 on MacOS 10.15
<!--- **PLEASE READ:** When submitting here, please ensure you've completed the following checklist and checked the boxes to confirm. Issue reports without it may be closed. Thanks! --->

### Issue Report Checklist

* [x] Searched the [issues page](https://github.com/spyder-ide/spyder/issues?q=is%3Aissue) for similar reports
* [x] Read the relevant sections of the [Spyder Troubleshooting Guide](https://github.com/spyder-ide/spyder/wiki/Troubleshooting-Guide-and-FAQ) and followed its advice
* [x] Reproduced the issue after updating with ``conda update spyder`` (or ``pip``, if not using Anaconda)
* [ ] Could not reproduce inside ``jupyter qtconsole`` (if console-related)
* [x] Tried basic troubleshooting (if a bug/error)
    * [x] Restarted Spyder
    * [x] Reset preferences with ``spyder --reset``
    * [x] Reinstalled the latest version of [Anaconda](https://www.anaconda.com/download/)
    * [x] Tried the other applicable steps from the Troubleshooting Guide
* [x] Completed the **Problem Description**, **Steps to Reproduce** and **Version** sections below


## Problem Description
The scroll bar on the right hand side that shows overview of issues, highlighted items, etc... is missing in Spyder 4.1.2 and 4.x.x releases on MacOS 10.15.4

### What steps reproduce the problem?

1. I have tried to use "spyder --reset" no luck 
2. I have downgraded to 3.3.6 and it works

![image](https://user-images.githubusercontent.com/46607096/81224565-ea3de980-8fb5-11ea-8d82-d3353366d577.png)

3. I have upgraded to 4.0.0, missing.

![image](https://user-images.githubusercontent.com/46607096/81224763-3852ed00-8fb6-11ea-873e-a65587fbc2de.png)

### What is the expected output? What do you see instead?
I am not seeing the scroll bar that I am used to on 3.x versions. Talked to @bcolsen and he suggested that I should open a bug at github.

### Paste Traceback/Error Below (if applicable)
<!--- Copy from error dialog or View > Panes > Internal Console --->

```python-traceback

PASTE TRACEBACK HERE

```

## Versions
<!--- You can get this information from Help > About Spyder...
or (if Spyder won't launch) the "conda list" command
from the Anaconda Prompt/Terminal/command line. --->

* Spyder version: 
spyder                    4.1.2                    py37_0  
spyder-kernels            1.9.0                    py37_0  
* Python version: 
python                    3.7.3                h359304d_0  
python-chromedriver-binary 83.0.4103.14.0   py37hc8dfbb8_0    conda-forge
python-dateutil           2.8.1                      py_0  
python-jsonrpc-server     0.3.4                      py_0  
python-language-server    0.31.10                  py37_0  
python-libarchive-c       2.9                        py_0  
python.app                2                        py37_9  
python_abi                3.7                     1_cp37m    conda-forge
* Qt version: 
qt                        5.9.7                h468cd18_1  
qtawesome                 0.7.0                      py_0  
qtconsole                 4.7.3                      py_0  
qtpy                      1.9.0                      py_0  
qt                        5.9.7                h468cd18_1  
qtawesome                 0.7.0                      py_0  
qtconsole                 4.7.3                      py_0  
qtpy                      1.9.0                      py_0  
* PyQt version: 
pyqt                      5.9.2            py37h655552a_2  
* Operating System name/version: 
MacOS 10.15.4

### Dependencies
<!--- Please go to the menu entry Help > Dependencies,
press the Copy to clipboard button and paste below --->

```

# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.4.1 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.15.2                   :  0.15.2 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
parso =0.5.2                   :  0.5.2 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=0.25                  :  2.5.0 (OK)
pyls >=0.31.9;<0.32.0          :  0.31.10 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.3 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.0.3 (OK)
spyder_kernels >=1.9.0;<1.10.0 :  1.9.0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  None (OK)
matplotlib >=2.0.0             :  None (OK)
numpy >=1.7                    :  None (OK)
pandas >=0.13.1                :  None (OK)
scipy >=0.17.0                 :  None (OK)
sympy >=0.7.3                  :  None (OK)
```



Discussion:
Hi @aosavas, thanks for your report.

Do you mean the scrollbar that shows lint information or the normal scrollbar to move up and down?

Cheers
It's the scroll flags area. It was a bit more obvious in the gitter chat images
Yeah, the secondary scroll bar that shows the errors or highlighted items
on the right...

The regular scroll bar to go up and down is there.

On Wed, May 6, 2020 at 7:14 PM bcolsen <notifications@github.com> wrote:

> It's the scroll flags area. It was a bit more obvious in the gitter chat
> images
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/spyder-ide/spyder/issues/12637#issuecomment-624938423>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ALDSV6DSXT3LGNQZVI3GZCTRQHVM3ANCNFSM4M2X7EKQ>
> .
>

@goanpeca hi Gonzalo, I was wondering if you have any update on this issue? 
@impact27, have you observed this in the latest macOS?
I have it with masOS 10.15.4
![SCROLL](https://user-images.githubusercontent.com/6740194/82036145-d0309500-96a0-11ea-9c35-b12add039bdf.png)

The interesting is, it works on 3.6 with the same MacOS.

On Fri, May 15, 2020 at 5:40 AM Quentin Peter <notifications@github.com>
wrote:

> I have it with masOS 10.15.4
> [image: SCROLL]
> <https://user-images.githubusercontent.com/6740194/82036145-d0309500-96a0-11ea-9c35-b12add039bdf.png>
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/spyder-ide/spyder/issues/12637#issuecomment-629139132>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ALDSV6DFMNGHP66BKKJFKIDRRUE2XANCNFSM4M2X7EKQ>
> .
>

Hi @aosavas

I have not been managed to reproduce this, but I use 36 as my default dev env. Will try with 3.7 and 3.8.

Thanks for the information.
It seems like something is wrong in @impact screenshot. The default scrollbar and scrollflag bar are not supposed to overlap like that, or are they?
>It seems like something is wrong in @impact screenshot. The default scrollbar and scrollflag bar are not supposed to overlap like that, or are they?

Good point @jnsebgosselin , they should not overlap!
> > It seems like something is wrong in @impact screenshot. The default scrollbar and scrollflag bar are not supposed to overlap like that, or are they?
> 
> Good point @jnsebgosselin , they should not overlap!

Are you sure? in mac, the scroll bar is supposed to be small and disappear when not in use. 

https://developer.apple.com/design/human-interface-guidelines/macos/windows-and-views/scroll-views/

> By default, scroll bars are transient and only appear during user interaction.




Yeah pretty sure, if you want we can do a quick zoom and show you in first
hand...

Just upgraded to 4.1.3 and the issue still there... You can see that I am
highlighting "browser" in 4.1.3, and nothing on the right scroll bar. If I
scroll up and down, nothing changes on the scroll bar. It is always there.
[image: image.png]

Same file, same action in 3.3.6 shows as below. You can see all the
highlighted items. If I scroll up and down, I see the secondary scroll as
well with the highlights... I guess what is showing below moves to the left
and the real page scroll shows up as well in 3.3.6.

So it seems like the main scroll bar is hidden in 3.3.6 but the scroll with
the function/feature I am missing is there by default and the main scroll
appears only when I scroll up and down on the right-hand side of the
default scroll (the feature that's not functioning in 4.1.3 for me at
least).
[image: image.png]

On Fri, May 15, 2020 at 12:39 PM Quentin Peter <notifications@github.com>
wrote:

> It seems like something is wrong in @impact <https://github.com/impact>
> screenshot. The default scrollbar and scrollflag bar are not supposed to
> overlap like that, or are they?
>
> Good point @jnsebgosselin <https://github.com/jnsebgosselin> , they
> should not overlap!
>
> Are you sure? in mac, the scroll bar is supposed to be small and disappear
> when not in use.
>
>
> https://developer.apple.com/design/human-interface-guidelines/macos/windows-and-views/scroll-views/
>
> By default, scroll bars are transient and only appear during user
> interaction.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/spyder-ide/spyder/issues/12637#issuecomment-629360992>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ALDSV6DLDIXG3DXKXB2KVR3RRVV4HANCNFSM4M2X7EKQ>
> .
>

@aosavas answering by email will not upload images, you will need to come to the issue tracker :-) 
Ok, so the issue is that they are overlapping. 

<img width="773" alt="Screen Shot 2020-05-15 at 12 39 21" src="https://user-images.githubusercontent.com/3627835/82079824-1e499680-96a9-11ea-9f16-acc36b35bcf2.png">

As soon as the normal scrollbar appears it completely blocks the other scroll flag.
Would you like me to post the pictures at github?


On Fri, May 15, 2020 at 1:38 PM Gonzalo Peña-Castellanos <
notifications@github.com> wrote:

> @aosavas <https://github.com/aosavas> answering by email will not upload
> images, you will need to come to the issue tracker :-)
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/spyder-ide/spyder/issues/12637#issuecomment-629389681>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ALDSV6ESSO4N54EW6V76MR3RRV425ANCNFSM4M2X7EKQ>
> .
>

Not exactly... as in my view, the normal scroll bar is the default one and
always blocks it. Hence I can't see the other one at any given time...

On Fri, May 15, 2020 at 1:40 PM Gonzalo Peña-Castellanos <
notifications@github.com> wrote:

> Ok, so the issue is that they are overlapping.
>
> [image: Screen Shot 2020-05-15 at 12 39 21]
> <https://user-images.githubusercontent.com/3627835/82079824-1e499680-96a9-11ea-9f16-acc36b35bcf2.png>
>
> As soon as the normal scrollbar appears it completely blocks the other
> scroll flag.
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/spyder-ide/spyder/issues/12637#issuecomment-629390304>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ALDSV6EFISCA3J7RSFKODBLRRV47ZANCNFSM4M2X7EKQ>
> .
>

On my mac if mi file is longer than the screen view, the scrollbar will appear and block it, it seems
>Would you like me to post the pictures at github?

Please do :-) !
4.1.3 image
![image](https://user-images.githubusercontent.com/46607096/82086468-8ce41f80-96bc-11ea-8920-1642bf776ee3.png)

3.6.6 image
![image](https://user-images.githubusercontent.com/46607096/82086496-953c5a80-96bc-11ea-8858-0b41d7cd8d8e.png)

@aosavas could you open a new file with just this content?
```python
d = {}
d.
```

You should be able to see the scrollbar (since the nomrmal one should be hidden?)
@goanpeca Yep, that's it...

So how to make the regular scroll bar, optional like in 3.6.6?

![image](https://user-images.githubusercontent.com/46607096/82088200-552aa700-96bf-11ea-80d9-45fca98fdaa7.png)

I can go ahead and try to fix this ;-) will let you know
Thank you !!! :)

On Fri, May 15, 2020 at 4:38 PM Gonzalo Peña-Castellanos <
notifications@github.com> wrote:

> I can go ahead and try to fix this ;-) will let you know
>
> —
> You are receiving this because you were mentioned.
> Reply to this email directly, view it on GitHub
> <https://github.com/spyder-ide/spyder/issues/12637#issuecomment-629472005>,
> or unsubscribe
> <https://github.com/notifications/unsubscribe-auth/ALDSV6E5QKC7R74M5W6FINTRRWR3TANCNFSM4M2X7EKQ>
> .
>

@goanpeca Hi, I was just wondering what would be the time frame for the fix. I really like 4.* but this is preventing me to stay in 3.3.6. Thanks for the great support!!!
Spyder 4.1.4 will be available in mid June, so that is when it will become available for install. If you want to run from source as soon as it is merged you could install from the 4.x branch
@goanpeca Perfect!!! thanks...
Was #12852 supposed to fix this issue? Because I still see it on MacOS 10.14.6 and bootstrapped from commit 06edb40f0 (latest 4.x). Note that the arrow selector of the class and method selector is also hidden behind the scroll bar in the upper right corner of the Editor.

<details><summary>Dependencies</summary>
<p>

# Mandatory:
applaunchservices >=0.1.7      :  0.2.1 (OK)
atomicwrites >=1.2.0           :  1.4.0 (OK)
chardet >=2.0.0                :  3.0.4 (OK)
cloudpickle >=0.5.0            :  1.4.1 (OK)
diff_match_patch >=20181111    :  20181111 (OK)
intervaltree                   :  None (OK)
IPython >=4.0                  :  7.13.0 (OK)
jedi =0.17.0                   :  0.17.0 (OK)
nbconvert >=4.0                :  5.6.1 (OK)
numpydoc >=0.6.0               :  0.9.2 (OK)
parso =0.7.0                   :  0.7.0 (OK)
pexpect >=4.4.0                :  4.8.0 (OK)
pickleshare >=0.4              :  0.7.5 (OK)
psutil >=5.3                   :  5.7.0 (OK)
pygments >=2.0                 :  2.6.1 (OK)
pylint >=1.0                   :  2.5.2 (OK)
pyls >=0.33.0;<0.34.0          :  v4.1.3+175.g06edb40f0 (OK)
qdarkstyle >=2.8               :  2.8.1 (OK)
qtawesome >=0.5.7              :  0.7.0 (OK)
qtconsole >=4.6.0              :  4.7.4 (OK)
qtpy >=1.5.0                   :  1.9.0 (OK)
rtree >=0.8.3                  :  0.9.4 (OK)
sphinx >=0.6.6                 :  3.0.3 (OK)
spyder_kernels >=1.9.1;<1.10.0 :  1.10.0.dev0 (OK)
watchdog                       :  None (OK)
zmq >=17                       :  18.1.1 (OK)

# Optional:
cython >=0.21                  :  0.29.17 (OK)
matplotlib >=2.0.0             :  3.1.3 (OK)
numpy >=1.7                    :  1.18.1 (OK)
pandas >=0.13.1                :  1.0.3 (OK)
scipy >=0.17.0                 :  1.4.1 (OK)
sympy >=0.7.3                  :  1.5.1 (OK)
</p>
</details>

<img width="1792" alt="Screen Shot 2020-06-06 at 8 34 03 AM" src="https://user-images.githubusercontent.com/9618975/83948355-9c451d00-a7d1-11ea-8ce0-909267da819e.png">

@goanpeca Hi, do you know when in June it will be available? Also based on the previous comment not sure if it is already fixed or not.
Not yet fixed. But will work on that for 4.1.4

>do you know when in June it will be available? 

End of June maybe 🤷 ?

Resolving patch:
diff --git a/spyder/plugins/editor/panels/scrollflag.py b/spyder/plugins/editor/panels/scrollflag.py
--- a/spyder/plugins/editor/panels/scrollflag.py
+++ b/spyder/plugins/editor/panels/scrollflag.py
@@ -9,6 +9,7 @@
 
 # Standard library imports
 from __future__ import division
+import sys
 from math import ceil
 
 # Third party imports
@@ -18,6 +19,7 @@
 
 # Local imports
 from spyder.api.panel import Panel
+from spyder.config.gui import is_dark_interface
 from spyder.plugins.completion.languageserver import DiagnosticSeverity
 
 
@@ -26,7 +28,7 @@
 
 class ScrollFlagArea(Panel):
     """Source code editor's scroll flag area"""
-    WIDTH = 12
+    WIDTH = 24 if sys.platform == 'darwin' and is_dark_interface() else 12
     FLAGS_DX = 4
     FLAGS_DY = 2
 
@@ -167,7 +169,6 @@ def paintEvent(self, event):
         # Note that we calculate the pixel metrics required to draw the flags
         # here instead of using the convenience methods of the ScrollFlagArea
         # for performance reason.
-
         rect_x = ceil(self.FLAGS_DX / 2)
         rect_w = self.WIDTH - self.FLAGS_DX
         rect_h = self.FLAGS_DY
@@ -177,45 +178,25 @@ def paintEvent(self, event):
         painter.fillRect(event.rect(), self.editor.sideareas_color)
 
         editor = self.editor
-        # Check if the slider is visible
-        paint_local = not bool(self.slider)
 
         # Define compute_flag_ypos to position the flags:
-        if not paint_local:
-            # Paint flags for the entire document
-            last_line = editor.document().lastBlock().firstLineNumber()
-            # The 0.5 offset is used to align the flags with the center of
-            # their corresponding text edit block before scaling.
-            first_y_pos = self.value_to_position(
-                0.5, scale_factor, offset) - self.FLAGS_DY / 2
-            last_y_pos = self.value_to_position(
-                last_line + 0.5, scale_factor, offset) - self.FLAGS_DY / 2
-
-            def compute_flag_ypos(block):
-                line_number = block.firstLineNumber()
+        # Paint flags for the entire document
+        last_line = editor.document().lastBlock().firstLineNumber()
+        # The 0.5 offset is used to align the flags with the center of
+        # their corresponding text edit block before scaling.
+        first_y_pos = self.value_to_position(
+            0.5, scale_factor, offset) - self.FLAGS_DY / 2
+        last_y_pos = self.value_to_position(
+            last_line + 0.5, scale_factor, offset) - self.FLAGS_DY / 2
+
+        def compute_flag_ypos(block):
+            line_number = block.firstLineNumber()
+            if last_line != 0:
                 frac = line_number / last_line
-                pos = first_y_pos + frac * (last_y_pos - first_y_pos)
-                return ceil(pos)
-
-        else:
-            # Only paint flags for visible lines
-            visible_lines = [val[1] for val in editor.visible_blocks]
-            if not visible_lines:
-                # Nothing to do
-                return
-            min_line = min(visible_lines)
-            max_line = max(visible_lines)
-
-            def compute_flag_ypos(block):
-                # When the vertical scrollbar is not visible, the flags are
-                # vertically aligned with the center of their corresponding
-                # text block with no scaling.
-                top = editor.blockBoundingGeometry(block).translated(
-                    editor.contentOffset()).top()
-                bottom = top + editor.blockBoundingRect(block).height()
-                middle = (top + bottom)/2
-
-                return ceil(middle-self.FLAGS_DY/2)
+            else:
+                frac = line_number
+            pos = first_y_pos + frac * (last_y_pos - first_y_pos)
+            return ceil(pos)
 
         # All the lists of block numbers for flags
         dict_flag_lists = {
@@ -228,10 +209,6 @@ def compute_flag_ypos(block):
             painter.setBrush(self._facecolors[flag_type])
             painter.setPen(self._edgecolors[flag_type])
             for block_number in dict_flag_lists[flag_type]:
-                # Don't paint local flags outside of the window
-                if paint_local and not (
-                        min_line <= block_number + 1 <= max_line):
-                    continue
                 # Find the block
                 block = editor.document().findBlockByNumber(block_number)
                 if not block.isValid():
diff --git a/spyder/plugins/editor/widgets/codeeditor.py b/spyder/plugins/editor/widgets/codeeditor.py
--- a/spyder/plugins/editor/widgets/codeeditor.py
+++ b/spyder/plugins/editor/widgets/codeeditor.py
@@ -467,7 +467,6 @@ def __init__(self, parent=None):
         # Scrollbar flag area
         self.scrollflagarea = self.panels.register(ScrollFlagArea(self),
                                                    Panel.Position.RIGHT)
-        self.scrollflagarea.hide()
         self.panels.refresh()
 
         self.document_id = id(self)


Test patch:
diff --git a/spyder/plugins/editor/panels/tests/test_scrollflag.py b/spyder/plugins/editor/panels/tests/test_scrollflag.py
--- a/spyder/plugins/editor/panels/tests/test_scrollflag.py
+++ b/spyder/plugins/editor/panels/tests/test_scrollflag.py
@@ -6,6 +6,7 @@
 
 # Standard library imports
 import os
+import sys
 
 # Third party imports
 import pytest
@@ -85,7 +86,8 @@ def test_enabled(editor_bot):
     assert not sfa.isVisible()
 
 
-@pytest.mark.skipif(not os.name == 'nt', reason="It fails on Travis")
+@pytest.mark.skipif(sys.platform.startswith('linux'),
+                    reason="Fails in Linux")
 def test_flag_painting(editor_bot, qtbot):
     """"Test that there is no error when painting all flag types on the
     scrollbar area when the editor vertical scrollbar is visible and not
@@ -123,7 +125,6 @@ def test_flag_painting(editor_bot, qtbot):
 
     # Set a long text in the editor and assert that the slider is visible.
     editor.set_text(long_code)
-    qtbot.waitUntil(lambda: sfa.slider)
 
     # Trigger the painting of all flag types.
     editor.debugger.toogle_breakpoint(line_number=2)