Patch for overzealous plv reinit in CellBuffer::BasicDeleteChars.

5 views
Skip to first unread message

Mitchell

unread,
Sep 9, 2022, 8:35:37 PM9/9/22
to scintilla...@googlegroups.com
Hi Neil,

Attached is a patch to CellBuffer::BasicDeleteChars that only calls plv->Init() if the range to delete spans multiple lines. It is based on Scintilla 5.3.0.

The use case for this is a one-line Scintilla control that uses a text margin as a label. Whenever I backspaced until the start of the line, plv was being reinited, and I lost my margin text. This was unexpected. Judging by the comment, I think perhaps requiring the deleted range to span multiple lines is acceptable. With the attached patch, I don't lose my margin text when the line becomes empty.

Cheers,
Mitchell
overzealous_plv_reinit.patch
CellBuffer.cxx

Neil Hodgson

unread,
Sep 10, 2022, 5:57:22 PM9/10/22
to Scintilla mailing list
Mitchell:

> The use case for this is a one-line Scintilla control that uses a text margin as a label.

This is not a core use case. Label widgets are designed to function as labels - amongst other possible benefits, they will likely work better with screen readers.

> Whenever I backspaced until the start of the line, plv was being reinited, and I lost my margin text. This was unexpected. Judging by the comment, I think perhaps requiring the deleted range to span multiple lines is acceptable. With the attached patch, I don't lose my margin text when the line becomes empty.

The patch will change behaviour of projects using Scintilla which may cause new bugs. This appears to me to not be be justified by the small benefits.

Neil

Mitchell

unread,
Sep 11, 2022, 10:15:27 AM9/11/22
to scintilla...@googlegroups.com
Hi Neil,
Thanks for your insights into this. It makes sense.

Cheers,
Mitchell
Reply all
Reply to author
Forward
0 new messages