Whenever I open a very large text file (I'm talking 100k lines or more), gedit's background color changes from white to black, which makes the black text almost impossible to read.

Here's a screenshot of a file with more than 400k lines as an example

Is this a bug with gedit? What can I do to stop it from changing to a black background?

  • Possibly useful - askubuntu.com/questions/974606/… (ie. don't use an editor to view text files). It wasn't designed to handle large files, and better tools are available. If it's a bug, it's an old one, eg. bugs.launchpad.net/ubuntu/+source/gedit/+bug/156201 that will unlikely get fixed, as it's an inefficient approach to the problem.
    – guiverc
    Jan 12, 2021 at 23:46
  • I have no problem with a 170 000 lines file. With a larger file, indeed, the background turns black when switching away, but for me not always and not permanently. But indeed, yes, it appears to be some bug in display rendering that could be more or less severe depending on your graphics card/drivers. Would be good to mention these in the post. When staying black (only happened to me right after opening), it helps for me to do Ctrl+a then click to unselect.
    – vanadium
    Jan 13, 2021 at 8:29

2 Answers 2


First, graphical editors all have their limitations in handling very large text files. They will choke sooner or later as the number of lines increases. They will choke sooner or later when the lines become longer (try creating a very long single line in gedit).

Therefore, avoid having to deal with such large files for manual edits, and prefer to use dedicated tools to view or edit such large files.

Still, Gedit has come a long way in supporting opening and editing quite large files. For me, it opens a 180 000 lines text file without any issue. For larger text files, a blue dialog is implemented showing the progress. At that point, I also see the issue with the black screen. However, that issue appears not related directly to Gedit, but rather is related to limitations in the the graphical toolkit, GTK.

  • So it's a problem with GTK... That explains it!
    – yogurt
    Jan 13, 2021 at 20:36

This isn't exactly a fix, but you can at least get the text to be visible again if you change the color scheme to Cobalt.

  1. Click the triple lines in the upper-right corner.
  2. Click "Preferences".
  3. Click "Fonts and Colors".
  4. Choose the "Cobalt" color scheme.

This makes the text white, and you can see it again. It also does a lot of other things to the colors that you may or may not like, but it will at least make it so that you can see what you're doing again.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.