class BackspaceController < ApplicationController
EndPart= -15..-1
  def reformat_choices
#		@choices=get_choices.collect {|s| s[EndPart]}
	end
	def get_title
		translate('delete how much?')
	end
	def get_separator
		'`'
	end
  def get_choices
		t=get_text
		bsprx=[/.$/, /..$/, #last char(s)
					/\w+\W*$/, #last word
					/[.?!;][\w ,]+$/, #last sentence
					/.*/] #all
		c=[] #choices
		bsprx.each do |r|
			if t=~r
				c<< $~.pre_match+ ''+$~.to_s+''
			end
		end
		c.uniq
	end
	def extras
		@text=session[:text]
	end
	def selected(str)
# 		logger.info "bsp selected #{str}"
		if str.match(//)
			session[:text]=$~.pre_match
		end
		session[:choices]=nil
	end
end