Codechange: C++-ify the Layouter and related functions

They all now access a std::string_view, instead of a "const char *"
or std::string (in some cases).

Additionally, GetCharAtPosition and friends now return an index
instead of a "const char *", as it makes for a more clear interface.
This commit is contained in:
Patric Stout
2023-05-06 19:53:02 +02:00
committed by Patric Stout
parent 61d1b330d1
commit 60399e17bd
10 changed files with 84 additions and 157 deletions

View File

@@ -1057,10 +1057,11 @@ void CocoaDialog(const char *title, const char *message, const char *buttonLabel
Point pt = { (int)view_pt.x, (int)[ self frame ].size.height - (int)view_pt.y };
const char *ch = _focused_window->GetTextCharacterAtPosition(pt);
if (ch == nullptr) return NSNotFound;
auto index = _focused_window->GetTextCharacterAtPosition(pt);
if (index == -1) return NSNotFound;
return CountUtf16Units(_focused_window->GetFocusedText(), ch);
auto text = _focused_window->GetFocusedText();
return CountUtf16Units(text, text + index);
}
/** Get the bounding rect for the given range. */