Forum Archive

Editorial exits on editor.set_selection() with arguments out of range

Rob

This may well be a known or fixed issue – Editorial crashes/exits on out-of-range set_selection()

To reproduce:
- create an empty file
- run a python script workflow action like:

#coding: utf-8
import editor

editor.set_selection(4,4) # out of range - buffer empty
omz

Thanks, I'll look into this.

MartinPacker

Funnily enough I use editor.set_selection(1,9999999) to select the whole document - and then do a replace. This is in one of my scripts. You'd think THAT would get an "out of range error" but it doesn't. I WOULD like a "select all" function, of course.

omz

The bug only occurs if the start of the range is out of bounds, the length is capped automatically.

MartinPacker

@omz Thanks. I still feel like I'm exploiting an undocumented loophole. Please consider documenting how to select the whole document.