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

Concealed text causes vim to wrap before window width #260

Closed
GoogleCodeExporter opened this issue Aug 18, 2015 · 19 comments
Closed

Concealed text causes vim to wrap before window width #260

GoogleCodeExporter opened this issue Aug 18, 2015 · 19 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Execute ":setlocal conceallevel=3 concealcursor=nvic |syn match Foo conceal 
'^....................'".
2. Make vim window narrow, say ~40 columns.
3. Type "The quick brown fox jumps over the lazy dog." twice.

What is the expected output? What do you see instead?
Vim should not wrap the line until the visible text actually reaches the edge 
of the window, but it wraps apparently 20 columns before the edge, as if the 
concealed characters still contribute to the effective length.

What version of the product are you using? On what operating system?
vim 7.4.430 on Ubuntu Linux 14.04

Original issue reported on code.google.com by dbarn...@google.com on 22 Sep 2014 at 6:41

@GoogleCodeExporter
Copy link
Author

See screenshot. Note the cursor is at "1,41", which is wrapped onto the second 
line even though "dog." fits on the previous line.

Original comment by dbarn...@google.com on 22 Sep 2014 at 6:44

Attachments:

@GoogleCodeExporter
Copy link
Author

This is how it is expected to work.  Wrapping works on the actual characters, 
no matter whether they are not visible or replaced by another character.
It would be possible to add an option to make it behave the other way, but it's 
going to be a lot of work (and slow).

Original comment by brammool...@gmail.com on 22 Sep 2014 at 7:47

  • Changed state: WontFix

@GoogleCodeExporter
Copy link
Author

I would argue that wrapping is a purely visual thing, and so the most sensible 
thing to do would be to have it work on actually visible characters. Otherwise 
you will get very confusing wrapping behaviour.

Original comment by j...@opencloud.com on 13 Oct 2014 at 12:36

@GoogleCodeExporter
Copy link
Author

Since in conceal mode the current cursor line has its concealed characters 
shown, wrapping based on visible characters would result in the lines being 
re-wrapped as you moved the cursor around the file. Even if this wasn't slow, 
it could create a very unpleasant "wobbling" visual effect.

Original comment by vince.ne...@gmail.com on 13 Oct 2014 at 6:52

@nhooyr
Copy link

nhooyr commented Jan 2, 2017

What about when concealcursor=nvic? Then it should only wrap on what is visible.

edit: whoops, didn't see concealcursor=nvic in the original post.

@nhooyr
Copy link

nhooyr commented Jan 2, 2017

Also, horizontal scrolling doesn't scroll on only visible text.

@louwers
Copy link

louwers commented Jan 3, 2017

@nhooyr It should, but it's not the case.

@nhooyr
Copy link

nhooyr commented Jan 3, 2017

@louwers in the original post, the person has concealcursor=nvic set though?

@louwers
Copy link

louwers commented Jan 3, 2017

@nhooyr Yes, so for that setting it's incorrect that it would create a wobbling effect or that it would be slow. However, there's still the issue of it being a lot of work to implement.

Are you working on a patch? Personally I think it would be worth it, because without correct wrapping the conceal feature has little use, at least to me.

@ao2
Copy link

ao2 commented Jul 18, 2017

And as mentioned by @brammool in https://groups.google.com/forum/#!topic/vim_dev/ZQTXsL4Tdyg on lines where there is some concealed text, positioning the cursor with the mouse also fails.

As aside effect of these bugs the AnsiEsc plugin which uses conceal to hide the ANSI escape sequences is not that useful either.

@henrebotha
Copy link

I know this is wontfix, but I would like to add my 2c that it be reconsidered. My use case: I write notes in markdown syntax, using this plugin for syntax highlighting. The plugin helpfully defines conceals for URL patterns (like [this](https://github.com/vim/vim/issues/260)).

I'd like my notes to remain reasonably readable. With long URLs, it becomes a challenge. The "correct" answer here is set conceallevel > 0; however, due to also using set wrap, this completely breaks the flow of reading. I may as well not use conceal at all.

The behaviour I think anyone would expect is that wrapping happens based on visible characters only.

If we can map out what all needs to be done to implement this change, I'd be willing to help.

@ihadgraft
Copy link

For pages that contain reference information or a solution (most of my cases) I do this:

  • Create a new page in vimwiki
  • On the new page, I paste relevant content from the URL, add a summary, metadata, annotations, the source URL, and whatever else is useful

A quick way I've come up with to get nicely-formatted, easily "yankable" content from a URL is to use Pandoc and pipe the output right into vim:

$ pandoc -o - -t markdown ${SOME_URL} | vim - 

Creating my own page is a bit more up-front work but has a couple of nice advantages:

  • The reference / solution itself is searchable in the wiki
  • I often don't have to deal with a browser on repeat visits if I've done a good job capturing the critical information.
  • Links in the wiki are far easier to deal with

If there are cases where this solution wouldn't work or would be annoying, I might use a URL shortener. But I'm finding that most things I need to link to directly every time are site home pages or maybe one level deep, so they aren't causing issues to begin with.

@kflu
Copy link

kflu commented Aug 25, 2021

I know this is wontfix, but I would like to add my 2c that it be reconsidered. My use case: I write notes in markdown syntax, using this plugin for syntax highlighting. The plugin helpfully defines conceals for URL patterns (like [this](https://github.com/vim/vim/issues/260)).

I'd like my notes to remain reasonably readable. With long URLs, it becomes a challenge. The "correct" answer here is set conceallevel > 0; however, due to also using set wrap, this completely breaks the flow of reading. I may as well not use conceal at all.

The behaviour I think anyone would expect is that wrapping happens based on visible characters only.

If we can map out what all needs to be done to implement this change, I'd be willing to help.

I want to make the same point as this comment, but mainly using the below screenshots to give an idea:

image

image

This is how emacs markdown-mode looks like (with the equivalence of set wrap)

image

image

@mtwebb
Copy link

mtwebb commented Jan 4, 2022

+1 to this. The visual example above is great, and there are many other use cases this would enable (hide footnotes, or notes to self in long prose work).

@tusktenon
Copy link

Another vote for fixing this issue. I love Vim and use it for almost everything, but I still find myself using Emacs for Markdown and Org files. The ability to conceal links and still have properly wrapped lines is a huge advantage; I almost never need to bother with a separate viewer application.

@hneutr
Copy link

hneutr commented Jan 4, 2023

Adding a vote for a fix to this issue — definitely funky for invisible content to cause wrapping.

@flechtwerkflechtwerk
Copy link

I'd also love this to be reconsidered. I use comments in Markdown a lot and would like to conceal them, but it truly messes up my lines.

@WhiteBlackGoose
Copy link

WhiteBlackGoose commented Mar 9, 2023

Bump

Am using orgmode, also need it XD

@ychin
Copy link
Contributor

ychin commented Mar 13, 2023

Just something random I have been dealing with: conceal also affects hard tab character positioning. In fact, if you read Vim documentation, it makes liberal uses of hard tabs and the alignment of the docs assume that conceal characters still count towards the hard tabs (in fact vimhelp.org only recently fixed this issue to make the online documentation look correct alignment-wise c4rlo/vimhelp#23). So if we fix this this probably need to be a toggleable option unless we fix up all the docs (and not sure if others rely on this as well).

flatheadmill added a commit to flatheadmill/dotfiles that referenced this issue Apr 19, 2023
See vim/vim#260. Might be fixed by NeoVIM
soonish with their "anticonceal" project.

Also: nvim-neorg/neorg#292
Also: neovim/neovim#14409
Also: neovim/neovim#9496

Including `gettysburg.md` to check when conceal is working property, if
ever. Note that everyone claims that concel works better in Emacs.
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