terminfoのマンページでは、遅延を指定するエンコーディングの$<>
がms
であり、その角括弧内に小数点以下1桁の精度があることが記述されています。terminfoパラメータ化された文字列の遅延
そして、次のpythonスクリプトでは、$<
が遅延を指定するためにのみ使用されていることが確認されました。つまり、遅延を指定しないために$<
が使用されたパラメータ化された文字列はありませんでした。
#!/usr/bin/env python3
# './test/data/stressTestTerms.txt' contains contains terminal names
# and directory './test/data/mirror' contains terminal databases of 2718 terminals
import subprocess
import re
def check_dollar_angular(caps):
string_caps = [cap for cap in caps.split(',') if '=' in cap]
# search for $<..> type delays in string caps
delay = r"\$<(\d+(\.(\d)+)?\*?/?|(\.(\d)+)?\*?/?)>"
caps_with_dollar = 0
delay_matches = 0
for cap in string_caps:
matches = list(re.finditer(delay, cap))
dollar_idx = cap.find('$<')
if dollar_idx != -1:
caps_with_dollar += 1
if any([True if match.start() == dollar_idx else False for match in matches]):
delay_matches += 1
if caps_with_dollar == delay_matches:
return True
else:
return False
if __name__ == "__main__":
with open('./test/data/stressTestTerms.txt') as terminal_names:
res = []
for each_terminal in terminal_names:
output = subprocess.run(
['infocmp', '-0', '-A', './test/data/mirror', each_terminal.strip()], stdout=subprocess.PIPE)
try:
output.check_returncode()
caps = output.stdout.decode('utf-8')
res.append(check_dollar_angular(caps))
except subprocess.CalledProcessError as e:
print(e)
if (not all(res)):
print(
"We have a terminal where in one of it's caps there is a dollar-angular but it doesn't signify delay")
else:
print(
"Success! no terminal found where '$<' is used for anything else other than specifying delay")
だから私の質問は、かどうかは、テキスト/シーケンスの一部であると遅延を示すものではありませ$<
ですか?例えば。 $<%p1%d
または$<A
のようなケース(現在または将来の端末)がある可能性があります。遅延は、$<
を使用して指定されることを意味するものではなく、有効なterminfoシーケンスです。 manual page