Allow using context in the placeholder_text method
This commit is contained in:
committed by
Kirill Bulatov
parent
cf3b875922
commit
c29ea9bdbc
@@ -1749,7 +1749,7 @@ impl Editor {
|
||||
self.completion_provider = Some(hub);
|
||||
}
|
||||
|
||||
pub fn placeholder_text(&self) -> Option<&str> {
|
||||
pub fn placeholder_text(&self, _cx: &mut WindowContext) -> Option<&str> {
|
||||
self.placeholder_text.as_deref()
|
||||
}
|
||||
|
||||
@@ -9618,7 +9618,7 @@ impl EditorSnapshot {
|
||||
self.is_focused
|
||||
}
|
||||
|
||||
pub fn placeholder_text(&self) -> Option<&Arc<str>> {
|
||||
pub fn placeholder_text(&self, _cx: &mut WindowContext) -> Option<&Arc<str>> {
|
||||
self.placeholder_text.as_ref()
|
||||
}
|
||||
|
||||
|
||||
@@ -1904,7 +1904,7 @@ impl EditorElement {
|
||||
rows: Range<u32>,
|
||||
line_number_layouts: &[Option<ShapedLine>],
|
||||
snapshot: &EditorSnapshot,
|
||||
cx: &ViewContext<Editor>,
|
||||
cx: &mut ViewContext<Editor>,
|
||||
) -> Vec<LineWithInvisibles> {
|
||||
if rows.start >= rows.end {
|
||||
return Vec::new();
|
||||
@@ -1914,7 +1914,7 @@ impl EditorElement {
|
||||
if snapshot.is_empty() {
|
||||
let font_size = self.style.text.font_size.to_pixels(cx.rem_size());
|
||||
let placeholder_color = cx.theme().colors().text_placeholder;
|
||||
let placeholder_text = snapshot.placeholder_text();
|
||||
let placeholder_text = snapshot.placeholder_text(cx);
|
||||
|
||||
let placeholder_lines = placeholder_text
|
||||
.as_ref()
|
||||
|
||||
Reference in New Issue
Block a user