Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions nb
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,8 @@ Can't edit archives. Export archive and expand to edit.\\n"
touch "${_file_path:-}"
fi

eval "${_editor_command} \"${_file_path}\""
escaped=${_file_path//$/\\$}
eval "${_editor_command} \"$escaped\""
fi
}

Expand Down Expand Up @@ -5719,7 +5720,8 @@ _index() {
# grep -n "^${1:-}$" "${2:-}" | cut -f1 -d:
# awk 'match($0,v){print NR; exit}' v="^${1:-}$" "${2:-}"
# rg --color=never --line-number "^${1:-}$" "${2:-}" | cut -d: -f1
sed -n "/^${1:-}$/=" "${2:-}"
escaped=$(printf "%s" "${1:-}" | sed -e 's/[\[\*]/\\&/g')
sed -n "/^$escaped$/=" "${2:-}"
}

local _basename="${2:-}"
Expand Down Expand Up @@ -6427,7 +6429,8 @@ HEREDOC
local _item_identifier=
# use `sed` directly instead of `_index get_id` for performance
_item_identifier="$(
sed -n "/^${__basename:-}$/=" "${_notebook_path:-}/.index"
escaped=$(printf "%s" "${__basename:-}" | sed -e 's/[\[\*]/\\&/g')
sed -n "/^$escaped$/=" "${_notebook_path:-}/.index"
)"

local _max_identifier="${_max_id}"
Expand Down