mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Fix centered & right aligned TextEdit (#8082)
A couple improvements to centered and right-aligned text edits: - Fix text selection in centered and right aligned text edits (ironically, this broke in #8076) - Fix cursor movement in centered and right aligned text edits (horizontal cursor position will be retained on vertical movement) - Multiline text edit exceeding available width if there are atoms - Added atoms & alignment options to text edit demo - Improve how vertical_align and horizontal_align are applied - Textedit atom is grow now, removing the need for the extra seperate grow atom - This allows us to apply the `align` on the text edit atom instead of the whole AtomLayout - Fixes https://github.com/emilk/egui/pull/8022 - Fixes https://github.com/emilk/egui/issues/7999
This commit is contained in:
@@ -1244,7 +1244,8 @@ impl Galley {
|
||||
|
||||
let new_layout_cursor = {
|
||||
// keep same X coord
|
||||
let column = self.rows[new_row].char_at(h_pos);
|
||||
// char_at is Row-relative, so subtract the row's position
|
||||
let column = self.rows[new_row].char_at(h_pos - self.rows[new_row].pos.x);
|
||||
LayoutCursor {
|
||||
row: new_row,
|
||||
column,
|
||||
@@ -1266,7 +1267,8 @@ impl Galley {
|
||||
|
||||
let new_layout_cursor = {
|
||||
// keep same X coord
|
||||
let column = self.rows[new_row].char_at(h_pos);
|
||||
// char_at is Row-relative, so subtract the row's position
|
||||
let column = self.rows[new_row].char_at(h_pos - self.rows[new_row].pos.x);
|
||||
LayoutCursor {
|
||||
row: new_row,
|
||||
column,
|
||||
|
||||
Reference in New Issue
Block a user