Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

large 10 GB text file has visually overlapping text lines in the lower portions of the file #27180

Closed
pmaier-bhs opened this issue Mar 20, 2025 · 2 comments

Comments

@pmaier-bhs
Copy link

Summary

When loading a 10 GB text file into ZED and then scrolling down the file, at some point the text lines start to overlap visually. First it's two lines, than the number of overlapping lines increases.

Steps to trigger the problem:

  1. Create a large text file filled with random text.
  2. Load that file.
  3. Scroll down.

Actual Behavior:

Text lines overlap visually.

Expected Behavior:

Text is displayed normally.

# %%

import os
import random
import string
import sys

def generate_random_text(length):
  """Generate a random string of specified length."""
  return ''.join(random.choices(string.ascii_letters + string.digits + string.punctuation + ' ', k=length))

def write_large_file(file_path, size_in_gb):
  """Write a large text file with random text, line-breaking after 120 characters."""
  chunk_size = 1024 * 1024  # 1 MB chunks
  total_size = size_in_gb * 1024 * 1024 * 1024  # Convert GB to bytes
  written_size = 0

  with open(file_path, 'w') as f:
      while written_size < total_size:
          remaining_size = total_size - written_size
          current_chunk_size = min(chunk_size, remaining_size)

          # Generate random text for the current chunk
          chunk_text = generate_random_text(current_chunk_size)

          # Insert line breaks after every 120 characters
          formatted_text = '\n'.join(chunk_text[i:i+120] for i in range(0, len(chunk_text), 120))

          # Write the formatted text to the file
          f.write(formatted_text)

          # Update the written size
          written_size += current_chunk_size

          # Print progress
          progress = (written_size / total_size) * 100
          sys.stdout.write(f"\rProgress: {progress:.2f}%")
          sys.stdout.flush()


  print("\nFile writing complete.")

# %%

file_path = "large_random_text_file.txt"
size_in_gb = 1  # Change this value to write a file of the desired size in GB
write_large_file(file_path, size_in_gb)
# %%
#
file_path = "large_random_text_file_10GB.txt"
size_in_gb = 10  # Change this value to write a file of the desired size in GB
write_large_file(file_path, size_in_gb)

<!-- Failed to upload "Bildschirmaufnahme 2025-03-20 um 12.53.05.mov" -->

Zed Version and System Specs

Zed: v0.178.5 (Zed)
OS: macOS 15.3.2
Memory: 32 GiB
Architecture: aarch64

@pmaier-bhs
Copy link
Author

Bildschirmaufnahme.2025-03-20.um.12.53.05.480p.mov

@MrSubidubi
Copy link
Contributor

Hey, thanks for the report!

This is a duplicate of #5355, so please feel free to upvote that issue and mark this one as duplicate. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants