From 096ee0c2670f176cfab76d54a440e5d9201d79b4 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 4 Nov 2020 18:44:51 +0100 Subject: Add ctrl+arrow key to move by word in text input, fix search triggering with backspace repeat char --- include/SearchBar.hpp | 1 + include/Text.hpp | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/SearchBar.hpp b/include/SearchBar.hpp index de3b686..78420ec 100644 --- a/include/SearchBar.hpp +++ b/include/SearchBar.hpp @@ -66,6 +66,7 @@ namespace QuickMedia { bool needs_update; bool input_masked; bool typing; + int backspace_seq_count; float vertical_pos; sf::Clock time_since_search_update; }; diff --git a/include/Text.hpp b/include/Text.hpp index e471441..f102c59 100644 --- a/include/Text.hpp +++ b/include/Text.hpp @@ -111,12 +111,16 @@ namespace QuickMedia HOME, END, LEFT, - RIGHT + RIGHT, + LEFT_WORD, + RIGHT_WORD }; void updateCaret(); int getStartOfLine(int startIndex) const; int getEndOfLine(int startIndex) const; + int getStartOfWord(int startIndex) const; + int getEndOfWord(int startIndex) const; int getPreviousLineClosestPosition(int startIndex) const; int getNextLineClosestPosition(int startIndex) const; @@ -130,6 +134,7 @@ namespace QuickMedia VertexRef& get_vertex_ref_clamp(int index); // Takes into consideration if index is the last vertex and the last vertex is a newline, then it should be on its own line int get_vertex_line(int index) const; + sf::Uint32 get_vertex_codepoint(int index) const; private: sf::String str; // TODO: Remove this for non-editable text??? also replace with std::string? then we get more efficient editing of text const bool bold_font; -- cgit v1.2.3