Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
fzf
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to JiHu GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KMSCAKKSCFKA AKFACAMADCAS
fzf
Commits
6037e1e2
Commit
6037e1e2
authored
11 years ago
by
Junegunn Choi
Browse files
Options
Downloads
Patches
Plain Diff
Ignore invalid UTF-8 sequences
parent
43acf5c8
No related branches found
Branches containing commit
Tags
0.16.0
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
fzf
+22
-4
22 additions, 4 deletions
fzf
test/test_fzf.rb
+5
-0
5 additions, 0 deletions
test/test_fzf.rb
with
27 additions
and
4 deletions
fzf
+
22
−
4
View file @
6037e1e2
...
...
@@ -155,12 +155,27 @@ class FZF
(
arr
[
2
]
||
0
)].
pack
(
'U*'
)
end
if
String
.
method_defined?
(
:each_char
)
def
self
.
split
str
str
.
each_char
.
to_a
end
else
def
self
.
split
str
str
.
split
(
''
)
end
end
def
self
.
nfc
str
,
offsets
=
[]
ret
=
''
omap
=
[]
pend
=
[]
str
.
split
(
//
).
each_with_index
do
|
c
,
idx
|
cp
=
c
.
ord
split
(
str
).
each_with_index
do
|
c
,
idx
|
cp
=
begin
c
.
ord
rescue
Exception
next
end
omap
<<
ret
.
length
unless
pend
.
empty?
if
cp
>=
JUNGSUNG
&&
cp
<
JUNGSUNG
+
JUNGSUNGS
...
...
@@ -221,9 +236,12 @@ class FZF
def
cursor_y
;
C
.
lines
-
1
;
end
def
cprint
str
,
col
C
.
attron
(
col
)
do
C
.
addstr
str
.
gsub
(
"
\0
"
,
''
)
addstr
_safe
str
end
if
str
end
def
addstr_safe
str
C
.
addstr
str
.
gsub
(
"
\0
"
,
''
)
end
def
print_input
C
.
setpos
cursor_y
,
0
...
...
@@ -320,7 +338,7 @@ class FZF
cprint
token
,
color
(
chosen
?
:match!
:
:match
,
chosen
)
C
.
attron
color
(
:chosen
,
true
)
if
chosen
else
C
.
addstr
token
addstr
_safe
token
end
end
C
.
attroff
color
(
:chosen
,
true
)
if
chosen
...
...
This diff is collapsed.
Click to expand it.
test/test_fzf.rb
+
5
−
0
View file @
6037e1e2
...
...
@@ -288,5 +288,10 @@ class TestFZF < MiniTest::Unit::TestCase
assert_equal
NFD
,
nfd
end
end
def
test_split
assert_equal
[
"a"
,
"b"
,
"c"
,
"
\xFF
"
,
"d"
,
"e"
,
"f"
],
FZF
::
UConv
.
split
(
"abc
\xFF
def"
)
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment