3 class TextMode < ScrollMode
7 @text = text.normalize_whitespace
9 buffer.mark_dirty if buffer
23 @lines = [0] if @text.empty?
25 @lines << @text.length
37 return nil unless i < @lines.length
38 @text[@lines[i] ... (i + 1 < @lines.length ? @lines[i + 1] - 1 : @text.length)]
39 # (@lines[i] ... (i + 1 < @lines.length ? @lines[i + 1] - 1 : @text.length)).inspect
45 pos = @text.find_all_positions("\n")
46 pos.push @text.length unless pos.last == @text.length - 1
47 @lines = [0] + pos.map { |x| x + 1 }