ale icon indicating copy to clipboard operation
ale copied to clipboard

Nvim floating window border displaying wrong

Open Tloe opened this issue 3 years ago • 2 comments

NVIM v0.4.4 Build type: Release Linux Manjaro

image

I've done some debugging in the code. In the below I print the line number, the output of strdisplaywidth() of the current line and the line string. strdisplaywidth() seems to show the correct length where \t is expanded and counted as 4 tabs (which is what I have setup as you can see in the buffer behind the floating window) and " is counted as 1 char.. I know " is two chars, but as far as I understand strdisplaywidth should show what is being displayed and " should be displayed as ".. But looking at the screenshot it seems like one \t is displayed as one space and two \t\t is displayed as 3 spaces in the preview window?

'0 20 type Config struct {'
"1 139 \tAuthlyIDServiceKEY  string `yaml:\"authlyid_servicekey\"  env:\"AUTHLYID_SERVICEKEY\"`  //will be generated and stored in service. not here"
"2 139 \tAuthlyWEBServiceKEY string `yaml:\"authlyweb_servicekey\" env:\"AUTHLYWEB_SERVICEKEY\"` //will be generated and stored in service. not here"
"3 32 \tFiles               struct {"
"4 66 \t\tLog string `yaml:\"log\"                      env:\"LOGFILE\"`"
"5 5 \t}"
"6 19 \tDomain struct {"
"7 70 \t\tName string `yaml:\"domain\"                  env:\"DOMAIN_NAME\"`"
"8 69 \t\tUrl  string `yaml:\"url\"                     env:\"DOMAIN_URL\"`"
"9 70 \t\tPort string `yaml:\"port\"                    env:\"DOMAIN_PORT\"`"
"10 5 \t}"
"11 17 \tLdap struct {"
"12 67 \t\tUrl     string `yaml:\"url\"                  env:\"LDAP_URL\"`"
"13 68 \t\tPort    string `yaml:\"port\"                 env:\"LDAP_PORT\"`"
"14 71 \t\tSslPort string `yaml:\"sslport\"              env:\"LDAP_SSLPORT\"`"
"15 5 \t}"
"16 18 \tRedis struct {"
"17 68 \t\tUrl  string `yaml:\"url\"                     env:\"REDIS_URL\"`"
"18 69 \t\tPort string `yaml:\"port\"                    env:\"REDIS_PORT\"`"
"19 5 \t}"
'20 1 }'

Not sure what the correct fix would be here? Is there a function we can run on the lines to expand the \t's before its set in the floating window? This is go code btw where tabs are enforced.

I have a local change where I can set the max height of the preview window. Thats why its so tall in the screenshot.

:ALEInfo

Current Filetype: go Available Linters: ['bingo', 'gobuild', 'gofmt', 'golangci-lint', 'golint', 'gometalinter', 'gopls', 'gosimple', 'gotype', 'govet', 'golangserver', 'revive', 'staticcheck'] Linter Aliases: 'gobuild' -> ['go build'] 'govet' -> ['go vet'] Enabled Linters: ['golint', 'gopls'] Ignored Linters: [] Suggested Fixers: 'gofmt' - Fix Go files with go fmt. 'goimports' - Fix Go files imports with goimports. 'remove_trailing_lines' - Remove all blank lines at the end of a file. 'trim_whitespace' - Remove all trailing whitespace characters at the end of every line. Linter Variables:

let g:ale_go_go_executable = 'go' let g:ale_go_goimports_executable = 'goimports' let g:ale_go_goimports_options = '' let g:ale_go_golangci_lint_executable = 'golangci-lint' let g:ale_go_golangci_lint_options = '--enable-all' let g:ale_go_golangci_lint_package = 0 let g:ale_go_golint_executable = 'golint' let g:ale_go_golint_options = '' let g:ale_go_gopls_executable = 'gopls' let g:ale_go_gopls_init_options = {} let g:ale_go_gopls_options = '--mode stdio' let g:ale_go_langserver_executable = 'go-langserver' let g:ale_go_langserver_options = '' Global Variables:

let g:ale_cache_executable_check_failures = v:null let g:ale_change_sign_column_color = 0 let g:ale_command_wrapper = '' let g:ale_completion_delay = 100 let g:ale_completion_enabled = 1 let g:ale_completion_max_suggestions = 50 let g:ale_disable_lsp = 0 let g:ale_echo_cursor = 0 let g:ale_echo_msg_error_str = 'Error' let g:ale_echo_msg_format = '%code: %%s' let g:ale_echo_msg_info_str = 'Info' let g:ale_echo_msg_warning_str = 'Warning' let g:ale_enabled = 1 let g:ale_fix_on_save = 1 let g:ale_fixers = {'*': ['remove_trailing_lines', 'trim_whitespace']} let b:ale_fixers = ['gofmt', 'goimports'] let g:ale_history_enabled = 1 let g:ale_history_log_output = 1 let g:ale_keep_list_window_open = 0 let g:ale_lint_delay = 200 let g:ale_lint_on_enter = 1 let g:ale_lint_on_filetype_changed = 1 let g:ale_lint_on_insert_leave = 1 let g:ale_lint_on_save = 1 let g:ale_lint_on_text_changed = 'always' let g:ale_linter_aliases = {} let g:ale_linters = {} let b:ale_linters = ['gopls', 'golint'] let g:ale_linters_explicit = 0 let g:ale_linters_ignore = {} let g:ale_list_vertical = 0 let g:ale_list_window_size = 10 let g:ale_loclist_msg_format = '%code: %%s' let g:ale_max_buffer_history_size = 20 let g:ale_max_signs = -1 let g:ale_maximum_file_size = v:null let g:ale_open_list = 0 let g:ale_pattern_options = v:null let g:ale_pattern_options_enabled = v:null let g:ale_root = {} let g:ale_set_balloons = 0 let g:ale_set_highlights = 1 let g:ale_set_loclist = 1 let g:ale_set_quickfix = 0 let g:ale_set_signs = 1 let g:ale_sign_column_always = 0 let g:ale_sign_error = '' let g:ale_sign_info = '' let g:ale_sign_offset = 1000000 let g:ale_sign_style_error = '' let g:ale_sign_style_warning = '' let g:ale_sign_warning = '' let g:ale_sign_highlight_linenrs = 0 let g:ale_statusline_format = v:null let g:ale_type_map = {} let g:ale_use_global_executables = v:null let g:ale_virtualtext_cursor = 0 let g:ale_warn_about_trailing_blank_lines = 1 let g:ale_warn_about_trailing_whitespace = 1 Command History:

(executable check - success) golint (finished - exit code 0) ['/usr/bin/zsh', '-c', '''golint'' ''/tmp/nvimYp8fTs/2/app.go''']

<<<OUTPUT STARTS>>> /tmp/nvimYp8fTs/2/app.go:25:6: exported type Context should have comment or be unexported /tmp/nvimYp8fTs/2/app.go:28:2: exported const Production should have comment (or a comment on this block) or be unexported /tmp/nvimYp8fTs/2/app.go:33:6: exported type App should have comment or be unexported /tmp/nvimYp8fTs/2/app.go:41:1: exported function NewApp should have comment or be unexported /tmp/nvimYp8fTs/2/app.go:75:2: var authlyId should be authlyID /tmp/nvimYp8fTs/2/app.go:104:1: exported method App.Run should have comment or be unexported /tmp/nvimYp8fTs/2/app.go:111:1: exported method App.CheckPrintStack should have comment or be unexported /tmp/nvimYp8fTs/2/app.go:119:1: exported method App.DeleteDb should have comment or be unexported <<<OUTPUT ENDS>>>

(executable check - success) gopls (started) ['/usr/bin/zsh', '-c', '''gopls'' --mode stdio'] (finished - exit code 0) ['/usr/bin/zsh', '-c', '''golint'' ''/tmp/nvimYp8fTs/4/app.go''']

<<<OUTPUT STARTS>>> /tmp/nvimYp8fTs/4/app.go:25:6: exported type Context should have comment or be unexported /tmp/nvimYp8fTs/4/app.go:28:2: exported const Production should have comment (or a comment on this block) or be unexported /tmp/nvimYp8fTs/4/app.go:33:6: exported type App should have comment or be unexported /tmp/nvimYp8fTs/4/app.go:41:1: exported function NewApp should have comment or be unexported /tmp/nvimYp8fTs/4/app.go:75:2: var authlyId should be authlyID /tmp/nvimYp8fTs/4/app.go:104:1: exported method App.Run should have comment or be unexported /tmp/nvimYp8fTs/4/app.go:111:1: exported method App.CheckPrintStack should have comment or be unexported /tmp/nvimYp8fTs/4/app.go:119:1: exported method App.DeleteDb should have comment or be unexported <<<OUTPUT ENDS>>>

(finished - exit code 0) ['/usr/bin/zsh', '-c', '''golint'' ''/tmp/nvimYp8fTs/7/app.go''']

<<<OUTPUT STARTS>>> /tmp/nvimYp8fTs/7/app.go:25:6: exported type Context should have comment or be unexported /tmp/nvimYp8fTs/7/app.go:28:2: exported const Production should have comment (or a comment on this block) or be unexported /tmp/nvimYp8fTs/7/app.go:33:6: exported type App should have comment or be unexported /tmp/nvimYp8fTs/7/app.go:41:1: exported function NewApp should have comment or be unexported /tmp/nvimYp8fTs/7/app.go:75:2: var authlyId should be authlyID /tmp/nvimYp8fTs/7/app.go:104:1: exported method App.Run should have comment or be unexported /tmp/nvimYp8fTs/7/app.go:111:1: exported method App.CheckPrintStack should have comment or be unexported /tmp/nvimYp8fTs/7/app.go:119:1: exported method App.DeleteDb should have comment or be unexported <<<OUTPUT ENDS>>>

(finished - exit code 0) ['/usr/bin/zsh', '-c', '''golint'' ''/tmp/nvimYp8fTs/8/app.go''']

<<<OUTPUT STARTS>>> /tmp/nvimYp8fTs/8/app.go:25:6: exported type Context should have comment or be unexported /tmp/nvimYp8fTs/8/app.go:28:2: exported const Production should have comment (or a comment on this block) or be unexported /tmp/nvimYp8fTs/8/app.go:33:6: exported type App should have comment or be unexported /tmp/nvimYp8fTs/8/app.go:41:1: exported function NewApp should have comment or be unexported /tmp/nvimYp8fTs/8/app.go:75:2: var authlyId should be authlyID /tmp/nvimYp8fTs/8/app.go:104:1: exported method App.Run should have comment or be unexported /tmp/nvimYp8fTs/8/app.go:111:1: exported method App.CheckPrintStack should have comment or be unexported /tmp/nvimYp8fTs/8/app.go:119:1: exported method App.DeleteDb should have comment or be unexported <<<OUTPUT ENDS>>>

(finished - exit code 0) ['/usr/bin/zsh', '-c', '''golint'' ''/tmp/nvimYp8fTs/11/app.go''']

<<<OUTPUT STARTS>>> /tmp/nvimYp8fTs/11/app.go:25:6: exported type Context should have comment or be unexported /tmp/nvimYp8fTs/11/app.go:28:2: exported const Production should have comment (or a comment on this block) or be unexported /tmp/nvimYp8fTs/11/app.go:33:6: exported type App should have comment or be unexported /tmp/nvimYp8fTs/11/app.go:41:1: exported function NewApp should have comment or be unexported /tmp/nvimYp8fTs/11/app.go:75:2: var authlyId should be authlyID /tmp/nvimYp8fTs/11/app.go:104:1: exported method App.Run should have comment or be unexported /tmp/nvimYp8fTs/11/app.go:111:1: exported method App.CheckPrintStack should have comment or be unexported /tmp/nvimYp8fTs/11/app.go:119:1: exported method App.DeleteDb should have comment or be unexported <<<OUTPUT ENDS>>>

(finished - exit code 0) ['/usr/bin/zsh', '-c', '''golint'' ''/tmp/nvimYp8fTs/25/app.go''']

<<<OUTPUT STARTS>>> /tmp/nvimYp8fTs/25/app.go:25:6: exported type Context should have comment or be unexported /tmp/nvimYp8fTs/25/app.go:28:2: exported const Production should have comment (or a comment on this block) or be unexported /tmp/nvimYp8fTs/25/app.go:33:6: exported type App should have comment or be unexported /tmp/nvimYp8fTs/25/app.go:41:1: exported function NewApp should have comment or be unexported /tmp/nvimYp8fTs/25/app.go:75:2: var authlyId should be authlyID /tmp/nvimYp8fTs/25/app.go:104:1: exported method App.Run should have comment or be unexported /tmp/nvimYp8fTs/25/app.go:111:1: exported method App.CheckPrintStack should have comment or be unexported /tmp/nvimYp8fTs/25/app.go:119:1: exported method App.DeleteDb should have comment or be unexported <<<OUTPUT ENDS>>>

Tloe avatar Mar 06 '21 10:03 Tloe

I got another smaller and easier example of the same:

image

'0 17 error interface {'
"1 18 \tError() string"
'2 1 }'

Still think the example above is important though as it shows that two \t is shown with 3 spaces.

Tloe avatar Mar 06 '21 11:03 Tloe

This issue is still present today. :slightly_smiling_face:

BarrensZeppelin avatar Apr 12 '22 07:04 BarrensZeppelin