Recent

Author Topic: Fold API opinion  (Read 5044 times)

Alextp

  • Hero Member
  • *****
  • Posts: 1274
    • UVviewsoft
Fold API opinion
« on: June 15, 2015, 07:50:26 pm »
Martin;
i need suggestion about ATSynedit fold api. My api is

a) app can fold block by passin X=-1 and Y, Y2,==> hide lines Y to Y2, no [...] mark shown
b) app can fold block by passin X=1..100, Y, Y2==> hide part of line Y. [...] is shown. after column X.

How you see?

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7029
  • Debugger - SynEdit - and more
    • wiki
Re: Fold API opinion
« Reply #1 on: June 15, 2015, 08:46:22 pm »
I am not sure what you try to archive.

I dont know other editors that hide partial lines (at fold start). Also that raises the question what should happen when you type at the start of such a line.

SynEdit does track an x position:
   If foo() then begin if bar then begin
This line has 2 foldable blocks, x is needed to find the end.
Though this is partly obsolete, since folding of selection was added.

As for the [....] marker, personally I can see 2 desirable positions.
1) at the end of the line
2) at the end of line OR at the right site of the screen (keep visible for long lines)
I see no point in hiding any more of the line.




Alextp

  • Hero Member
  • *****
  • Posts: 1274
    • UVviewsoft
Re: Fold API opinion
« Reply #2 on: June 15, 2015, 09:04:51 pm »
First part of reply : has no sense for me
I asked other thing: you see my api enough? enough to 'emulate SynEdit' fold? U said u don't see 'fold from part' usable..
This works ok (though)even if I fold from char 4

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7029
  • Debugger - SynEdit - and more
    • wiki
Re: Fold API opinion
« Reply #3 on: June 15, 2015, 11:29:47 pm »
SynEdit supports nested and overlap folds.

That is you can have 2 or more fords start on the same line. Each of those fold can be folded, or unfolded and all states are stored.

Code: [Select]
   If foo() then begin if bar then begin
    // inner
    end;
  //outer
  end;

use the context menu on the [-] symbol, and you can fold either of the 2 begins.
- fold the 2/2 first
- then fold the 1/2
If you unfold the outer, the inner is still folded.

--------------------
As for API (for triggering by code) SynEdit does not currently offer much, it might in future.

However usercode can get access to  TSynEditFoldedView.
This has several methods. they take:
- the line
- an index: nth keyword (not the x pos, but the how-maniest foldable position)

SynEdit has (currently) no  concept of a position for the [...] marker. And I do not see this happen on a per fold base anyway.

SynEdit has a difference between fold and hide. (keep first line visible or not). Try selecting text, and folding it.



Alextp

  • Hero Member
  • *****
  • Posts: 1274
    • UVviewsoft
Re: Fold API opinion
« Reply #4 on: June 17, 2015, 01:24:33 am »
U posted info about Synedit. Thks. But i asked opinion about MY api.
no opinion i see. Ok.
I see info by you

Alextp

  • Hero Member
  • *****
  • Posts: 1274
    • UVviewsoft
Re: Fold API opinion
« Reply #5 on: June 17, 2015, 01:30:08 am »
Quote
However usercode can get access to  TSynEditFoldedView.
This has several methods. they take:
- the line
- an index: nth keyword

It is not needed inf for me. I don't need this inf. I don't want to know SE api
« Last Edit: June 17, 2015, 01:31:40 am by Alextp »

Septe

  • Jr. Member
  • **
  • Posts: 68
Re: Fold API opinion
« Reply #6 on: June 17, 2015, 06:45:38 am »
Alex,

You're really unclear about what you're saying.  From what I'm reading, I think English is not your main language.  Maybe if you know someone with good english, have that person help you write your request or you can write your request in your language and we can try to decipher it or someone on here may know it and help out.

Alextp

  • Hero Member
  • *****
  • Posts: 1274
    • UVviewsoft
Re: Fold API opinion
« Reply #7 on: June 17, 2015, 11:13:32 am »
Hm, maybe you didn't understand message since you don't get idea of Fold API. I wanted to see opinion about _my_ API

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7029
  • Debugger - SynEdit - and more
    • wiki
Re: Fold API opinion
« Reply #8 on: June 17, 2015, 03:09:49 pm »
To tell the truth, the API (a every API) is ok if it allows to do what the code behind is intended to do.
I do not know what that intend is, so I do not know if the API is good or not.

Your question does not say what happens if the user calls:
Code: [Select]
  FoldApiCall({y=} 10, {y2=} 19, {x=} 15);
  FoldApiCall({y=} 10, {y2=} 14, {x=} 25);

Is that allowed?
Will that create 2 independent folded blocks (nested), that can individually be unfolded without affecting the state of the other?

That is why I gave the example.

You also do not provide info on what and how provides foldable blocks. (e.g. position of begin ... end), or if there is an API to access this.

Since I could not tell from your description what your code does, I tried to answer your 2nd question
Quote
enough to 'emulate SynEdit' fold?
by giving you an examples of what would need to be possible in order to archive this.

« Last Edit: June 18, 2015, 01:12:12 am by Martin_fr »

Alextp

  • Hero Member
  • *****
  • Posts: 1274
    • UVviewsoft
Re: Fold API opinion
« Reply #9 on: June 17, 2015, 03:23:23 pm »
Martin
this reply/answer 's much better. Thanks

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 7029
  • Debugger - SynEdit - and more
    • wiki
Re: Fold API opinion
« Reply #10 on: June 17, 2015, 03:45:17 pm »
Also if you want to emulate SynEdit.

The above  is about nested folds.

SynEdit also has overlapping folds
Code: [Select]
  FoldApiCall({y=} 10, {y2=} 19, {x=} 15);
  FoldApiCall({y=} 17, {y2=} 24, {x=} 15);

Which also creates 2 foldblocks (though the [+]  of the 2nd is not visible, as it is in the 1st fold)

----------------
And SynEdit has "hide". It is similar to fold, but displays different.
I do not see in your API how to pass in this info.

Select text, and it will show a [-] for the text. But when you click [-] it displays a different symbol [v], and on the line above.)

Reason: If you click [-] the line, on which the [-] was is itself hidden. So it is not possible to display a [+] on this line. Hence the Symbol moves one line up.

If you do that on line 1 of the file, then there is no line above, so it goes to the line below [^]

---------------
The rest depends on the code using the API, and the code providing info what can be folded.
E.g. right click SynEdits fold gutter and see the context menu.

I assume the providing what can be folded is part of a different API?

 

TinyPortal © 2005-2018