Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions KiNotes/core/defaultsConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,20 +203,20 @@ def debug_print(msg: str) -> None:
'text_primary': '#FFFFFF', # Pure White
'text_secondary': '#98989D', # Apple System Gray (Text)
'border': '#38383A', # Subtle separators
'accent_blue': '#5A9BD5', # Muted professional blue
'accent_blue': '#3B82F6', # Prism Blue (Dark)
'accent_green': '#6AAF6A', # Muted professional green
'accent_red': '#FF453A', # iOS Red (Dark Mode)
},
'light': {
'bg_panel': '#F2F2F7', # Apple System Gray 6 (Light)
'bg_panel': '#FFFFFF', # Prism Pure White
'bg_toolbar': '#FFFFFF', # Pure white cards
'bg_button': '#E5E5EA', # Apple System Gray 3 (Light)
'bg_button_hover': '#D1D1D6',
'bg_editor': '#FFFFFF',
'text_primary': '#000000',
'text_secondary': '#8E8E93',
'border': '#C6C6C8',
'accent_blue': '#3B82F6', # Muted professional blue
'accent_blue': '#2563EB', # Prism Blue (Light)
'accent_green': '#10B981', # Muted professional green
'accent_red': '#FF3B30', # iOS Red
},
Expand Down
54 changes: 27 additions & 27 deletions KiNotes/ui/main_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,10 @@ def _create_top_bar(self):
"""Create top bar with tabs + Import button on same line."""
top_bar = wx.Panel(self)
top_bar.SetBackgroundColour(hex_to_colour(self._theme["bg_toolbar"]))
top_bar.SetMinSize((-1, scale_size(70, self)))
top_bar.SetMinSize((-1, scale_size(48, self)))

sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.AddSpacer(scale_size(16, self))
sizer.AddSpacer(scale_size(12, self))

# Tab buttons - unified rounded style
self.tab_buttons = []
Expand All @@ -440,11 +440,11 @@ def _create_top_bar(self):
top_bar,
label=label,
icon="",
size=(100, 42),
size=(80, 32),
bg_color=self._theme["bg_button"],
fg_color=self._theme["text_primary"],
corner_radius=10,
font_size=11,
corner_radius=4,
font_size=10,
font_weight=wx.FONTWEIGHT_BOLD
)
btn.Bind_Click(lambda e, i=idx: self._on_tab_click(i))
Expand All @@ -459,11 +459,11 @@ def _create_top_bar(self):
top_bar,
label="Import",
icon="",
size=(120, 42),
size=(80, 32),
bg_color=self._theme["bg_button"],
fg_color=self._theme["text_primary"],
corner_radius=10,
font_size=11,
corner_radius=4,
font_size=10,
font_weight=wx.FONTWEIGHT_NORMAL
)
self.import_btn.Bind_Click(self._on_import_click)
Expand All @@ -477,11 +477,11 @@ def _create_top_bar(self):
top_bar,
label="↻",
icon="",
size=(42, 42),
size=(32, 32),
bg_color=self._theme["accent_blue"],
fg_color="#FFFFFF",
corner_radius=10,
font_size=14,
corner_radius=4,
font_size=12,
font_weight=wx.FONTWEIGHT_NORMAL
)
self.refresh_net_btn.SetToolTip("Refresh Net Cache")
Expand All @@ -493,11 +493,11 @@ def _create_top_bar(self):
top_bar,
label="Help",
icon="",
size=(80, 42),
size=(70, 32),
bg_color=self._theme["bg_button"],
fg_color=self._theme["text_primary"],
corner_radius=10,
font_size=11,
corner_radius=4,
font_size=10,
font_weight=wx.FONTWEIGHT_NORMAL
)
self.help_btn.Bind_Click(self._on_help_click)
Expand All @@ -508,11 +508,11 @@ def _create_top_bar(self):
top_bar,
label="Settings",
icon="",
size=(130, 42),
size=(90, 32),
bg_color=self._theme["bg_button"],
fg_color=self._theme["text_primary"],
corner_radius=10,
font_size=11,
corner_radius=4,
font_size=10,
font_weight=wx.FONTWEIGHT_NORMAL
)
self.settings_btn.Bind_Click(self._on_settings_click)
Expand All @@ -526,7 +526,7 @@ def _create_bottom_bar(self):
"""Create bottom bar with pcbtools.xyz link, Save and Export PDF buttons."""
bottom_bar = wx.Panel(self)
bottom_bar.SetBackgroundColour(hex_to_colour(self._theme["bg_toolbar"]))
bottom_bar.SetMinSize((-1, scale_size(70, self)))
bottom_bar.SetMinSize((-1, scale_size(48, self)))

sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.AddSpacer(scale_size(16, self))
Expand Down Expand Up @@ -572,11 +572,11 @@ def _create_bottom_bar(self):
bottom_bar,
label="Export Diary",
icon="",
size=(170, 48),
size=(110, 32),
bg_color=self._theme["bg_button"],
fg_color=self._theme["text_primary"],
corner_radius=10,
font_size=11,
corner_radius=4,
font_size=10,
font_weight=wx.FONTWEIGHT_NORMAL
)
self.export_diary_btn.Bind_Click(lambda e: self._on_export_work_diary())
Expand All @@ -587,11 +587,11 @@ def _create_bottom_bar(self):
bottom_bar,
label="Save",
icon="",
size=(130, 48),
size=(80, 32),
bg_color=self._theme["accent_green"],
fg_color="#FFFFFF",
corner_radius=10,
font_size=12,
corner_radius=4,
font_size=10,
font_weight=wx.FONTWEIGHT_BOLD
)
self.save_btn.Bind_Click(lambda e: self._on_manual_save())
Expand All @@ -602,11 +602,11 @@ def _create_bottom_bar(self):
bottom_bar,
label="Export PDF",
icon="",
size=(170, 48),
size=(110, 32),
bg_color=self._theme["accent_blue"],
fg_color="#FFFFFF",
corner_radius=10,
font_size=12,
corner_radius=4,
font_size=10,
font_weight=wx.FONTWEIGHT_BOLD
)
self.pdf_btn.Bind_Click(lambda e: self._on_export_pdf())
Expand Down
38 changes: 38 additions & 0 deletions KiNotes/ui/markdown_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,11 @@ def _on_key_down(self, event):
if alt and not ctrl and keycode == ord('T'):
self._on_format_timestamp(None)
return

# Alt+Backspace = Word Deletion (macOS Option+Delete)
if alt and not ctrl and keycode == wx.WXK_BACK:
self._delete_word_backwards()
return

# Enter key in list - continue list
if keycode == wx.WXK_RETURN:
Expand All @@ -349,6 +354,39 @@ def _on_key_down(self, event):

event.Skip()

def _delete_word_backwards(self):
"""Implement macOS-style Option+Delete word deletion."""
start, end = self._editor.GetSelection()
if start != end:
self._editor.Remove(start, end)
return

pos = self._editor.GetInsertionPoint()
if pos <= 0:
return

text = self._editor.GetValue()
if not text:
return

# Ensure pos is within bounds
pos = min(pos, len(text))
new_pos = pos

# Scan backward to skip immediate whitespace/punctuation if any
while new_pos > 0 and not text[new_pos-1].isalnum():
new_pos -= 1

if new_pos == 0:
self._editor.Remove(0, pos)
return

# Scan backward until we hit a non-alphanumeric character (word start)
while new_pos > 0 and text[new_pos-1].isalnum():
new_pos -= 1

self._editor.Remove(new_pos, pos)

# ============================================================
# FORMATTING HANDLERS
# ============================================================
Expand Down
10 changes: 5 additions & 5 deletions KiNotes/ui/styles.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class KiNotesStyles:
MARGIN_LARGE = 16

# Border radius (for custom drawing)
BORDER_RADIUS = 8
BORDER_RADIUS_SMALL = 4
BORDER_RADIUS = 4
BORDER_RADIUS_SMALL = 2

# Button sizes
BUTTON_HEIGHT = 28
ICON_BUTTON_SIZE = 28
TOOLBAR_HEIGHT = 40
BUTTON_HEIGHT = 32
ICON_BUTTON_SIZE = 32
TOOLBAR_HEIGHT = 36

# Checkbox styles
CHECKBOX_UNCHECKED = "☐"
Expand Down
57 changes: 50 additions & 7 deletions KiNotes/ui/visual_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ def _create_toolbar(self) -> wx.Panel:
"""Create the formatting toolbar with all buttons."""
toolbar = wx.Panel(self)
toolbar.SetBackgroundColour(self._toolbar_bg)
toolbar.SetMinSize((-1, scale_size(44, self)))
toolbar.SetMinSize((-1, scale_size(32, self)))

sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.AddSpacer(scale_size(8, self))
Expand Down Expand Up @@ -491,7 +491,7 @@ def _create_toolbar(self) -> wx.Panel:
if group_idx > 0:
# Add separator
sep = wx.StaticLine(toolbar, style=wx.LI_VERTICAL)
sep.SetMinSize((1, scale_size(28, self)))
sep.SetMinSize((1, scale_size(16, self)))
sizer.Add(sep, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, scale_size(6, self))

for label, tooltip, callback, is_toggle in group:
Expand All @@ -510,7 +510,7 @@ def _create_toolbar(self) -> wx.Panel:

def _create_toolbar_button(self, parent, label: str, tooltip: str, callback) -> wx.Button:
"""Create a toolbar button with consistent styling."""
btn_size = scale_size((36, 32), self)
btn_size = scale_size((28, 24), self)
btn = wx.Button(parent, label=label, size=btn_size, style=wx.BORDER_NONE)
btn.SetBackgroundColour(self._toolbar_bg)
btn.SetForegroundColour(self._text_color)
Expand All @@ -524,14 +524,14 @@ def _create_toolbar_button(self, parent, label: str, tooltip: str, callback) ->
if label in ("B", "I", "U"):
# Bold/Italic/Underline with appropriate style
style = wx.FONTSTYLE_ITALIC if label == "I" else wx.FONTSTYLE_NORMAL
btn.SetFont(wx.Font(13, wx.FONTFAMILY_DEFAULT, style, wx.FONTWEIGHT_BOLD))
btn.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, style, wx.FONTWEIGHT_BOLD))
elif label == "ab":
# Strikethrough - smaller font
btn.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
btn.SetFont(wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
elif len(label) <= 2:
btn.SetFont(wx.Font(12, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
btn.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
else:
btn.SetFont(wx.Font(11, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
btn.SetFont(wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))

btn.Bind(wx.EVT_BUTTON, callback)
btn.SetCursor(wx.Cursor(wx.CURSOR_HAND))
Expand Down Expand Up @@ -1216,6 +1216,9 @@ def _on_key_down(self, event):
if key == ord('T'):
self._on_timestamp(None)
return
elif key == wx.WXK_BACK:
self._delete_word_backwards()
return

# Handle Enter key for list continuation
if key == wx.WXK_RETURN:
Expand All @@ -1224,6 +1227,46 @@ def _on_key_down(self, event):

event.Skip()


def _delete_word_backwards(self):
"""Implement macOS-style Option+Delete word deletion."""
if self._editor.HasSelection():
self._editor.DeleteSelection()
return

pos = self._editor.GetInsertionPoint()
if pos <= 0:
return

text = self._editor.GetValue()
if not text:
return

# Ensure pos is within bounds for safety
pos = min(pos, len(text))

# macOS Option+Delete behavior:
# 1. Skip trailing whitespace/punctuation
# 2. Skip word characters

new_pos = pos

# Scan backward to skip immediate whitespace/non-alphanumeric if any
while new_pos > 0 and not text[new_pos-1].isalnum():
new_pos -= 1

# If we skipped something and hit start, just delete that range
if new_pos == 0:
self._editor.Remove(0, pos)
return

# Now we are at the end of a word (alphanumeric). Scan backward to find word start.
while new_pos > 0 and text[new_pos-1].isalnum():
new_pos -= 1

# Delete the range from detected start to original position
self._editor.Remove(new_pos, pos)

def _handle_enter_key(self):
"""Handle Enter key - new line with normal text style."""
pos = self._editor.GetInsertionPoint()
Expand Down