1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-24 20:13:00 +03:00

write command refuse to write a scratch file when no filename is given

This commit is contained in:
Maxime Coste 2012-08-07 23:20:53 +02:00
parent 207f2f6bb9
commit 8e0f99a03b

View File

@ -271,6 +271,10 @@ void write_buffer(const CommandParameters& params, Context& context)
throw wrong_argument_count();
Buffer& buffer = context.window().buffer();
if (params.empty() and buffer.type() == Buffer::Type::Scratch)
throw runtime_error("cannot write scratch buffer without a filename");
String filename = params.empty() ? buffer.name()
: parse_filename(params[0]);