Skip to content

Commit c286ad4

Browse files
tecosaurmkitti
authored andcommitted
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.
1 parent fc0a770 commit c286ad4

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

base/terminfo_data.jl

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ awk '/^#=run/{flag=1;next}/=#/{flag=0}flag{gsub(/__FILE__/,"\"'"$0"'\"");print}'
1010
julia --startup-file=no -E 'readchomp("/dev/fd/0") |> Meta.parse |> eval' && echo "Done"; exit
1111
=#
1212

13-
#=run
14-
begin
15-
const NCURSES_VERSION = "6.3"
16-
=#
17-
1813
"""
1914
struct TermCapability
2015
@@ -38,19 +33,25 @@ struct TermCapability
3833
end
3934

4035
#=run
36+
begin
37+
4138
using Downloads
4239
40+
version_info = IOBuffer()
4341
standard_caps = IOBuffer()
4442
user_caps = IOBuffer()
4543
46-
Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/v$NCURSES_VERSION/include/Caps", standard_caps)
47-
Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/v$NCURSES_VERSION/include/Caps-ncurses", user_caps)
44+
Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/master/VERSION", version_info)
45+
Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/master/include/Caps", standard_caps)
46+
Downloads.download("https://raw.githubusercontent.com/mirror/ncurses/master/include/Caps-ncurses", user_caps)
4847
4948
const TERM_FLAGS = NTuple{3, String}[]
5049
const TERM_NUMBERS = NTuple{3, String}[]
5150
const TERM_STRINGS = NTuple{3, String}[]
5251
const TERM_USER = NTuple{3, String}[]
5352
53+
_, ncurses_version, ncurses_date = split(read(seekstart(version_info), String))
54+
5455
for line in eachline(seekstart(standard_caps))
5556
startswith(line, '#') && continue
5657
components = split(line, '\t', keepempty=false)
@@ -98,11 +99,12 @@ const SENTINEL = "\n## GENERATED CODE BEYOND THIS POINT ##"
9899
const PREAMBLE = readuntil(__FILE__, SENTINEL, keep=true)
99100
100101
out = IOBuffer()
101-
write(out, PREAMBLE, "\n\n# Terminfo Capabilities as of NCurses $NCURSES_VERSION\n")
102+
write(out, PREAMBLE, "\n\n# Terminfo Capabilities as of NCurses $ncurses_version-$ncurses_date\n",
103+
"const NCURSES_VERSION = v\"$ncurses_version.$ncurses_date\"\n")
102104
103105
for (ftype, list) in [("flag", TERM_FLAGS), ("number", TERM_NUMBERS), ("string", TERM_STRINGS)]
104106
print(out, "\n\"\"\"\n\
105-
Ordered list of known terminal capability $ftype fields, as of NCurses $NCURSES_VERSION.\n\
107+
Ordered list of known terminal capability $ftype fields, as of NCurses $ncurses_version-$ncurses_date.\n\
106108
\"\"\"\n\
107109
const TERM_$(uppercase(ftype))S = [")
108110
namepad = maximum(textwidth, getindex.(list, 1)) + 1
@@ -129,14 +131,15 @@ function getcustomalias(allterms::Vector{NTuple{3, String}}, type, short, descri
129131
"Su" => ":can_style_underline",
130132
"csl" => ":clear_status_line",
131133
"Ms" => ":set_host_clipboard",
132-
"Tc" => ":truecolor")
134+
"Tc" => ":truecolor",
135+
"XF" => ":xterm_focus")
133136
if startswith(short, 'k') && !occursin("keypad", description)
134137
return ":key_" * replace(lowercase(description), r"[^a-z]" => '_')
135138
end
136139
return get(specific_aliases, short, "nothing")
137140
end
138141
139-
print(out, "\n\"\"\"\nTerminfo extensions that NCurses $NCURSES_VERSION is aware of.\n\"\"\"",
142+
print(out, "\n\"\"\"\nTerminfo extensions that NCurses $ncurses_version-$ncurses_date is aware of.\n\"\"\"",
140143
"\nconst TERM_USER = Dict{Tuple{DataType, Symbol}, Union{Tuple{Nothing, String}, Tuple{Symbol, String}}}(")
141144
shortpad = maximum(textwidth, getindex.(TERM_USER, 2)) + 1
142145
for (type, short, description) in TERM_USER
@@ -153,10 +156,11 @@ end
153156

154157
## GENERATED CODE BEYOND THIS POINT ##
155158

156-
# Terminfo Capabilities as of NCurses 6.3
159+
# Terminfo Capabilities as of NCurses 6.4-20230311
160+
const NCURSES_VERSION = v"6.4.20230311"
157161

158162
"""
159-
Ordered list of known terminal capability flag fields, as of NCurses 6.3.
163+
Ordered list of known terminal capability flag fields, as of NCurses 6.4-20230311.
160164
"""
161165
const TERM_FLAGS = [
162166
TermCapability(:auto_left_margin, :bw, "cub1 wraps from column 0 to last column"),
@@ -206,7 +210,7 @@ const TERM_FLAGS = [
206210
]
207211

208212
"""
209-
Ordered list of known terminal capability number fields, as of NCurses 6.3.
213+
Ordered list of known terminal capability number fields, as of NCurses 6.4-20230311.
210214
"""
211215
const TERM_NUMBERS = [
212216
TermCapability(:columns, :cols, "number of columns in a line"),
@@ -251,7 +255,7 @@ const TERM_NUMBERS = [
251255
]
252256

253257
"""
254-
Ordered list of known terminal capability string fields, as of NCurses 6.3.
258+
Ordered list of known terminal capability string fields, as of NCurses 6.4-20230311.
255259
"""
256260
const TERM_STRINGS = [
257261
TermCapability(:back_tab, :cbt, "back tab (P)"),
@@ -671,7 +675,7 @@ const TERM_STRINGS = [
671675
]
672676

673677
"""
674-
Terminfo extensions that NCurses 6.3 is aware of.
678+
Terminfo extensions that NCurses 6.4-20230311 is aware of.
675679
"""
676680
const TERM_USER = Dict{Tuple{DataType, Symbol}, Union{Tuple{Nothing, String}, Tuple{Symbol, String}}}(
677681
(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
719723
(String, :Ss) => (:set_cursor_style, "change the cursor style."),
720724
(String, :rmxx) => (:exit_strikeout_mode, "reset ECMA-48 strikeout/crossed-out attributes."),
721725
(String, :smxx) => (:enter_strikeout_mode, "set ECMA-48 strikeout/crossed-out attributes."),
726+
(String, :BD) => (nothing, "disables bracketed paste"),
727+
(String, :BE) => (nothing, "enables bracketed paste"),
728+
(String, :PE) => (nothing, "is sent after pasted text"),
729+
(String, :PS) => (nothing, "is sent before pasted text"),
730+
(String, :RV) => (nothing, "report terminal secondary device attributes"),
731+
(String, :XR) => (nothing, "report terminal version as a free-format string."),
732+
(Bool, :XF) => (:xterm_focus, "terminal supports xterm focus in/out"),
733+
(String, :rv) => (nothing, "response to RV, regular expression"),
734+
(String, :xr) => (nothing, "response to XR, regular expression"),
722735
(String, :csl) => (:clear_status_line, "clear status line"),
723736
(String, :kDC3) => (:key_alt_delete_character, "alt delete-character"),
724737
(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
776789
(String, :kb1) => (nothing, "vt220-keypad extensions"),
777790
(String, :kb3) => (nothing, "vt220-keypad extensions"),
778791
(String, :kc2) => (nothing, "vt220-keypad extensions"),
792+
(String, :kxIN) => (:key_mouse_response_on_focus_in, "mouse response on focus-in"),
793+
(String, :kxOUT) => (:key_mouse_response_on_focus_out, "mouse response on focus-out"),
779794
(Bool, :Tc) => (:truecolor, "tmux extension to indicate 24-bit truecolor support"),
795+
(Bool, :Su) => (:can_style_underline, "kitty extension to indicate styled underline support"),
780796
)

0 commit comments

Comments
 (0)