Trouble viewing source files, wrong indentation.

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
juanlfg
Posts: 1
Joined: Wed Feb 04, 2004 7:36 pm

Trouble viewing source files, wrong indentation.

Post by juanlfg »

I'm a TextPad 4.7.2 user and I have trouble viewing source files because tabs are not shown properly and the indentation makes it hard to read the files, for instance, when I open a certain java source file TextPad shows:

Code: Select all

	public void paint(Graphics g) {
	//draw a black border and a white background
            g.setColor(Color.white);
	g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
            g.setColor(Color.black);
	g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
	etc...
when it should show the following:

Code: Select all

	public void paint(Graphics g) {
	  //draw a black border and a white background
	  g.setColor(Color.white);
	  g.fillRect(0, 0, getSize().width - 1, getSize().height - 1);
	  g.setColor(Color.black);
	  g.drawRect(0, 0, getSize().width - 1, getSize().height - 1);
               etc...
However another editor like the one that comes with jEdit 4.1 final version does show the file like it is supposed to be shown!(unfortunately I don't master jEdit).

Furthermore, in some cases TextPad shows tabs and in others spaces, arbitrarily (it seems).

Last but not least, I have tried opening the java source files with the 'Maintain indentation' and 'Automatically indent blocks' options both enabled and disabled for Java documents, but it doesn't fix the annoyance in any form.

I would like to know how can I solve this problem. :?:
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

I suspect the issue you are having with tabs is that source code you are using has a mixture of spaces and tab characters (soft and hard tabs). The jEdit4.1 is probably using the same spacing for hard tabs as the soft tabs. Experiment with the tabbing tab. I believe 2 is the tab spacing you'd need given the previous code.

The best solution, IMAO, is to check the convert tabs to spaces and throttle whomever else touches the file for not having done the same in whatever editor they're using.
I choose to fight with a sack of angry cats.
Post Reply