aboutsummaryrefslogtreecommitdiff
path: root/plugins/ephemeraldocviews.lua
diff options
context:
space:
mode:
authorAdam <adamdharrison@gmail.com>2021-12-15 16:53:52 -0500
committerGitHub <noreply@github.com>2021-12-15 16:53:52 -0500
commitd79c5435506937f447f48238d5a748fd92d1b45d (patch)
treeaeb913543ed12cec9fbbfaf5770e9d1181eeba25 /plugins/ephemeraldocviews.lua
parent22022a9751ee0b059049b8e16b8b2b15db3b7727 (diff)
parent72d30b00d6012d4ea432a5f680eac37040475279 (diff)
downloadlite-xl-plugins-d79c5435506937f447f48238d5a748fd92d1b45d.tar.gz
lite-xl-plugins-d79c5435506937f447f48238d5a748fd92d1b45d.zip
Merge pull request #106 from Jipok/ephemeraldocviews
Rewrite ephemeral tabs plugin
Diffstat (limited to 'plugins/ephemeraldocviews.lua')
-rw-r--r--plugins/ephemeraldocviews.lua45
1 files changed, 0 insertions, 45 deletions
diff --git a/plugins/ephemeraldocviews.lua b/plugins/ephemeraldocviews.lua
deleted file mode 100644
index cb9f53d..0000000
--- a/plugins/ephemeraldocviews.lua
+++ /dev/null
@@ -1,45 +0,0 @@
--- mod-version:2 -- lite-xl 2.0
-local core = require "core"
-local command = require "core.command"
-local RootView = require "core.rootview"
-local DocView = require "core.docview"
-local Doc = require "core.doc"
-
-local open_doc = RootView.open_doc
-function RootView:open_doc(doc)
- local node = self:get_active_node_default()
- local ephemeral, existing_ephemeral = node.views, nil
- for i, view in ipairs(node.views) do
- if view.doc == doc then
- ephemeral = false
- end
- if view.doc and view.doc.ephemeral then
- existing_ephemeral = view
- end
- end
- if ephemeral and existing_ephemeral then
- node:close_view(self.root_node, existing_ephemeral)
- end
- local view = open_doc(self, doc)
- if ephemeral then
- view.doc.ephemeral = #node.views > 1
- end
- return view
-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)
-end
-
-local doc_insert = Doc.insert
-function Doc:insert(...)
- doc_insert(self, ...)
- self.ephemeral = false
-end
-
-local doc_remove = Doc.remove
-function Doc:remove(...)
- doc_remove(self, ...)
- self.ephemeral = false
-end