mac - TextEdit not caring about hard links?

08
2014-07
  • Svish

    Possible Duplicate:
    Hard link not works under Mac OS X in GUI mode

    I did a little experiment. First I ran the following in a Terminal:

    mkdir test
    cd test
    echo "A" > a
    echo "B" > b
    ln a.txt c
    

    Now a and c have the same content, A, and the same inode number. I can then edit c, using vim, to contain C instead of A and a will also contain C, since they are the same file.

    However, if I do the same experiment again but use TextEdit instead of vim it seems to create a new file when I save it. c gets a new inode number and a still contains A. Why is this? What's going on?

  • Answers
  • akira

    maybe the saving routine of TextEdit works like this:

    1. store the content to a file named differently than the original to ensure, everything is written correctly to the disk. if the content was written to the disk successfully, continue.
    2. unlink the old filename
    3. rename the new file to "old filename"
    4. release the file descriptor of the old filename.

  • Related Question

    osx - How to disable line wrap in TextEdit
  • Željko Filipin

    I can not find a settings in TextEdit to disable line wrap. I have found only wrap to page/window.


  • Related Answers
  • Pablo Santa Cruz

    I know that this does not answer your question, but let me suggest you TextWrangler as a free and more featured alternative to TextEdit.

    Hope it helps.

  • Mike Heinz

    Another suggestion is to try smultron.

    I don't think textedit is designed to be much more than demoware.

  • Michael P

    This isn't possible and you can't even dig into the plist file to override this behaviour. But you can get close.

    In File → Page Setup create a Custom Page size with absurdly huge margins:

    enter image description here

    Now select Format → Wrap to Page and TextEdit will now have horizontal scroll bars, but you'll be stuck with an annoying whitespace on the top and left side of the page.

    enter image description here