Method: MiniGL::TextField#selected_text

Defined in:
lib/minigl/forms.rb

#selected_textObject

Returns the currently selected text.



914
915
916
917
918
919
# File 'lib/minigl/forms.rb', line 914

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