lib/textbringer/commands/fill.rb in textbringer-0.3.1 vs lib/textbringer/commands/fill.rb in textbringer-0.3.2
- old
+ new
@@ -42,20 +42,20 @@
fill_column = CONFIG[:fill_column]
prev_c = nil
while c = input.getc
if c == "\n"
if column < fill_column && !input.eof?
- if /(?=[\u{0000}-\u{00FF}])[[:graph:]]/ =~ prev_c
+ if /(?=[\u{0000}-\u{00FF}])[[:graph:]]/.match?(prev_c)
column = insert_space_between_words(input, output, column)
end
next
end
column = insert_newline(output)
else
w = Buffer.display_width(c)
if column + w > fill_column || column >= fill_column
- if /\w/ =~ prev_c && /\w/ =~ c
+ if /\w/.match?(prev_c) && /\w/.match?(c)
column = insert_newline_before_word(output, column)
else
column = insert_newline(output)
end
end
@@ -67,11 +67,11 @@
end
def insert_space_between_words(input, output, column)
c = input.getc
input.ungetc(c)
- if /(?=[\u{0000}-\u{00FF}])[[:graph:]]/ =~ c
+ if /(?=[\u{0000}-\u{00FF}])[[:graph:]]/.match?(c)
output << " "
column + 1
else
column
end
@@ -91,10 +91,10 @@
output << "\n"
0
end
def insert_char(output, column, c, w)
- if column == 0 && /[ \t]/ =~ c
+ if column == 0 && /[ \t]/.match?(c)
column
else
output << c
column + w
end