Add optional 'options' parameter to the setSelection and setSelections method in CodeMirror.

This commit is contained in:
Peter Bartha
2017-11-21 19:56:38 +01:00
parent 10e05d7aa2
commit 4bf9699f26
+7 -4
View File
@@ -535,11 +535,14 @@ declare namespace CodeMirror {
/** Set the cursor position.You can either pass a single { line , ch } object , or the line and the character as two separate parameters. */
setCursor(pos: CodeMirror.Position): void;
/** Set the selection range.anchor and head should be { line , ch } objects.head defaults to anchor when not given. */
setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position): void;
/** Set a single selection range. anchor and head should be {line, ch} objects. head defaults to anchor when not given. */
setSelection(anchor: CodeMirror.Position, head: CodeMirror.Position, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void;
/** Set and normalize selection ranges and range should be { anchor, head } objects. primary determines which selection is the primary one. */
setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number): void;
/** Sets a new set of selections. There must be at least one selection in the given array. When primary is a
number, it determines which selection is the primary one. When it is not given, the primary index is taken from
the previous selection, or set to the last range if the previous selection had less ranges than the new one.
Supports the same options as setSelection. */
setSelections(ranges: Array<{ anchor: CodeMirror.Position, head: CodeMirror.Position }>, primary?: number, options?: { bias: number, clearRedo: boolean, origin: string, scroll: boolean }): void;
/** Similar to setSelection , but will, if shift is held or the extending flag is set,
move the head of the selection while leaving the anchor at its current place.