fix: do not return zero width codepoints from egc_at
Skip them and return the next non-zero width codepoint. This makes more sense and prevents endless loops in code that scans by egc width using egc_at, like Cursor.move_right_until for example.
This commit is contained in:
		
							parent
							
								
									79487baa6e
								
							
						
					
					
						commit
						3d90b199ad
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -538,7 +538,7 @@ const Node = union(enum) { | |||
|                 const ctx = @as(*@This(), @ptrCast(@alignCast(ctx_))); | ||||
|                 ctx.at = egc; | ||||
|                 ctx.wcwidth = wcwidth; | ||||
|                 if (ctx.col == 0 or egc[0] == '\n' or ctx.col < wcwidth) | ||||
|                 if (wcwidth > 0 and (ctx.col == 0 or egc[0] == '\n' or ctx.col < wcwidth)) | ||||
|                     return Walker.stop; | ||||
|                 ctx.col -= wcwidth; | ||||
|                 return Walker.keep_walking; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue