feat: add support for session local tab_width setting
This commit is contained in:
parent
63a527726a
commit
4037d67fe9
3 changed files with 8 additions and 2 deletions
|
@ -469,7 +469,7 @@ pub const Editor = struct {
|
|||
fn init(self: *Self, allocator: Allocator, n: Plane, buffer_manager: *Buffer.Manager) void {
|
||||
const logger = log.logger("editor");
|
||||
const frame_rate = tp.env.get().num("frame-rate");
|
||||
const tab_width = tui.config().tab_width;
|
||||
const tab_width = tui.get_tab_width();
|
||||
const indent_mode = tui.config().indent_mode;
|
||||
const indent_size = if (indent_mode == .tabs) tab_width else tui.config().indent_size;
|
||||
self.* = Self{
|
||||
|
|
|
@ -11,7 +11,7 @@ pub fn name(_: *Type) []const u8 {
|
|||
}
|
||||
|
||||
pub fn start(self: *Type) usize {
|
||||
const tab_width = if (tui.get_active_editor()) |editor| editor.tab_width else tui.config().tab_width;
|
||||
const tab_width = if (tui.get_active_editor()) |editor| editor.tab_width else tui.get_tab_width();
|
||||
self.input = tab_width;
|
||||
return tab_width;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ allocator: Allocator,
|
|||
rdr_: renderer,
|
||||
config_: @import("config"),
|
||||
config_bufs: [][]const u8,
|
||||
session_tab_width: ?usize = null,
|
||||
highlight_columns_: []const u16,
|
||||
highlight_columns_configured: []const u16,
|
||||
frame_time: usize, // in microseconds
|
||||
|
@ -1122,6 +1123,11 @@ pub fn config() *const @import("config") {
|
|||
return ¤t().config_;
|
||||
}
|
||||
|
||||
pub fn get_tab_width() usize {
|
||||
const self = current();
|
||||
return self.session_tab_width orelse self.config_.tab_width;
|
||||
}
|
||||
|
||||
pub fn highlight_columns() []const u16 {
|
||||
return current().highlight_columns_;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue