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

Width of popup_dialog() depends on wrap and showbreak values and exceeds window width #4701

Closed
bfrg opened this issue Jul 20, 2019 · 0 comments

Comments

@bfrg
Copy link
Contributor

bfrg commented Jul 20, 2019

Describe the bug
The popup window returned by popup_dialog() is drawn wider than it needs to be. The window width depends on the number of characters in showbreak.

To Reproduce

  1. Run vim --clean tmp.vim -c "source tmp.vim"
" tmp.vim
let &showbreak = '+++'

function! Popup_dialog_cb(id, result) abort
        echo a:result ? "YES" : "NO"
endfunction

call popup_dialog(['Do some action? (y/n)'], {
        \ 'filter': 'popup_filter_yesno',
        \ 'callback': 'Popup_dialog_cb'
        \ })
  1. The more characters are added to showbreak, the wider the popup dialog window gets, and eventually exceed the window width. Only by passing the popup window option {'wrap': v:false} to popup_dialog() will draw the dialog correctly.

Expected behavior
The width of the dialog window should not be drawn wider than the text displayed inside it.

Screenshots

let &showbreak = '+'

screenshot-2019-07-20_023917

let &showbreak = '++'

screenshot-2019-07-20_024000

let &showbreak = '+++'

screenshot-2019-07-20_024017

let &showbreak = '+++'`
" Pass {'wrap': v:false} to popup_dialog()

screenshot-2019-07-20_024033

Environment

  • Vim version 8.1.1714
  • Gentoo Linux
  • xfce4-terminal
manuelschiller pushed a commit to manuelschiller/vim that referenced this issue Nov 10, 2019
Problem:    Popup too wide when 'showbreak' is set.
Solution:   Set window width when computing line length. (closes vim#4701)
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

No branches or pull requests

1 participant