Guest User

Untitled

a guest
Sep 17th, 2024
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. Right now, we have a problem with this diff.
  2.  
  3. Image a file:
  4. ```
  5. line 1
  6. line 2
  7. ``
  8.  
  9. and the diff changes it to
  10. ```
  11. line 1
  12. line 2_1
  13. ```
  14.  
  15. when the characters are streming in, let's say line 1 has already been streamed in. And now, line 2 is being streamed: `lin`
  16.  
  17. what would the diff look like? since we update char by char, we'll have
  18.  
  19. line 1 -> no chage
  20. line 2 -> deleted
  21. line 3 -> addition of `lin`
  22.  
  23. This makes a weird graphic effect where at the very bottom of the diff, you see a bunch of characters streaming in.
  24.  
  25. To fix this, we should only dispatch the diff when the newcode that's being streamed in adds a new line
  26.  
  27. So, let's say, line 1 begins streaming. We break newCode by newline and only send the code for lines that have full new lines.
  28.  
  29. When the code stops streaming, there might not be a new line at the end of it - that's fine, i will handle that case separately.
  30.  
  31. Fix this code to change this
Advertisement
Add Comment
Please, Sign In to add comment