Do not force recreate scratch buffers by default, require edit! for that

This commit is contained in:
Maxime Coste 2016-05-17 19:41:24 +01:00
parent 49e674fe55
commit fb01c8c377

View File

@ -161,8 +161,13 @@ void edit(const ParametersParser& parser, Context& context, const ShellContext&)
{ {
if (parser.get_switch("scratch")) if (parser.get_switch("scratch"))
{ {
if (Buffer* buf = buffer_manager.get_buffer_ifp(name)) if (buffer and (force_reload or buffer->flags() != Buffer::Flags::None))
buffer_manager.delete_buffer(*buf); {
buffer_manager.delete_buffer(*buffer);
buffer = nullptr;
}
if (not buffer)
buffer = buffer_manager.create_buffer(name, Buffer::Flags::None); buffer = buffer_manager.create_buffer(name, Buffer::Flags::None);
} }
else if (auto fifo = parser.get_switch("fifo")) else if (auto fifo = parser.get_switch("fifo"))