diff options
| author | Frank LENORMAND <lenormf@gmail.com> | 2018-07-03 14:34:48 +0300 |
|---|---|---|
| committer | Frank LENORMAND <lenormf@gmail.com> | 2018-07-03 14:34:48 +0300 |
| commit | dd17b20bbf397647397209a0f74fd91f1ed0ad5a (patch) | |
| tree | d8b9fff2b3718e5e6e8c41fdc931e2e00d1889bd /src | |
| parent | a13e36b4b7034af9085dbf5a69ab99ba2443030f (diff) | |
src: Allow the `edit` command to create readonly buffers
Diffstat (limited to 'src')
| -rw-r--r-- | src/commands.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/commands.cc b/src/commands.cc index b196f847..a2979783 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -255,6 +255,8 @@ void edit(const ParametersParser& parser, Context& context, const ShellContext&) } buffer->flags() &= ~Buffer::Flags::NoHooks; + if (parser.get_switch("readonly")) + buffer->flags() |= Buffer::Flags::ReadOnly; } Buffer* current_buffer = context.has_buffer() ? &context.buffer() : nullptr; @@ -286,6 +288,7 @@ ParameterDesc edit_params{ { "scratch", { false, "create a scratch buffer, not linked to a file" } }, { "debug", { false, "create buffer as debug output" } }, { "fifo", { true, "create a buffer reading its content from a named fifo" } }, + { "readonly", { false, "create a buffer in readonly mode" } }, { "scroll", { false, "place the initial cursor so that the fifo will scroll to show new data" } } }, ParameterDesc::Flags::None, 0, 3 }; |
