mate-desktop / pluma

A powerful text editor for MATE
http://www.mate-desktop.org
GNU General Public License v2.0
158 stars 66 forks source link

Word wrap looks crazy on one line of this file #695

Open sekelsta opened 7 months ago

sekelsta commented 7 months ago

Expected behaviour

Plaintext file should look like plaintext

Actual behaviour

This one line looks crazy Screenshot at 2024-04-18 17-21-07

Steps to reproduce the behaviour

Open this file with pluma: server-debug.txt (had to trim a bit off the end to get it to upload)

MATE general version

1.26.0

Package version

1.26.0

Linux Distribution

Ubuntu 22.04.4 LTS 64 bit

Link to bugreport of your Distribution (requirement)

dhasenan commented 7 months ago

This looks like an upstream bug with Gtk's TextBuffer class (or something more basic than that). See:

import sys
import gi
gi.require_version("Gtk", "3.0")
gi.require_version("GtkSource", "4")
from gi.repository import Gtk, GtkSource

buffer = Gtk.TextBuffer()
with open(sys.argv[1], "r") as f:
    t = f.read()
    print(len(t))
    buffer.set_text(t)
source_view = Gtk.TextView.new_with_buffer(buffer)

sv = Gtk.ScrolledWindow()
sv.add(source_view)

win = Gtk.Window()
win.add(sv)
win.connect("destroy", Gtk.main_quit)
win.show_all()
Gtk.main()

gtktextview

In Gtk+ 4, the line simply does not render instead.

cwendling commented 7 months ago

Also note that although it's not really an excuse, the line in question is 2727232 characters long. Again, not an excuse, but it's pretty uncommon :slightly_smiling_face: