omz / Pythonista-Issues

Issue tracker for Pythonista (iOS)
168 stars 14 forks source link

editor.set_selection behaves weirdly #395

Open zrzka opened 6 years ago

zrzka commented 6 years ago

Environment

Description

Try to run following script and check commented instructions:

#!python3

import editor

# PLACE CURSOR ON THIS LINE
#  - run the script
#  - hit the down arrow key (HW keyboard)
#  - oops and you're on line 14

editor.set_selection(15)

Steps to reproduce:

It's like it moves the cursor, but some internal variable holding line number wasn't updated? Thread issue? Tried to wrap it with on_main_thread, didn't help.

What's funny is a fact that if I try to hit left / arrow key, it behaves correctly. Only up / down arrow keys are causing this.

This issue is reproducible in ~70% of cases.

The behavior can be observed in this video, where I'm hitting Cmd R and then just Down arrow key.

Found this when I was implementing page up / down in Black Mamba.

zrzka commented 6 years ago

Still happens.