:(before "End Primitive Recipe Declarations")
_BROWSE_TRACE,
:(before "End Primitive Recipe Numbers")
put(Recipe_ordinal, "$browse-trace", _BROWSE_TRACE);
:(before "End Primitive Recipe Checks")
case _BROWSE_TRACE: {
break;
}
:(before "End Primitive Recipe Implementations")
case _BROWSE_TRACE: {
start_trace_browser();
break;
}
:(after "Commandline Parsing")
if (argc == 3 && is_equal(argv[1], "browse-trace")) {
load_trace(argv[2]);
start_trace_browser();
return 0;
}
:(before "End Globals")
set<int> Visible;
int Top_of_screen = 0;
int Last_printed_row = 0;
map<int, int> Trace_index;
:(code)
void start_trace_browser() {<# Compatible with ranger 1.4.2 through 1.7.*
#
# Automatically change the directory in bash after closing ranger
#
# This is a bash function for .bashrc to automatically change the directory to
# the last visited one after ranger quits.
# To undo the effect of this function, you can type "cd -" to return to the
# original directory.
function ranger-cd {
tempfile="$(mktemp -t tmp.XXXXXX)"
/usr/bin/ranger --choosedir="$tempfile" "${@:-$(pwd)}"
test -f "$tempfile" &&
if [ "$(cat -- "$tempfile")" != "$(echo -n `pwd`)" ]; then
cd -- "$(cat "$tempfile")"
fi
rm -f -- "$tempfile"
}
# This binds Ctrl-O to ranger-cd:
bind '"\C-o":"ranger-cd\C-m"'