Clean up codebase and improve file loading

- Moved plugins to proper sub groups (autopairs, code_minimap, colorize, commentzar, info_bar, markdown_preview, prettify_json, search_replace, tabs_bar, telescope, toggle_source_view, lsp_client)
- Add filter_out_loaded_files to prevent opening already-loaded files
- Add INDEPENDENT source view state
- Fix cursor scroll position on buffer switch
- Fix signal blocking during file load
- Fix word boundary in completion provider
- Refactor code events into single events module
This commit is contained in:
2026-03-08 00:51:28 -06:00
parent a52d5243ab
commit 99dc917de3
229 changed files with 8809 additions and 756 deletions

View File

@@ -0,0 +1,3 @@
"""
Pligin Module Mixins
"""

View File

@@ -0,0 +1,39 @@
# Python imports
from pathlib import Path
# Lib imports
# Application imports
from .markdown_template_mixin import MarkdownTemplateMixin
from .. import markdown
class MarkdownPreviewMixin(MarkdownTemplateMixin):
def _do_markdown_translate(self, buffer):
if self.is_preview_paused: return
if not self.is_markdown(buffer):
data = self.wrap_html_to_body("<h1>Not a Markdown file...</h1>")
self._load_html(data)
return
data = self.get_rendered_markdown(buffer)
self._load_html(data, f"file://{self.fpath}")
def _load_html(self, data: str, base_path: str = ""):
self._markdown_view.load_html(
content = data, base_uri = base_path
)
def get_rendered_markdown(self, buffer) -> str:
start_itr = buffer.get_start_iter()
end_itr = buffer.get_end_iter()
text = buffer.get_text(start_itr, end_itr, include_hidden_chars = False)
html = markdown.markdown(text)
return self.wrap_html_to_body(html)
def is_markdown(self, buffer) -> bool:
return buffer.get_language() and buffer.get_language().get_id() == "markdown"

View File

@@ -0,0 +1,43 @@
# Python imports
# Lib imports
# Application imports
class MarkdownTemplateMixin:
def wrap_html_to_body(self, html: str):
return f"""\
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Markdown View</title>
<style media="screen">
html, body {{
display: block;
// background-color: #32383e64;
background-color: #32383e;
color: #ffffff;
text-wrap: wrap;
}}
img {{
width: 100%;
height: auto;
}}
code {{
border: 1px solid #32383e;
background-color: #32383e;
padding: 4px;
}}
</style>
</head>
<body>
{html}
</body>
</html>
"""