Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make the text file looks the same in different text editor

 
frank sun
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I write the document in ultraedit, it looks different in TextPad(Windows textpad),
the same inversely.
How to write the text document looks the same in different text editor?
Regards!
Frank
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frank,
I assume you are talking about carriage returns appearing in strange places. Or disapearing.
From memory UltraEdit will let you set what it should use as the default format for saving brand new files, You can set it to Microsoft, Unix, or Macintosh format (line termination is different in text files on all 3 platforms).
For an existing file, UltraEdit should always maintain the existing coding scheme unless you explicitly change it.
All this is from memory ... I am exclusively working in Linux now, so I have not used UltraEdit for over 6 months.
I assume you are not talking about display differences such as tab settings, or colour highlighting
Regards, Andrew
 
frank sun
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andrew Monkhouse:
I assume you are talking about carriage returns appearing in strange places. Or disapearing.
I assume you are not talking about display differences such as tab settings, or colour highlighting
Regards, Andrew

It's about the Tab and white space, the text format looks very good in Notepad(windows), but in the ultraedit, or other ascii text editor, the format looks ugly,
could you give me some suggestion to produce a format-consistent text?
Regards!
Frank
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Frank
Notepad defaults to 8 spaces for a tab (this is correct as far as the Sun standards are concerned, so this is a good thing), but just to confuse everyone, the Sun standards also say that each indentation should be 4 spaces. So for the code:
the line begining "public doSomething" should be prefixed by four spaces, not a tab.
the line begining "System.out" could be prefixed by eight spaces or one tab - your choice.
Anyway, in UltraEdit (firing up the laptop (which has it in stalled) for a different problem), you should be able to change this in the Configurations (under "Advanced -> Configuration").
In the "Edit" tab, you have
  • "use spaces instead of tabs" - I think that for maximum compatibility with Notepad (now there's a concept! ) you probably want this turened off.
  • "Tab stop value" - set this to "8" - the same as Notepad.


  • Regards, Andrew
    [ May 21, 2003: Message edited by: Andrew Monkhouse ]
     
    Andrew Monkhouse
    author and jackaroo
    Marshal Commander
    Pie
    Posts: 12014
    220
    C++ Firefox Browser IntelliJ IDE Java Mac Oracle
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Frank,
    Just realised your question could be read a different way.
    You asked could you give me some suggestion to produce a format-consistent text
    Simple: dont use tabs
    This is actually recommended by a great many people (including Kathy Sierra / Bert Bates) for just the reason you are now finding - problems with changing editors, or even viewability in the same editor with different settings. Many programmers start with a large tab stop when they first start coding because it makes it real easy to spot the indentation. But after coding for a while, many people reduce this level, and they dont always do it evenly, or in one move. So you could get one newbie coder who uses 8 spaces, someone who has been coding for a year using 6 spaces, someone a little longer using 4 spaces, and the expert using two spaces (yes I have known people who get down to 2 spaces). And if they swap their code between each other, even if they are all using the same editor, the results can look horrific.
    Using spaces always instead of tabs, I know my code will always look the same in every editor - the other users may not like my indentation, but they are not going to get screwy indentation.
    Regards, Andrew
     
    frank sun
    Ranch Hand
    Posts: 102
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks Andrew.
    I almost complete the submission, I'll do the final check on it.
    As to the text format, it's still the problem even I replace the tabs with white spaces.
    Regards!
    Frank.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic