Skip to content

Commit

Permalink
fix: Currentword highlights are not visible due to currentline highli…
Browse files Browse the repository at this point in the history
…ghts (fixed order)
  • Loading branch information
tomlin7 committed Aug 8, 2023
1 parent a301e59 commit eb0a1e8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
16 changes: 8 additions & 8 deletions biscuit/core/components/editors/texteditor/text.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ def __init__(self, master, path=None, exists=True, minimalist=False, language=No
self.update_words()

def config_tags(self):
self.tag_config(tk.SEL, background=self.base.theme.primary_background_highlight)
self.tag_config("highlight", background=self.base.theme.primary_background_highlight)
self.tag_config("currentline", background=self.base.theme.border)
self.tag_config("found", background="green")
self.tag_config("foundcurrent", background="orange")
self.tag_config(tk.SEL, background=self.base.theme.editors.selection)
self.tag_config("currentline", background=self.base.theme.editors.currentline)
self.tag_config("currentword", background=self.base.theme.editors.currentword)
self.tag_config("found", background=self.base.theme.editors.found)
self.tag_config("foundcurrent", background=self.base.theme.editors.foundcurrent)

def config_bindings(self):
self.bind("<KeyRelease>", self.key_release_events)
Expand Down Expand Up @@ -519,13 +519,13 @@ def highlight_current_word(self):
if self.minimalist or self.get_selected_text():
return

self.tag_remove("highlight", 1.0, tk.END)
self.tag_remove("currentword", 1.0, tk.END)
word = re.findall(r"\w+", self.get("insert wordstart", "insert wordend"))
if any(word) and word[0] not in self.syntax.keywords:
self.highlight_pattern(f"\\y{word[0]}\\y", "highlight", regexp=True)
self.highlight_pattern(f"\\y{word[0]}\\y", "currentword", regexp=True)

# elif word := self.get_selected_text():
# self.highlight_pattern(word, "highlight", end="sel.first")
# self.highlight_pattern(word, "currentword", end="sel.first")
# self.highlight_pattern(word, start="sel.last")


Expand Down
6 changes: 5 additions & 1 deletion biscuit/core/settings/config/theme/dark.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sv_ttk
from .theme import Theme
from pygments.token import Token

from .theme import Theme


class Dark(Theme):
name = "biscuit dark"
Expand Down Expand Up @@ -38,6 +39,9 @@ def __init__(self, *args, **kwds):
self.editors.diff.removed = "#452323"
self.editors.diff.addition = "#203423"

self.editors.currentword = "#474747"
self.editors.found = "#203423"

self.views.panel.logs.time = "#6a9955"
self.views.panel.logs.caller = "#569cd6"
self.views.panel.logs.info = "#b5cea8"
Expand Down
3 changes: 2 additions & 1 deletion biscuit/core/settings/config/theme/light.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import sv_ttk
from .theme import Theme
from pygments.token import Token

from .theme import Theme


class Light(Theme):
name = "biscuit light"
Expand Down
8 changes: 8 additions & 0 deletions biscuit/core/settings/config/theme/theme.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import Mapping

from pygments.token import Token


Expand Down Expand Up @@ -124,6 +125,7 @@ def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.menubar = FrameThemeObject(self)
self.menubar.item = HighlightableThemeObject(self.menubar)
self.menubar.title = ThemeObject(self)

self.base = BasePane(self)

Expand Down Expand Up @@ -191,6 +193,12 @@ def __init__(self, *args, **kwargs):
self.section = HighlightableThemeObject(self) # settings
self.labels = ThemeObject(self)

self.selection = theme.primary_background_highlight
self.currentline = theme.border
self.currentword = "#d5d5d5"
self.found = "#dbe6c2"
self.foundcurrent = "green"

self.text = ThemeObject(self)
self.minimap = FrameThemeObject(self)

Expand Down

0 comments on commit eb0a1e8

Please sign in to comment.