struct WordDragStep

Overview

Advances the cursor to the beginning or to the end of the word the speculative next character lands in, depending on whether the selection's cursor is before or after its anchor, respectively.

This cursor step needs a selection. It is passed during initialization.

Included Modules

Defined in:

aspis/step.cr

Constructors

Instance Method Summary

Instance methods inherited from module CursorStep

advance(document : Document, prev : Int, nxt : Int) : Int advance

Constructor Detail

def self.new(selection : Selection) #

[View source]

Instance Method Detail

def advance(document : Document, prev : Int, nxt : Int) : Int #
Description copied from module CursorStep

Returns the next cursor index.

prev and nxt are indices belonging to document.

prev index is the previous index (where motion started).

nxt index is the speculative, character-based next index. It might be out of document's bounds.

The latter is usually the index you'd need to change/snap, as a CursorStep implementor. The former is given to you so you can e.g. compute delta or determine the direction of the movement.

The returned index must be in bounds of the document.


[View source]