Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflect moving of textwidth back to Base #644

Merged
merged 1 commit into from
Jan 22, 2019
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ Currently, the `@compat` macro supports the following syntaxes:

* `IntSet` is now `BitSet` ([#24282])

* `strwidth` and `charwidth` are now merged into `textwidth` ([#23667]).

* `Complex32`, `Complex64`, and `Complex128` are now `ComplexF16`, `ComplexF32`, and
`ComplexF64`, respectively ([#24647]).

Expand Down Expand Up @@ -470,6 +472,7 @@ includes this fix. Find the minimum version from there.
[#23570]: https://github.com/JuliaLang/julia/issues/23570
[#23642]: https://github.com/JuliaLang/julia/issues/23642
[#23666]: https://github.com/JuliaLang/julia/issues/23666
[#23667]: https://github.com/JuliaLang/julia/issues/23667
[#23757]: https://github.com/JuliaLang/julia/issues/23757
[#23805]: https://github.com/JuliaLang/julia/issues/23805
[#23931]: https://github.com/JuliaLang/julia/issues/23931
Expand Down
18 changes: 14 additions & 4 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,18 @@ else
const tr = LinearAlgebra.trace
end

if VERSION < v"0.7.0-DEV.1930"
# no textwidth definition in Base
export textwidth
textwidth(c::Char) = charwidth(c)
textwidth(c::AbstractString) = strwidth(c)
elseif v"0.7.0-DEV.2915" ≤ VERSION < v"0.7.0-DEV.3393"
# textwidth definition moved to Unicode module
import Unicode
const textwidth = Unicode.textwidth
export textwidth
end

# 0.7.0-DEV.2915
module Unicode
export graphemes, textwidth, isvalid,
Expand All @@ -897,10 +909,8 @@ module Unicode
lowercase, uppercase, titlecase, lcfirst, ucfirst

if VERSION < v"0.7.0-DEV.2915"
# 0.7.0-DEV.1930
if !isdefined(Base, :textwidth)
textwidth(c::Char) = charwidth(c)
textwidth(c::AbstractString) = strwidth(c)
if VERSION < v"0.7.0-DEV.1930"
import ..Compat: textwidth
end

isnumeric(c::Char) = isnumber(c)
Expand Down
5 changes: 0 additions & 5 deletions src/deprecated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,3 @@ else
import Base.@irrational
import Base.LinAlg.BLAS.@blasfunc
end

if VERSION < v"0.7.0-DEV.2915"
const textwidth = Compat.Unicode.textwidth
export textwidth
end
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ end
@test 1 in BitSet(1:10)

# 0.7.0-DEV.1930
@test Compat.Unicode.textwidth("A") == 1
@test Compat.Unicode.textwidth('A') == 1
@test textwidth("A") == 1
@test textwidth('A') == 1

# 0.7
@test diagm(0 => ones(2), -1 => ones(2)) == [1.0 0.0 0.0; 1.0 1.0 0.0; 0.0 1.0 0.0]
Expand Down