`{1~20,30}` printed the placeholder as is, because the `,end` part was only
checked when the start index was inside the string. `{1~20}` printed nothing.
Parse and check the whole range first, so that a valid range that lies outside
of the string gives an empty result.
Numbers that don't fit in 32 bits were truncated, so `{4294967297}` was read
as `{1}`, `{4294967296}` as the next argument, and `{$4294967297}` as the
first constant. The same applied to the start, end and length of `~`, `:`, `<`,
`>` and `|`. Clamp them instead, so that they stay out of range.
Also avoid negating INT32_MIN for the ellipsis length of `{1:-2147483648}`,
which is a signed integer overflow.
When a `{?arg}` / `{/arg}` conditional is skipped, the end of the skipped part
was the next `{?}` / `{/}` in the format string, even if it closed a
conditional nested in it. The text after the nested conditional was printed
and the real closing `{?}` / `{/}` was reported as an invalid placeholder.
A literal `{{?}}` inside the skipped part also ended it.
Skip to the `{?}` / `{/}` that matches the opening one, like the printing path
already does.
In libdrm/amdgpu.ids, device IDs are formatted with 4 hex digits and
revision IDs with 2 uppercase hex digits (e.g. `1681,\t0B,`). Using
`%04X,\t%02X,` ensures both fields match the file syntax even when
values have leading zeros.
Same issue as on Unix: ffGetTerminalResponse() waits for input only before
the first ReadFile(). If the terminal answers only part of the request
(e.g. one of the two OSC 10/11 replies), the next ReadFile() blocks forever.
Wait with the same timeout before every subsequent ReadFile() as well, and
restore the console mode on that error path. While waiting, also skip
key-up records: ReadFile() returns no data for them, so one left alone in
the buffer would end the wait and the following ReadFile() would block.
ffGetTerminalResponse() polls only before the first read(). If the terminal
sends a response that is cut short (e.g. `\e[4;800` without the rest), the
following read() in the loop blocks forever because the tty is in
non-canonical mode with VMIN=1.
Wait with the same timeout before every subsequent read() as well.
* Format: fix substring ends before the start of the string
Closes#2668
Signed-off-by: Don Yin <Don_Yin@outlook.com>
* Doc: moves changelog entry to Unreleased [ci skip]
I moved the unreleased fix out of the 2.70.0 section.
Signed-off-by: Don Yin <Don_Yin@outlook.com>
---------
Signed-off-by: Don Yin <Don_Yin@outlook.com>
- Windows: use FILE_FS_FULL_SIZE_INFORMATION_EX on Windows 10 1809+ (Build >= 17763) when calcType != AVAILABLE to get ActualTotalAllocationUnits/ActualAvailableAllocationUnits (ignoring per-user disk quotas). Fall back to legacy FILE_FS_FULL_SIZE_INFORMATION with CallerAvailableAllocationUnits when calcType is AVAILABLE or EX is unavailable.
- Unix-like: respect --disk-calc-type. Use f_bfree for FREE, f_bavail for AVAILABLE (Linux/BSD/SunOS). Haiku currently always uses free_blocks.
- Refactor FFDisk: remove bytesUsed and bytesAvailable; compute used = total - free in disk module.
- Disk module: update custom format (remove `size-available`, add `bytes-used` and `bytes-total`); update JSON output (remove `bytes.available`, `bytes.used`).
- Disk detection: stop computing used in common path; let each platform set bytesFree by chosen semantics.
Fixes#2651
- Host: "Ana Bilgisayar" -> "Cihaz". The module reports the machine
model; "ana bilgisayar" reads as a mainframe in Turkish.
- Login Manager: "Oturum Açma Yöneticisi" -> "Giriş Yöneticisi".
Shorter, and the common Turkish term.
- Top: "En yoğun işlemler" -> "En Yoğun Süreçler". Title case like the
other Turkish names, and "Süreçler" to match the Processes module.
- Bluetooth Radio: "Bluetooth Radyosu" -> "Bluetooth Adaptörü". "Radyo"
reads as an FM radio; "Adaptör" matches Power Adapter ("Güç Adaptörü").
Related to #2526