This commit is contained in:
Joseph T. Lyons 2023-12-05 13:04:53 -05:00
parent ce8bdb354b
commit a80b145d0d
2 changed files with 27 additions and 11 deletions

View file

@ -33,16 +33,16 @@ actions!(GiveFeedback, SubmitFeedback);
// }); // });
// } // }
// #[derive(Serialize)] #[derive(Serialize)]
// struct FeedbackRequestBody<'a> { struct FeedbackRequestBody<'a> {
// feedback_text: &'a str, feedback_text: &'a str,
// email: Option<String>, email: Option<String>,
// metrics_id: Option<Arc<str>>, metrics_id: Option<Arc<str>>,
// installation_id: Option<Arc<str>>, installation_id: Option<Arc<str>>,
// system_specs: SystemSpecs, system_specs: SystemSpecs,
// is_staff: bool, is_staff: bool,
// token: &'a str, token: &'a str,
// } }
// #[derive(Clone)] // #[derive(Clone)]
// pub(crate) struct FeedbackEditor { // pub(crate) struct FeedbackEditor {

View file

@ -1,3 +1,4 @@
use editor::Editor;
use gpui::{ use gpui::{
div, rems, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Render, div, rems, AppContext, DismissEvent, Div, EventEmitter, FocusHandle, FocusableView, Render,
ViewContext, ViewContext,
@ -8,7 +9,7 @@ use workspace::Workspace;
use crate::feedback_editor::GiveFeedback; use crate::feedback_editor::GiveFeedback;
pub struct FeedbackModal { pub struct FeedbackModal {
// editor: View<FeedbackEditor>, editor: View<Editor>,
tmp_focus_handle: FocusHandle, // TODO: should be editor.focus_handle(cx) tmp_focus_handle: FocusHandle, // TODO: should be editor.focus_handle(cx)
} }
@ -28,7 +29,22 @@ impl FeedbackModal {
} }
pub fn new(cx: &mut ViewContext<Self>) -> Self { pub fn new(cx: &mut ViewContext<Self>) -> Self {
let line_editor = cx.build_view(|cx| Editor::single_line(cx));
let line_editor_change = cx.subscribe(&line_editor, Self::on_line_editor_event);
// let editor = active_editor.read(cx);
// let cursor = editor.selections.last::<Point>(cx).head();
// let last_line = editor.buffer().read(cx).snapshot(cx).max_point().row;
// let scroll_position = active_editor.update(cx, |editor, cx| editor.scroll_position(cx));
// let current_text = format!(
// "line {} of {} (column {})",
// cursor.row + 1,
// last_line + 1,
// cursor.column + 1,
// );
Self { Self {
editor: line_editor,
tmp_focus_handle: cx.focus_handle(), tmp_focus_handle: cx.focus_handle(),
} }
} }