chiark / gitweb /
Second thoughts, remove that assertion again.
authorSimon Tatham <anakin@pobox.com>
Sun, 10 Dec 2023 22:46:02 +0000 (22:46 +0000)
committerSimon Tatham <anakin@pobox.com>
Sun, 10 Dec 2023 22:46:02 +0000 (22:46 +0000)
Turns out that Composer does want to keep the entire editor buffer in
a ColouredString so that it can colourise it as a whole. And that can
include \n. We do want to keep \n away from add_wch, but keeping it
out of ColouredString entirely isn't a workable approach.

Oh well. The immediate crash is fixed, at least.

text.py

diff --git a/text.py b/text.py
index 57a4d27b4494d8f246330e7884385d132e9e16c5..42f70d0ce6f9f0dc7dee7a1a6409aa2eed7ec305 100644 (file)
--- a/text.py
+++ b/text.py
@@ -51,7 +51,6 @@ class ColouredString:
                 assert len(colour) == 1, "Colour ids are single characters"
                 colour = colour * len(string)
             self.s, self.c = string, colour
-        assert '\n' not in self.s, "Newlines ought to be handled elsewhere"
         self.width = cached_wcswidth(self.s)
 
     def __add__(self, rhs):