Repository: JuliaLang/julia
File: stdlib/REPL/src/REPL.jl (Julia)

Code before:
        days = Int(floor((ccall(:jl_clock_now, Float64, ()) - Base.GIT_VERSION_INFO.fork_master_timestamp) / (60 * 60 * 24)))
        days = max(0, days)
        unit = days == 1 ? "day" : "days"
        distance = Base.GIT_VERSION_INFO.fork_master_distance
        commit = Base.GIT_VERSION_INFO.commit_short

        if distance == 0
            styled"""Commit {grey:$commit} \
                     ({warning:⌛ {italic:$days $unit}} old master)"""
        else
            branch = Base.GIT_VERSION_INFO.branch
            styled"""{emphasis:$branch}/{grey:$commit} \
                     ({italic:{success:{bold,(slant=normal):↑} $distance commits}, \
                     {warning:{(slant=normal):⌛} $days $unit}})"""
        end
    end

    commit_date = isempty(Base.GIT_VERSION_INFO.date_string) ? "" : styled" {light:($(split(Base.GIT_VERSION_INFO.date_string)[1]))}"
    doclink = styled"{bold:Documentation:} {(underline=grey),link={https://docs.julialang.org}:https://docs.julialang.org}"
    help = styled"Type {region,repl_prompt_help:?} for help, {region,repl_prompt_pkg:]?} for {(underline=grey),link={https://pkgdocs.julialang.org/}:Pkg} help."

    size = min(if     all(displaysize(io) .>= (5, 70)); 4 # Full size
               elseif all(displaysize(io) .>= (5, 45)); 3 # Narrower
               elseif all(displaysize(io) .>= (3, 50)); 2 # Tiny
               else 1 end,
               max(0, maxsize))

    if size == 4 # Full size
        print(io, styled"""
                                 {bold,green:_}
                     {bold,blue:_}       _ {bold:{red:_}{green:(_)}{magenta:_}}     {shadow:│}  $doclink
                    {bold,blue:(_)}     | {bold:{red:(_)} {magenta:(_)}}    {shadow:│}
                     _ _   _| |_  __ _   {shadow:│}  $help
                    | | | | | | |/ _` |  {shadow:│}
                    | | |_| | | | (_| |  {shadow:│}  Version {bold:$VERSION}$commit_date
                   _/ |\\__'_|_|_|\\__'_|  {shadow:│}  $commit_string
                  |__/                   {shadow:│}
                  \n""")
    elseif size == 3 # Rotated
        print(io, styled"""
                                 {bold,green:_}
                     {bold,blue:_}       _ {bold:{red:_}{green:(_)}{magenta:_}}
                    {bold,blue:(_)}     | {bold:{red:(_)} {magenta:(_)}}
                     _ _   _| |_  __ _
                    | | | | | | |/ _` |
                    | | |_| | | | (_| |
                   _/ |\\__'_|_|_|\\__'_|
                  |__/

                  $doclink
                  $help

Review comment (suggestion):
IIUC currently the banner size is always adaptive and the min of what fits on screen and what a user asked for. I think auto being adaptive is good. However, if I ask for `julia --banner=7`, I think I should get banner 7 regardless of screen size.

Code after:
                                end
                                return :ok
                            end
                        )
                    end
                end
                Base.errormonitor(t_replswitch)
            else
                # Use bracket insertion if enabled, otherwise just insert
                if repl.options.auto_insert_closing_bracket
                    buf = LineEdit.buffer(s)
                    if !eof(buf) && LineEdit.peek(buf, Char) == ']'
                        LineEdit.edit_move_right(buf)
                    else
                        edit_insert(buf, ']')
                    end
                    LineEdit.refresh_line(s)
                else
                    edit_insert(s, ']')
                end
                LineEdit.check_show_hint(s)
            end
        end,

        # Bracketed Paste Mode
        "\e[200~" => (s::MIState,o...)->begin
            input = LineEdit.bracketed_paste(s) # read directly from s until reaching the end-bracketed-paste marker
            sbuffer = LineEdit.buffer(s)
            curspos = position(sbuffer)
            seek(sbuffer, 0)
            shouldeval = (bytesavailable(sbuffer) == curspos && !occursin(UInt8('\n'), sbuffer))
            seek(sbuffer, curspos)
            if curspos == 0
                # if pasting at the beginning, strip leading whitespace
                input = lstrip(input)
            end
            if !shouldeval
                # when pasting in the middle of input, just paste in place
                # don't try to execute all the WIP, since that's rather confusing
                # and is often ill-defined how it should behave
                edit_insert(s, input)
                return
            end
            LineEdit.push_undo(s)
            edit_insert(sbuffer, input)
            input = String(take!(sbuffer))
            oldpos = firstindex(input)
            firstline = true
            isprompt_paste = false
            curr_prompt_len = 0
            pasting_help = false