8000 Support editing non-seekable files via read-only temporary file by noborus · Pull Request #782 · noborus/ov · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Support editing non-seekable files via read-only temporary file #782

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

Merged
merged 3 commits into from
May 26, 2025

Conversation

noborus
Copy link
Owner
@noborus noborus commented May 26, 2025
  • Non-seekable files are now exported to a read-only temporary file for editing
  • Seekable files now trigger automatic reload after editing

This is a continuation of the implementation of issue #780.

noborus added 3 commits May 26, 2025 15:21
- Non-seekable files are now exported to a read-only temporary file for editing
- Seekable files now trigger automatic reload after editing

This is a continuation of the implementation of issue #780.
- Resolved an issue where the application could freeze if the editor command failed to execute
- Now properly handles command execution errors and displays an appropriate message
- Changed the timing to delete the temporary file:
  now it is removed after resuming the screen
- Prevents issues that could occur if the file is deleted before resume
}
// Reload the document after editing.
if isTemp {
os.Remove(fileName) // Clean up the temporary file.
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If anyone has any objections to deleting temporary files please comment.

@noborus noborus requested a review from Copilot May 26, 2025 08:32
Copy link
Contributor
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for editing non-seekable files by exporting them to a read-only temporary file and automatically reloading seekable files after editing.

  • Changed the default editor command from "vi" to "vim +%d %f" to include placeholders.
  • Introduced conditional handling to create a temporary file for non-seekable documents and trigger a reload for seekable ones.
  • Updated the editor execution setup, including a change in the standard input assignment.
Comments suppressed due to low confidence (1)

oviewer/edit.go:64

  • Assigning os.Stdout to c.Stdin may prevent the editor from receiving user input correctly. Consider reverting this to os.Stdin to ensure interactive editing works as expected.
c.Stdin = os.Stdout

@groutoutlook
Copy link

It's working as intended.

@noborus
Copy link
Owner Author
noborus commented May 26, 2025

It's working as intended.

Thank you for trying it.

@noborus noborus merged commit a8a394d into m 8624 aster May 26, 2025
9 checks passed
@noborus noborus deleted the non-seekable-edit branch June 12, 2025 23:55
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

Successfully merging this pull request may close these issues.

2 participants
0