Number of spaces in Tab - OpenEdge - progress-4gl

In OpenEdge the tab can be configured to any number of spaces, usually is configured to 4 spaces.
To insert a tab in a text can be used: ~t.
What I want to find is how many spaces have the tab set.
For example, I am reading a file line by line, and for each line I want to see how many spaces are at the beginning.
I am using:
iNoOfBeginningSpaces = index (cLine, left-trim (cLine)) - 1.
But if the line begins with 3 tabs then it gives me 3, and not the number of the spaces: 3 * spaces from tab.
Is there a way to find the number of beginning spaces of a line, treating the tab as x numbers of spaces?

No. Spaces and tabs are not the same thing. You are getting confused by the fact that programming editors, word processors and printers convert tabs to spaces to get to tab stops. But in a data file no such conversion occurs (unless you are saving the file from an editor that does such conversions).

I will tell you how to check in your AppBuilder.
On the AppBuilder Menu you go to OPTIONS and then EDITING OPTIONS and there you can set how much "spaces" the editor uses for Tabs and Syntax indents. But this is basically for DISPLAY purposes within APPBUILDER.
Tom has given you the correct technical answer, a tab is a type of control character that can be interpreted differently by different apps. It has a different value than spaces.Below you can see the value of space and Horizontal Tab.
Char Oct Dec Hex Control-Key Control Action
HT 11 9 9 ^I Horizontal tab, move to next tab stop
=============================================
Char Octal Dec Hex Description
SP 40 32 20 Space

Related

Tab stops are messed up after rarer unicode characters

In vscode, when I open a file containing unicode characters,
I notice that tabs do not always advance to the next tab stop.
For example, the following might be part of an ASCII-flavor table
a<tab>b<tab>c<tab>d<tab>e
α<tab>β<tab>γ<tab>δ<tab>ε
𝔸<tab>𝔹<tab>ℂ<tab>𝔻<tab>𝔼
While sublime text renders it correctly(IMO)
vscdoe has a different idea
As I understand it, vscode renders a tab by
replacing it with a proper number of space characters.
So if there are characters showing using proportional fonts,
no integer number of spaces will make it to the proper stop.
(See this related issue.)
So my question is, how can I fix this?
Is it possible to tell vscode that
"Fine, if you were to assume that those unicode characters
are 2 spaces wide when tabbing,
would you please render them as 2 spaces wide?"

vscode - for file type, make tab always just make 4 spaces

From my understanding, vscode's default tab behavior is to tab to the next column that is divisible by your tab length. So if my tab length is 4 and I am at column 1, it will add 3 spaces. Great!
For a certain file type, I would like to override this behavior and have tab always make exactly 4 spaces, rather than taking me to the next divisible column. How can I do this?
VScode currently spaces the cursor to column 5 from column 1. So it is adding 4 spaces to wherever you hit the tab key. I just typed a comment line like so
1234567890 and in the line under that I hit the tab key and the curson went to space 5 and space 9. So it appears to be doing what you want. I haven't set anything. In the settings file you can see the following description.
// The number of spaces a tab is equal to. This setting is overridden based on the file contents when editor.detectIndentation is on.
"editor.tabSize": 4,

indeneted files in my sublime don't show up indented correctly on github files

I have indented my files in my sublime text but when I push to github they don't look indented. How do I fix this?
The approach taken to indent file on sublime is:
select the code > Edit > Line > Reindent
looks like this on github:
Your issue looks to be caused by your use of literal tab characters for indenting as opposed to using spaces instead.
If there's a hotter holy war topic among developers than the debate of tabs versus spaces, it's probably related to how wide you should interpret a tab character to be for display purposes if you happen to use them.
In particular your images would appear to indicate that you think that tabs should be 2 characters wide and GitHub thinks they should be 8. As mentioned in this answer you can append an extra query field to the URL in GitHub in order to view the files the way you prefer them to be viewed.
As far as I'm aware that just changes how they're rendered on the page when you view and doesn't actually modify the file at all. If it's important that the file retain the same indent levels regardless of where or how you view the file, you should convert from tab indentation to space indentation instead since a space is unambiguously sized.
If you're using Sublime Text you can do that by clicking in the status bar where it says Tab Size: 2 and select Convert indentation to spaces; the status bar will switch to say Spaces: 2 to indicate that the indent has changed.

Eclipse: use both tabs and spaces for indentation

A project I'm working in has an indentation standard as follows:
A single tab-width is 4 space characters.
A double tab-width is a tab character displayed at 8 spaces wide.
Examples:
A singly-indented line begins with four spaces
A doubly-indented line begins with a tab character
A triply-indented line begins with a tab character followed by four spaces
A 4x indented line begins with two tab characters
...and so on
In Vim, the necessary configuration is achieved with:
:set tabstop=8 softtabstop=4 noexpandtab
How can I configure Eclipse to automatically enforce this indentation standard?
I don't believe Eclipse CDT supports this indentation style.
Eclipse is open source; you could consider contributing a patch to add support for this style.
Eclipse doesn't have that built-in, but it looks like the plug-in Vrapper (Vim) provides what you are looking for.
See Vrapper > Documentation > Configuration:
softtabstop - When using spaces for tabs, set this to the number of spaces inserted for each Tab key press and hitting
Backspace in InsertMode will delete that many spaces as if you had
deleted a tab character.
tabstop - Used by i_ctrl-t, i_ctrl-d, and :retab. Determines number of spaces to replace each tab character with when xpandtab is enabled.
expandtab/noexpandtab - Used by i_ctrl-t, i_ctrl-d, and :retab. Determines whether :retab should replace all tabs with spaces (true) or spaces with tabs (false). Also determines whether i_ctrl-t and i_ctrl-d will replace tabstop spaces with a tab.
Eclipse does support this natively.
My eclipse version:
The result (see in-image comments):
Step 1:
Step 2:
Step 3:
Step 4 (the most important step):

Is tab-switching a feature in VSCode?

By this I mean if some file was written with 4 spaces, can you simply highlight it all and click on something to turn it into 2 spaces. I'm not sure if in practice (parsing) this would make sense/could lead to broken code.
I currently have my editor.tabSize set to 2, and sometimes I open files written with 4 spaces and I want to be able to turn them into 2 spaces. I have at least figured out to turn off the auto-detect so that when I highlight sections of the code and hit shift-tab, then tab again it will turn the selected code from 4 spaces into 2 spaces.
Is there a feature like this or does it make sense that this wouldn't exist?
To change the current document from using 4 spaces to 2 spaces:
Click on Spaces: 4 in the status bar or run the Indent using Spaces command
Select 2 for the new tab size
Run for Format Document command to apply the new indentation to the entire document