feat: make indent_size always equal to tab_width in indent_mode tabs
This commit is contained in:
parent
4100585b03
commit
ed1fe30e74
1 changed files with 3 additions and 1 deletions
|
@ -460,9 +460,9 @@ pub const Editor = struct {
|
||||||
fn init(self: *Self, allocator: Allocator, n: Plane, buffer_manager: *Buffer.Manager) void {
|
fn init(self: *Self, allocator: Allocator, n: Plane, buffer_manager: *Buffer.Manager) void {
|
||||||
const logger = log.logger("editor");
|
const logger = log.logger("editor");
|
||||||
const frame_rate = tp.env.get().num("frame-rate");
|
const frame_rate = tp.env.get().num("frame-rate");
|
||||||
const indent_size = tui.config().indent_size;
|
|
||||||
const tab_width = tui.config().tab_width;
|
const tab_width = tui.config().tab_width;
|
||||||
const indent_mode = tui.config().indent_mode;
|
const indent_mode = tui.config().indent_mode;
|
||||||
|
const indent_size = if (indent_mode == .tabs) tab_width else tui.config().indent_size;
|
||||||
self.* = Self{
|
self.* = Self{
|
||||||
.allocator = allocator,
|
.allocator = allocator,
|
||||||
.plane = n,
|
.plane = n,
|
||||||
|
@ -683,10 +683,12 @@ pub const Editor = struct {
|
||||||
while (it.next()) |line| {
|
while (it.next()) |line| {
|
||||||
if (line.len == 0) continue;
|
if (line.len == 0) continue;
|
||||||
if (line[0] == '\t') {
|
if (line[0] == '\t') {
|
||||||
|
self.indent_size = self.tab_width;
|
||||||
self.indent_mode = .tabs;
|
self.indent_mode = .tabs;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
self.indent_size = tui.config().indent_size;
|
||||||
self.indent_mode = .spaces;
|
self.indent_mode = .spaces;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue