Why do text editors have problems with long lines?

If you copy the text in the link below and paste it into a text editor (I tried a few: gedit, notepad, phpstorm, but also the command-line editors, such as a nano) you run into trouble.

http://pastebin.com/5dqT7mFm

Here are some of them that I noticed during my tests:

  • very strange text rendering effects
  • text selection is no longer possible
  • heavy processor consumption
  • Editors stop responding (sometimes they even crash)

I also noticed that these problems will not occur if I enable the functionality text-wrapin an appropriate text editor.

What would I like to know why text editors have such problems with long lines? Is there a reasonable explanation for this behavior?

+4
source share
1 answer

What would I like to know why text editors have such problems with long lines? Is there a reasonable explanation for this behavior?

I am the author of Zeus IDE, so I will let you know why this is so.

One of the main reasons is the presence of a tab character. Let me explain.

Since the text editor should assume that the string may contain tabs, the only way it can handle these tabs correctly is to analyze the string from left to right, always starting with the first character of the string.

, , , ^ :

This is line one with no tables
This line has a ^ tab character

8, :

This is line one with no tables
This line has a          tab character

4, :

This is line one with no tables
This line has a     tab character

, 31 .

, , , .

, .

, | :

This is line one with no |tables
This line has a          tab character

25 , 25 ( ).

, , :

This is line one with no tables
This line has a          |tab character

25 , - 8 , 18 .

, , , .

, , .

, , , / .. ..

, , .

, , , , , .

PS: Zeus 286 721 , , , .

+4

Source: https://habr.com/ru/post/1537119/


All Articles