Thursday, June 21, 2012

Re: TOhtml - select without linenr

On Wednesday, June 20, 2012 6:35:50 PM UTC-5, Tarlika Elisabeth Schmitz wrote:
> On Mon, 14 May 2012 11:45:00 -0500
> Benjamin Fritz <fritzophrenic@gmail.com> wrote:
>
> >> >Dynamic folding [...]
> >>
> >> Could you attach an example?
> >> I don't use folding, not even in vim. Maybe I get an idea if I see
> >> the HTML output in action.
> >
> >Attached is the output of TOhtml on the netrwPlugin.vim
>
>
> It gets very complex once you take into consideration display/nodisplay
> of line numbers in combination with dynamic folding/no folding.
>

Yes, that's one of the problems the design must be able to solve. I'm not sure that putting the lines in an <ol> and using the list index as the line number as in your example will work in combination with folding, and it will take some doing for conversions starting in the middle of the file. Plus this will only make the line numbers uncopyable, when I also want the fold column.

>
> Just to confirm briefly: folding can be nested, hence the column is of
> dynamic width?
>

Yes, folding can be nested, and the width in the generated HTML depends on the greater of the max foldlevel in the document, and the 'foldcolumn' setting in Vim. In Vim in is just the 'foldcolumn' setting.

> Is the line number column of dynamic width depending on number of total
> lines?
>

Yes. With a minimum width (in characters) equal to the 'numberwidth' option in Vim.

Thanks for looking into this some more. If you come up with an alternative do let me know, but as soon as I get a chance to run some tests and look over the results, I'll have a release candidate based on the <input> method. To make the page render faster I modified it to not use one <input> per character, but to size a single <input> according to the number of characters, with the 'ch' unit if supported or a fallback to calculate the size with javascript.

I'll put that out no later than this weekend. Did you have a problem with the functionality of the <input> method? I mentioned I don't like it because it feels like such a hack, but I've yet to see a viable alternative.

By the way, I tried inline SVG as an alternative, but even though it's an "image", all the browsers supporting it allow selecting it as text, so that's not a solution. Interestingly, SVG pulled in from an external file in an <object> tag is NOT selectable. But I don't want to generate dozens of files for a single page with :TOhtml; part of the idea is for it to generate a self-contained easily share-able file.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment