Skip to content

Commit bfd8968

Browse files
committed
fix clearing editbox
1 parent 07d84e1 commit bfd8968

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,8 @@ def clearSelection(self):
281281
self.currentHotkeyLabel.setText("")
282282
self.currentFileLabel.setText("")
283283
self.snippetDescription.setText("")
284-
self.edit.setPlainText("")
284+
self.edit.clear()
285+
self.tree.clearSelection()
285286
self.currentFile = ""
286287

287288
def reject(self):
@@ -311,11 +312,16 @@ def selectFile(self, new, old):
311312
if (self.resetting):
312313
self.resetting = False
313314
return
315+
if len(new.indexes()) == 0:
316+
self.clearSelection()
317+
self.currentFile = ""
318+
self.readOnly(True)
319+
return
314320
newSelection = self.files.filePath(new.indexes()[0])
315321
self.settings.setValue("ui/snippeteditor/selected", newSelection)
316322
if QFileInfo(newSelection).isDir():
317323
self.readOnly(True)
318-
self.tree.clearSelection()
324+
self.clearSelection()
319325
self.currentFile = ""
320326
return
321327

0 commit comments

Comments
 (0)