|
64 | 64 |
|
65 | 65 | PREVIEWER_GROUP = "previewers" |
66 | 66 | TEXT_PREVIEW_CACHE_VERSION = "windowed-v2" |
67 | | -FONT_PREVIEW_CACHE_VERSION = "font-v2" |
68 | 67 | BAT_PREVIEW_CACHE_VERSION = "paged-v2" |
69 | 68 | BAT_PREVIEW_PAGE_SIZE = 256 |
70 | 69 | BAT_PREVIEWER_GROUP = "bat-pages" |
@@ -359,9 +358,15 @@ async def file_not_found( |
359 | 358 | return |
360 | 359 | try: |
361 | 360 | if dir_entry.is_symlink(): |
362 | | - await self.mount( |
363 | | - Static("The symlink target is not found!", classes="special") |
364 | | - ) |
| 361 | + self.set_border("title", "Broken Symlink") |
| 362 | + try: |
| 363 | + target_path = os.readlink(location) |
| 364 | + msg = f"The symlink target is not found!\nTarget: {target_path}" |
| 365 | + except OSError: |
| 366 | + msg = "The symlink target is not found!" |
| 367 | + |
| 368 | + await self.mount(Static(msg, classes="special")) |
| 369 | + |
365 | 370 | # also update option if necessary |
366 | 371 | if isinstance( |
367 | 372 | highlighted_option, FileListSelectionWidget |
@@ -411,7 +416,7 @@ def show_font_preview(self) -> None: |
411 | 416 | ) |
412 | 417 | return |
413 | 418 | signature = ( |
414 | | - f"{FONT_PREVIEW_CACHE_VERSION}:{preview_utils.MAX_FONT_SIZE}:{config['interface']['font_preview']['font_size']}", |
| 419 | + f"{preview_utils.MAX_FONT_SIZE}:{config['interface']['font_preview']['font_size']}", |
415 | 420 | f"{self._preview_texts['font_text']}:{fg_color.hex}:{bg_color.hex}:{NewImage.func.__name__}", |
416 | 421 | ) |
417 | 422 | img = _load_cached_image(realpath, "font", stat_result, signature) |
@@ -1652,8 +1657,7 @@ def mount_special_messages(self) -> None: |
1652 | 1657 | return |
1653 | 1658 | self.log(self._mime_type) |
1654 | 1659 | assert isinstance(self._current_content, str) |
1655 | | - title = self._mime_type.method if self._mime_type else "Preview" |
1656 | | - self.set_border("title", title) |
| 1660 | + self.set_border("title", self._mime_type.method if self._mime_type else "Preview") |
1657 | 1661 |
|
1658 | 1662 | display_content: str = self._current_content |
1659 | 1663 | if self._mime_type: |
|
0 commit comments