mirror of
				https://github.com/notepad-plus-plus/notepad-plus-plus.git
				synced 2025-11-03 21:14:08 +01:00 
			
		
		
		
	[BUG_FIXED] (Author: Andreas Jonsson) Fix the crash issue while user Ctrl + double click on an empty document.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1342 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
		
							parent
							
								
									d5f8a23a09
								
							
						
					
					
						commit
						deb3b8fcfe
					
				@ -486,7 +486,14 @@ BOOL Notepad_plus::notify(SCNotification *notification)
 | 
			
		||||
			const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
 | 
			
		||||
 | 
			
		||||
			std::string bufstring;
 | 
			
		||||
 | 
			
		||||
			unsigned int position_of_click;
 | 
			
		||||
			// For some reason Ctrl+DoubleClick on an empty line means that notification->position == 1.
 | 
			
		||||
			// In that case we use SCI_GETCURRENTPOS to get the position.
 | 
			
		||||
			if (notification->position != -1)
 | 
			
		||||
				position_of_click = notification->position;
 | 
			
		||||
			else
 | 
			
		||||
				position_of_click = int(_pEditView->execute(SCI_GETCURRENTPOS));
 | 
			
		||||
 | 
			
		||||
			// Anonymous scope to limit use of the buf pointer (much easier to deal with std::string).
 | 
			
		||||
			{
 | 
			
		||||
@ -499,13 +506,6 @@ BOOL Notepad_plus::notify(SCNotification *notification)
 | 
			
		||||
					length = notifyView->execute(SCI_GETLENGTH);
 | 
			
		||||
					buf = new char[length + 1];
 | 
			
		||||
					notifyView->execute(SCI_GETTEXT, (LPARAM)(length + 1), (WPARAM)buf);
 | 
			
		||||
 | 
			
		||||
					// For some reason Ctrl+DoubleClick on an empty line means that notification->position == 1.
 | 
			
		||||
					// In that case we use SCI_GETCURRENTPOS to get the position.
 | 
			
		||||
					if(notification->position != -1)
 | 
			
		||||
						position_of_click = notification->position;
 | 
			
		||||
					else
 | 
			
		||||
						position_of_click = int(_pEditView->execute(SCI_GETCURRENTPOS));
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
@ -516,7 +516,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
 | 
			
		||||
 | 
			
		||||
					// Compute the position of the click (relative to the beginning of the line).
 | 
			
		||||
					const int line_position = notifyView->execute(SCI_POSITIONFROMLINE, notifyView->getCurrentLineNumber());
 | 
			
		||||
					position_of_click = notification->position - line_position;
 | 
			
		||||
					position_of_click = position_of_click - line_position;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				bufstring = buf;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user