Set new file default content to a single byte full of zeros so that the cursor doesn't leave replace mode.
This commit is contained in:
parent
b2afa06ee1
commit
b1b442b23a
1 changed files with 5 additions and 2 deletions
7
file.py
7
file.py
|
@ -1,7 +1,7 @@
|
|||
#!/usr/bin/python3
|
||||
import os.path
|
||||
|
||||
from PyQt6.QtWidgets import QFileDialog, QTabWidget
|
||||
from PyQt6.QtWidgets import QFileDialog
|
||||
from editor import BitEditor
|
||||
|
||||
MAX_FILE_SIZE = 262144 # 2^18
|
||||
|
@ -22,7 +22,10 @@ class FileActions:
|
|||
if dialog.exec():
|
||||
self.open_multiple_files(dialog.selectedFiles())
|
||||
|
||||
def create_file(self, content: bin=b""):
|
||||
def create_file(self, content: bytes=(0).to_bytes(1)):
|
||||
# open a dialog where the user can choose a new filepath and create an empty file at that path
|
||||
# bytes=(0).to_bytes(1) creates a byte with only zeros in it
|
||||
|
||||
file_path, extension = QFileDialog.getSaveFileName(
|
||||
caption="New File",
|
||||
directory=self.app.utils.home_path,
|
||||
|
|
Loading…
Reference in a new issue