 // MARK: - main controller
 class TemplatesPrefsController: NSViewController {
 	let templatePasteboardType = NSPasteboard.PasteboardType(rawValue: "io.rc2.client.codeTemplate")
-
+	//>>>
+	var last = ""
+	
 	// MARK: properties
 	@IBOutlet private var splitterView: NSSplitView!
 	@IBOutlet private var markdownButton: NSButton!


// MARK: - NSOutlineViewDataSource
extension TemplatesPrefsController: NSOutlineViewDataSource {
	func outlineView(_ outlineView: NSOutlineView, numberOfChildrenOfItem item: Any?) -> Int {
		if item == nil { return currentCategories.count }
		guard let category = item as? CodeTemplateCategory else { return 0 }

		guard let parent = codeOutlineView.parent(forItem: template) as? CodeTemplateCategory,
				let index = Optional.some(codeOutlineView.childIndex(forItem: template)), index != -1
			else { Log.error("", .app); return }
//		let index = parent.childIndex(forItem: template)
		parent.templates.value.remove(at: index)
		codeOutlineView.removeItems(at: IndexSet(integer: index), inParent: parent, withAnimation: .slideUp)
	}
