mirror of
https://github.com/mawww/kakoune.git
synced 2024-11-15 01:11:09 +03:00
Do not jump to buffer start on g.
with no previous modifications
This commit is contained in:
parent
1f4ad0f25e
commit
bfaf52f8c0
@ -726,7 +726,7 @@ void Buffer::run_hook_in_own_context(StringView hook_name, StringView param, Str
|
||||
hooks().run_hook(hook_name, param, hook_handler.context());
|
||||
}
|
||||
|
||||
BufferCoord Buffer::last_modification_coord() const
|
||||
Optional<BufferCoord> Buffer::last_modification_coord() const
|
||||
{
|
||||
if (m_history_cursor.get() == &m_history)
|
||||
return {};
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "coord.hh"
|
||||
#include "constexpr_utils.hh"
|
||||
#include "enum.hh"
|
||||
#include "optional.hh"
|
||||
#include "safe_ptr.hh"
|
||||
#include "scope.hh"
|
||||
#include "shared_string.hh"
|
||||
@ -163,12 +164,12 @@ public:
|
||||
bool is_valid(BufferCoord c) const;
|
||||
bool is_end(BufferCoord c) const;
|
||||
|
||||
BufferCoord last_modification_coord() const;
|
||||
|
||||
BufferIterator begin() const;
|
||||
BufferIterator end() const;
|
||||
LineCount line_count() const;
|
||||
|
||||
Optional<BufferCoord> last_modification_coord() const;
|
||||
|
||||
StringView operator[](LineCount line) const
|
||||
{ return m_lines[line]; }
|
||||
|
||||
|
@ -306,9 +306,11 @@ void goto_commands(Context& context, NormalParams params)
|
||||
{
|
||||
context.push_jump();
|
||||
auto pos = buffer.last_modification_coord();
|
||||
if (pos >= buffer.back_coord())
|
||||
if (not pos)
|
||||
throw runtime_error("no last modification position");
|
||||
if (*pos >= buffer.back_coord())
|
||||
pos = buffer.back_coord();
|
||||
select_coord<mode>(buffer, pos, context.selections());
|
||||
select_coord<mode>(buffer, *pos, context.selections());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user