Bug 58970 - don't collapse structure tree on save or document change
Summary: don't collapse structure tree on save or document change
Status: RESOLVED FIXED
Alias: None
Product: kile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Jeroen Wijnhout
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-05-26 10:39 UTC by mrudolf
Modified: 2004-08-06 21:43 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mrudolf 2003-05-26 10:39:34 UTC
Version:           CVS-2003-05-25 (using KDE KDE 3.1.1a)
OS:          Linux

Now after every save and document change, document structure tree is collapse and only first-level items are shown.

I suggest not to collapse structure tree in such case, leaving tree in current state. As an easy-to-implement replacement: allow configuring default tree expansion level.
Comment 1 Jeroen Wijnhout 2003-08-10 17:33:47 UTC
When switching between tabs, the structure view is now untouched. 
 
However upon save (or anything that implies an update of the structure view), the 
structure tree stills collapse. Will do something about this later. 
 
best, 
Jeroen 
Comment 2 Jeroen Wijnhout 2003-09-04 16:04:30 UTC
Fixed. You can now specify a default expansion level ( 1 = parts, 2 =chapters, ..., 5 = 
subsubsections). 
Comment 3 Jens 2004-01-28 12:07:28 UTC
Hi,

this does not work yet (at least as how I understand the bug).

When you save a changed file, I would like the expansion status to be _preserved_ for nodes that didn't change. I.e. for example, expand chapter 1 and some sections within it, but don't expand chapter 2.

Of course, added and removed nodes cannot be respected that way, but that is kind of obvious. I guess you recreate the whole tree when one saves the document, and that this makes preserving the status difficult. What about saving the nodes in an array like

expanded_status = array(
 labels = array(expanded=BOOL),
 toc = array(
   1 = array(
	name="title of first chapter",
	expanded=BOOL
   ), // no subchapters
   2 = array(
	name="...", expanded=BOOL,
	toc = array(
		name = "name of subchapter",
		expanded=BOOL,
		...
	),
	...
);

... and then use this after you recreated the tree, to restore the expansion status of each node - if it still exists. If it doesn't, just ignore it (and perhaps use the default expansion level).


Would that be possible?

Thanks for thinking about it! :-)
Comment 4 Jeroen Wijnhout 2004-01-30 13:30:18 UTC
Subject: Re:  don't collapse structure tree on save or document change

On Wednesday 28 January 2004 12:07, you wrote:
> this does not work yet (at least as how I understand the bug).
>
> When you save a changed file, I would like the expansion status to be
> _preserved_ for nodes that didn't change. I.e. for example, expand chapter
> 1 and some sections within it, but don't expand chapter 2.

Yes, I did not meant to say that the wish was fully implemented. You can only 
set the default expansion level (Settings->Configure Kile).

> Of course, added and removed nodes cannot be respected that way, but that
> is kind of obvious. I guess you recreate the whole tree when one saves the
> document, and that this makes preserving the status difficult. What about
> saving the nodes in an array like
<snip>
> ... and then use this after you recreated the tree, to restore the
> expansion status of each node - if it still exists. If it doesn't, just
> ignore it (and perhaps use the default expansion level).
>
>
> Would that be possible?

It would be possible I guess, but not so easy considering how the structure 
view is built internally. Since this part of the code is subject to change 
anyway, I will give it an extra thought.

best,
Jeroen

Comment 5 David Grant 2004-05-05 06:45:55 UTC
Can this bug be re-opened as the ultimate solution wasn't fixed?  Thanks.
Comment 6 Jeroen Wijnhout 2004-05-05 09:50:30 UTC
I have a patch for this somewhere, but it will take some time to 
1. find it 
2. modify it to the current situation

best,
Jeroen
Comment 7 Jeroen Wijnhout 2004-08-06 21:43:15 UTC
It is fixed (for a while already actually). Kile does it best to restore the structure view, it is only perfect if either the sections did not move or did not change their title.

best,
Jeroen