Skip to content

class PositionSelection public ​

Represents a selectable area using offsets. Designed for text/char selection. Used from with Util::Selection Depends on Util::GeometrySelection and also Hokusai::Util::Wrapped

#cursor_index=(index) public ​

get/set the cursor offset

Arguments ​

  • index - an integer representing the current offset

Returns ​

Returns the cursor ofset

#positions=(range) public ​

get/set the selected positions

Arguments ​

  • range - a range denoting the start..end selection

Returns ​

Returns the positions

#move(to, selecting) public ​

Moves cursor to (index)

Arguments ​

  • to - the offset to move the cursor to
  • selecting - a boolean to denote that the move should adjust the selectable region

Returns ​

Returns nothing

#frozen? public ​

Is this selection frozen?

Returns ​

Returns boolean

#freeze! public ​

Freeze the selection to prevent modifications

#concat(arr) public ​

merges the geometry selection into the existing positions

Arguments ​

  • arr - the tokens: Array(Hokusai::Util::Wrapped) that are currently selected on the screen. Note: if the selection is out of the viewport, this will be missing tokens.

Returns ​

Returns nothing

#selected(offset) public ​

Is this offset selected?

Arguments ​

  • offset - An index (Integer) to test

Returns ​

Returns boolean

#clear public ​

Reset this selection

Returns ​

Returns nothing

#cursor_index=(index) public ​

get/set the cursor offset

Arguments ​

  • index - an integer representing the current offset

Returns ​

Returns the cursor ofset

#positions=(range) public ​

get/set the selected positions

Arguments ​

  • range - a range denoting the start..end selection

Returns ​

Returns the positions

#move(to, selecting) public ​

Moves cursor to (index)

Arguments ​

  • to - the offset to move the cursor to
  • selecting - a boolean to denote that the move should adjust the selectable region

Returns ​

Returns nothing

#frozen? public ​

Is this selection frozen?

Returns ​

Returns boolean

#freeze! public ​

Freeze the selection to prevent modifications

#concat(arr) public ​

merges the geometry selection into the existing positions

Arguments ​

  • arr - the tokens: Array(Hokusai::Util::Wrapped) that are currently selected on the screen. Note: if the selection is out of the viewport, this will be missing tokens.

Returns ​

Returns nothing

#selected(offset) public ​

Is this offset selected?

Arguments ​

  • offset - An index (Integer) to test

Returns ​

Returns boolean

#clear public ​

Reset this selection

Returns ​

Returns nothing