completion not working yet
This commit is contained in:
@@ -13,4 +13,8 @@ pub trait CanvasState {
|
||||
fn set_current_field(&mut self, index: usize);
|
||||
fn set_current_cursor_pos(&mut self, pos: usize);
|
||||
fn set_has_unsaved_changes(&mut self, changed: bool);
|
||||
|
||||
// --- Autocomplete Support ---
|
||||
fn get_suggestions(&self) -> Option<&[String]>;
|
||||
fn get_selected_suggestion_index(&self) -> Option<usize>;
|
||||
}
|
||||
|
||||
@@ -93,7 +93,6 @@ impl RegisterState {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
impl CanvasState for AuthState {
|
||||
fn current_field(&self) -> usize {
|
||||
self.current_field
|
||||
@@ -163,6 +162,15 @@ impl CanvasState for AuthState {
|
||||
// Allow the generic handler to signal changes
|
||||
self.has_unsaved_changes = changed;
|
||||
}
|
||||
|
||||
// --- Autocomplete Support (Not Used for AuthState) ---
|
||||
fn get_suggestions(&self) -> Option<&[String]> {
|
||||
None // AuthState doesn't provide suggestions
|
||||
}
|
||||
|
||||
fn get_selected_suggestion_index(&self) -> Option<usize> {
|
||||
None // AuthState doesn't have selected suggestions
|
||||
}
|
||||
}
|
||||
|
||||
impl CanvasState for RegisterState {
|
||||
@@ -258,4 +266,22 @@ impl CanvasState for RegisterState {
|
||||
fn set_has_unsaved_changes(&mut self, changed: bool) {
|
||||
self.has_unsaved_changes = changed;
|
||||
}
|
||||
|
||||
fn get_suggestions(&self) -> Option<&[String]> {
|
||||
// Only show suggestions for the role field (index 4) when requested
|
||||
if self.current_field == 4 && self.show_role_suggestions {
|
||||
Some(&self.role_suggestions)
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
fn get_selected_suggestion_index(&self) -> Option<usize> {
|
||||
// Only return index if suggestions are shown for the role field
|
||||
if self.current_field == 4 && self.show_role_suggestions {
|
||||
self.selected_suggestion_index
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,4 +133,13 @@ impl CanvasState for FormState {
|
||||
fn set_has_unsaved_changes(&mut self, changed: bool) {
|
||||
self.has_unsaved_changes = changed;
|
||||
}
|
||||
|
||||
// --- Autocomplete Support (Not Used for FormState) ---
|
||||
fn get_suggestions(&self) -> Option<&[String]> {
|
||||
None // FormState doesn't provide suggestions
|
||||
}
|
||||
|
||||
fn get_selected_suggestion_index(&self) -> Option<usize> {
|
||||
None // FormState doesn't have selected suggestions
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user