1- VERSION = " 2.0 .0"
1+ VERSION = " 2.1 .0"
22
33treeView = nil
44cwd = WorkingDirectory ()
@@ -72,6 +72,7 @@ function getSelection()
7272end
7373
7474-- don't use built-in view.Cursor:SelectLine() as it will copy to clipboard (in old versions of Micro)
75+ -- TODO: We require micro >= 1.3.2, so is this still an issue?
7576function selectLineInTree (view )
7677 if view == treeView then
7778 debug (" ***** selectLineInTree() *****" )
@@ -86,26 +87,34 @@ function onCursorDown(view) selectLineInTree(view) end
8687function onCursorUp (view ) selectLineInTree (view ) end
8788
8889-- mouse callback from micro editor when a left button is clicked on your view
89- function onMousePress (view , event )
90+ function preMousePress (view , event )
9091 if view == treeView then -- check view is tree as only want inputs from that view.
9192 local columns , rows = event :Position ()
9293 debug (" INFO: --> Mouse pressed -> columns location rows location -> " ,columns ,rows )
93- return false
94+ return true
9495 end
9596end
97+ function onMousePress (view , event )
98+ if view == treeView then
99+ selectLineInTree (view )
100+ preInsertNewline (view )
101+ return false
102+ end
103+ end
104+
96105
97106-- disallow selecting topmost line in treeView:
98107function preCursorUp (view )
99108 if view == treeView then
100- debug (" ***** preCursor(view ) *****" )
109+ debug (" ***** preCursor() *****" )
101110 if view .Cursor .Loc .Y == 1 then
102111 return false
103112end end end
104113
105114-- allows for deleting files
106115function preDelete (view )
107116 if view == treeView then
108- if debug == true then messenger :AddLog (" ***** preDelete(view ) *****" ) end
117+ if debug == true then messenger :AddLog (" ***** preDelete() *****" ) end
109118 local selected = getSelection ()
110119 if selected == " .." then return false end
111120 local type , command
203212
204213-- micro editor commands
205214MakeCommand (" tree" , " filemanager.ToggleTree" , 0 )
206- AddRuntimeFile (" filemanager" , " syntax" , " syntax.yaml" )
215+ AddRuntimeFile (" filemanager" , " syntax" , " syntax.yaml" )
0 commit comments