@@ -1838,6 +1838,115 @@ impl Screen { |
| 1838 | 1838 | Ok(()) |
| 1839 | 1839 | } |
| 1840 | 1840 | |
| 1841 | + /// Render a centered rename modal dialog |
| 1842 | + pub fn render_rename_modal(&mut self, original_name: &str, new_name: &str) -> Result<()> { |
| 1843 | + let (width, height) = (self.cols, self.rows); |
| 1844 | + |
| 1845 | + // Calculate modal dimensions |
| 1846 | + let title = "Rename Symbol"; |
| 1847 | + let from_label = "From: "; |
| 1848 | + let to_label = "To: "; |
| 1849 | + let content_width = original_name.len().max(new_name.len()).max(20).max(title.len()); |
| 1850 | + let modal_width = content_width + 8; // padding + border |
| 1851 | + let modal_height = 6; // title + from + to + bottom border + padding |
| 1852 | + |
| 1853 | + // Center the modal |
| 1854 | + let start_col = ((width as usize).saturating_sub(modal_width)) / 2; |
| 1855 | + let start_row = ((height as usize).saturating_sub(modal_height)) / 2; |
| 1856 | + |
| 1857 | + let bg = Color::AnsiValue(236); |
| 1858 | + let border_color = Color::AnsiValue(244); |
| 1859 | + let label_color = Color::AnsiValue(248); |
| 1860 | + let value_color = Color::White; |
| 1861 | + let input_bg = Color::AnsiValue(238); |
| 1862 | + |
| 1863 | + // Draw top border |
| 1864 | + execute!( |
| 1865 | + self.stdout, |
| 1866 | + MoveTo(start_col as u16, start_row as u16), |
| 1867 | + SetBackgroundColor(bg), |
| 1868 | + SetForegroundColor(border_color), |
| 1869 | + Print(format!("┌{:─<width$}┐", "", width = modal_width - 2)), |
| 1870 | + )?; |
| 1871 | + |
| 1872 | + // Draw title row |
| 1873 | + let title_padding = (modal_width - 2 - title.len()) / 2; |
| 1874 | + execute!( |
| 1875 | + self.stdout, |
| 1876 | + MoveTo(start_col as u16, start_row as u16 + 1), |
| 1877 | + SetBackgroundColor(bg), |
| 1878 | + SetForegroundColor(border_color), |
| 1879 | + Print("│"), |
| 1880 | + SetForegroundColor(Color::Cyan), |
| 1881 | + Print(format!("{:>pad$}{}{:<rpad$}", "", title, "", pad = title_padding, rpad = modal_width - 2 - title_padding - title.len())), |
| 1882 | + SetForegroundColor(border_color), |
| 1883 | + Print("│"), |
| 1884 | + )?; |
| 1885 | + |
| 1886 | + // Draw separator |
| 1887 | + execute!( |
| 1888 | + self.stdout, |
| 1889 | + MoveTo(start_col as u16, start_row as u16 + 2), |
| 1890 | + SetBackgroundColor(bg), |
| 1891 | + SetForegroundColor(border_color), |
| 1892 | + Print(format!("├{:─<width$}┤", "", width = modal_width - 2)), |
| 1893 | + )?; |
| 1894 | + |
| 1895 | + // Draw "From:" row |
| 1896 | + execute!( |
| 1897 | + self.stdout, |
| 1898 | + MoveTo(start_col as u16, start_row as u16 + 3), |
| 1899 | + SetBackgroundColor(bg), |
| 1900 | + SetForegroundColor(border_color), |
| 1901 | + Print("│ "), |
| 1902 | + SetForegroundColor(label_color), |
| 1903 | + Print(from_label), |
| 1904 | + SetForegroundColor(value_color), |
| 1905 | + Print(format!("{:<width$}", original_name, width = modal_width - 4 - from_label.len())), |
| 1906 | + SetForegroundColor(border_color), |
| 1907 | + Print(" │"), |
| 1908 | + )?; |
| 1909 | + |
| 1910 | + // Draw "To:" row with input field |
| 1911 | + let input_width = modal_width - 4 - to_label.len(); |
| 1912 | + execute!( |
| 1913 | + self.stdout, |
| 1914 | + MoveTo(start_col as u16, start_row as u16 + 4), |
| 1915 | + SetBackgroundColor(bg), |
| 1916 | + SetForegroundColor(border_color), |
| 1917 | + Print("│ "), |
| 1918 | + SetForegroundColor(label_color), |
| 1919 | + Print(to_label), |
| 1920 | + SetBackgroundColor(input_bg), |
| 1921 | + SetForegroundColor(Color::White), |
| 1922 | + Print(format!("{:<width$}", new_name, width = input_width)), |
| 1923 | + SetBackgroundColor(bg), |
| 1924 | + SetForegroundColor(border_color), |
| 1925 | + Print(" │"), |
| 1926 | + )?; |
| 1927 | + |
| 1928 | + // Draw bottom border |
| 1929 | + execute!( |
| 1930 | + self.stdout, |
| 1931 | + MoveTo(start_col as u16, start_row as u16 + 5), |
| 1932 | + SetBackgroundColor(bg), |
| 1933 | + SetForegroundColor(border_color), |
| 1934 | + Print(format!("└{:─<width$}┘", "", width = modal_width - 2)), |
| 1935 | + ResetColor, |
| 1936 | + )?; |
| 1937 | + |
| 1938 | + // Position cursor in the input field |
| 1939 | + let cursor_col = start_col + 2 + to_label.len() + new_name.len(); |
| 1940 | + execute!( |
| 1941 | + self.stdout, |
| 1942 | + MoveTo(cursor_col as u16, start_row as u16 + 4), |
| 1943 | + SetBackgroundColor(input_bg), |
| 1944 | + crossterm::cursor::Show, |
| 1945 | + )?; |
| 1946 | + |
| 1947 | + Ok(()) |
| 1948 | + } |
| 1949 | + |
| 1841 | 1950 | /// Render the LSP server manager panel |
| 1842 | 1951 | pub fn render_server_manager_panel(&mut self, panel: &ServerManagerPanel) -> Result<()> { |
| 1843 | 1952 | if !panel.visible { |