vimwiki-backup / vimwiki

Automatically exported from code.google.com/p/vimwiki
1 stars 1 forks source link

Shortening of long URL breaks wrapping of text that follows on the same line #402

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open vimwiki within gvim
2. Write a line containing a long URL (that will be shortened using '~')
3. Add some text following the long URL, on the same line
4. Resize the gvim window

What is the expected output? What do you see instead?
-> Line wrapping is done in the wrong place; gvim will still count characters 
replaced with the '~' as if they were actually displayed.

What version of the product are you using? On what operating system?
-> 2.0.1 on Ubuntu Server 12.04.1

Please provide any additional information below.
-> n/a

Original issue reported on code.google.com by alexandr...@gmail.com on 4 Mar 2013 at 4:49

GoogleCodeExporter commented 8 years ago
Vim version: 7.3.429

Same thing also occurs when "[[URL|desc]]" is replaced with "desc" when the 
cursor is not on the line. Makes lines with multiple links basically unreadable.

Original comment by alexandr...@gmail.com on 11 Mar 2013 at 1:29

GoogleCodeExporter commented 8 years ago
It may be a bit hard for someone to follow your description, but I believe that 
what you are seeing is simply a result of Vim's implementation of its "conceal" 
feature. In particular, it has nothing to do with resizing of windows, and 
there is nothing that vimwiki could do to make the behaviour of concealed text 
more intuitive (aside from choosing not to use the feature).

That said, I agree that the perceived problem is quite disturbing at first, and 
some may never get accustomed to it. I am actually rather surprised that you 
are the first one to complain about it, I had expected a flood of complaints - 
this link concealing feature has been in the codebase perhaps for two years 
already.

What Vim does: it conceals text on each _screen line_ separately - this is 
presumably to avoid large-scale redrawing and shifting of text lines anytime 
you move cursor up and down the file. This way, only the text of the logical 
cursor line changes as you move the cursor, nothing else needs to be moved up 
or down. But for long concealed text, such as long URLs in Vimwiki, this means 
that the concealed form of a link might get strangely torn across lines, 
sometimes even separated by several empty lines.

It is this concealing behaviour which makes it difficult to do anything about 
concealing in tables - there is basically no way one could have both concealed 
form and at the same time visually aligned columns. Just as with links, it 
could work nicely only if unconcealed text fits on a single screen line, but 
not in general.

That said, this link concealing should be made optional in Vimwiki, even if one 
wants to keep using the simple concealing of one-character markers.

Original comment by tpospi...@gmail.com on 12 Mar 2013 at 2:33

GoogleCodeExporter commented 8 years ago
Hi ! Thanks for the quick reaction, and yes, this is exactly what I am seeing. 
I agree that the issue description was a bit cryptic, so for anyone reading 
this thread, here's what I am referring to:

-- what I write --
[[http://localhost/this-is-a-long-url|URL1]] 
[[http://localhost/this-is-another-long-URL|URL2]] this
 is trailing text

-- what I see when I move my cursor to another line --
URL1 URL2 this
 is trailing text

What you say about concealing and display/redrawing optimization makes perfect 
sense. After checking the vimwiki help, I ended up adding these lines in my 
.vimrc:
  set conceallevel=0
  let g:vimwiki_conceallevel = 0

But now it is no longer conceling anything, even [[WikiLink]] links -- the 
square brackets remain and this hampers readability. I have been using vimwiki 
1.2 for years and just recently decided to try 2.0, and frankly this is a step 
backwards in terms of usability -- I don't think shortening long blocks of text 
adds more value than it takes away, as opposed to hiding backtics and other 
one-character markers as in 1.2.

Your suggestion (option to keep simple concealing only) makes perfect sense.

Thanks for the work on vimwiki in any case -- one of the best and most 
efficient productivity tools around !

Original comment by alexandr...@gmail.com on 12 Mar 2013 at 3:39

GoogleCodeExporter commented 8 years ago
It is now possible to turn off link shortening, although it is still on by 
default. 
https://code.google.com/p/vimwiki/source/detail?r=5db3125c4e3d6ddd27f3df62b511b4
5db8d7a3bd

One has to use 
let g:vimwiki_url_maxsave = 0
in .vimrc

It is done both for the plain URLs and links with description, since I suppose 
that people who are bothered by one would also mind the other.

I had already put a remark on possible ugliness of concealed text in the 
documentation for that option some time ago, but now it is better explained 
what the problem is.

But the link markers (square brackets etc) will not be hidden if you turn it 
off: that would be possible to implement in principle, but it would require 
more additions to the code that is already dangerously obese, and who knows how 
much testing with all kinds of links, whose number I lost track of a long time 
ago.

The change I have pushed increased only the size of the documentation. One-char 
markers are still hidden, those are much less likely to cause any serious 
disturbance.

Original comment by tpospi...@gmail.com on 12 Mar 2013 at 8:44

GoogleCodeExporter commented 8 years ago
Seems to work nicely; I can probably live with the [[ ]] markers. Many thanks !

Original comment by alexandr...@gmail.com on 13 Mar 2013 at 8:47