diff options
Diffstat (limited to 'plugins/ephemeraldocviews.lua')
-rw-r--r-- | plugins/ephemeraldocviews.lua | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/plugins/ephemeraldocviews.lua b/plugins/ephemeraldocviews.lua index cb9f53d..1169d7f 100644 --- a/plugins/ephemeraldocviews.lua +++ b/plugins/ephemeraldocviews.lua @@ -4,6 +4,7 @@ local command = require "core.command" local RootView = require "core.rootview" local DocView = require "core.docview" local Doc = require "core.doc" +local TreeView = require "plugins.treeview" local open_doc = RootView.open_doc function RootView:open_doc(doc) @@ -29,7 +30,7 @@ end local get_name = DocView.get_name function DocView:get_name() - return self.doc and self.doc.ephemeral and ("-- " .. get_name(self) .. " --") or get_name(self) + return self.doc and self.doc.ephemeral and ("~ " .. get_name(self) .. " ~") or get_name(self) end local doc_insert = Doc.insert @@ -43,3 +44,27 @@ function Doc:remove(...) doc_remove(self, ...) self.ephemeral = false end + +-- Double clicking in the TreeView makes the tab normal +local TreeView_original_event = TreeView.on_mouse_pressed +function TreeView:on_mouse_pressed(button, x, y, clicks) + TreeView_original_event(self, button, x, y, clicks) + if (clicks > 1) and (core.active_view.doc ~= nil) then + core.active_view.doc.ephemeral = false + end +end + +-- Double clicking on a tab makes it normal +local RootView_original_event = RootView.on_mouse_pressed +function RootView:on_mouse_pressed(button, x, y, clicks) + if RootView_original_event(self, button, x, y, clicks) then + if clicks > 1 then + local node = self.root_node:get_child_overlapping_point(x, y) + local idx = node:get_tab_overlapping_point(x, y) + if idx then + node.views[idx].doc.ephemeral = false + end + end + return true + end +end |