Skip to content

Commit 4598846

Browse files
committed
refactor: picker width/height
1 parent 6abdcf6 commit 4598846

File tree

4 files changed

+10
-7
lines changed

4 files changed

+10
-7
lines changed

lua/leetcode/picker/language/snacks.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ return function(question, cb)
1919
end
2020

2121
picker.pick({
22-
source = "select",
2322
items = finder_items,
2423
format = function(item)
2524
local ret = {}
@@ -36,8 +35,10 @@ return function(question, cb)
3635
title = t("Available Languages"),
3736
layout = {
3837
preview = false,
38+
preset = "select",
3939
layout = {
40-
height = math.floor(math.min(vim.o.lines * 0.8 - 10, #items + 2) + 0.5),
40+
height = language_picker.height,
41+
width = language_picker.width,
4142
},
4243
},
4344
actions = {

lua/leetcode/picker/question/init.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ local Picker = require("leetcode.picker")
99
local P = {}
1010

1111
P.width = 100
12-
P.height = 20
12+
P.height = 0.6
1313

1414
---@param items lc.cache.Question[]
1515
---@param opts table<string, string[]>

lua/leetcode/picker/question/snacks.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ return function(questions, opts)
1919
end
2020

2121
picker.pick({
22-
source = "select",
2322
items = finder_items,
2423
format = function(item)
2524
local ret = {}
@@ -35,9 +34,11 @@ return function(questions, opts)
3534
end,
3635
title = t("Select a Question"),
3736
layout = {
37+
preset = "select",
3838
preview = false,
3939
layout = {
40-
height = math.floor(math.min(vim.o.lines * 0.8 - 10, #items + 2) + 0.5),
40+
height = question_picker.height,
41+
width = question_picker.width,
4142
},
4243
},
4344
actions = {

lua/leetcode/picker/tabs/snacks.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ return function(tabs)
2121
end
2222

2323
picker.pick({
24-
source = "select",
2524
items = finder_items,
2625
format = function(item)
2726
local ret = {}
@@ -38,8 +37,10 @@ return function(tabs)
3837
title = t("Select a Question"),
3938
layout = {
4039
preview = false,
40+
preset = "select",
4141
layout = {
42-
height = math.floor(math.min(vim.o.lines * 0.8 - 10, #items + 2) + 0.5),
42+
height = tabs_picker.height,
43+
width = tabs_picker.width,
4344
},
4445
},
4546
actions = {

0 commit comments

Comments
 (0)