Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #650 Correct window positioning defaults #652

Merged
merged 2 commits into from
Sep 1, 2020

Conversation

raven42
Copy link
Collaborator

@raven42 raven42 commented Aug 31, 2020

Fixes #650
With default case having multiple vertically split windows, the tagbar
window should open on the far right of the screen. When the feature in
pull-request #630 was added, this behavior changed to open the tagbar
window relative to the current window. This commit will fix that by
allowing direct usage of the vim split options.

Validated the following cases for the old default values. These all
still behave the same way as prior to pull-request #630 when the tagbar
is activated in the active window shown in the below examples:

	" No options - tagbar on right, preview above
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| edit   | edit   | edit   | tagbar |
	|        | active |        |        |
	+--------+--------+--------+--------+

	" tagbar on left, preview above
	let g:tagbar_left = 1
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| tagbar | edit   | edit   | edit   |
	|        |        | active |        |
	+--------+--------+--------+--------+

	" tagbar on bottom, preview to right of tagbar
	let g:tagbar_vertical = 10
	+--------+---------------+--------+
	| edit   | edit          | edit   |
	|        | active        |        |
	|        +-----+---------+        |
	|        | tag | preview |        |
	+--------+-----+---------+--------+

	" tagbar on top, preview to the right of tagbar
	let g:tagbar_left = 1
	let g:tagbar_vertical = 10
	+--------+-----+---------+--------+
	| edit   | tag | preview | edit   |
	|        +-----+---------+        |
	|        | edit          |        |
	|        | active        |        |
	+--------+---------------+--------+

New values supported by #630 also all validated using the defined behavior

let g:tagbar_position = 'right'   " Behaves the same as no options
let g:tagbar_position = 'left'    " Behaves the same as g:tagbar_left = 1
let g:tagbar_position = 'bottom'  " Behaves the same as g:tagbar_vertical = <#>
let g:tagbar_position = 'top'     " Behaves the same as g:tagbar_left = 1 g:tagbar_vertical = <#>

With default case having multiple vertically split windows, the tagbar
window should open on the far right of the screen. When the feature in
pull-request 630 was added, this behavior changed to open the tagbar
window relative to the current window. This commit will fix that by
allowing direct usage of the vim split options.

Validated the following cases for the old default values. These all
still behave the same way as prior to pull-request 630 when the tagbar
is activated in the `active` window shown in the below examples:
```
	" No options
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| edit   | edit   | edit   | tagbar |
	|        | active |        |        |
	+--------+--------+--------+--------+

	" tagbar on left, preview above
	let g:tagbar_left = 1
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| tagbar | edit   | edit   | edit   |
	|        |        | active |        |
	+--------+--------+--------+--------+

	" tagbar on bottom, preview to right of tagbar
	let g:tagbar_vertical = 10
	+--------+---------------+--------+
	| edit   | edit          | edit   |
	|        | active        |        |
	|        +-----+---------+        |
	|        | tag | preview |        |
	+--------+-----+---------+--------+

	" tagbar on top, preview to the right of tagbar
	let g:tagbar_left = 1
	let g:tagbar_vertical = 10
	+--------+-----+---------+--------+
	| edit   | tag | preview | edit   |
	|        +-----+---------+        |
	|        | edit          |        |
	|        | active        |        |
	+--------+---------------+--------+

```

New values also all validated using the following:
```
" Behaves the same as no options
let g:tagbar_position = 'right'

" Behaves the same as g:tagbar_left = 1
let g:tagbar_position = 'left'

" Behaves the same as g:tagbar_vertical = <#>
let g:tagbar_position = 'bottom'

" Behaves the same as g:tagbar_left = 1 | g:tagbar_vertical = <#>
let g:tagbar_position = 'top'
```
@alerque
Copy link
Member

alerque commented Sep 1, 2020

Thanks @raven42, this is lookig good. I haven't actually had a chance to test drive it but the code looks sane.

@RoDuth have you tried this out yet in practice?

doc/tagbar.txt Outdated Show resolved Hide resolved
@RoDuth
Copy link

RoDuth commented Sep 1, 2020

Thanks for your effort on this @raven42, works for me.

@alerque I've given it a quick run around the block (behaves as expected), and agree that the code looks good to me, happy for you to merge it.

doc/tagbar.txt Outdated Show resolved Hide resolved
@alerque alerque merged commit e1c2c98 into preservim:master Sep 1, 2020
@raven42 raven42 deleted the window-positioning-fix branch September 1, 2020 14:29
@raven42 raven42 mentioned this pull request Oct 29, 2020
dev-hann added a commit to dev-hann/tagbar that referenced this pull request Sep 18, 2023
* Fix for window positioning
With default case having multiple vertically split windows, the tagbar
window should open on the far right of the screen. When the feature in
pull-request 630 was added, this behavior changed to open the tagbar
window relative to the current window. This commit will fix that by
allowing direct usage of the vim split options.

Validated the following cases for the old default values. These all
still behave the same way as prior to pull-request 630 when the tagbar
is activated in the `active` window shown in the below examples:
```
	" No options
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| edit   | edit   | edit   | tagbar |
	|        | active |        |        |
	+--------+--------+--------+--------+

	" tagbar on left, preview above
	let g:tagbar_left = 1
	+-----------------------------------+
	| preview                           |
	+--------+--------+--------+--------+
	| tagbar | edit   | edit   | edit   |
	|        |        | active |        |
	+--------+--------+--------+--------+

	" tagbar on bottom, preview to right of tagbar
	let g:tagbar_vertical = 10
	+--------+---------------+--------+
	| edit   | edit          | edit   |
	|        | active        |        |
	|        +-----+---------+        |
	|        | tag | preview |        |
	+--------+-----+---------+--------+

	" tagbar on top, preview to the right of tagbar
	let g:tagbar_left = 1
	let g:tagbar_vertical = 10
	+--------+-----+---------+--------+
	| edit   | tag | preview | edit   |
	|        +-----+---------+        |
	|        | edit          |        |
	|        | active        |        |
	+--------+---------------+--------+

```

New values also all validated using the following:
```
" Behaves the same as no options
let g:tagbar_position = 'right'

" Behaves the same as g:tagbar_left = 1
let g:tagbar_position = 'left'

" Behaves the same as g:tagbar_vertical = <#>
let g:tagbar_position = 'bottom'

" Behaves the same as g:tagbar_left = 1 | g:tagbar_vertical = <#>
let g:tagbar_position = 'top'
```

* preservim#650 - Fix typo in doc/tagbar.txt for g:tagbar_height option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to get back the old default (botright vertical) window position?
3 participants