From 1584ea6fbe5a1ccc3902c511da81bf1c64a38d74 Mon Sep 17 00:00:00 2001 From: Axel Kappel <69117984+Kl4rry@users.noreply.github.com> Date: Tue, 30 Apr 2024 17:53:31 +0200 Subject: [PATCH] fix read only indicator --- crates/ferrite-core/src/buffer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ferrite-core/src/buffer.rs b/crates/ferrite-core/src/buffer.rs index 3c02f2b..3183d2f 100644 --- a/crates/ferrite-core/src/buffer.rs +++ b/crates/ferrite-core/src/buffer.rs @@ -162,7 +162,7 @@ impl Buffer { metadata.permissions().readonly() }; #[cfg(unix)] - let read_only_file = nix::unistd::access(path, nix::unistd::AccessFlags::R_OK).is_ok(); + let read_only_file = !nix::unistd::access(path, nix::unistd::AccessFlags::W_OK).is_ok(); let (encoding, rope) = read::read_from_file(path)?; let mut syntax = Syntax::new(get_buffer_proxy());