diff options
author | BlackEagle <ike.devolder@gmail.com> | 2019-07-13 14:30:49 +0200 |
---|---|---|
committer | BlackEagle <ike.devolder@gmail.com> | 2019-07-13 14:30:49 +0200 |
commit | e265b81a3ffef5ffcc6061a69cd04e3fb8556b57 (patch) | |
tree | f6f763f1e3949baa883050664a2dc2774e8100fb | |
parent | 7479feb58adce1e8397f183a89641d0310ce52a3 (diff) | |
parent | 78e938c24f3173bfa8fe628ceefda5f5f62d907c (diff) | |
download | vdebug-e265b81a3ffef5ffcc6061a69cd04e3fb8556b57.zip |
Merge branch 'Garethp-debugger-layouts'
* Garethp-debugger-layouts:
add documentation about layout and simplified status
move default layouts in python and have layout option
Fixing bad config
Another way to let people choose between layouts
-rw-r--r-- | doc/Vdebug.txt | 49 | ||||
-rw-r--r-- | plugin/vdebug.vim | 11 | ||||
-rw-r--r-- | python3/vdebug/ui/vimui.py | 76 |
3 files changed, 122 insertions, 14 deletions
diff --git a/doc/Vdebug.txt b/doc/Vdebug.txt index e138eda..54f7a1b 100644 --- a/doc/Vdebug.txt +++ b/doc/Vdebug.txt @@ -860,7 +860,9 @@ The default options look like this: > \ 'marker_open_tree' : '▾', \ 'sign_breakpoint' : '▷', \ 'sign_current' : '▶', - \ 'continuous_mode' : 1 + \ 'continuous_mode' : 1, + \ 'simplified_status': 1, + \ 'layout': 'vertical', \} < You can either use the multi-line notation like above, or set individual keys @@ -984,6 +986,51 @@ g:vdebug_options.continuous_mode (default = 1) requests. Press <F6> during a debugging session to stop this, or <Ctrl-C> when Vdebug is listening. +g:vdebug_options.simplified_status (default = 1) + When enabled the status will be shown in 1 line, if disabled you get a more + verbose status output + +g:vdebug_options.layout (default = 'vertical') + When layout is vertical, the debug session tab will have a vertical split + between the source window and the DebuggerStatus, DebuggerStack and + DebuggerWatch. + + +------------------------------------+-----------------------------------+ + | | DebuggerStatus | + | +-----------------------------------+ + | | DebuggerStack | + | | | + | | | + | SourceWindow +-----------------------------------+ + | | DebuggerWatch | + | | | + | | | + | | | + | | | + | | | + | | | + +------------------------------------+-----------------------------------+ + + When the layout is horizontal, the debug session tab will have a horizontal + split between the source window and the DebuggerStatus and DebuggerStack + will be split on the left next to the DebuggerWatch. + + +------------------------------------------------------------------------+ + | | + | | + | | + | SourceWindow | + | | + | | + | | + | | + +------------------------------------+-----------------------------------+ + | DebuggerStatus | | + +------------------------------------+ DebuggerWatch | + | DebuggerStack | | + | | | + +------------------------------------+-----------------------------------+ + ============================================================================== 6. Key maps *VdebugKeys* diff --git a/plugin/vdebug.vim b/plugin/vdebug.vim index c15ae2b..8d7962b 100644 --- a/plugin/vdebug.vim +++ b/plugin/vdebug.vim @@ -95,16 +95,7 @@ let g:vdebug_options_defaults = { \ 'background_listener' : 1, \ 'auto_start' : 1, \ 'simplified_status': 1, -\ 'window_commands' : { -\ 'DebuggerWatch' : 'below new', -\ 'DebuggerStack' : 'belowright new', -\ 'DebuggerStatus' : 'vertical leftabove new' -\ }, -\ 'window_size' : { -\ 'DebuggerWatch' : { 'height' : 15 }, -\ 'DebuggerStatus' : { 'height' : 1 }, -\ }, -\ 'window_arrangement' : ['DebuggerWatch', 'DebuggerStatus', 'DebuggerStack'] +\ 'layout': 'vertical', \} " Different symbols for non unicode Vims diff --git a/python3/vdebug/ui/vimui.py b/python3/vdebug/ui/vimui.py index 9d41da1..415e4c9 100644 --- a/python3/vdebug/ui/vimui.py +++ b/python3/vdebug/ui/vimui.py @@ -34,10 +34,27 @@ class WindowManager: "DebuggerTrace": 'rightbelow 7new' } self._commands = self._default_commands.copy() + self._default_layout = { + 'window_commands': { + 'DebuggerWatch': 'vertical belowright new', + 'DebuggerStack': 'aboveleft 12new', + 'DebuggerStatus': 'aboveleft 1new' + }, + 'window_size': { + }, + 'window_arrangement': [ + 'DebuggerWatch', + 'DebuggerStack', + 'DebuggerStatus' + ] + } + self._layout = None def open_all(self): self._refresh_commands() - arrangement = opts.Options.get('window_arrangement', list) + layout = self.get_layout() + arrangement = layout["window_arrangement"] + for name in arrangement: self.window(name).create(self._command(name)) @@ -85,9 +102,22 @@ class WindowManager: raise WindowError("No debugger window named '%s' - check your " "window options" % name) + def set_layout(self, layout): + self._layout = layout + + def get_layout(self): + if self._layout is None \ + or 'window_commands' not in self._layout \ + or 'window_arrangement' not in self._layout: + self.set_layout(self._default_layout) + + return self._layout + def _refresh_commands(self): self._commands = self._default_commands.copy() - self._commands.update(opts.Options.get('window_commands', dict)) + + updated_commands = self._layout["window_commands"] + self._commands.update(updated_commands) class Ui(interface.Ui): @@ -105,6 +135,39 @@ class Ui(interface.Ui): self.empty_buf_num = None self.selected_stack = None self.selected_context = 0 + self.default_layout = 'vertical' + self.layouts = { + 'vertical': { + 'window_commands': { + 'DebuggerWatch': 'vertical belowright new', + 'DebuggerStack': 'aboveleft 12new', + 'DebuggerStatus': 'aboveleft 1new' + }, + 'window_size': { + }, + 'window_arrangement': [ + 'DebuggerWatch', + 'DebuggerStack', + 'DebuggerStatus' + ] + }, + 'horizontal': { + 'window_commands': { + 'DebuggerWatch': 'below new', + 'DebuggerStack': 'belowright new', + 'DebuggerStatus': 'vertical leftabove new' + }, + 'window_size': { + 'DebuggerWatch': { 'height' : 15 }, + 'DebuggerStatus': { 'height' : 1 } + }, + 'window_arrangement': [ + 'DebuggerWatch', + 'DebuggerStatus', + 'DebuggerStack' + ] + } + } def mark_window_as_closed(self, name): self.windows.window(name).mark_as_closed() @@ -125,6 +188,12 @@ class Ui(interface.Ui): self.is_open = True try: + layout_option = opts.Options.get('layout', str) + + layout = self.layouts[layout_option] \ + if layout_option in self.layouts \ + else self.layouts[self.default_layout] + existing_buffer = True cur_buf_name = vim.current.buffer.name if cur_buf_name is None: @@ -140,11 +209,12 @@ class Ui(interface.Ui): self.tabnr = vim.current.tabpage.number + self.windows.set_layout(layout) self.windows.open_all() statuswin = self.windows.status() statuswin.set_status("loading") - window_sizes = opts.Options.get('window_size', dict) + window_sizes = layout["window_size"] if "window_size" in layout else {} for window_name, settings in window_sizes.items(): if 'height' in settings: self.windows.window(window_name).set_height(settings['height']) |