Prompt and prefix overhauls, readline enhancements, diff pane navigation, write protection overhaul, terminal rendering fixes, and new prefixes.
I'd like to nickname this release "from toy to tool".
Warning
This release removes unpredictable variable-size prefixes and adds new comprehensable fixed-size prefixes. The x: prefix was repurposed as an array type instead of a variable-sized scalar type. See x8:/x16:/x32:/x64: instead.
Warning
s: prefix was removed for ambuguity, use utf8: instead, which is how ddhx natively interfaces with the system anyway.
Warning
Under the new quote mechanic, all strings are raw, except for double-quotes (""), which now allow for escapes (i.e., \xff, \t, \\ as one backslash, etc.). Single-quotes ('') are used to contain spaces while still remaining raw strings.
Overview
- Command line overhaul: Now with C string expressions.
Arguments are split with single quotes (raw) and double quotes (C string literals with escape sequences), for every command and in configuration files, not just for patterns.
WARNING:s:and"string"prefixes are gone, sofind s:testandfind "test"are now errors; usefind utf8:testorfind utf8:"test"instead. - Pattern prefix overhaul: Fixed-width prefixes without surprises.
The variable-width scalars (d:, o:, and 0o), which produced needles of odd lengths depending on the value written. They are now replaced by fixed-width ones: u8/u16/u32/u64, i8/i16/i32/i64, x8/x16/x32/x64, and o8/o16/o32/o64. The x: prefix is now a byte string, so x:1122 produces [ 11, 22 ] in order. - New text patterns:
utf8:,utf16:, andutf32:
These transcode text from UTF-8 (the readline implementation). - New float pattern prefixes:
f32:,f64:, andf80:(x87 extended) and constants:f32:pi,u16:max, etc. - Diff mode navigation: new
diff-next/diff-prevcommands (bound to}and{) jump between differing regions with a diff panel opened, with a cursor mirror and better alignment in the diff panel. - Write protection overhaul: new
-W/--writableflag andwritemodeconfig; write mode is now enforced on fixed-size media.
Added
- Single quoting ('TEXT', raw) and double quoting ("TEXT", C string literal)
for command arguments (decc3ee) - C escape sequences inside double quotes:
\a \b \e \f \n \r \t \v \\ \' \" \?, octal (\0,\377), and hexadecimal (\x1b) (decc3ee) - Fixed-width pattern prefixes:
x8:/x16:/x32:/x64:,u8:..u64:,o8:..o64:, and signedi8:..i64:. A value too large for its width is an error rather than a truncation - Signed pattern values, encoded as two's complement:
find i16:-1. Only thei*prefixes take a sign; a minus on an unsigned type is reported rather than wrapped - Text pattern prefixes
utf8:,utf16:andutf32:, alongsideutf8:. Takes fromendiansetting. No BOM is emitted. - Float pattern prefixes
f32:andf64:, always binary32 and binary64 on every platform. - Float pattern prefix
f80:for x87's 80-bit extended (long double): ten bytes. nan/qnan,snan,snan_hi,indefinite,pi,e,tau,sqrt2,phiconstants andmax,min,epsilon,denorm_minproperties for the float prefixes, each at the width's
precision: 'f80:pi' is the ten bytes FLDPI loads.maxandminproperties for the integer prefixes.find-bookmarkcommand: bookmarks every match of a pattern in one pass. (a0bb40f)find-bookmark-limitconfig option: how many matchesfind-bookmarktakes before it stops and says so. Defaults to 4096. (f8f8544)-W/--writableflag. (cb1c02d)writemodeconfig option, enforced on fixed-size media. (6fd3d7e)diff-next/diff-prevcommands mapped to}/{. (73a5983)- Cursor mirror in the diff panel. (e77bd04)
BracesandPipeterminal enum values. (7d15f8b)showcommand withname,path,size, andversionarguments. (e7f786e)
Easier to remember thanreportcommand.- Add statusbar format optional argument to
reportcommand.
Changed
- Quoting and escapes apply to every command and to configuration files, not only to patterns:
save-as "dump\x2Etxt"saves dump.txt (decc3ee) - Arguments are bytes rather than text, so an escape may produce data that is not valid UTF-8. Commands that need text (
save-as "\xff") report it, and commands that take data are unaffected (decc3ee) - Unquoted and single quoted text is raw, so a path needs no escaping:
find utf8:C:\Usersanddiff-file C:\dump.binwork as typed (decc3ee) - An unknown escape, an unterminated quote, and a hex escape with a third digit are errors instead of being guessed at (decc3ee)
x:and0xare byte strings rather than integers, so digits are taken in the order written and the length is no longer capped at 64 bits. An odd number of digits is an error instead of being padded:x:0is nowx:00- The
s:string pattern prefix is nowutf8:, since a text prefix names the encoding its bytes come out in the same way a scalar prefix names its width. - The
endiansetting (and Alt+E) now applies to scalar patterns as well as to the inspector, instead of scalars silently using the host`s endianness - Scalar patterns always state a width, so a pattern's length no longer depends on the value written in it.
d:255becomesu8:255oru16:255,o:377becomeso8:377. Variable-length prefixes sometimes created 3, 5, or 7-byte needles which made a lot of aligned operations pretty confusing. - Restricted mode split into its own variable, simplifying
-Whandling (0ae096e) - Diff panel alignment improved (391a387)
- Benchmark tool: fixed compile, uses default editor when run without args (3ffdac4)
Fixed
- Backward search never tested offset 0, so a needle sitting at the very start of the document was unfindable with
find-back - Patterns no longer silently accept trailing garbage:
x16:12zzwas taken for 0x12, and is now an error. - Row drift when lines are truncated by terminal width (4bcb010)
- Terminal partial rendering for readline (63cdbf7), with multiple fixes:
- cell count no longer relies on terminalWrite, counts using graphs
instead - text truncated correctly according to terminal size
- scroll condition no longer ignores base position
- CJK width heuristic no longer fails to fire (byte vs char comparison
bug)
- cell count no longer relies on terminalWrite, counts using graphs
Removed
- Bare
"STRING"pattern alias forutf8:STRING. Quotes are the prompt's syntax, not a pattern type, so theutf8:prefix is always required (decc3ee) - Bare
d:,o:, and0opattern prefixes. They named a type without a size, so they are gone rather than defaulted, and are now unknown prefixes. Decimal isu8:..u64:andi8:..i64:; octal iso8:..o64:.0xis unaffected, being a byte string like thex:it abbreviates
Docs
- ddhx.1 manpage updated for writemode, -W, and diff-next/diff-prev (6fd3d7e, 0ae096e, cb1c02d, 73a5983)
- ddhx.1: new Quoting subsection under COMMANDS, rewritten
utf8:and wildcard entries under PATTERNS (2f06c99) - src/README: new COMMAND LINE section covering the rules, the cases the design is pinned to, and why each decision was made (aa9d503)
- src/README: PREFIXES subsection on the byte string versus scalar split, plus the rationale for widths, for endianness being a setting, and for x: no longer being a number
- ddhx.1: PATTERNS rewritten for the width prefixes, and the
endiansetting no longer described as inspector-only