diff options
| author | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-08 22:31:44 -0400 |
|---|---|---|
| committer | TJ DeVries <devries.timothyj@gmail.com> | 2020-10-08 22:31:44 -0400 |
| commit | 59497d664086c4c7aa24a15a1c3b9ccf718ce9c7 (patch) | |
| tree | fc418ff9dbfd96579ccb897c0f15f47c19894bb6 /lua/telescope/pickers/layout_strategies.lua | |
| parent | 7938ace0f6681e5bd5207283036b496416879c67 (diff) | |
feat: Do a bit better sorting for command history
To be honest, I'm not 100% sure this is fantastic, but it's definitely a
step in the right direction for command history.
Closes: #150
Diffstat (limited to 'lua/telescope/pickers/layout_strategies.lua')
| -rw-r--r-- | lua/telescope/pickers/layout_strategies.lua | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/lua/telescope/pickers/layout_strategies.lua b/lua/telescope/pickers/layout_strategies.lua index b43466c..390c748 100644 --- a/lua/telescope/pickers/layout_strategies.lua +++ b/lua/telescope/pickers/layout_strategies.lua @@ -75,17 +75,22 @@ layout_strategies.horizontal = function(self, max_columns, max_lines) end)(self, max_columns, max_lines) local picker_height = max_lines - 2 * height_padding - preview.width = resolve.resolve_width(layout_config.preview_width or function(_, cols) - if not self.previewer or cols < self.preview_cutoff then - return 0 - elseif cols < 150 then - return math.floor(cols * 0.4) - elseif cols < 200 then - return 80 - else - return 120 - end - end)(self, picker_width, max_lines) + if self.previewer then + preview.width = resolve.resolve_width(layout_config.preview_width or function(_, cols) + if not self.previewer or cols < self.preview_cutoff then + return 0 + elseif cols < 150 then + return math.floor(cols * 0.4) + elseif cols < 200 then + return 80 + else + return 120 + end + end)(self, picker_width, max_lines) + else + preview.width = 0 + end + results.width = picker_width - preview.width prompt.width = picker_width - preview.width @@ -114,7 +119,7 @@ layout_strategies.horizontal = function(self, max_columns, max_lines) end return { - preview = preview.width > 0 and preview, + preview = self.previewer and preview.width > 0 and preview, results = results, prompt = prompt } @@ -174,7 +179,7 @@ layout_strategies.center = function(self, columns, lines) preview.col = results.col return { - preview = self.previewer and preview, + preview = self.previewer and preview.width > 0 and preview, results = results, prompt = prompt } @@ -246,7 +251,7 @@ layout_strategies.vertical = function(self, max_columns, max_lines) end return { - preview = preview.width > 0 and preview, + preview = self.previewer and preview.width > 0 and preview, results = results, prompt = prompt } |
