wouldn't it be better if instead of calling the IntPtr .ctor (twice) at every call site
we let DirectMessage create the IntPtr ?
private static IntPtr DirectMessage (IntPtr sciPtr, int msg, IntPtr wParam, IntPtr lParam) {
// Like Win32 SendMessage but directly to Scintilla
var result = _DIRECT_FUNCTION(sciPtr, msg, wParam, lParam);
return result;
}
public int WordStartPosition (int position, bool onlyWordCharacters) {
var onlyWordChars = (onlyWordCharacters ? new IntPtr(1) : IntPtr.Zero);
position = Helpers.Clamp(position, 0, TextLength);
position = Lines.CharToBytePosition(position);
position = DirectMessage(NativeMethods.SCI_WORDSTARTPOSITION, new IntPtr(position), onlyWordChars).ToInt32();
return Lines.ByteToCharPosition(position);
}
vs
private static IntPtr DirectMessage (IntPtr sciPtr, int msg, int wParam, int lParam) {
// Like Win32 SendMessage but directly to Scintilla
var result = _DIRECT_FUNCTION(sciPtr, msg, new IntPtr(wParam), new IntPtr(lParam));
return result;
}
public int WordStartPosition (int position, bool onlyWordCharacters) {
var onlyWordChars = onlyWordCharacters ? 1 : 0;
position = Helpers.Clamp(position, 0, TextLength);
position = Lines.CharToBytePosition(position);
position = DirectMessage(NativeMethods.SCI_WORDSTARTPOSITION, position, onlyWordChars).ToInt32();
return Lines.ByteToCharPosition(position);
}
wouldn't it be better if instead of calling the IntPtr .ctor (twice) at every call site we let DirectMessage create the IntPtr ?
vs
edit: how can i label this as "unimportant" ?