Skip to content

Commit

Permalink
Reflect moving of textwidth back to Base (#644)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters authored Jan 22, 2019
1 parent 1bb891d commit 58c0b6e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
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

0 comments on commit 58c0b6e

Please sign in to comment.