Skip to content

Commit a378b60

Browse files
committed
rename iosize to displaysize (ref #13825)
1 parent 452f903 commit a378b60

16 files changed

+38
-38
lines changed

base/Terminals.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import Base:
2929
flush,
3030
read,
3131
readuntil,
32-
iosize,
32+
displaysize,
3333
start_reading,
3434
stop_reading,
3535
write,
@@ -43,7 +43,7 @@ import Base:
4343
abstract TextTerminal <: Base.IO
4444

4545
# INTERFACE
46-
iosize(::TextTerminal) = error("Unimplemented")
46+
displaysize(::TextTerminal) = error("Unimplemented")
4747
writepos(t::TextTerminal, x, y, s::Array{UInt8,1}) = error("Unimplemented")
4848
cmove(t::TextTerminal, x, y) = error("Unimplemented")
4949
getX(t::TextTerminal) = error("Unimplemented")
@@ -88,8 +88,8 @@ function writepos(t::TextTerminal, x, y, args...)
8888
cmove(t, x, y)
8989
write(t, args...)
9090
end
91-
width(t::TextTerminal) = iosize(t)[2]
92-
height(t::TextTerminal) = iosize(t)[1]
91+
width(t::TextTerminal) = displaysize(t)[2]
92+
height(t::TextTerminal) = displaysize(t)[1]
9393

9494
# For terminals with buffers
9595
flush(t::TextTerminal) = nothing
@@ -158,8 +158,8 @@ disable_bracketed_paste(t::UnixTerminal) = write(t.out_stream, "$(CSI)?2004l")
158158
end_keypad_transmit_mode(t::UnixTerminal) = # tput rmkx
159159
write(t.out_stream, "$(CSI)?1l\x1b>")
160160

161-
function Base.iosize(t::UnixTerminal)
162-
return iosize(t.out_stream)
161+
function Base.displaysize(t::UnixTerminal)
162+
return displaysize(t.out_stream)
163163
end
164164

165165
clear(t::UnixTerminal) = write(t.out_stream, "\x1b[H\x1b[2J")

base/deprecated.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -921,17 +921,17 @@ export isreadable, iswritable, isexecutable
921921
@deprecate RemoteRef RemoteChannel
922922

923923
function tty_size()
924-
depwarn("tty_size is deprecated. use `iosize(io)` as a replacement", :tty_size)
924+
depwarn("tty_size is deprecated. use `displaysize(io)` as a replacement", :tty_size)
925925
if isdefined(Base, :active_repl)
926926
os = REPL.outstream(Base.active_repl)
927927
if isa(os, Terminals.TTYTerminal)
928-
return iosize(os)
928+
return displaysize(os)
929929
end
930930
end
931931
if isdefined(Base, :STDOUT)
932-
return iosize(STDOUT)
932+
return displaysize(STDOUT)
933933
end
934-
return iosize()
934+
return displaysize()
935935
end
936936

937937
#14335

base/dict.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ function showdict{K,V}(io::IO, t::Associative{K,V}; compact = false)
9898
isempty(t) && return
9999
print(io, ":")
100100
if limit
101-
sz = iosize(io)
101+
sz = displaysize(io)
102102
rows, cols = sz[1] - 3, sz[2]
103103
rows < 2 && (print(io, ""); return)
104104
cols < 12 && (cols = 12) # Minimum widths of 2 for key, 4 for value
@@ -158,7 +158,7 @@ function showkv{T<:Union{KeyIterator,ValueIterator}}(io::IO, iter::T)
158158
print(io, ". ", T<:KeyIterator ? "Keys" : "Values", ":")
159159
limit::Bool = limit_output(io)
160160
if limit
161-
sz = iosize(io)
161+
sz = displaysize(io)
162162
rows, cols = sz[1] - 3, sz[2]
163163
rows < 2 && (print(io, ""); return)
164164
cols < 4 && (cols = 4)

base/docs/utils.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ end
9494
function repl_search(io::IO, s)
9595
pre = "search:"
9696
print(io, pre)
97-
printmatches(io, s, completions(s), cols = iosize(io)[2] - length(pre))
97+
printmatches(io, s, completions(s), cols = displaysize(io)[2] - length(pre))
9898
println(io, "\n")
9999
end
100100

@@ -243,7 +243,7 @@ end
243243

244244
printmatch(args...) = printfuzzy(STDOUT, args...)
245245

246-
function printmatches(io::IO, word, matches; cols = iosize(io)[2])
246+
function printmatches(io::IO, word, matches; cols = displaysize(io)[2])
247247
total = 0
248248
for match in matches
249249
total + length(match) + 1 > cols && break
@@ -254,9 +254,9 @@ function printmatches(io::IO, word, matches; cols = iosize(io)[2])
254254
end
255255
end
256256

257-
printmatches(args...; cols = iosize(STDOUT)[2]) = printmatches(STDOUT, args..., cols = cols)
257+
printmatches(args...; cols = displaysize(STDOUT)[2]) = printmatches(STDOUT, args..., cols = cols)
258258

259-
function print_joined_cols(io::IO, ss, delim = "", last = delim; cols = iosize(io)[2])
259+
function print_joined_cols(io::IO, ss, delim = "", last = delim; cols = displaysize(io)[2])
260260
i = 0
261261
total = 0
262262
for i = 1:length(ss)
@@ -266,13 +266,13 @@ function print_joined_cols(io::IO, ss, delim = "", last = delim; cols = iosize(i
266266
print_joined(io, ss[1:i], delim, last)
267267
end
268268

269-
print_joined_cols(args...; cols = iosize(STDOUT)[2]) = print_joined_cols(STDOUT, args...; cols=cols)
269+
print_joined_cols(args...; cols = displaysize(STDOUT)[2]) = print_joined_cols(STDOUT, args...; cols=cols)
270270

271271
function print_correction(io, word)
272272
cors = levsort(word, accessible(current_module()))
273273
pre = "Perhaps you meant "
274274
print(io, pre)
275-
print_joined_cols(io, cors, ", ", " or "; cols = iosize(io)[2] - length(pre))
275+
print_joined_cols(io, cors, ", ", " or "; cols = displaysize(io)[2] - length(pre))
276276
println(io)
277277
return
278278
end

base/exports.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1146,7 +1146,7 @@ export
11461146
htol,
11471147
hton,
11481148
IOContext,
1149-
iosize,
1149+
displaysize,
11501150
ismarked,
11511151
isopen,
11521152
isreadonly,

base/interactiveutil.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ Print information about exported global variables in a module, optionally restri
430430
The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object.
431431
"""
432432
function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"")
433-
maxline = iosize(io)[2]
433+
maxline = displaysize(io)[2]
434434
line = zeros(UInt8, maxline)
435435
head = PipeBuffer(maxline + 1)
436436
for v in sort!(names(m))

base/markdown/render/terminal/render.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
include("formatting.jl")
44

55
const margin = 2
6-
cols(io) = iosize(io)[2]
6+
cols(io) = displaysize(io)[2]
77

88
function term(io::IO, content::Vector, cols)
99
isempty(content) && return

base/pkg/entry.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,7 @@ function resolve(
490490
end
491491

492492
function warnbanner(msg...; label="[ WARNING ]", prefix="")
493-
cols = Base.iosize(STDERR)[2]
493+
cols = Base.displaysize(STDERR)[2]
494494
warn(prefix="", Base.cpad(label,cols,"="))
495495
println(STDERR)
496496
warn(prefix=prefix, msg...)

base/profile.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function print{T<:Unsigned}(io::IO, data::Vector{T} = fetch(), lidict::Dict = ge
8181
combine = true,
8282
maxdepth::Int = typemax(Int),
8383
sortedby::Symbol = :filefuncline)
84-
cols = Base.iosize(io)[2]
84+
cols = Base.displaysize(io)[2]
8585
if format == :tree
8686
tree(io, data, lidict, C, combine, cols, maxdepth)
8787
elseif format == :flat

base/range.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ function print_range(io::IO, r::Range,
266266
# This function borrows from print_matrix() in show.jl
267267
# and should be called by writemime (replutil.jl) and by display()
268268
limit = limit_output(io)
269-
sz = iosize(io)
269+
sz = displaysize(io)
270270
screenheight, screenwidth = sz[1] - 4, sz[2]
271271
screenwidth -= length(pre) + length(post)
272272
postsp = ""

base/show.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ limit_output(::ANY) = _limit_output::Bool
6767
limit_output(io::IOContext) = get(io, :limit_output, _limit_output::Bool) === true
6868
_limit_output = false # delete with with_output_limit deprecation
6969

70-
iosize(io::IOContext) = haskey(io, :iosize) ? io[:iosize] : iosize(io.io)
70+
displaysize(io::IOContext) = haskey(io, :displaysize) ? io[:displaysize] : displaysize(io.io)
7171

7272

7373
show(io::IO, x::ANY) = show_default(io, x)
@@ -1197,7 +1197,7 @@ function print_matrix(io::IO, X::AbstractVecOrMat,
11971197
if !limit_output(io)
11981198
screenheight = screenwidth = typemax(Int)
11991199
else
1200-
sz = iosize(io)
1200+
sz = displaysize(io)
12011201
screenheight, screenwidth = sz[1] - 4, sz[2]
12021202
end
12031203
screenwidth -= length(pre) + length(post)

base/sparse/sparsematrix.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function Base.showarray(io::IO, S::SparseMatrixCSC;
8585

8686
limit::Bool = Base.limit_output(io)
8787
if limit
88-
rows = iosize(io)[1]
88+
rows = displaysize(io)[1]
8989
half_screen_rows = div(rows - 8, 2)
9090
else
9191
half_screen_rows = typemax(Int)

base/sparse/sparsevector.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ function showarray(io::IO, x::AbstractSparseVector;
597597
end
598598

599599
limit::Bool = Base.limit_output(io)
600-
half_screen_rows = limit ? div(iosize(io)[1] - 8, 2) : typemax(Int)
600+
half_screen_rows = limit ? div(displaysize(io)[1] - 8, 2) : typemax(Int)
601601
pad = ndigits(n)
602602
sep = "\n\t"
603603
for k = 1:length(nzind)

base/stream.jl

+6-6
Original file line numberDiff line numberDiff line change
@@ -383,15 +383,15 @@ end
383383
ispty(s::IO) = false
384384
end
385385

386-
" iosize(io) -> (lines, columns)
386+
" displaysize(io) -> (lines, columns)
387387
Return the nominal size of the screen that may be used for rendering output to this io object"
388-
iosize(io::IO) = iosize()
389-
iosize() = (parse(Int, get(ENV, "LINES", "24")),
390-
parse(Int, get(ENV, "COLUMNS", "80")))::Tuple{Int, Int}
388+
displaysize(io::IO) = displaysize()
389+
displaysize() = (parse(Int, get(ENV, "LINES", "24")),
390+
parse(Int, get(ENV, "COLUMNS", "80")))::Tuple{Int, Int}
391391

392-
function iosize(io::TTY)
392+
function displaysize(io::TTY)
393393
local h::Int, w::Int
394-
default_size = iosize()
394+
default_size = displaysize()
395395

396396
@windows_only if ispty(io)
397397
# io is actually a libuv pipe but a cygwin/msys2 pty

doc/stdlib/io-network.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -624,7 +624,7 @@ Text I/O
624624
625625
Decodes the base64-encoded ``string`` and returns a ``Vector{UInt8}`` of the decoded bytes.
626626

627-
.. function:: iosize(io) -> (lines, columns)
627+
.. function:: displaysize(io) -> (lines, columns)
628628

629629
.. Docstring generated from Julia source
630630

test/dict.jl

+3-3
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ for d in (Dict("\n" => "\n", "1" => "\n", "\n" => "2"),
257257
for cols in (12, 40, 80), rows in (2, 10, 24)
258258
# Ensure output is limited as requested
259259
s = IOBuffer()
260-
io = Base.IOContext(Base.IOContext(s, :limit_output => true), :iosize => (rows, cols))
260+
io = Base.IOContext(Base.IOContext(s, :limit_output => true), :displaysize => (rows, cols))
261261
Base.showdict(io, d)
262262
out = split(takebuf_string(s),'\n')
263263
for line in out[2:end]
@@ -267,7 +267,7 @@ for d in (Dict("\n" => "\n", "1" => "\n", "\n" => "2"),
267267

268268
for f in (keys, values)
269269
s = IOBuffer()
270-
io = Base.IOContext(Base.IOContext(s, :limit_output => true), :iosize => (rows, cols))
270+
io = Base.IOContext(Base.IOContext(s, :limit_output => true), :displaysize => (rows, cols))
271271
Base.showkv(io, f(d))
272272
out = split(takebuf_string(s),'\n')
273273
for line in out[2:end]
@@ -287,7 +287,7 @@ end
287287
type Alpha end
288288
Base.show(io::IO, ::Alpha) = print(io,"α")
289289
let sbuff = IOBuffer(),
290-
io = Base.IOContext(Base.IOContext(sbuff, :limit_output => true), :iosize => (10, 20))
290+
io = Base.IOContext(Base.IOContext(sbuff, :limit_output => true), :displaysize => (10, 20))
291291

292292
Base.showdict(io, Dict(Alpha()=>1))
293293
@test !contains(bytestring(sbuff), "")

0 commit comments

Comments
 (0)