View Issue Details

IDProjectCategoryView StatusLast Update
0038843PackagesPackagespublic2021-05-04 23:58
ReporterMartok Assigned ToMartin Friebe  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Summary0038843: SynEdit: AutoIndent ignores tab configuration
DescriptionWith a Synedit configured to use Tabs for indentation, eoAutoIndent still uses space characters.

Manual Smart Indent with [Tab] at the start of an empty line (eoSmartTabs) works correctly, so the code for it is already there somewhere.
Steps To Reproduce- Set SynEdit
    BlockIndent = 0
    BlockTabIndent = 1
    Options = Options - [eoTabsToSpaces] + [eoShowSpecialChars]
    Options2 += [eoCaretSkipTab]

- Indent a line using [Tab], Put some text
-> Text is indented with tabs
- Press [Enter]
-> new line is now indented with spaces, not tabs
TagsNo tags attached.
Fixed in Revision
LazTarget-
Widgetset
Attached Files

Activities

Martok

2021-05-02 19:56

reporter  

ff00bb5a36[1].png (3,026 bytes)   
ff00bb5a36[1].png (3,026 bytes)   

Martin Friebe

2021-05-02 20:46

manager   ~0130724

AutoIndent is done by TSynBeautifier and that has it's own settings.

The default class (none language specific beautifier) has
SynEdit.Beautifier.IndentType

which can be
  TSynBeautifierIndentType = (
    sbitSpace,
    sbitCopySpaceTab, // copy indent as it is on previous line.
    sbitPositionCaret,
    sbitConvertToTabSpace, // convert to tabs, fill with spcaces if needed
    sbitConvertToTabOnly // convert to tabs, even if shorter
  );

So you want one of the last two.

Does that solve the issue, or is there still a bug after setting those values?

Martok

2021-05-02 23:03

reporter   ~0130729

Another setting? Hm. Could this be documented somewhere?
Default Beautifier properties set in Object Inspector are not saved to LFM so this has to be set in code, is that intentional?

On a more general note, that means that, so far:
- block indent of selections uses BlockIndent/BlockTabIndent
- smart indent from [Tab] at line start uses CreateTabsAndSpaces(TabWidth)
- autoindent uses the Beautifier
All of these have completely different rules and depending on which one you happen to hit, the resulting text looks completely different. Is it really supposed to be that messy?

Martin Friebe

2021-05-04 15:10

manager   ~0130749

Feedback: If there is nothing else on this specific on this issue, I would like to close it. (move it to the forum)

--------------------------------

I generally at this point do not consider this a bug any more [1]. It is according to the current design.
So I would like to continue the discussion on the forum or mail list...

If you do feel, any of this is a bug (i.e. does not work as designed), then please let me know.
- A documentation bug can be filed, but will be ignored/closed unless it has a patch to docs.
- A feature request can be filed as below. Yet given my current todo, will stay open, until a patch is provided.
- From your last note I found that default Beautifier is visible in OI (I almost overlooked this). That is a bug. So this should have a bug report of its own.

I ask for them to be new mantis issues, so that if they get revisited after a longer time, they have their own description, and have not mixed any of the discussions of this issue mixed into (always makes it harder to read up on an issues, if it mixes different bits and pieces / thanks).
I.e., if I were to re-read this report at some time in the future, I would 99.9% likely not spot the "OI shows default Beautifier" part.

----------------------------
One way to quickly improve the current design:

The Beautifier could have a default that depends on the SynEdit.
 sbitUseBlockIndent
 sbitUseBlockIndentAndSpace

If BlockIndent uses spaces, both will use spaces.
If BlockIndent uses tabs both will use tabs, the first one will "cut off" the indent, if it can not be matched by tabs, the 2nd will fill the remainder by spaces.

I am not sure, which one would/should become the new default.

----------------------------
I started a forum thread.
https://forum.lazarus.freepascal.org/index.php?topic=54454

If there is nothing else on this specific on this issue, I would like to close it. (move it to the forum)

-------------------------
[1]
"not a bug" => poor design maybe => see the forum.

However: "SynEdit needs some design changes" is not a topic for the bug tracker.
Once more detailed tasks are set, they may or may not fit the tracker.
See my forum post.

Martok

2021-05-04 22:53

reporter   ~0130758

You can close this issue as No Change Required, I know the curse of "time-tested" components.
I will get back to that forum post in a few days, but I clearly have some reading to do first.
Thanks.

Issue History

Date Modified Username Field Change
2021-05-02 19:56 Martok New Issue
2021-05-02 19:56 Martok File Added: ff00bb5a36[1].png
2021-05-02 20:46 Martin Friebe Assigned To => Martin Friebe
2021-05-02 20:46 Martin Friebe Status new => feedback
2021-05-02 20:46 Martin Friebe LazTarget => -
2021-05-02 20:46 Martin Friebe Note Added: 0130724
2021-05-02 23:03 Martok Note Added: 0130729
2021-05-02 23:03 Martok Status feedback => assigned
2021-05-04 15:10 Martin Friebe Status assigned => feedback
2021-05-04 15:10 Martin Friebe Note Added: 0130749
2021-05-04 22:53 Martok Note Added: 0130758
2021-05-04 22:53 Martok Status feedback => assigned
2021-05-04 23:58 Martin Friebe Status assigned => resolved
2021-05-04 23:58 Martin Friebe Resolution open => no change required