[TxMt] diff statistics off by one
Grant Hollingworth
grant at antiflux.org
Thu Nov 9 22:56:52 UTC 2006
The 'Statistics (Lines Added/Removed)' command in the Diff bundle works by counting + and - characters in the first column. The current count includes the '---' and '+++' that unified diffs have in the first two lines.
The fix is to skip the first two lines.
-------------- next part --------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>beforeRunningCommand</key>
<string>nop</string>
<key>bundleUUID</key>
<string>C2D2BFF9-708D-11D9-BD09-0011242E4184</string>
<key>command</key>
<string>tail -n +3 | tee >(add=$(grep ^+|wc -l); echo 1>&2 "Lines Added $add") \
|{ rem=$(grep ^-|wc -l); wait; echo "Lines Removed $rem"; }</string>
<key>input</key>
<string>document</string>
<key>keyEquivalent</key>
<string>^N</string>
<key>name</key>
<string>Statistics (Lines Added/Removed)</string>
<key>output</key>
<string>showAsTooltip</string>
<key>scope</key>
<string>source.diff</string>
<key>uuid</key>
<string>B9091553-4317-415E-B381-4609BD453E01</string>
</dict>
</plist>
More information about the textmate
mailing list