Skip to content

Commit

Permalink
changed (hex-)editor status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
SilenZcience committed Dec 5, 2024
1 parent 26cfb17 commit 385e297
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 3 additions & 4 deletions cat_win/src/service/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,7 @@ def _function_help(self) -> None:
'',
f"{'(Shift-)Tab':<{coff}}(de-)indent",
'',
f"{'^S':<{coff}}save file",
f"{'alt+S' if self.save_with_alt else '^S':<{coff}}save file",
f"{'^R':<{coff}}reload file",
'',
f"{'^B':<{coff}}put editor in background",
Expand Down Expand Up @@ -1450,16 +1450,15 @@ def _render_scr(self) -> None:
self.curse_window.addstr(max_y + self.status_bar_size - 2, 0,
self.error_bar[:max_x].ljust(max_x), self._get_color(2))

save_hotkey = ('alt+' if self.save_with_alt else '^') + 's'
status_bar = f"File: {self.display_name} | Exit: ^q | Save: {save_hotkey} | "
status_bar = f"File: {self.display_name} | Help: F1 | "
status_bar += f"Ln {self.cpos.row+1}, Col {self.cpos.col+1} "
status_bar += f"| {'NOT ' * self.unsaved_progress}Saved!"
if self.debug_mode:
status_bar += f" - Win: {self.wpos.col+1} {self.wpos.row+1} | {max_y}x{max_x}"
if len(status_bar) > max_x:
necc_space = max(0, max_x - (len(status_bar) - len(self.display_name) + 3))
status_bar = f"File: ...{self.display_name[-necc_space:] * bool(necc_space)} "
status_bar += f"| Exit: ^q | Save: {save_hotkey} | "
status_bar += '| Help: F1 | '
status_bar += f"Ln {self.cpos.row+1}, Col {self.cpos.col+1} "
status_bar += f"| {'NOT ' * self.unsaved_progress}Saved!"
if self.debug_mode:
Expand Down
7 changes: 3 additions & 4 deletions cat_win/src/service/hexeditor.py
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ def _function_help(self) -> None:
'',
f"{'Space,>,<':<{coff}}insert new byte",
'',
f"{'^S':<{coff}}save file",
f"{'alt+S' if self.save_with_alt else '^S':<{coff}}save file",
f"{'^R':<{coff}}reload file",
'',
f"{'^B':<{coff}}put editor in background",
Expand Down Expand Up @@ -1027,16 +1027,15 @@ def _render_status_bar(self, max_y: int, max_x: int) -> None:
self.curse_window.addstr(max_y + self.status_bar_size + 1, 0,
self.error_bar[:max_x].ljust(max_x), self._get_color(2))

save_hotkey = ('alt+' if self.save_with_alt else '^') + 's'
status_bar = f"File: {self.display_name} | Exit: ^q | Save: {save_hotkey} | "
status_bar = f"File: {self.display_name} | Help: F1 | "
status_bar += f"{self.cpos.row*HexEditor.columns+self.cpos.col:08X}"
status_bar += f" | {'NOT ' * self.unsaved_progress}Saved!"
if self.debug_mode:
status_bar += f" - Win: {self.wpos.col+1} {self.wpos.row+1} | {max_y}x{max_x}"
if len(status_bar) > max_x:
necc_space = max(0, max_x - (len(status_bar) - len(self.display_name) + 3))
status_bar = f"File: ...{self.display_name[-necc_space:] * bool(necc_space)} "
status_bar += f"| Exit: ^q | Save: {save_hotkey} | "
status_bar += '| Help: F1 | '
status_bar += f"{self.cpos.row*HexEditor.columns+self.cpos.col:08X}"
status_bar += f" | {'NOT ' * self.unsaved_progress}Saved!"
if self.debug_mode:
Expand Down

0 comments on commit 385e297

Please sign in to comment.