Skip to content
Myr

Ignore invalid UTF-8 sequences

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 43acf5c · Browse files · 2 files+27 added−4 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+27 added−4 removed

  • tests:+5 added−0 removed
  • other:+22 added−4 removed

2 files+27 added−4 removed

modified:test/test_fzf.rb+5 added
286 unmodified lines
287 assert_equal 6, nfd.length288 assert_equal NFD, nfd289 end290 end291292 def test_split293 assert_equal ["a", "b", "c", "\xFF", "d", "e", "f"],294 FZF::UConv.split("abc\xFFdef")295 end296end297
modified:fzf+22 added-4 removed
153 unmodified lines
154 (arr[1] || 0) * JONGSUNGS +155 (arr[2] || 0)].pack('U*')156 end157158 if String.method_defined?(:each_char)159 def self.split str160 str.each_char.to_a161 end162 else163 def self.split str164 str.split('')165 end166 end167168 def self.nfc str, offsets = []169 ret = ''170 omap = []171 pend = []162 str.split(//).each_with_index do |c, idx|163 cp = c.ord172 split(str).each_with_index do |c, idx|173 cp =174 begin175 c.ord176 rescue Exception177 next178 end179 omap << ret.length180 unless pend.empty?181 if cp >= JUNGSUNG && cp < JUNGSUNG + JUNGSUNGS182 pend << cp - JUNGSUNG
52 unmodified lines
235 def max_items; C.lines - 2; end236 def cursor_y; C.lines - 1; end237 def cprint str, col238 C.attron(col) do224 C.addstr str.gsub("\0", '')239 addstr_safe str240 end if str241 end242 def addstr_safe str243 C.addstr str.gsub("\0", '')244 end245246 def print_input247 C.setpos cursor_y, 0248 C.clrtoeol
88 unmodified lines
337 if highlighted338 cprint token, color(chosen ? :match! : :match, chosen)339 C.attron color(:chosen, true) if chosen340 else323 C.addstr token341 addstr_safe token342 end343 end344 C.attroff color(:chosen, true) if chosen345 end
447 unmodified lines