mirror of
https://github.com/RGBCube/serenity
synced 2025-05-18 15:25:08 +00:00
GTextEditor: Add basic selection support.
This commit is contained in:
parent
c9c40e1da6
commit
b5521e1b0d
3 changed files with 65 additions and 12 deletions
|
@ -27,7 +27,12 @@ int main(int argc, char** argv)
|
|||
auto* statusbar = new GStatusBar(widget);
|
||||
|
||||
text_editor->on_cursor_change = [statusbar] (GTextEditor& editor) {
|
||||
statusbar->set_text(String::format("Line: %d, Column: %d", editor.cursor().line(), editor.cursor().column()));
|
||||
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());
|
||||
}
|
||||
statusbar->set_text(builder.to_string());
|
||||
};
|
||||
|
||||
String path = "/tmp/TextEditor.save.txt";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue