Small fixes

This commit is contained in:
Maddie H 2022-04-15 16:38:39 +01:00
parent b5553440fc
commit 2cde5fa49f
2 changed files with 14 additions and 12 deletions

View File

@ -7,7 +7,7 @@ class StatusBar:
self.mode = instance.mode.upper() self.mode = instance.mode.upper()
self.file = instance.buffer.name or "[No Name]" self.file = instance.buffer.name or "[No Name]"
self.icon = instance.config["icon"] or "λ" self.icon = instance.config["icon"] or "λ"
self.theme = "inverted" self.theme = "default"
self.colors = [7, 5, 13] self.colors = [7, 5, 13]
self.components = [self.icon, self.mode, self.file] self.components = [self.icon, self.mode, self.file]
@ -23,6 +23,16 @@ class StatusBar:
self.update(instance) self.update(instance)
if self.theme == "inverted": if self.theme == "inverted":
# Initialise the x position for each component
x = 1
# Render each component
for count, component in enumerate(self.components):
instance.screen.addstr(instance.height - 2, x, component,
curses.color_pair(self.colors[count]) | curses.A_BOLD)
x += len(component) + 1
else:
# Initialise temporary colors for inverted theme # Initialise temporary colors for inverted theme
colors = [] colors = []
@ -33,8 +43,9 @@ class StatusBar:
# Initialise the x position for each component # Initialise the x position for each component
x = 0 x = 0
# Render each component
for count, component in enumerate(self.components): for count, component in enumerate(self.components):
component = " " + component + " " component = f" {component} "
instance.screen.addstr(instance.height - 2, x, component, instance.screen.addstr(instance.height - 2, x, component,
curses.color_pair(colors[count]) | curses.A_BOLD) curses.color_pair(colors[count]) | curses.A_BOLD)
x += len(component) x += len(component)
@ -42,15 +53,6 @@ class StatusBar:
# Add a space at the end of the status bar # Add a space at the end of the status bar
instance.screen.addstr(instance.height - 2, x, " " * (instance.width - x), instance.screen.addstr(instance.height - 2, x, " " * (instance.width - x),
curses.color_pair(2)) curses.color_pair(2))
else:
# Initialise the x position for each component
x = 1
# Render each component
for count, component in enumerate(self.components):
instance.screen.addstr(instance.height - 2, x, component,
curses.color_pair(self.colors[count]) | curses.A_BOLD)
x += len(component) + 1
class Components: class Components:

View File

@ -15,7 +15,7 @@ def activate(instance, mode):
elif mode == "insert": elif mode == "insert":
# Activate insert mode # Activate insert mode
instance.components.components["bottom"][0].colors[1] = 9 instance.components.components["bottom"][0].colors[1] = 11
insert.activate() insert.activate()
elif mode == "normal": elif mode == "normal":