diff options
author | BlackEagle <ike.devolder@gmail.com> | 2018-10-20 22:55:42 +0200 |
---|---|---|
committer | BlackEagle <ike.devolder@gmail.com> | 2018-10-20 22:55:42 +0200 |
commit | aaea9baa55ac43e061f54c9c3fac5f52b1057307 (patch) | |
tree | 2fd852998742186d3850ad9bc46dbea97b60101d /python3 | |
parent | d3d16726140dfa65a5b86c92e093bd1bc298dd9c (diff) | |
download | vdebug-aaea9baa55ac43e061f54c9c3fac5f52b1057307.zip |
fix exception when setting wrong options in vim window via python
Signed-off-by: BlackEagle <ike.devolder@gmail.com>
Diffstat (limited to 'python3')
-rw-r--r-- | python3/vdebug/ui/vimui.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/python3/vdebug/ui/vimui.py b/python3/vdebug/ui/vimui.py index 855f173..3463705 100644 --- a/python3/vdebug/ui/vimui.py +++ b/python3/vdebug/ui/vimui.py @@ -441,6 +441,15 @@ class Window(interface.Window): def getwinnr(self): return int(vim.eval("bufwinnr('%s')" % self.name)) + def set_height(self, height): + height = int(height) + minheight = int(vim.eval("&winminheight")) + if height < minheight: + height = minheight + if height <= 0: + height = 1 + self.command('resize %i' % height) + def write(self, msg, return_focus=True, after="normal G"): self._buffer.write(msg, return_focus, lambda: self.command(after)) @@ -459,11 +468,11 @@ class Window(interface.Window): vim.command('silent %s %s' % (open_cmd, self.name)) vim.current.buffer.options['buftype'] = 'nofile' vim.current.buffer.options['modifiable'] = True - vim.current.buffer.window['winfixheight'] = True - vim.current.buffer.window['winfixwidth'] = True - vim.current.buffer.window['swapfile'] = False - vim.current.buffer.window['number'] = False - vim.current.buffer.window['relativenumber'] = False + vim.current.buffer.options['swapfile'] = False + vim.current.window.options['winfixheight'] = True + vim.current.window.options['winfixwidth'] = True + vim.current.window.options['number'] = False + vim.current.window.options['relativenumber'] = False existing_content = self._buffer.contents() log.Log("Setting buffer for %s: %s" % (self.name, existing_content), log.Logger.DEBUG) |