Propose using typedefs for document positions and lines

34 views
Skip to first unread message

Neil Hodgson

unread,
Mar 29, 2017, 5:59:42 AM3/29/17
to Scintilla mailing list
In 2015, a LargePos branch was made to experiment with documents larger that 2GB. One part of this was using a typedef Sci::Position for positions and line numbers within Scintilla. This appears to me to have value separate from large document support as it makes it easier to understand which elements refer to positions. Adding a Sci::Line type separately for line numbers enhances this further.

The attached patch defines both Sci::Position and Sci::Line as int and removes the old Position type from Document.h. It redefines variables of type int (and a couple of unsigned int) to be Sci::Position when they represent document byte or character positions, lengths of text in bytes or characters or similar. Variables that represent lines or numbers of lines or similar become Sci::Line. Don’t worry, I haven’t become a Pascal zealot as C++ typedefs don’t really allow strong numeric subtypes. This should be quite safe as, apart from a couple of unsigned ints becoming signed ints, the types have not changed - they’ve merely been given new names.

The patch is very large and there is a good chance I have made mistakes.

This change may be used for later work on large documents but that is uncertain.

Neil
justSci.patch

Neil Hodgson

unread,
Mar 31, 2017, 9:30:23 PM3/31/17
to scintilla...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages