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,9 +161,14 @@ void edit(const ParametersParser& parser, Context& context, const ShellContext&)
{
if (parser.get_switch("scratch"))
{
if (Buffer* buf = buffer_manager.get_buffer_ifp(name))
buffer_manager.delete_buffer(*buf);
buffer = buffer_manager.create_buffer(name, Buffer::Flags::None);
if (buffer and (force_reload or buffer->flags() != Buffer::Flags::None))
{
buffer_manager.delete_buffer(*buffer);
buffer = nullptr;
}
if (not buffer)
buffer = buffer_manager.create_buffer(name, Buffer::Flags::None);
}
else if (auto fifo = parser.get_switch("fifo"))
buffer = open_fifo(name, *fifo, (bool)parser.get_switch("scroll"));