From b46c9ac630d65fe4791d410b752624018359251b Mon Sep 17 00:00:00 2001 From: Delapouite Date: Tue, 19 Sep 2017 19:11:52 +0200 Subject: [PATCH] Add max_history_id in status printed with and --- src/buffer.hh | 1 + src/normal.cc | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/buffer.hh b/src/buffer.hh index 41b29b77..d677647a 100644 --- a/src/buffer.hh +++ b/src/buffer.hh @@ -142,6 +142,7 @@ public: bool redo(size_t count = 1) noexcept; bool move_to(size_t history_id) noexcept; size_t current_history_id() const noexcept; + size_t next_history_id() const noexcept { return m_next_history_id; } String string(BufferCoord begin, BufferCoord end) const; StringView substr(BufferCoord begin, BufferCoord end) const; diff --git a/src/normal.cc b/src/normal.cc index 6fad0772..9c1c7cf4 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1770,6 +1770,7 @@ void move_in_history(Context& context, NormalParams params) const int count = std::max(1, params.count); const int history_id = (int)buffer.current_history_id() + (direction == Direction::Forward ? count : -count); + const int max_history_id = (int)buffer.next_history_id() - 1; if (buffer.move_to((size_t)history_id)) { auto ranges = compute_modified_ranges(buffer, timestamp); @@ -1777,11 +1778,13 @@ void move_in_history(Context& context, NormalParams params) context.selections_write_only() = std::move(ranges); context.selections().avoid_eol(); - context.print_status({ format("moved to change #{}", history_id), + context.print_status({ format("moved to change #{} ({})", + history_id, max_history_id), get_face("Information") }); } else - context.print_status({ format("no such change: #{}", history_id), + context.print_status({ format("no such change: #{} ({})", + history_id, max_history_id), get_face("Information") }); }