From 1a76ed4d95a293676df3fc7957bcdbb0e0b38b70 Mon Sep 17 00:00:00 2001 From: TEC Date: Tue, 13 Feb 2024 12:24:55 +0800 Subject: [PATCH] Change terminfo update logic, and update Using the tagged releases in the ncurses repository isn't actually a good idea, since it fails to capture the patch releases made subsequently. Instead, we switch to grabbing the latest version and recording which patch release it is. Normally, there would be a danger of grabbing un-released changes, however this doesn't seem like an actual risk in this case given how the ncurses repo seems to operate. --- base/terminfo_data.jl | 48 ++++++++++++++++++++++++++++--------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/base/terminfo_data.jl b/base/terminfo_data.jl index 54d6e988aa2bb..caf2ff528d3e1 100644 --- a/base/terminfo_data.jl +++ b/base/terminfo_data.jl @@ -10,11 +10,6 @@ awk '/^#=run/{flag=1;next}/=#/{flag=0}flag{gsub(/__FILE__/,"\"'"$0"'\"");print}' julia --startup-file=no -E 'readchomp("/dev/fd/0") |> Meta.parse |> eval' && echo "Done"; exit =# -#=run -begin -const NCURSES_VERSION = "6.3" -=# - """ struct TermCapability @@ -38,19 +33,25 @@ struct TermCapability end #=run +begin + using Downloads +version_info = IOBuffer() standard_caps = IOBuffer() user_caps = IOBuffer() -Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/v$NCURSES_VERSION/include/Caps", standard_caps) -Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/v$NCURSES_VERSION/include/Caps-ncurses", user_caps) +Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/master/VERSION", version_info) +Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/master/include/Caps", standard_caps) +Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/master/include/Caps-ncurses", user_caps) const TERM_FLAGS = NTuple{3, String}[] const TERM_NUMBERS = NTuple{3, String}[] const TERM_STRINGS = NTuple{3, String}[] const TERM_USER = NTuple{3, String}[] +_, ncurses_version, ncurses_date = split(read(seekstart(version_info), String)) + for line in eachline(seekstart(standard_caps)) startswith(line, '#') && continue components = split(line, '\t', keepempty=false) @@ -98,11 +99,12 @@ const SENTINEL = "\n## GENERATED CODE BEYOND THIS POINT ##" const PREAMBLE = readuntil(__FILE__, SENTINEL, keep=true) out = IOBuffer() -write(out, PREAMBLE, "\n\n# Terminfo Capabilities as of NCurses $NCURSES_VERSION\n") +write(out, PREAMBLE, "\n\n# Terminfo Capabilities as of NCurses $ncurses_version-$ncurses_date\n", + "const NCURSES_VERSION = v\"$ncurses_version.$ncurses_date\"\n") for (ftype, list) in [("flag", TERM_FLAGS), ("number", TERM_NUMBERS), ("string", TERM_STRINGS)] print(out, "\n\"\"\"\n\ - Ordered list of known terminal capability $ftype fields, as of NCurses $NCURSES_VERSION.\n\ + Ordered list of known terminal capability $ftype fields, as of NCurses $ncurses_version-$ncurses_date.\n\ \"\"\"\n\ const TERM_$(uppercase(ftype))S = [") namepad = maximum(textwidth, getindex.(list, 1)) + 1 @@ -129,14 +131,15 @@ function getcustomalias(allterms::Vector{NTuple{3, String}}, type, short, descri "Su" => ":can_style_underline", "csl" => ":clear_status_line", "Ms" => ":set_host_clipboard", - "Tc" => ":truecolor") + "Tc" => ":truecolor", + "XF" => ":xterm_focus") 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 is aware of.\n\"\"\"", +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 @@ -153,10 +156,11 @@ end ## GENERATED CODE BEYOND THIS POINT ## -# Terminfo Capabilities as of NCurses 6.3 +# Terminfo Capabilities as of NCurses 6.4-20230311 +const NCURSES_VERSION = v"6.4.20230311" """ -Ordered list of known terminal capability flag fields, as of NCurses 6.3. +Ordered list of known terminal capability flag fields, as of NCurses 6.4-20230311. """ const TERM_FLAGS = [ TermCapability(:auto_left_margin, :bw, "cub1 wraps from column 0 to last column"), @@ -206,7 +210,7 @@ const TERM_FLAGS = [ ] """ -Ordered list of known terminal capability number fields, as of NCurses 6.3. +Ordered list of known terminal capability number fields, as of NCurses 6.4-20230311. """ const TERM_NUMBERS = [ TermCapability(:columns, :cols, "number of columns in a line"), @@ -251,7 +255,7 @@ const TERM_NUMBERS = [ ] """ -Ordered list of known terminal capability string fields, as of NCurses 6.3. +Ordered list of known terminal capability string fields, as of NCurses 6.4-20230311. """ const TERM_STRINGS = [ TermCapability(:back_tab, :cbt, "back tab (P)"), @@ -671,7 +675,7 @@ const TERM_STRINGS = [ ] """ -Terminfo extensions that NCurses 6.3 is aware of. +Terminfo extensions that NCurses 6.4-20230311 is aware of. """ const TERM_USER = Dict{Tuple{DataType, Symbol}, Union{Tuple{Nothing, String}, Tuple{Symbol, String}}}( (Int, :CO ) => (nothing, "number of indexed colors overlaying RGB space"), @@ -719,6 +723,15 @@ const TERM_USER = Dict{Tuple{DataType, Symbol}, Union{Tuple{Nothing, String}, Tu (String, :Ss) => (:set_cursor_style, "change the cursor style."), (String, :rmxx) => (:exit_strikeout_mode, "reset ECMA-48 strikeout/crossed-out attributes."), (String, :smxx) => (:enter_strikeout_mode, "set ECMA-48 strikeout/crossed-out attributes."), + (String, :BD) => (nothing, "disables bracketed paste"), + (String, :BE) => (nothing, "enables bracketed paste"), + (String, :PE) => (nothing, "is sent after pasted text"), + (String, :PS) => (nothing, "is sent before pasted text"), + (String, :RV) => (nothing, "report terminal secondary device attributes"), + (String, :XR) => (nothing, "report terminal version as a free-format string."), + (Bool, :XF) => (:xterm_focus, "terminal supports xterm focus in/out"), + (String, :rv) => (nothing, "response to RV, regular expression"), + (String, :xr) => (nothing, "response to XR, regular expression"), (String, :csl) => (:clear_status_line, "clear status line"), (String, :kDC3) => (:key_alt_delete_character, "alt delete-character"), (String, :kDC4) => (:key_shift_alt_delete_character, "shift+alt delete-character"), @@ -776,5 +789,8 @@ const TERM_USER = Dict{Tuple{DataType, Symbol}, Union{Tuple{Nothing, String}, Tu (String, :kb1) => (nothing, "vt220-keypad extensions"), (String, :kb3) => (nothing, "vt220-keypad extensions"), (String, :kc2) => (nothing, "vt220-keypad extensions"), + (String, :kxIN) => (:key_mouse_response_on_focus_in, "mouse response on focus-in"), + (String, :kxOUT) => (:key_mouse_response_on_focus_out, "mouse response on focus-out"), (Bool, :Tc) => (:truecolor, "tmux extension to indicate 24-bit truecolor support"), + (Bool, :Su) => (:can_style_underline, "kitty extension to indicate styled underline support"), )