Repository: JuliaLang/julia
File: base/terminfo_data.jl (Julia)

Code before:
    for (name, shortcode, description) in list
        print(out, "\n    TermCapability(:", name, ',', ' '^(namepad - textwidth(name)),
              ':', shortcode, ',', ' '^(codepad - textwidth(shortcode)),
              '"', escape_string(description), "\"),")
    end
    println(out, "\n]")
end

function getcustomalias(allterms::Vector{NTuple{3, String}}, type, short, description)
    specific_aliases = Dict{String, String}(
        "smxx"  => ":enter_strikeout_mode",
        "rmxx"  => ":exit_strikeout_mode",
        "Smol"  => ":enter_overline_mode",
        "Rmol"  => ":exit_overline_mode",
        "Cs"    => ":set_cursor_color",
        "Cr"    => ":reset_cursor_color",
        "Ss"    => ":set_cursor_style",
        "Se"    => ":reset_cursor_style",
        "Smulx" => ":set_underline_style",
        "Su"    => ":can_style_underline",
        "csl"   => ":clear_status_line",
        "Ms"    => ":set_host_clipboard",
        "Tc"    => ":truecolor",
        "XF"    => ":xterm_focus",
        "fd"    => ":focus_disable",
        "fe"    => ":focus_enable")
    if startswith(short, 'k') && !occursin("keypad", description)
        return ":key_" * replace(lowercase(description), r"[^a-z]" => '_')
    end
    return get(specific_aliases, short, "nothing")
end

print(out, "\n\"\"\"\nTerminfo extensions that NCurses $ncurses_version-$ncurses_date is aware of.\n\"\"\"",
           "\nconst TERM_USER = Dict{Tuple{DataType, Symbol}, Union{Tuple{Nothing, String}, Tuple{Symbol, String}}}(")
shortpad = maximum(textwidth, getindex.(TERM_USER, 2)) + 1
for (type, short, description) in TERM_USER
    print(out, "\n    ($(rpad(type * ',', 7)) :$short)", ' '^(shortpad - textwidth(short)),
          "=> (", getcustomalias(TERM_USER, type, short, description), ", \"",
          escape_string(description), "\"),")
end
println(out, "\n)")

open(io -> write(io, seekstart(out)), __FILE__, "w")

end
=#

## GENERATED CODE BEYOND THIS POINT ##

# Terminfo Capabilities as of NCurses 6.5-20251018
const NCURSES_VERSION = v"6.5.20251018"

Review comment (suggestion):
Could also do this to make future additions nicer (but obviously that's a matter of taste, too)
```suggestion
        "fe"    => ":focus_enable",
        )
```

Code after:
    for (name, shortcode, description) in list
        print(out, "\n    TermCapability(:", name, ',', ' '^(namepad - textwidth(name)),
              ':', shortcode, ',', ' '^(codepad - textwidth(shortcode)),
              '"', escape_string(description), "\"),")
    end
    println(out, "\n]")
end

function getcustomalias(allterms::Vector{NTuple{3, String}}, type, short, description)
    specific_aliases = Dict{String, String}(
        "smxx"  => ":enter_strikeout_mode",
        "rmxx"  => ":exit_strikeout_mode",
        "Smol"  => ":enter_overline_mode",
        "Rmol"  => ":exit_overline_mode",
        "Cs"    => ":set_cursor_color",
        "Cr"    => ":reset_cursor_color",
        "Ss"    => ":set_cursor_style",
        "Se"    => ":reset_cursor_style",
        "Smulx" => ":set_underline_style",
        "Su"    => ":can_style_underline",
        "csl"   => ":clear_status_line",
        "Ms"    => ":set_host_clipboard",
        "Tc"    => ":truecolor",
        "XF"    => ":xterm_focus",
        "fd"    => ":focus_disable",
        "fe"    => ":focus_enable",
        )
    if startswith(short, 'k') && !occursin("keypad", description)
        return ":key_" * replace(lowercase(description), r"[^a-z]" => '_')
    end
    return get(specific_aliases, short, "nothing")
end

print(out, "\n\"\"\"\nTerminfo extensions that NCurses $ncurses_version-$ncurses_date is aware of.\n\"\"\"",
           "\nconst TERM_USER = Dict{Tuple{DataType, Symbol}, Union{Tuple{Nothing, String}, Tuple{Symbol, String}}}(")
shortpad = maximum(textwidth, getindex.(TERM_USER, 2)) + 1
for (type, short, description) in TERM_USER
    print(out, "\n    ($(rpad(type * ',', 7)) :$short)", ' '^(shortpad - textwidth(short)),
          "=> (", getcustomalias(TERM_USER, type, short, description), ", \"",
          escape_string(description), "\"),")
end
println(out, "\n)")

open(io -> write(io, seekstart(out)), __FILE__, "w")

end
=#

## GENERATED CODE BEYOND THIS POINT ##

# Terminfo Capabilities as of NCurses 6.5-20251018