Skip to content

Commit

Permalink
chore: remove dead code (#202)
Browse files Browse the repository at this point in the history
  • Loading branch information
benlubas committed Jun 1, 2024
1 parent ab9351b commit 47b9a56
Showing 1 changed file with 16 additions and 39 deletions.
55 changes: 16 additions & 39 deletions rplugin/python3/molten/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,6 @@ def present(self) -> None:
to reduce flickering.
"""

@abstractmethod
def clear(self) -> None:
"""
Clear all images from the canvas.
"""

@abstractmethod
def img_size(self, identifier: str) -> Dict[str, int]:
"""
Expand Down Expand Up @@ -102,9 +96,6 @@ def deinit(self) -> None:
def present(self) -> None:
pass

def clear(self) -> None:
pass

def img_size(self, _indentifier: str) -> Dict[str, int]:
return {"height": 0, "width": 0}

Expand All @@ -131,7 +122,6 @@ class ImageNvimCanvas(Canvas):

def __init__(self, nvim: Nvim):
self.nvim = nvim
self.images = {}
self.visible = set()
self.to_make_visible = set()
self.to_make_invisible = set()
Expand All @@ -145,7 +135,6 @@ def init(self) -> None:

def deinit(self) -> None:
self.image_api.clear_all()
self.images.clear()

def present(self) -> None:
# images to both show and hide should be ignored
Expand All @@ -164,10 +153,6 @@ def present(self) -> None:
self.to_make_invisible.clear()
self.to_make_visible.clear()

def clear(self) -> None:
for img in self.visible:
self.image_api.clear(img)

def img_size(self, identifier: str) -> Dict[str, int]:
return self.image_api.image_size(identifier)

Expand All @@ -180,21 +165,19 @@ def add_image(
bufnr: int,
winnr: int | None = None,
) -> str:
if path not in self.images:
img = self.image_api.from_file(
path,
{
"id": identifier,
"buffer": bufnr,
"with_virtual_padding": True,
"x": x,
"y": y,
"window": winnr,
},
)
self.to_make_visible.add(img)
return img
return path
img = self.image_api.from_file(
path,
{
"id": identifier,
"buffer": bufnr,
"with_virtual_padding": True,
"x": x,
"y": y,
"window": winnr,
},
)
self.to_make_visible.add(img)
return img

def remove_image(self, identifier: str) -> None:
self.to_make_invisible.add(identifier)
Expand All @@ -214,7 +197,6 @@ def __init__(self, nvim: Nvim, split_dir: str | None, split_size: int | None):
self.nvim = nvim
self.split_dir = split_dir
self.split_size = split_size
self.images: dict = {}
self.visible = set()
self.to_make_visible = set()
self.to_make_invisible = set()
Expand Down Expand Up @@ -247,9 +229,6 @@ def present(self) -> None:
self.to_make_invisible.clear()
self.to_make_visible.clear()

def clear(self) -> None:
pass

def img_size(self, _indentifier: str) -> Dict[str, int]:
return {"height": 0, "width": 0}

Expand All @@ -263,11 +242,9 @@ def add_image(
_winnr: int,
) -> str | dict[str, str]:
"""Adds an image to the queue to be rendered by Wezterm via the place method"""
if path not in self.images:
img = {"path": path, "id": identifier}
self.to_make_visible.add(img["path"])
return img
return path
img = {"path": path, "id": identifier}
self.to_make_visible.add(img["path"])
return img

def remove_image(self, identifier: str) -> None:
pass
Expand Down

0 comments on commit 47b9a56

Please sign in to comment.