core: Rename EditText::get_selection to ::selection

This commit is contained in:
Nathan Adams 2020-11-01 19:30:43 +01:00 committed by Mike Welsh
parent c520ff1f50
commit a067170afd
3 changed files with 6 additions and 6 deletions

View File

@ -16,7 +16,7 @@ pub fn get_begin_index<'gc>(
.focus_tracker .focus_tracker
.get() .get()
.and_then(|o| o.as_edit_text()) .and_then(|o| o.as_edit_text())
.and_then(EditText::get_selection) .and_then(EditText::selection)
{ {
Ok(Value::Number(selection.start() as f64)) Ok(Value::Number(selection.start() as f64))
} else { } else {
@ -34,7 +34,7 @@ pub fn get_end_index<'gc>(
.focus_tracker .focus_tracker
.get() .get()
.and_then(|o| o.as_edit_text()) .and_then(|o| o.as_edit_text())
.and_then(EditText::get_selection) .and_then(EditText::selection)
{ {
Ok(Value::Number(selection.end() as f64)) Ok(Value::Number(selection.end() as f64))
} else { } else {
@ -52,7 +52,7 @@ pub fn get_caret_index<'gc>(
.focus_tracker .focus_tracker
.get() .get()
.and_then(|o| o.as_edit_text()) .and_then(|o| o.as_edit_text())
.and_then(EditText::get_selection) .and_then(EditText::selection)
{ {
Ok(Value::Number(selection.to() as f64)) Ok(Value::Number(selection.to() as f64))
} else { } else {

View File

@ -579,7 +579,7 @@ pub fn attach_virtual_properties<'gc>(
Some(fn_proto), Some(fn_proto),
fn_proto, fn_proto,
)), )),
ReadOnly.into(), DontDelete | ReadOnly | DontEnum,
); );
object.add_property( object.add_property(
gc_context, gc_context,

View File

@ -933,7 +933,7 @@ impl<'gc> EditText<'gc> {
} }
} }
pub fn get_selection(self) -> Option<TextSelection> { pub fn selection(self) -> Option<TextSelection> {
self.0.read().selection self.0.read().selection
} }
@ -1003,7 +1003,7 @@ impl<'gc> EditText<'gc> {
return; return;
} }
if let Some(selection) = self.get_selection() { if let Some(selection) = self.selection() {
match character as u8 { match character as u8 {
8 | 127 if !selection.is_caret() => { 8 | 127 if !selection.is_caret() => {
// Backspace or delete with multiple characters selected // Backspace or delete with multiple characters selected