Merge remote-tracking branch 'Delapouite/next-history-id'
This commit is contained in:
commit
626ccc09cc
|
@ -142,6 +142,7 @@ public:
|
||||||
bool redo(size_t count = 1) noexcept;
|
bool redo(size_t count = 1) noexcept;
|
||||||
bool move_to(size_t history_id) noexcept;
|
bool move_to(size_t history_id) noexcept;
|
||||||
size_t current_history_id() const 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;
|
String string(BufferCoord begin, BufferCoord end) const;
|
||||||
StringView substr(BufferCoord begin, BufferCoord end) const;
|
StringView substr(BufferCoord begin, BufferCoord end) const;
|
||||||
|
|
|
@ -1775,6 +1775,7 @@ void move_in_history(Context& context, NormalParams params)
|
||||||
const int count = std::max(1, params.count);
|
const int count = std::max(1, params.count);
|
||||||
const int history_id = (int)buffer.current_history_id() +
|
const int history_id = (int)buffer.current_history_id() +
|
||||||
(direction == Direction::Forward ? count : -count);
|
(direction == Direction::Forward ? count : -count);
|
||||||
|
const int max_history_id = (int)buffer.next_history_id() - 1;
|
||||||
if (buffer.move_to((size_t)history_id))
|
if (buffer.move_to((size_t)history_id))
|
||||||
{
|
{
|
||||||
auto ranges = compute_modified_ranges(buffer, timestamp);
|
auto ranges = compute_modified_ranges(buffer, timestamp);
|
||||||
|
@ -1782,11 +1783,13 @@ void move_in_history(Context& context, NormalParams params)
|
||||||
context.selections_write_only() = std::move(ranges);
|
context.selections_write_only() = std::move(ranges);
|
||||||
context.selections().avoid_eol();
|
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") });
|
get_face("Information") });
|
||||||
}
|
}
|
||||||
else
|
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") });
|
get_face("Information") });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user