descriptionDiffutils for BlackBox! (Beta)
last changeSat, 23 Mar 2019 18:58:21 +0000 (21:58 +0300)
BlackBox diffutils

Clone of diff and diff3 utilites from *nix for BlackBox and its binary Compound Document format.


To use tools within Blackbox just compile DiffBase and DiffUtils.

DiffUtils.Compare (guard TextCmds.FocusGuard)

        Compare texts from two windows.
        You can directly replace DevSearch.Compare with DiffUtils.Compare in Dev/Rsrc/Menus.odc.

^Q DiffUtils.CompareThis <old> <new> [">" <outfile>]

        Compare two files and produce patch in unified diff format.

^Q DiffUtils.MergeThis <my> <old> <your> [">" <outfile>]

        Read three files and do three-way merge like diff3.

Dedicated tool

You can read, create diffs and merge documents from command line using odctool.
To build it, open DiffMain and execute commanders at the end of document.
Call `odctool help` to learn how to use it.

Integration with git

1. Compile odctool.

2. Create script odctool-gitdiff:

        #! /bin/sh
        odctool diff -x -X -E -C -p "$1" "$2" "$5"

3. Add to .git/config:

        [merge "odctool"]
                name = BlackBox Compound Document merge driver
                driver = odctool merge -o %A -p HEAD %A -p PARENT %O -p BRANCH %B
        [diff "odctool"]
                name = BlackBox Compound Document diff driver
                command = odctool-gitdiff

4. Add to .git/info/attributes:

        *.odc merge=odctool diff=odctool

5. Optionally you can ignore some BlackBox related files if add to .git/info/exclude:


Now you can see diffs using `git diff' and resolve conflicts without converting odc to text.

Integration with ranger

1. To preview documents add to $HOME/.config/ranger/

        handle_extension() {
                case "${FILE_EXTENSION_LOWER}" in


                        # BlackBox Compound Document
                                odctool -C -X cat "${FILE_PATH}" && exit 5
                                exit 1;;

2. To open/read documents add to $HOME/.config/ranger/rifle.conf:

        ext odc, has odctool, terminal, file = odctool -C -X cat "$1" | less --tabs=2 -S

Current state

This is NOT final version of subsustem Diff and odctool. It is NOT well tested, you are warned!
Also, program and user interfaces are not stable yet, so it can be changed in future.
2019-03-23 DeaDDooMERfixed trap when open empty file master
2019-03-20 DeaDDooMERadded mode that show invisible spaces/tabs
2019-03-19 DeaDDooMERfix aliases for merge
2019-03-19 DeaDDooMERaliases can be applied for any file
2019-03-19 DeaDDooMERadded file conversion support
2019-03-18 DeaDDooMERadded new View print modes
2019-03-17 DeaDDooMERadded terminal detection
2019-03-16 DeaDDooMERadded highter argument count checking
2019-03-12 DeaDDooMERfixed formatting
2019-03-11 DeaDDooMERimplemented colorized output
2019-03-10 DeaDDooMERfix trap on linux when write to file
2019-03-10 DeaDDooMERadded integration with git diff
2019-03-10 DeaDDooMEReverything moved to sysbystem Diff, removed patch utili...
2018-12-16 DeaDDooMERAdded dedicated utility - odctool
2018-12-15 DeaDDooMERCommands now use DevCommanders and special syntax
2018-12-14 DeaDDooMERImplemented three-way merge
4 years ago master