mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 18:05:07 +00:00
AK: Make string-to-number conversion helpers return Optional
Get rid of the weird old signature: - int StringType::to_int(bool& ok) const And replace it with sensible new signature: - Optional<int> StringType::to_int() const
This commit is contained in:
parent
15f4043a7a
commit
fdfda6dec2
55 changed files with 354 additions and 455 deletions
|
@ -91,10 +91,9 @@ void TextEditor::create_actions()
|
|||
auto input_box = InputBox::construct("Line:", "Go to line", window());
|
||||
auto result = input_box->exec();
|
||||
if (result == InputBox::ExecOK) {
|
||||
bool ok;
|
||||
auto line_number = input_box->text_value().to_uint(ok);
|
||||
if (ok)
|
||||
set_cursor(line_number - 1, 0);
|
||||
auto line_number = input_box->text_value().to_uint();
|
||||
if (line_number.has_value())
|
||||
set_cursor(line_number.value() - 1, 0);
|
||||
}
|
||||
},
|
||||
this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue