Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@haya14busa
Copy link
Contributor

Hi

Problem

'statusline' is disable with builtin error which is cathced correctly

How To Reproduce

statusline_test.vimrc
set nocompatible

function! StatuslineKiller() abort
  try
    call eval('error!')
  catch
    return 'OK: error catched!'
  endtry
  return 'OK'
endfunction

set laststatus=2
set statusline=%{StatuslineKiller()}
  1. vim -u statusline_test.vimrc -i NONE -N
    • statusline shows 'OK: error catched!'
  2. :redrawstatus
    • " Press ENTER or type command to continue
    • Press <Enter>
    • statusline is disable (&statusline == '')

Expected

  1. vim -u statusline_test.vimrc -i NONE -N
  • statusline shows 'OK: error catched!'
  1. :redrawstatus
    • statusline shows 'OK: error catched!'

I fixed this problem and also added tests. Please include it.

Thanks.

Instead, we should check did_emsg (which I assume is an error actually
occur) and disable statusline and show an error message as well.
return ''
endfunction

function! Test_cached_error_in_statusline()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/cached/catched/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also in the title of this pull request

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be "caught".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 👍 I fixed it.

@haya14busa haya14busa changed the title 'statusline' is disable with builtin error which is cathced correctly 'statusline' is disable with builtin error which is caught correctly Apr 4, 2016
@brammool brammool closed this in a742e08 Apr 5, 2016
@haya14busa
Copy link
Contributor Author

Thanks 👍

micbou added a commit to micbou/vim that referenced this pull request Apr 5, 2016
- 7.4.1711: when using try/catch in 'statusline' it is still considered
  an error and the status line will be disabled. Check did_emsg instead
  of called_emsg. (haya14busa, closes vim#729)
- 7.4.1712: for plugins in packages, plugin authors need to take care of
  all dependencies. When loading "start" packages and for :packloadall,
  first add all directories to 'runtimepath' before sourcing plugins.
- 7.4.1713: gTK GUI doesn't work on Wayland. Specify that only the X11
  backend is allowed. (Simon McVittie)
- 7.4.1714: non-GUI specific settings in the gvimrc_example file. Move
  some settings to the vimrc_example file. Remove setting 'hlsearch'
  again. (suggested by Hirohito Higashi)
micbou added a commit to micbou/vim that referenced this pull request Apr 5, 2016
- 7.4.1711: When using try/catch in 'statusline' it is still considered
  an error and the status line will be disabled. Check did_emsg instead
  of called_emsg. (haya14busa, closes vim#729)
- 7.4.1712: For plugins in packages, plugin authors need to take care of
  all dependencies. When loading "start" packages and for :packloadall,
  first add all directories to 'runtimepath' before sourcing plugins.
- 7.4.1713: GTK GUI doesn't work on Wayland. Specify that only the X11
  backend is allowed. (Simon McVittie)
- 7.4.1714: Non-GUI specific settings in the gvimrc_example file. Move
  some settings to the vimrc_example file. Remove setting 'hlsearch'
  again. (suggested by Hirohito Higashi)
micbou added a commit to micbou/vim that referenced this pull request Apr 5, 2016
- 7.4.1711: When using try/catch in 'statusline' it is still considered
  an error and the status line will be disabled. Check did_emsg instead
  of called_emsg. (haya14busa, closes vim#729)
- 7.4.1712: For plugins in packages, plugin authors need to take care of
  all dependencies. When loading "start" packages and for :packloadall,
  first add all directories to 'runtimepath' before sourcing plugins.
- 7.4.1713: GTK GUI doesn't work on Wayland. Specify that only the X11
  backend is allowed. (Simon McVittie)
- 7.4.1714: Non-GUI specific settings in the gvimrc_example file. Move
  some settings to the vimrc_example file. Remove setting 'hlsearch'
  again. (suggested by Hirohito Higashi)
micbou added a commit to micbou/vim that referenced this pull request Apr 5, 2016
- 7.4.1711: When using try/catch in 'statusline' it is still considered
  an error and the status line will be disabled. Check did_emsg instead
  of called_emsg. (haya14busa, closes vim#729)
- 7.4.1712: For plugins in packages, plugin authors need to take care of
  all dependencies. When loading "start" packages and for :packloadall,
  first add all directories to 'runtimepath' before sourcing plugins.
- 7.4.1713: GTK GUI doesn't work on Wayland. Specify that only the X11
  backend is allowed. (Simon McVittie)
- 7.4.1714: Non-GUI specific settings in the gvimrc_example file. Move
  some settings to the vimrc_example file. Remove setting 'hlsearch'
  again. (suggested by Hirohito Higashi)
micbou added a commit to micbou/vim that referenced this pull request Apr 5, 2016
- 7.4.1711: When using try/catch in 'statusline' it is still considered
  an error and the status line will be disabled. Check did_emsg instead
  of called_emsg. (haya14busa, closes vim#729)
- 7.4.1712: For plugins in packages, plugin authors need to take care of
  all dependencies. When loading "start" packages and for :packloadall,
  first add all directories to 'runtimepath' before sourcing plugins.
- 7.4.1713: GTK GUI doesn't work on Wayland. Specify that only the X11
  backend is allowed. (Simon McVittie)
- 7.4.1714: Non-GUI specific settings in the gvimrc_example file. Move
  some settings to the vimrc_example file. Remove setting 'hlsearch'
  again. (suggested by Hirohito Higashi)
micbou added a commit to micbou/vim that referenced this pull request Apr 5, 2016
- 7.4.1711: When using try/catch in 'statusline' it is still considered
  an error and the status line will be disabled. Check did_emsg instead
  of called_emsg. (haya14busa, closes vim#729)
- 7.4.1712: For plugins in packages, plugin authors need to take care of
  all dependencies. When loading "start" packages and for :packloadall,
  first add all directories to 'runtimepath' before sourcing plugins.
- 7.4.1713: GTK GUI doesn't work on Wayland. Specify that only the X11
  backend is allowed. (Simon McVittie)
- 7.4.1714: Non-GUI specific settings in the gvimrc_example file. Move
  some settings to the vimrc_example file. Remove setting 'hlsearch'
  again. (suggested by Hirohito Higashi)
micbou added a commit to micbou/vim that referenced this pull request Apr 6, 2016
- 7.4.1711: When using try/catch in 'statusline' it is still considered
  an error and the status line will be disabled. Check did_emsg instead
  of called_emsg. (haya14busa, closes vim#729)
- 7.4.1712: For plugins in packages, plugin authors need to take care of
  all dependencies. When loading "start" packages and for :packloadall,
  first add all directories to 'runtimepath' before sourcing plugins.
- 7.4.1713: GTK GUI doesn't work on Wayland. Specify that only the X11
  backend is allowed. (Simon McVittie)
- 7.4.1714: Non-GUI specific settings in the gvimrc_example file. Move
  some settings to the vimrc_example file. Remove setting 'hlsearch'
  again. (suggested by Hirohito Higashi)
haya14busa pushed a commit to haya14busa/vim that referenced this pull request Apr 9, 2016
Problem:    When using try/catch in 'statusline' it is still considered an
            error and the status line will be disabled.
Solution:   Check did_emsg instead of called_emsg. (haya14busa, closes vim#729)
brcolow added a commit to brcolow/neovim that referenced this pull request Nov 25, 2016
Problem:    When using try/catch in 'statusline' it is still considered an
            error and the status line will be disabled.
Solution:   Check did_emsg instead of called_emsg. (haya14busa, closes vim/vim#729)

vim/vim@a742e08
brcolow added a commit to brcolow/neovim that referenced this pull request Nov 26, 2016
Problem:    When using try/catch in 'statusline' it is still considered an
            error and the status line will be disabled.
Solution:   Check did_emsg instead of called_emsg. (haya14busa, closes vim/vim#729)

vim/vim@a742e08
@haya14busa haya14busa deleted the fix-redrawstatusline-for-catched-error branch November 3, 2017 08:48
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.

4 participants