Add API SCI_FINDCOLUMNEX(line line, position column, int tabWidth) → position
Hi,
Could we add a new API SCI_FINDCOLUMNEX(line line, position column, int tabWidth) → position?
Extend FindColumn() to something like:
Sci::Position Document::FindColumnEx(Sci::Line line, Sci::Position column, int tabWidth) const noexcept {
If tabWidth > 0, use it instead of tabInChars.
columnCurrent = NextTab(columnCurrent, tabInChars);
This request/idea originated from https://github.com/zufuliu/notepad4/pull/1305#issuecomment-5713847205. We are planning to improve the /g CLI option for 3 types of "column" results of searching tool: character, bytes and column.
Due to the searching tools (ugrep) and editor (notepad4) will adopt different Tab width to calculate columns, it is very useful to get the target position of the searching tool.
Thanks in advance!
I think this may not suitable for upstream Scintilla as
SCImessage can't support three parameters.As
GetRelativePosition()is 3x slow thanFindColumn()and doesn't stop at EOL, I'm planing to add new function (maybe justFindColumnEx(flag, CharacterRangeFull)) in Notepad4 that does the three types position finding:\t.Combining
columnandtabWidthinto a struct is an option with minimal changes. MaybeThe messaging API can only take 2 parameters. Structs are avoided to ensure binary compatibility (there have been many issues with existing use of structs) and ease calling from scripting languages.
Applications can implement their own features based on currently available APIs.