Forum > Editor

Using tabs instead of spaces with Lazarus

<< < (2/4) > >>

440bx:

--- Quote from: Nadar on December 07, 2023, 03:50:30 am ---I've tried to configure it for using tabs to the best of my abilities, but it is inconsistent. My actual code ends up being a mix. It looks to me like the codetools (or something related) doesn't respect that tab is indentation.

--- End quote ---
As @Tron mentioned, without the specifics of the problem no help can be given.  What inconsistencies are you referring to ?... an example of the inconsistencies would be very useful... provide a little snippet of code where the inconsistencies occur...

Maybe what you refer to as "inconsistency" may be a bug but, without specifics no determination can be made.


--- Quote from: Nadar on December 07, 2023, 03:50:30 am ---Is there a way to make Lazarus work properly with tabs, or do I have to keep doing this for every commit?

--- End quote ---
If you don't provide useful specifics, you'll probably be stuck having to do whatever you're doing for every commit.

Martin_fr:
All settings in Menu: Tools > Options  (On Mac Preferences)

* Tabs:
Editor > Genearl > Tabs and Indent
  "Tabs to spaces" off
  "smart tabs" off  (probably...)
  Drop down "Auto indent" => tabs

Codetools > General
  Turn OFF all indention options.

   That means if you press return after a "begin" there will be NO indent added.
   If you want that, and want it tabs....
   Never tried, but you probably need to write a new "example file"... no idea


* Show Special Char:
  Editor > General > Misc "Show special chars"

* Find dialog
    Editor > General > Misc "Find text at cursor"
   Or use cursor down inside the find dialog to get the previous search term

Nadar:
It seems that many of you misunderstood what I mean with "inconsistent". That wasn't critique of Lazarus or those that prefer spaces or anything else, I was merely saying that whatever choice you make, it should be consistent (in the same source file). With my current settings I end up with a mix of spaces and tabs, which isn't good in my view. It ruins the main point of using tabs in that people can use different tab with to make code "readable to them", and it makes future commits very likely to introduce whitespace changes, which tends to ruin diffs.

I want code to use either space or tab for indentation, not a mix. The way my code is formatted now, some lines are all tab - some are all space - and some have both tabs and spaces in the "indentation part of the line".

I'll get back to the other points after having checked my settings closer - I just feel that there's a need to clarify this.

Nadar:

--- Quote from: TRon on December 07, 2023, 12:01:29 pm ---I assume you are familiar with the menu Tools, options (IDE options), editor, general, items Tabs and indent & Miscellaneous ?

--- End quote ---

I don't know if I qualify as "familiar with", but I feel that I tried to tweak the things I deem relevant without managing to get rid of spaces in some of the indentations, so I guess the answer is yes.


--- Quote from: TRon on December 07, 2023, 12:01:29 pm ---For example, at the misc item you can at least set the option "show special characters" that allows you to distinguish between tabs and characters.

--- End quote ---
Ah - there it was  ;) Don't ask me how I could have missed it, but I assume that I've been "scanning for" the word "whitespace" and simply missed "special" (characters). Thanks anyway, this makes it a lot easier to see what is actually happening when (as opposed to having to open the file in another editor after having saved it before I can see what ended up as spaces and what ended up as tabs).

Nadar:

--- Quote from: Thaddy on December 07, 2023, 12:08:06 pm ---The inconsistency is that tabs can not be relied upon.
I think that Lazarus has an option to treat tabs a a defined number of spaces. But I never used that since I am one of those guys that HATE tabs since I often need to reformat other peopleĀ“ s code to make it readable..
I want consistent behavior along any editor I choose. Tabs do not fit that bill, although it should! it gives you more headaches than warranted.

--- End quote ---

I'm not too eager to start that discussion, although I must just state that I don't find tabs unreliable or "difficult" in any way. Even though I used to be a "space guy", I now find them easier to deal with - except for one thing: The fact that GitHub think it's appropriate to show a tab as 8 spaces without letting you choose. It makes the code hard to read at their site.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version