Add (undocumented, not yet final) extra argument to setSelection and extendSelection

Issue #1743