strip right edge when making files.txt

This commit is contained in:
Lera Elvoé 2022-06-29 13:51:46 +03:00
parent 2284a1d1dd
commit 741e23af56

View File

@ -10,7 +10,7 @@ const START_BUTTON_SERVER_TEXT: Dictionary = {
false: "Start server", false: "Start server",
} }
const ACCEPTED_FILE_FORMATS := ["md"] # server should ignore these file types when adding endpoints const ACCEPTED_FILE_FORMATS := ["md"]
export(bool) var enable_file_autosave := true # if true, will save the active file's contents every save_file_timeout seconds. export(bool) var enable_file_autosave := true # if true, will save the active file's contents every save_file_timeout seconds.
export(float) var save_file_timeout := 4.0 # the time to save document content after the edited signal of TextEdit export(float) var save_file_timeout := 4.0 # the time to save document content after the edited signal of TextEdit
@ -170,7 +170,7 @@ func _generate_filestxt():
for file in working_files: for file in working_files:
file = file as FileDef file = file as FileDef
if file.include_in_filestxt: if file.include_in_filestxt:
files += "%s %s %s\n" % [file.file_path, file.date, file.title] files += ("%s %s %s\n" % [file.file_path, file.date, file.title]).strip_edges(false, true)
var f := File.new() var f := File.new()
if f.open(server_dir.plus_file("files.txt"), File.WRITE) == OK: if f.open(server_dir.plus_file("files.txt"), File.WRITE) == OK:
@ -243,6 +243,10 @@ func _set_file_tree_disabled(disabled: bool) -> void:
tree_item = tree_item.get_next() tree_item = tree_item.get_next()
func _set_context_menu_disabled(disabled: bool) -> void:
pass
func _on_FileTreeContextMenu_id_pressed(id: int) -> void: func _on_FileTreeContextMenu_id_pressed(id: int) -> void:
var idx = current_tree_selection.get_metadata(0)["id"] as int var idx = current_tree_selection.get_metadata(0)["id"] as int
var fd = working_files[idx] as FileDef var fd = working_files[idx] as FileDef