summaryrefslogtreecommitdiff
path: root/src/context.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-12-12 18:22:05 +1100
committerMaxime Coste <mawww@kakoune.org>2017-12-12 18:22:05 +1100
commit4b06c09c684b633a9cb746c7dbe3d715cf5c6777 (patch)
tree7a99a8d1ad1342e41cbf346cc71575246b50d34c /src/context.cc
parentce2c0e54f4608483480ee22109b95f318cbea12a (diff)
Make `edit` command work fine when running from an empty context
This way, the kind of context we get from a piped command allows for opening a buffer and working with it directly.
Diffstat (limited to 'src/context.cc')
-rw-r--r--src/context.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/context.cc b/src/context.cc
index ef2a999f..da23aac1 100644
--- a/src/context.cc
+++ b/src/context.cc
@@ -159,10 +159,10 @@ void JumpList::forget_buffer(Buffer& buffer)
void Context::change_buffer(Buffer& buffer)
{
- if (&buffer == &this->buffer())
+ if (has_buffer() and &buffer == &this->buffer())
return;
- if (m_edition_level > 0)
+ if (has_buffer() and m_edition_level > 0)
this->buffer().commit_undo_group();
m_window.reset();