Me on Folding

sir_lichtkind on 2009-01-04T01:49:28

After a discussion, which wasn't that big like wished but i got me some insights. I was thinking about the whole thing but in the end its a no brainer. lot of people use recursive folding, it has advantages so i put it in. of course simple current node folding has to be in. thats the stepping stone for beginners. i took my new sibling fold because it was fastest and intuitive to me and of cause fold all if you want to clean up a mess.

the second stage was the key binding. renneb++ pointed out he wanted a key binding and since it is in the kephra policies to be able to do the way you prefer. it had to be in. poth you use most i made on easier to reach kombos alt+plus and alt+minus. the minussymbolize that its about one point (like in a enumeration list) and the plus is about more. and the to are related. for the other to ops you add the shift key. And from alt+minus to alt+shift+plus its alway more you fold (in average code). so all fits logically. i was really satisfied.

but then the mouse binding would be a problem becaue you have 3 keys and 4 actions. (you cant rely to have more keys on a mouse). right click is normally context menu but using that for folding is to complicated. i want just on clik nav and it should be done whatever you wish, or fairly close. leftclick is simple toggle fold. thats logical, understood and everybody does it, so can't touch that. middle have to be recursive all 4 folding ops perform a toggle mode. thats consistant because its looks like single fold and middle button is the next. but you do it not that ofen because once folded recursively you unfold you way mostly with simple left click. thats also a reason to put in on middle because people aren't used to click middle that oftern. and right click that is sibling fold. it looks a bit like opening context menu so the metapho fits. if searching for something you do it more often and people are more used to right click, so that fits too. but where to put fold all? after some fiddling and some practically nasty approaches i found somthing that first sounds nasty but does the thing better than expected. (yes volker p. ruleZZZ). right click when left button is down. that is the metaphor of doing all together and to take a inrun in other direction before approaching the big heap at once. since it doenst matter in which line you click it workes mostly very well. only if you fold the first head it unfolds because fold all orientes always on this first head. that can be somtimes nasty indeed but for my part the workflow is nearly natural.

Of course all the clicking has to take on the folding margin. i wrote some subs for the right margin detextion so context menu comes now only over edit area which was a long time wich of mine. i reached a lot of these goals in alst times which makes kephra hacking to real joy again. the margin number switch which clean some dark corners but has still one: if reload conf it breakesthe msontext menu binding for right click. have to figure somthing out but were not nearly to a stable version so its time. I also inserted (optional of cource) the folding flag line. thats nice because you always se where is the gap in the folded code. padre people left that out because the black colour was too abstusive to them and thy don't couldn't change default style because this is always visible and it woul make the normal text look silly.

actually it dindt because default style is displayed where no text is at all so you see jus beackground color sou you can colorize the foregrounf of the flag lines without any side effect. i did the in same color as the fold marker in the margin (that you can of course define in config soon in dialog too) so you can see that it belongs together. because i liked the folding marker theme of scite i enabled that too. (rotating arrows).

So now with Kephra 0.4.1.5 the chapter folding is closed and im really happy with it. to havy the most of this i have to rearrangethe main design of the widgets, and use the Wxnotebook in the intended way. and also use multiple stc instance instead of one and playing with doc pointers like i do now. that will also resolve some longstanding issues with unexpected jumpes of the visible text area when changing docs, which was another longterm issue of kephra. down side of this will maybe more RAM consumtion and i can't get stretched the tabbar over full window width when opening a panel on a side. but it will look more standeart and that tabbar belongs to the main editor unit. it also enables to make special pages like kommodo have. or insert dialogs on notebook pages. AUI will also follow but opional. so you have free draggable splitview of all doc panels.

good enough for tonight. it will be a while until 0.4.2.