Problems?

Discuss ROM-compatibility related issues here.
User avatar
Bighead
Posts: 2
Joined: Tue Nov 12, 2013 1:01 am

Re: Problems?

Post by Bighead » Tue Nov 12, 2013 1:09 am

ShadowFX wrote:I'm using Notepad++ for Windows, which by my knowledge, uses a monospaced font. I expected the forum to properly use the format I had submitted.
Snowstorm64 wrote:Don't use tab, which may vary software by software, you must use space to align text.
For future reference, this little program can convert all tabs in a text file to any number of spaces (default 8). This can save you time if you ever need to do something like this again.
http://bluefive.pair.com/tabs2spaces.htm

beannaich
Posts: 149
Joined: Mon Oct 21, 2013 2:43 pm

Re: Problems?

Post by beannaich » Tue Nov 12, 2013 3:04 pm

Bighead wrote:For future reference, this little program can convert all tabs in a text file to any number of spaces (default 8). This can save you time if you ever need to do something like this again.
http://bluefive.pair.com/tabs2spaces.htm
Wouldn't that just convert tabs to spaces blindly, and screw up your formatting? Probably better to do it programmatically:

Code: Select all

for (int i = 0; i < lines.Length; i++)
{
    string line = lines[i];
    string[] split = line.Split(new [] { '\t' }, StringSplitOptions.RemoveEmptyEntries);
    string newLine = "";

    foreach (string fract in split)
    {
        newLine = string.Concat(newLine, fract.PadRight(32, ' '));
    }

    lines[i] = newLine.TrimEnd();
}

User avatar
Bighead
Posts: 2
Joined: Tue Nov 12, 2013 1:01 am

Re: Problems?

Post by Bighead » Mon Nov 18, 2013 9:20 am

There's an option for that, "Fixed Tab Stops Formatting" which is an alternative to fixed number of spaces.

Lining up and spacing "Hello" with only tabs:

Code: Select all

Hello	Hello	Hello
	Hello	Hello
		Hello
Hello	Hello	Hello
Output from program on this forum looks correct with all tabs converted into spaces:

Code: Select all

Hello   Hello   Hello
        Hello   Hello
                Hello
Hello   Hello   Hello
Tab when starting a new line creates 8 spaces here and when used on the same line again only 3 spaces. This option accounts for that and converts the tab to however many spaces the tab actually consumes. Fixed number of spaces actually works just like a custom setting of spaces in NP++. Assuming you change the number of spaces tab skips to lets say, 3 in NP++, this will make a tab on the same line skip only 1 space. The program will also format this correctly, and convert same line tabs into only a single space. So I guess in the end either option will work. Maybe I don't fully understand each option clearly but I do know that it's always formatted any code I threw at it correctly over the years.

User avatar
Iconoclast
Posts: 47
Joined: Fri Oct 04, 2013 8:00 pm

Re: Problems?

Post by Iconoclast » Mon Nov 18, 2013 9:36 pm

Since, in C programming source code, the vast majority of tab characters are at the beginning of each line of text, before any actual text occurs, usually it just suffices for me to use the "Find and Replace" feature in Microsoft Notepad, or even Notepad++, to replace all occurrences of "tab" with "(four spaces here)" (or eight spaces in some tab stop interpretations).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest