Shape if needed to process left/right commands

This commit is contained in:
Jeremy Soller 2023-11-14 13:43:33 -07:00
parent abf58279be
commit 56f71ef973
No known key found for this signature in database
GPG key ID: DCFCA852D3906975

View file

@ -445,9 +445,9 @@ impl Edit for Editor {
self.cursor_x_opt = None; self.cursor_x_opt = None;
} }
Action::Left => { Action::Left => {
let rtl_opt = self.buffer.lines[self.cursor.line] let rtl_opt = self
.shape_opt() .buffer
.as_ref() .line_shape(font_system, self.cursor.line)
.map(|shape| shape.rtl); .map(|shape| shape.rtl);
if let Some(rtl) = rtl_opt { if let Some(rtl) = rtl_opt {
if rtl { if rtl {
@ -458,9 +458,9 @@ impl Edit for Editor {
} }
} }
Action::Right => { Action::Right => {
let rtl_opt = self.buffer.lines[self.cursor.line] let rtl_opt = self
.shape_opt() .buffer
.as_ref() .line_shape(font_system, self.cursor.line)
.map(|shape| shape.rtl); .map(|shape| shape.rtl);
if let Some(rtl) = rtl_opt { if let Some(rtl) = rtl_opt {
if rtl { if rtl {
@ -878,9 +878,9 @@ impl Edit for Editor {
self.cursor_x_opt = None; self.cursor_x_opt = None;
} }
Action::LeftWord => { Action::LeftWord => {
let rtl_opt = self.buffer.lines[self.cursor.line] let rtl_opt = self
.shape_opt() .buffer
.as_ref() .line_shape(font_system, self.cursor.line)
.map(|shape| shape.rtl); .map(|shape| shape.rtl);
if let Some(rtl) = rtl_opt { if let Some(rtl) = rtl_opt {
if rtl { if rtl {
@ -891,9 +891,9 @@ impl Edit for Editor {
} }
} }
Action::RightWord => { Action::RightWord => {
let rtl_opt = self.buffer.lines[self.cursor.line] let rtl_opt = self
.shape_opt() .buffer
.as_ref() .line_shape(font_system, self.cursor.line)
.map(|shape| shape.rtl); .map(|shape| shape.rtl);
if let Some(rtl) = rtl_opt { if let Some(rtl) = rtl_opt {
if rtl { if rtl {