unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* How the long-lines "optimisation" breaks font locking.
@ 2022-08-03 18:39 Alan Mackenzie
  2022-08-03 19:03 ` Lars Ingebrigtsen
  2022-08-03 19:15 ` Eli Zaretskii
  0 siblings, 2 replies; 32+ messages in thread
From: Alan Mackenzie @ 2022-08-03 18:39 UTC (permalink / raw)
  To: emacs-devel, Gregory Heytings

Hello Gregory and Emacs.

In the current master,
(i) start emacs -Q
(ii) C-x C-f ~/long-line.cc
(iii) Enter the following into the buffer (3 lines):

char long_line[] = R"foo(

)foo"

(iv) Create a long line (> 10,000 characters) somehow and get it into
  the kill ring.
(v) On the blank line 2 in long-line.cc, C-y inserting the long line.

(vi) Note that there is now a long valid raw string in the buffer,
  correctly fontified.
(vii) Put point on a "o" in the foo on L3.  Delete the o
(viii) Note that the opening delimiter of the raw string on L1 now has
  warning-face.  This is correct.
(ix) Undo this last change with C-_.
(x) Note that the opening delimiter falsely retains the warning-face,
  although it is now the opener of a validly terminated raw string.
  This is a bug.

(xi) Insert a LF (or several, if needed) into the long line, separating
  it into two or more lines, none of which is "long".
(xii) Note that the raw string opener still has warning-face.  A bug.
(xiii) Do M-x c++-mode.  This fails to initialise the fontification
  correctly, leaving the warning-face where it no longer belongs.  This
  is a bug.
(xiv) Note that in the foregoing operations, sometimes an error message
  appears in the echo area about the lack of an expected syntax-table
  text property.  This is a bug.

I don't think it is improbable that a C++ hacker will create a long line
in a raw string.  That this can cause permanent damage to the buffer's
fontification doesn't seem a good thing.  That it is the recent
"optimisation" for long lines which causes it can be seen by repeating
the above steps, but with a line less than 10,000 characters long.  The
fontification then behaves correctly.

-- 
Alan Mackenzie (Nuremberg, Germany).



^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2022-08-08 11:51 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-03 18:39 How the long-lines "optimisation" breaks font locking Alan Mackenzie
2022-08-03 19:03 ` Lars Ingebrigtsen
2022-08-04 10:44   ` Alan Mackenzie
2022-08-04 12:54     ` Eli Zaretskii
2022-08-04 14:44       ` Alan Mackenzie
2022-08-04 14:52         ` Lars Ingebrigtsen
2022-08-04 15:22         ` Gregory Heytings
2022-08-05  1:23           ` Ihor Radchenko
2022-08-04 16:09         ` Eli Zaretskii
2022-08-05 10:56       ` Alan Mackenzie
2022-08-05 11:20         ` Eli Zaretskii
2022-08-05 13:04           ` Dmitry Gutov
2022-08-05 14:22             ` Eli Zaretskii
2022-08-05 14:29               ` Dmitry Gutov
2022-08-05 15:30                 ` Eli Zaretskii
2022-08-05 19:50                   ` Dmitry Gutov
2022-08-06  5:36                     ` Eli Zaretskii
2022-08-06 10:54                       ` Dmitry Gutov
2022-08-04 13:11     ` Eric S Fraga
2022-08-04 13:34       ` Po Lu
2022-08-04 14:38         ` Eric S Fraga
2022-08-04 16:16           ` SOLVED: " Eric S Fraga
2022-08-04 16:21             ` Eric S Fraga
2022-08-04 17:36               ` Stefan Kangas
2022-08-05  9:36                 ` Eric S Fraga
2022-08-05 11:13                   ` Eli Zaretskii
2022-08-05 12:28                     ` Eric S Fraga
2022-08-05 13:40                       ` Eric S Fraga
2022-08-05 23:11                         ` Tim Cross
2022-08-05 23:23                         ` Lars Ingebrigtsen
2022-08-08 11:51                           ` Fraga, Eric
2022-08-03 19:15 ` Eli Zaretskii

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).