Method: MiniGL::TextField#selected_text

Defined in:
lib/minigl/forms.rb

#selected_textObject

Returns the currently selected text.



686
687
688
689
690
691
# File 'lib/minigl/forms.rb', line 686

def selected_text
  return '' if @anchor2.nil?
  min = @anchor1 < @anchor2 ? @anchor1 : @anchor2
  max = min == @anchor1 ? @anchor2 : @anchor1
  @text[min..max]
end