From e4d6952d8cea29f2ed4178cd23397d6e09b73dec Mon Sep 17 00:00:00 2001 From: Frank LENORMAND Date: Tue, 21 Sep 2021 12:47:20 +0300 Subject: [PATCH] src: Show a `readonly` modeline tag when relevant --- src/client.cc | 2 ++ test/regression/3398-readonly-fifo-failure/script | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/client.cc b/src/client.cc index af1c4add..09a39288 100644 --- a/src/client.cc +++ b/src/client.cc @@ -143,6 +143,8 @@ String generate_context_info(const Context& context) s += "[fifo]"; if (context.buffer().flags() & Buffer::Flags::Debug) s += "[debug]"; + if (context.buffer().flags() & Buffer::Flags::ReadOnly) + s += "[readonly]"; return s; } diff --git a/test/regression/3398-readonly-fifo-failure/script b/test/regression/3398-readonly-fifo-failure/script index 6962c782..b1df0d62 100644 --- a/test/regression/3398-readonly-fifo-failure/script +++ b/test/regression/3398-readonly-fifo-failure/script @@ -2,7 +2,7 @@ ui_out '{ "jsonrpc": "2.0", "method": "set_ui_options", "params": [{}] }' ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "cyan", "underline": "default", "attributes": [] }, "contents": "\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }' ui_out '{ "jsonrpc": "2.0", "method": "menu_hide", "params": [] }' ui_out '{ "jsonrpc": "2.0", "method": "info_hide", "params": [] }' -ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch][fifo]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }' +ui_out '{ "jsonrpc": "2.0", "method": "draw_status", "params": [[], [{ "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "out 1:1 " }, { "face": { "fg": "black", "bg": "yellow", "underline": "default", "attributes": [] }, "contents": "[scratch][fifo][readonly]" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " " }, { "face": { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }, "contents": "1 sel" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": " - client0@[kak-tests]" }], { "fg": "cyan", "bg": "default", "underline": "default", "attributes": [] }] }' ui_out '{ "jsonrpc": "2.0", "method": "set_cursor", "params": ["buffer", { "line": 0, "column": 0 }] }' ui_out '{ "jsonrpc": "2.0", "method": "refresh", "params": [true] }' ui_out '{ "jsonrpc": "2.0", "method": "draw", "params": [[[{ "face": { "fg": "black", "bg": "white", "underline": "default", "attributes": [] }, "contents": "b" }, { "face": { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, "contents": "lah\u000a" }]], { "fg": "default", "bg": "default", "underline": "default", "attributes": [] }, { "fg": "blue", "bg": "default", "underline": "default", "attributes": [] }] }'