diff options
Diffstat (limited to 'include/ricochet')
| -rw-r--r-- | include/ricochet/core/browser.hh | 5 | ||||
| -rw-r--r-- | include/ricochet/core/form_handler.hh | 11 | ||||
| -rw-r--r-- | include/ricochet/core/link_hints.hh | 27 | ||||
| -rw-r--r-- | include/ricochet/core/search_handler.hh | 23 | ||||
| -rw-r--r-- | include/ricochet/core/types.hh | 4 | ||||
| -rw-r--r-- | include/ricochet/core/ui_input.hh | 29 | ||||
| -rw-r--r-- | include/ricochet/core/ui_view.hh | 37 | ||||
| -rw-r--r-- | include/ricochet/core/utils.hh | 2 | ||||
| -rw-r--r-- | include/ricochet/tui/terminal.hh | 56 |
9 files changed, 2 insertions, 192 deletions
diff --git a/include/ricochet/core/browser.hh b/include/ricochet/core/browser.hh index ab7a473..fabcba4 100644 --- a/include/ricochet/core/browser.hh +++ b/include/ricochet/core/browser.hh @@ -18,7 +18,7 @@ #pragma once -#include <string_view> +#include <string> namespace ricochet::core { @@ -35,7 +35,6 @@ public: static std::string format_url( std::string input ); static std::string get_configured_homepage(); - static int run( std::string_view initial_url ); }; -} // namespace ricochet::core
\ No newline at end of file +} // namespace ricochet::core diff --git a/include/ricochet/core/form_handler.hh b/include/ricochet/core/form_handler.hh index 5abf148..d95bd02 100644 --- a/include/ricochet/core/form_handler.hh +++ b/include/ricochet/core/form_handler.hh @@ -12,7 +12,6 @@ #include "ricochet/core/types.hh" #include "ricochet/render/renderer.hh" -#include "ricochet/tui/terminal.hh" #include <cstddef> #include <string> #include <vector> @@ -25,14 +24,4 @@ InputAction submit_form( const render::InputField& target_input, std::vector<HttpRequest>& history, std::size_t& history_idx ); -void update_input_value( PageData& page_data, std::size_t index, const std::string& query ); -void update_single_line_ui( std::string& line, const std::string& marker, const render::InputField& in ); -void update_toggle_ui( PageData& page_data ); - -InputAction handle_form_input( const tui::Terminal& terminal, - PageData& page_data, - const std::string& current_url, - std::vector<HttpRequest>& history, - std::size_t& history_idx ); - } // namespace ricochet::core diff --git a/include/ricochet/core/link_hints.hh b/include/ricochet/core/link_hints.hh deleted file mode 100644 index 5da4846..0000000 --- a/include/ricochet/core/link_hints.hh +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Ricochet - A minimalist CLI web browser for fast, distraction-free navigation. - * Copyright (C) 2026 Richard Qin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - */ - -#pragma once - -#include "ricochet/core/types.hh" -#include "ricochet/tui/terminal.hh" -#include <string> - -namespace ricochet::core { - -std::string index_to_hint( std::size_t index ); -void toggle_link_hints( PageData& page_data, bool show ); -void handle_follow_link( const tui::Terminal& terminal, - PageData& page_data, - std::string& current_url, - std::size_t& scroll_y, - bool& navigate ); - -} // namespace ricochet::core diff --git a/include/ricochet/core/search_handler.hh b/include/ricochet/core/search_handler.hh deleted file mode 100644 index 7053be8..0000000 --- a/include/ricochet/core/search_handler.hh +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Ricochet - A minimalist CLI web browser for fast, distraction-free navigation. - * Copyright (C) 2026 Richard Qin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - */ - -#pragma once - -#include "ricochet/core/types.hh" -#include <cstddef> -#include <string> - -namespace ricochet::core { - -void find_search_matches( PageData& page_data, const std::string& query ); -void apply_search_highlight( PageData& page_data, const std::string& query ); -void execute_search( PageData& page_data, const std::string& query, std::size_t& scroll_y, bool next_match ); - -} // namespace ricochet::core diff --git a/include/ricochet/core/types.hh b/include/ricochet/core/types.hh index bd7e819..ef48016 100644 --- a/include/ricochet/core/types.hh +++ b/include/ricochet/core/types.hh @@ -31,10 +31,6 @@ struct PageData std::vector<std::string> links; std::vector<render::InputField> inputs; std::string title; - std::vector<std::string> original_lines {}; - std::string last_search {}; - std::size_t current_match_idx { 0 }; - std::vector<std::size_t> match_lines {}; }; struct HttpRequest diff --git a/include/ricochet/core/ui_input.hh b/include/ricochet/core/ui_input.hh deleted file mode 100644 index bf71685..0000000 --- a/include/ricochet/core/ui_input.hh +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Ricochet - A minimalist CLI web browser for fast, distraction-free navigation. - * Copyright (C) 2026 Richard Qin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -#pragma once - -#include "ricochet/tui/terminal.hh" -#include <string> - -namespace ricochet::core { - -std::string get_url_input( const tui::Terminal& terminal ); -std::string get_terminal_input( const tui::Terminal& terminal, const std::string& prompt ); - -} // namespace ricochet::core diff --git a/include/ricochet/core/ui_view.hh b/include/ricochet/core/ui_view.hh deleted file mode 100644 index d9a55fa..0000000 --- a/include/ricochet/core/ui_view.hh +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Ricochet - A minimalist CLI web browser for fast, distraction-free navigation. - * Copyright (C) 2026 Richard Qin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -#pragma once - -#include "ricochet/tui/terminal.hh" - -#include <string> -#include <string_view> -#include <vector> - -namespace ricochet::core { - -std::string build_footer( std::string_view url, std::size_t width ); - -void draw_view( const tui::Terminal& terminal, - const std::vector<std::string>& lines, - std::size_t scroll_y, - std::string_view url, - std::string_view title ); - -} // namespace ricochet::core diff --git a/include/ricochet/core/utils.hh b/include/ricochet/core/utils.hh index d9f58dd..61d480b 100644 --- a/include/ricochet/core/utils.hh +++ b/include/ricochet/core/utils.hh @@ -18,7 +18,6 @@ #pragma once -#include <cstddef> #include <string> #include <vector> @@ -27,6 +26,5 @@ namespace ricochet::core { std::vector<std::string> split_into_lines( const std::string& text ); std::string normalize_url( const std::string& target, const std::string& current_url ); std::string strip_ddg_tracker( std::string target ); -std::vector<std::string> wrap_lines( const std::vector<std::string>& original_lines, std::size_t wrap_width ); } // namespace ricochet::core diff --git a/include/ricochet/tui/terminal.hh b/include/ricochet/tui/terminal.hh deleted file mode 100644 index 2942a2a..0000000 --- a/include/ricochet/tui/terminal.hh +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Ricochet - A minimalist CLI web browser for fast, distraction-free navigation. - * Copyright (C) 2026 Richard Qin - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -#pragma once - -#include <termios.h> -#include <utility> - -namespace ricochet::tui { - -class Terminal -{ -public: - Terminal(); - ~Terminal(); - - Terminal( const Terminal& ) = delete; - Terminal& operator=( const Terminal& ) = delete; - Terminal( Terminal&& ) = delete; - Terminal& operator=( Terminal&& ) = delete; - - // Read a single key - char read_key() const; - - // Clear screen and move cursor to top-left - void clear_screen() const; - - // Get terminal size - std::pair<std::size_t, std::size_t> get_size() const; - - // Move cursor to a specific position - void move_cursor( std::size_t row, std::size_t col ) const; - - // Show or hide cursor - void show_cursor( bool visible ) const; - -private: - struct termios original_termios_ {}; // Save terminal original state -}; - -} // namespace ricochet::tui
\ No newline at end of file |
