Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions doc/pages/expansions.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,11 @@ The following expansions are supported (with required context _in italics_):
history), and each _modification_ is presented as in
`%val{uncommitted_modifications}`.

*%val{history_since_id}*::
_in buffer, window scope_ +
a partial history of the buffer in the same format as `%val{history}`
starting after entry _id_

*%val{history_id}*::
_in buffer, window scope_ +
history id of the current buffer, an integer value which refers to a
Expand Down
2 changes: 1 addition & 1 deletion src/buffer_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ static String modification_as_string(const Buffer::Modification& modification)
modification.content->strview());
}

Vector<String> history_as_strings(const Vector<Buffer::HistoryNode>& history)
Vector<String> history_as_strings(ConstArrayView<Buffer::HistoryNode> history)
{
Vector<String> res;
for (auto& node : history)
Expand Down
2 changes: 1 addition & 1 deletion src/buffer_utils.hh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ void write_buffer_to_backup_file(Buffer& buffer);

void write_to_debug_buffer(StringView str);

Vector<String> history_as_strings(const Vector<Buffer::HistoryNode>& history);
Vector<String> history_as_strings(ConstArrayView<Buffer::HistoryNode> history);
Vector<String> undo_group_as_strings(const Buffer::UndoGroup& undo_group);

String generate_buffer_name(StringView pattern);
Expand Down
7 changes: 7 additions & 0 deletions src/main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,13 @@ static const EnvVarDesc builtin_env_vars[] = { {
"history", false,
[](StringView name, const Context& context) -> Vector<String>
{ return history_as_strings(context.buffer().history()); }
}, {
"history_since_", true,
[](StringView name, const Context& context) -> Vector<String>
{ return history_as_strings(
ArrayView(context.buffer().history())
.subrange(str_to_int(name.substr(14_byte)) + 1)
); }
}, {
"uncommitted_modifications", false,
[](StringView name, const Context& context) -> Vector<String>
Expand Down
Loading