Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MultilineStrings"
uuid = "1e8d2bf6-9821-4900-9a2f-4d87552df2bd"
authors = ["Invenia Technical Computing Corporation"]
version = "0.1.1"
version = "1.0.0"

[compat]
Aqua = "0.8.11"
Expand Down
3 changes: 2 additions & 1 deletion src/indent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ function indent(str::AbstractString, n::Int)

line_start = firstindex(str)
blank_line = true
for (i, ch) in enumerate(str)
for i in eachindex(str)
ch = str[i]
if ch == '\n'
!blank_line && print(buf, indent_str)
print(buf, SubString(str, line_start, i))
Expand Down
2 changes: 2 additions & 0 deletions test/indent.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@

@test indent("a", 4) == " a"
@test indent("a\n\nb", 4) == " a\n\n b"

@test indent("三\nb", 4) == " 三\n b"
end
Loading