Open Files With Long Lines in KWrite, Kate and Kile

In a recent KDE upgrade, the katepart text editor, which powers, kwrite, kile and kate, has been modified to open files with long lines as read only.
Sometimes it will tell you about this in a warning, sometimes you’ll just notice that you cannot modify the file.
It also turns out that the maximum line length is actually very short: 1024 characters. You will have no trouble finding log files with lines longer than this.

After some poking around we’ve figured out that the maximum line length is configurable:
Go to
settings > configure editor > open/save

There you can change the

line length limit

The value 0 means that there is no maximum.
Hit Ok and you’re good to go again.

As a side note: this is a very annoying change. Kate was working fine for us. This new change might fix some bug somewhere, but made the software unusable for our scenario, with absolutely no documentation or hint on how restore the previous behavior. Sometimes you don’t even get a warning that the file was loaded read only (many keyboards have suffered because of this)

Edit: Apparently Kile remembers the read only state of a document. It will keep a document read only if it was previously read only, even after you made the change in the settings. You can turn off read only mode for the active mode by deselecting it in the Tools menu. Kate and KWrite do have this issue.

    • avlas
    • April 12th, 2012

    It can be even worse if as me you realize how to remove the read only option as then your file is cut… The alternative was to have a completely useless kile program! I finally gave kile up because of those annoyances (I had to reedit my very long tex file in texmaker because of this issues).

    I don’t know who had the brilliant idea of this change but she or he can be full of glory for these changes ;)

    Anyways, thanks a lot for this. I can sanely use kile and kate again!

    • mischeviousmark
    • April 26th, 2012

    Thanks for this! Saved me from figuring out the “bug” after upgrading to Ubuntu Precise

    • Cesar
    • May 3rd, 2012

    thanks for sharing this useful information!

    Ubuntu people usually makes thing right, but this avoidable “bug” is definitely a fail!

    • dappermuis
    • May 9th, 2012

    Thanks, worked and solved the problem :)

  1. thanks for the hint, really annoying way this change was introduced. in kate the option can be found here: Settings > Configure Kate… > Editor Component > Open/Save > Line Length Limit

    • arvid
    • May 16th, 2012

    Doesn’t really work for me – no matter what I set this setting to (e.g., I’ve tried 16384 and 0), the files are read only… Really annoying!

    • visdan
    • May 19th, 2012

    Doesn’t work for me either. Also with the option “unlimited” which follows after 0 in my case (because of kde 4.8.3 ?).

    • I haven’t updated kde yet. Maybe there is another issue in later versions.
      edit: Just installed a new machine, upgraded to kde 4.8.3 and the fix still works
      Setting the value to 0 should reset the behaviour to what it was pre 4.8

        • visdan
        • May 23rd, 2012

        Thank you for your help!
        I cannot reproduce the error anymore. :) . Actually I cannot say why it didn’t work the first time. I even restarted linux, which didn’t work and made me quiet “unhappy”.
        It’s “just” working! Thanks again!

      • Apparently kile remembers the read-only state of a document.
        A file that was previously opened in read-only mode will open again in read only mode, even after you have changed the setting.
        You can disengage read only mode for the current file by going into the “Tools” menu and turn it off.
        I will edit the main post with this info.

  2. Thank you very much. I got confused with this error because I can edit the file just fine with vim and other editor.

    • max
    • June 12th, 2012

    Thanks! Especially the bit about the read only mode was very helpful to me.

    • Alex
    • July 7th, 2012

    Thanks, this solved my problem!

    • Zeroflag
    • July 23rd, 2012

    Thanks a lot, dude! :-)

    • Francis Ayley
    • October 28th, 2012

    I have the same problem as stated above. Changed the settings to a very large number, but Kate still loads my files in read only made. After searching all the settings I don’t see a “Tools” menu anywhere. What Tools menu? Where is it?

    Any assistance appreciated. I am using Kate on Linux Mint – Debian 64 version.

    • You should change the value to 0 to enable the pre 4.8 behaviour.
      In certain cases kile (maybe kate to, I don’t know) remembers the read only flag. You can disable “read only mode” in the tools menu, which is a global menu just like “file” and “edit”

      I hope this gets it sorted for you.

  3. Thank you!
    I was parsing and converting a text file and I spent about half a day trying to figure out why when I opened the final file, there were more lines than they should … I thought that the original file had “hidden” delimiters that Octave took to be new line marks … I also thought that I was introducing odd characters in the parsing but when I couldn’t find any strange line break using vi I thought that it could be a Kwrite “feature” … I can now sleep!!!

    Thanks again

    • Matteo
    • November 29th, 2012

    Thanks mate!
    I’m getting pretty annoyed by the seemingly random changes that pop up in many open-source programs lately.

    • Hussain
    • February 15th, 2013

    Thanks! It’s weird this setting of infinite line limit is not set by default!

    • Lu
    • April 19th, 2013

    Thank you very much!! :D

  4. Thank you!!

    • MP
    • June 26th, 2013

    Thank you so much! I was so stresed/angry until I read this.
    Including your two additions at the bottom. Such a life-saver!

  5. What is the purpose of such limitation ?

  6. Thank you…. This was messing up one of my base64 encoded files and was quite annoying. Thanks again!

  7. Thank you! :)

    • Andrea
    • January 28th, 2014

    Thank you!

    • AC
    • June 22nd, 2014

    This works so far for Kate on Debian 7 AMD64. This was driving me crazy – I had to deselect read only mode for every html file I tried to edit in Kate – it became very annoying, very rapidly. I was considering testing the impact resistance of my computer.

    Thanks for posting the solution.

  1. April 12th, 2012

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: