Code Monkey home page Code Monkey logo

Comments (6)

marijnh avatar marijnh commented on June 19, 2024

Just be aware that on IE (at least 6 and 7, haven't tested 8), the white-space: pre and white-space: pre-wrap styles are so utterly broken in a contentEditable document that tabs are not going to work. I also remember other browsers having some issues, but those may have been fixed in the meantime. I'd certainly be okay with a patch that adds an optional leave-tabs-alone mode, if it works in at least a few browsers.

from codemirror-v1.

kneath avatar kneath commented on June 19, 2024

This is a show stopper for me. Every time you edit any file with hard-tabs it changes the entire file by replacing them with spaces. I'm not really sure it should ever be an "option" — I guess I just couldn't live with an editor (browser or otherwise) that changed everyone's code.

I'll probably try fixing this in my branch, I'll let you know how it goes.

from codemirror-v1.

marijnh avatar marijnh commented on June 19, 2024

Looks like another fizzled attempt. It seems browser vendors did not think about tabs very much when they were implementing designMode/contentEditable. On the bright side, CodeMirror 2 is more tab-friendly.

from codemirror-v1.

GBH avatar GBH commented on June 19, 2024

Quick question. Is there a way to control tabs in version2? Automatic indenting does it with 2 spaces, however pressing Tab does 8. This is with Firefox 4... not sure about other browsers.

from codemirror-v1.

marijnh avatar marijnh commented on June 19, 2024

Browsers fix tabs to 8 spaces, and CodeMirror has to use native browser tabs. However, you can set indentUnit to something other than 2, and you can set indentWithTabs to have it convert any leading multiples of 8 spaces to tabs when indenting.

from codemirror-v1.

GBH avatar GBH commented on June 19, 2024

Sorry, just realized that I was in the wrong repo. tabMode: 'indent' seems to be the thing I wanted.
Thanks for the library. It's fantastic.

from codemirror-v1.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.