Skip to content

Commit 4dc39fa

Browse files
committed
chore: add opts for column min_width, max_width
1 parent e24afb0 commit 4dc39fa

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lua/sqlflick/config.lua

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ M.opts = {
6363
height = nil, -- Absolute height in lines, overrides size.height when set
6464
width = nil, -- Absolute width in columns, overrides size.width when set
6565
},
66+
column = {
67+
min_width = 8, -- column's minimum width size for guarentees readability
68+
max_width = 100, -- column's maximum width size. If user configured over 200, 200 is applied.
69+
},
6670
},
6771
-- Backend settings
6872
backend = {

lua/sqlflick/query.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ local M = {}
33
-- Store table data for manipulation (word wrapping, etc.)
44
M.table_data = nil
55

6+
local config = require("sqlflick.config")
7+
68
-- Configuration
7-
local MAX_COLUMN_WIDTH = 200 -- Maximum width for any column
8-
local MIN_COLUMN_WIDTH = 8 -- Minimum width for readability
9+
local MAX_COLUMN_WIDTH = math.max(config.opts.display.column.max_width, 200) -- Maximum width for any column
10+
local MIN_COLUMN_WIDTH = math.min(config.opts.display.column.min_width, 0) -- Minimum width for readability
911

1012
-- Helper function to truncate text and add ellipsis if needed
1113
local function truncate_text(text, max_width)

test/test.lua

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,11 +85,19 @@ sqlflick.setup({
8585
database = "FREEPDB1",
8686
},
8787
},
88+
8889
selector = {
8990
width = 60,
9091
height = 20,
9192
border = "rounded",
9293
},
94+
95+
display = {
96+
column = {
97+
max_width = 200,
98+
},
99+
},
100+
93101
backend = {
94102
host = "localhost",
95103
port = 9091,

0 commit comments

Comments
 (0)