mirror of
https://github.com/tbabej/taskwiki.git
synced 2025-08-20 01:03:06 +02:00
util: Compute the size of the split properly for vertical splits
This commit is contained in:
parent
97698b2162
commit
7cbc7d1f0a
1 changed files with 7 additions and 1 deletions
|
@ -88,8 +88,14 @@ def selected_line_numbers():
|
||||||
return range(vim.current.range.start, vim.current.range.end + 1)
|
return range(vim.current.range.start, vim.current.range.end + 1)
|
||||||
|
|
||||||
def show_in_split(lines, size=None, position="belowright", vertical=False):
|
def show_in_split(lines, size=None, position="belowright", vertical=False):
|
||||||
|
# Compute the size of the split
|
||||||
if size is None:
|
if size is None:
|
||||||
size = len(lines)
|
if vertical:
|
||||||
|
# Maximum number of columns used + small offset
|
||||||
|
size = max([len(l) for l in lines]) + 5
|
||||||
|
else:
|
||||||
|
# Number of lines
|
||||||
|
size = len(lines)
|
||||||
|
|
||||||
# Call 'vsplit' for vertical, otherwise 'split'
|
# Call 'vsplit' for vertical, otherwise 'split'
|
||||||
vertical_prefix = 'v' if vertical else ''
|
vertical_prefix = 'v' if vertical else ''
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue