As discussed at https://sourceforge.net/p/scintilla/bugs/2093/#ed26/c13e
The old ScintillaBase::AddCharUTF() is marked as deprecated.
I think treatAsDBCS
can be removed, the unused bool parameter can be kept on the deprecated ScintillaBase::AddCharUTF().
Moved implementation of old AddCharUTF to ScintillaBase.cxx
That seems mostly worthwhile.
One problem is that using string_view encourages use of strings that are not NUL-terminated. This won't be a problem for internal use but the data is sent as a macro record notification to the application. Applications may fail if there is no terminating NUL in a situation in which there was previously. Perhaps a std::string copy of the insertion is needed in the
recordingMacro
branch.Since the method signature is incompatible, it would be reasonable to make other changes now. The "UTF" part of the name is meaningless, abbreviations should be avoided, and the method is inserting at the caret position(s) not adding to the end, so I'd like to change the method name to
InsertCharacter
.This method may receive more options in the future, so, if the
treatAsDBCS
option were to be retained it should be an extendableenum class InsertionOption { Default, TreatAsDBCS };
. IftreatAsDBCS
is removed then its simpler to not have an option parameter at this point as it can be added when needed with a default value.It actual not NUL-terminated from cocoa.
Should I make other changes (rename to InsertCharacter and remove treatAsDBCS, copy in recordingMacro) in one patch?
With these changes.
Editor::AddChar and ScintillaWin::AddWString not renamed.
I have written this up on the mailing list so that platform layer maintainers can discuss any problems they have with the proposed changes.
https://groups.google.com/d/topic/scintilla-interest/L6F_MiT0WEQ/discussion
Not NUL-terminating on Cocoa currently does not mean it is safe for client code that is not currently built for Cocoa. It is also possible that clients on Cocoa are faulty but problems have not been reported.
Committed as [e1e9f5]. Added 'const' inside IsAllSpacesOrTabs.
Related
Commit: [e1e9f5]
Committed as [e1e9f5]. Added 'const' inside IsAllSpacesOrTabs.
Related
Commit: [e1e9f5]