On Dec 17, 6:46 am, Ben Schmidt <[email protected]> wrote:
> >> Problems I am running into include:
> >> * handling the line number
>
> I'm not sure what you mean by that.

I mean inserting the fold column before the line number, adding fold
text after the line number, then duplicating the line number (with the
fold column) for any folded text. The current logic builds the entire
line left-to-right and (basically, thought not strictly true) doesn't
look back. I need to add logic that (for the opening line in a fold)
uses the line number and the line text multiple times.

>
> >> * getting the fold text for folds that aren't currently closed
>
> I thought of that. I think you'll have to :set foldlevel=0 at the start
> of 2html to deal with this. The real difficulty is if you want to
> preserve the current fold state; I wouldn't.

I did want to preserve the current fold state, so that the fallback
without a javascript-enable browser is to show the current fold state
(since you won't be able to toggle them). I think it can be done by
detecting if the fold is closed, and using "normal! zc" to close it
temporarily to get the fold text, immediately opening it once the fold
text is retrieved. It's just more logic to add. I think the first
working patch will just do as you suggest.

>
> >> * handling multiple folds that open on the same line
>
> And that. I think you have to solve that one by opening the folds one at
> a time after you process each, until you've exhausted all the folds at a
> given line.

Yeah, probably. Since we'll need to open them anyway, we may as well
close them back up later.

>
> > I think we don't need the foldcolumn in HTML.  One can click on the fold
> > to open it, and on the text to close it again.  That's a lot simpler and
> > removes the not-so-nice-looking fold column.
>
> How do you solve the ambiguity problem when there are two folds starting
> on the same line without the foldcolumn though (i.e. whether a click
> should open the second fold or close the first)? If they can appear
> beside each other in the foldcolumn, as in the prototype, that solves
> that problem quite nicely. I think.
>
> Are there other edge cases that need to be accounted for?
>

The other problem I saw with not using the fold column was the fact
that URLs are automatically converted to links by the script. I
envision that if we use the text itself as the link to toggle the
fold, we'd just surround every line with an <a> tag. Since you can't
nest <a> elements, we'd need to break the link used to toggle the
fold, ending it just before the URL and beginning it again afterwards.
Completely doable, but it adds additional complexity.

I think the issue of 2 folds starting on the same line is more of a
problem. I'm not actually sure how we could handle that one.
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui