Merge branch 'dudztroyer-hotfix-1.6.2' into hotfix-1.6.2
This commit is contained in:
		
						commit
						840d6b775d
					
				@ -167,6 +167,8 @@ namespace nana{	namespace widgets
 | 
			
		||||
 | 
			
		||||
			bool select(bool);
 | 
			
		||||
 | 
			
		||||
			bool select_points(nana::upoint arg_a, nana::upoint arg_b);
 | 
			
		||||
 | 
			
		||||
			/// Sets the end position of a selected string.
 | 
			
		||||
			void set_end_caret(bool stay_in_view);
 | 
			
		||||
			
 | 
			
		||||
 | 
			
		||||
@ -224,6 +224,8 @@ namespace nana
 | 
			
		||||
        /// Selects/unselects all text.
 | 
			
		||||
		void select(bool);
 | 
			
		||||
 | 
			
		||||
		void select_points(nana::upoint arg_a, nana::upoint arg_b);
 | 
			
		||||
 | 
			
		||||
		/// Returns the bounds of a text selection
 | 
			
		||||
		/**
 | 
			
		||||
		 * @return no selection if pair.first == pair.second.
 | 
			
		||||
 | 
			
		||||
@ -25,7 +25,8 @@
 | 
			
		||||
#include <algorithm>
 | 
			
		||||
#include <map>
 | 
			
		||||
 | 
			
		||||
namespace nana{	namespace widgets
 | 
			
		||||
namespace nana {
 | 
			
		||||
	namespace widgets
 | 
			
		||||
	{
 | 
			
		||||
		namespace skeletons
 | 
			
		||||
		{
 | 
			
		||||
@ -1632,14 +1633,20 @@ namespace nana{	namespace widgets
 | 
			
		||||
				select_.a = select_.b = points_.caret;
 | 
			
		||||
				const auto& line = impl_->textbase.getline(select_.b.y);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
				if (select_.a.x < line.size() && !std::isalnum(line[select_.a.x]) && line[select_.a.x] != '_') {
 | 
			
		||||
					++select_.b.x;
 | 
			
		||||
				}
 | 
			
		||||
				else {
 | 
			
		||||
					// Expand the selection forward to the word's end.
 | 
			
		||||
			while (select_.b.x < line.size() && !std::iswspace(line[select_.b.x]))
 | 
			
		||||
					while (select_.b.x < line.size() && !std::iswspace(line[select_.b.x]) && (std::isalnum(line[select_.b.x]) || line[select_.b.x] == '_'))
 | 
			
		||||
						++select_.b.x;
 | 
			
		||||
 | 
			
		||||
					// Expand the selection backward to the word's start.
 | 
			
		||||
			while (select_.a.x > 0 && !std::iswspace(line[select_.a.x - 1]))
 | 
			
		||||
					while (select_.a.x > 0 && !std::iswspace(line[select_.a.x - 1]) && (std::isalnum(line[select_.a.x - 1]) || line[select_.a.x - 1] == '_'))
 | 
			
		||||
						--select_.a.x;
 | 
			
		||||
 | 
			
		||||
				}
 | 
			
		||||
				select_.mode_selection = selection::mode::method_selected;
 | 
			
		||||
				impl_->try_refresh = sync_graph::refresh;
 | 
			
		||||
				return true;
 | 
			
		||||
@ -1865,6 +1872,15 @@ namespace nana{	namespace widgets
 | 
			
		||||
				return false;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			bool text_editor::select_points(nana::upoint arg_a, nana::upoint arg_b)
 | 
			
		||||
			{
 | 
			
		||||
				select_.a = arg_a;
 | 
			
		||||
				select_.b = arg_b;
 | 
			
		||||
				select_.mode_selection = selection::mode::method_selected;
 | 
			
		||||
				impl_->try_refresh = sync_graph::refresh;
 | 
			
		||||
				return true;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			void text_editor::set_end_caret(bool stay_in_view)
 | 
			
		||||
			{
 | 
			
		||||
				bool new_sel_end = (select_.b != points_.caret);
 | 
			
		||||
 | 
			
		||||
@ -588,6 +588,15 @@ namespace drawerbase {
 | 
			
		||||
				API::refresh_window(*this);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		void textbox::select_points(nana::upoint arg_a, nana::upoint arg_b)
 | 
			
		||||
		{
 | 
			
		||||
			auto editor = get_drawer_trigger().editor();
 | 
			
		||||
			internal_scope_guard lock;
 | 
			
		||||
			if (editor && editor->select_points(arg_a, arg_b))
 | 
			
		||||
				API::refresh_window(*this);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		std::pair<upoint, upoint> textbox::selection() const
 | 
			
		||||
		{
 | 
			
		||||
			std::pair<upoint, upoint> points;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user