MCPcopy Index your code
hub / github.com/ChrisFeldmeier/OpenCodeRust / handle_click

Method handle_click

crates/opencode-tui/src/components/session.rs:901–929  ·  view source on GitHub ↗
(&mut self, col: u16, row: u16)

Source from the content-addressed store, hash-verified

899 }
900
901 pub fn handle_click(&mut self, col: u16, row: u16) -> bool {
902 let Some(area) = self.last_messages_area else {
903 return false;
904 };
905
906 let max_x = area.x.saturating_add(area.width);
907 let max_y = area.y.saturating_add(area.height);
908 if col < area.x || col >= max_x || row < area.y || row >= max_y {
909 return false;
910 }
911
912 let line_index = self.scroll_offset + usize::from(row.saturating_sub(area.y));
913 if line_index >= self.rendered_line_count {
914 return false;
915 }
916 let Some(reasoning_id) = self
917 .thinking_toggle_hits
918 .iter()
919 .find(|hit| hit.line_index == line_index)
920 .map(|hit| hit.reasoning_id.clone())
921 else {
922 return false;
923 };
924
925 if !self.expanded_reasoning.insert(reasoning_id.clone()) {
926 self.expanded_reasoning.remove(&reasoning_id);
927 }
928 true
929 }
930
931 pub fn handle_sidebar_click(&mut self, col: u16, row: u16) -> bool {
932 if point_in_optional_rect(self.sidebar_open_button_area, col, row) {

Callers 1

handle_sidebar_clickMethod · 0.45

Calls 3

findMethod · 0.80
cloneMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected