From 78fc88ae6dd472cfa575cb762c31390a480b6ca4 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 24 Jul 2016 22:53:44 +0100 Subject: [PATCH] Display some information when moving in history --- src/normal.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/normal.cc b/src/normal.cc index 544fa08f0..50f7ca61f 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -1449,18 +1449,22 @@ void move_in_history(Context& context, NormalParams params) { Buffer& buffer = context.buffer(); size_t timestamp = buffer.timestamp(); - const size_t count = (size_t)std::max(1, params.count); - const size_t history_id = buffer.current_history_id() + + const int count = std::max(1, params.count); + const int history_id = (int)buffer.current_history_id() + (direction == Direction::Forward ? count : -count); - if (buffer.move_to(history_id)) + if (buffer.move_to((size_t)history_id)) { auto ranges = compute_modified_ranges(buffer, timestamp); if (not ranges.empty()) context.selections_write_only() = std::move(ranges); context.selections().avoid_eol(); + + context.print_status({ format("moved to change #{}", history_id), + get_face("Information") }); } else - context.print_status({ "nothing left to redo", get_face("Information") }); + context.print_status({ format("no such change: #{}", history_id), + get_face("Information") }); } void exec_user_mappings(Context& context, NormalParams params)