microbit-foundation / python-editor-v3

Micro:bit Educational Foundation Python Editor V3
https://python.microbit.org
MIT License
57 stars 36 forks source link

Code structure highlight stops prematurely in narrow window #995

Closed kmcnaught closed 2 years ago

kmcnaught commented 2 years ago

Bug Description

If the browser window width is small enough (or zoomed in) and code lines are long enough to require horizontal scrolling, then sometimes the code structure highlight stops before the end of the line.

image

video example showing highlight state: https://www.loom.com/share/0227af771b3e446db85189a665068187

How To Reproduce

I can't repro this just by pasting in an example that previously caused the issue, it seems to depend on some previous state. This code has reproduced the bug for me if I type it out line by line (starting with the sample code and adding to the bottom of the editor) with browser zoom set at 175% in Chrome. I also tried it with a slightly different window size/zoom and it didn't repro that time - I have not been able to pin down the exact requirements.

# Imports go at the top
from microbit import *

# Code in a 'while True:' loop repeats forever
while True:
    display.show(Image.HEART)
    sleep(1000)
    display.scroll('Hello')
    if False:
        print("no")
    if True:
        if True:
            sleep(100)
            print("hello my name is blasduioajdioas djiosa djisoa dj ioasd jio asd")
microbit-matt-hillsdon commented 2 years ago

This could be https://github.com/microbit-foundation/python-editor-v3/issues/753 which is fixed in CodeMirror, though we've decided it's too late/risky to upgrade for our initial release.