mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 18:55:07 +00:00
GTextEditor: Refactor selection into a GTextRange class.
This is a bit more expressive than "selection start + current cursor".
This commit is contained in:
parent
f40d11f06d
commit
032549d7bf
3 changed files with 95 additions and 51 deletions
|
@ -29,8 +29,9 @@ int main(int argc, char** argv)
|
|||
text_editor->on_cursor_change = [statusbar] (GTextEditor& editor) {
|
||||
StringBuilder builder;
|
||||
builder.appendf("Line: %d, Column: %d", editor.cursor().line(), editor.cursor().column());
|
||||
if (editor.selection_start().is_valid()) {
|
||||
builder.appendf(" Selection: [%d,%d]-[%d,%d]", editor.selection_start().line(), editor.selection_start().column(), editor.cursor().line(), editor.cursor().column());
|
||||
auto selection = editor.normalized_selection();
|
||||
if (selection.is_valid()) {
|
||||
builder.appendf(" Selection: [%d,%d]-[%d,%d]", selection.start().line(), selection.start().column(), selection.end().line(), selection.end().column());
|
||||
}
|
||||
statusbar->set_text(builder.to_string());
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue