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

Pressing <Enter> in insert mode in table breaks line wrapping #891

Closed
joe-antognini opened this issue May 27, 2020 · 3 comments
Closed

Pressing <Enter> in insert mode in table breaks line wrapping #891

joe-antognini opened this issue May 27, 2020 · 3 comments

Comments

@joe-antognini
Copy link

If I enter some data in a table, either in Markdown syntax or Vimwiki syntax and then go to another part of the file outside the table (possibly having exited insert mode) and start adding text, line wrapping no longer works. If I check :set textwidth I find that it gets set to 0 and doesn't go back to its original value.

I suspect that when entering data into a table Vimwiki turns off line wrapping by setting textwidth=0, but never reverts the setting to its original value.

  • This issue occurs both with Markdown and Vimwiki syntax.
  • This issue occurs on the dev branch as well as on master.
  • Output of :VimwikiShowVersion:
Os: Linux
Vim: 801
Branch: dev
Revision: c9e6afe
Date: 2020-05-26 23:09:58 +0200
@tinmarino
Copy link
Member

Can you add some example texts or screenshots please: not clear to me

@joe-antognini
Copy link
Author

If I start with a blank file in vimwiki, and then examine the textwidth via :set textwidth? it will be whatever the default is, say, 79.

Now let's say I enter insert mode and start to create a table:

| foo | bar |█

Now I press enter and vimwiki will know that this is a table and will start to auto-format:

| foo | bar |
|     ||

Now I return to normal mode and examine the textwidth variable via :set textwidth?. It will now be 0.

As I understand it, vimwiki sets textwidth to be 0 in order to line wrapping when formatting tables. But it should restore the user's original line wrapping settings once it is finished with the table. (Like once the user returns to normal mode the textwidth variable should reset to its previous value.)

@tinmarino tinmarino self-assigned this Jun 17, 2020
tinmarino added a commit to tinmarino/vimwiki that referenced this issue Jul 21, 2020
Issue: Pressing <Enter> in insert mode in table breaks line wrapping vimwiki#891
@tinmarino
Copy link
Member

Fixed: dfc5344 -> Removing the autocmd reseting tw (to zero)

    exe 'autocmd InsertEnter '.pat.' call vimwiki#tbl#reset_tw(line("."))'

deepredsky pushed a commit to deepredsky/vimwiki that referenced this issue Jan 16, 2021
Issue: Pressing <Enter> in insert mode in table breaks line wrapping vimwiki#891
jls83 pushed a commit to jls83/vimwiki that referenced this issue Jan 17, 2023
Issue: Pressing <Enter> in insert mode in table breaks line wrapping vimwiki#891
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants