feat: display indent mode in status bar

This commit is contained in:
CJ van den Berg 2025-08-08 21:30:42 +02:00
parent 009972309c
commit aee7c30c65
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
3 changed files with 24 additions and 14 deletions

View file

@ -330,6 +330,7 @@ pub const Editor = struct {
dirty: bool = false,
eol_mode: Buffer.EolMode = .lf,
utf8_sanitized: bool = false,
indent_mode: IndentMode = .spaces,
} = .{},
file_type: ?file_type_config = null,
@ -1647,8 +1648,8 @@ pub const Editor = struct {
buf.lsp_version += 1;
}
if (self.last.eol_mode != eol_mode or self.last.utf8_sanitized != utf8_sanitized)
try self.send_editor_eol_mode(eol_mode, utf8_sanitized);
if (self.last.eol_mode != eol_mode or self.last.utf8_sanitized != utf8_sanitized or self.last.indent_mode != self.indent_mode)
try self.send_editor_eol_mode(eol_mode, utf8_sanitized, self.indent_mode);
if (self.last.dirty != dirty)
try self.send_editor_dirty(dirty);
@ -1775,8 +1776,8 @@ pub const Editor = struct {
tp.self_pid().send(.{ "cmd", "save_file", .{} }) catch {};
}
fn send_editor_eol_mode(self: *const Self, eol_mode: Buffer.EolMode, utf8_sanitized: bool) !void {
_ = try self.handlers.msg(.{ "E", "eol_mode", @intFromEnum(eol_mode), utf8_sanitized });
fn send_editor_eol_mode(self: *const Self, eol_mode: Buffer.EolMode, utf8_sanitized: bool, indent_mode: IndentMode) !void {
_ = try self.handlers.msg(.{ "E", "eol_mode", eol_mode, utf8_sanitized, indent_mode });
}
fn clamp_abs(self: *Self, abs: bool) void {