forked from Botanical/BotanJS
		
	Fixed a cursor jumping issue for word-wrapped lines
This commit is contained in:
		@@ -131,9 +131,14 @@
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		var jumpY = expLineNum - lastLineNum;
 | 
							var jumpY = expLineNum - lastLineNum;
 | 
				
			||||||
		var jumpX = aPos < lineStart ? lineStart - aPos : aPos - lineStart;
 | 
							if( jumpY ) this.moveY( jumpY );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							pline = this.getLine();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							var jumpX = aPos < lineStart ? lineStart - aPos : aPos - lineStart;
 | 
				
			||||||
		var kX = jumpX - pline.content.length;
 | 
							var kX = jumpX - pline.content.length;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// This handles word-wrapped long line phantom "\n"
 | 
				
			||||||
		while( 0 < kX )
 | 
							while( 0 < kX )
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
			jumpX ++;
 | 
								jumpX ++;
 | 
				
			||||||
@@ -142,8 +147,6 @@
 | 
				
			|||||||
			kX -= pline.content.length;
 | 
								kX -= pline.content.length;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if( jumpY ) this.moveY( jumpY );
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// This is needed because first line does not contain the first "\n" character
 | 
							// This is needed because first line does not contain the first "\n" character
 | 
				
			||||||
		if( 0 < this.getLine().lineNum && lineStart <= aPos ) jumpX --;
 | 
							if( 0 < this.getLine().lineNum && lineStart <= aPos ) jumpX --;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user