Rename `TextBuffer::replace` to `replace_with` (#3751)
This removes the name conflict with `str::replace`. * Closes https://github.com/emilk/egui/issues/3746
This commit is contained in:
parent
239ade9a59
commit
4487f8ff9f
|
|
@ -996,7 +996,7 @@ fn events(
|
||||||
.lock()
|
.lock()
|
||||||
.undo(&(cursor_range.as_ccursor_range(), text.as_str().to_owned()))
|
.undo(&(cursor_range.as_ccursor_range(), text.as_str().to_owned()))
|
||||||
{
|
{
|
||||||
text.replace(undo_txt);
|
text.replace_with(undo_txt);
|
||||||
Some(*undo_ccursor_range)
|
Some(*undo_ccursor_range)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
@ -1015,7 +1015,7 @@ fn events(
|
||||||
.lock()
|
.lock()
|
||||||
.redo(&(cursor_range.as_ccursor_range(), text.as_str().to_owned()))
|
.redo(&(cursor_range.as_ccursor_range(), text.as_str().to_owned()))
|
||||||
{
|
{
|
||||||
text.replace(redo_txt);
|
text.replace_with(redo_txt);
|
||||||
Some(*redo_ccursor_range)
|
Some(*redo_ccursor_range)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ pub trait TextBuffer {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Replaces all contents of this string with `text`
|
/// Replaces all contents of this string with `text`
|
||||||
fn replace(&mut self, text: &str) {
|
fn replace_with(&mut self, text: &str) {
|
||||||
self.clear();
|
self.clear();
|
||||||
self.insert_text(text, 0);
|
self.insert_text(text, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -91,7 +91,7 @@ impl TextBuffer for String {
|
||||||
self.clear();
|
self.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replace(&mut self, text: &str) {
|
fn replace_with(&mut self, text: &str) {
|
||||||
*self = text.to_owned();
|
*self = text.to_owned();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -121,7 +121,7 @@ impl<'a> TextBuffer for Cow<'a, str> {
|
||||||
<String as TextBuffer>::clear(self.to_mut());
|
<String as TextBuffer>::clear(self.to_mut());
|
||||||
}
|
}
|
||||||
|
|
||||||
fn replace(&mut self, text: &str) {
|
fn replace_with(&mut self, text: &str) {
|
||||||
*self = Cow::Owned(text.to_owned());
|
*self = Cow::Owned(text.to_owned());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue