Skip to content

Commit 7709a91

Browse files
committed
fix(conflict): Fix Rich markup error when displaying non-conflicting fields
When a field is not conflicting, local_style/remote_style were empty strings, creating invalid markup like []value[/]. Fixed by using None and conditionally adding markup tags only when a style is present.
1 parent ca6e88d commit 7709a91

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

src/taskrepo/tui/conflict_resolver.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,13 +146,23 @@ def _display_conflict_comparison(console: Console, local_task: Task, remote_task
146146
remote_style = "bold yellow"
147147
conflict_marker = " ← CONFLICT"
148148
else:
149-
local_style = ""
150-
remote_style = ""
149+
local_style = None
150+
remote_style = None
151151
conflict_marker = ""
152152

153153
# Escape values to prevent Rich markup interpretation
154-
local_table.add_row(field_name, f"[{local_style}]{escape(str(local_val))}[/{local_style}]{conflict_marker}")
155-
remote_table.add_row(field_name, f"[{remote_style}]{escape(str(remote_val))}[/{remote_style}]{conflict_marker}")
154+
local_val_escaped = escape(str(local_val))
155+
remote_val_escaped = escape(str(remote_val))
156+
157+
if local_style:
158+
local_table.add_row(field_name, f"[{local_style}]{local_val_escaped}[/{local_style}]{conflict_marker}")
159+
else:
160+
local_table.add_row(field_name, f"{local_val_escaped}{conflict_marker}")
161+
162+
if remote_style:
163+
remote_table.add_row(field_name, f"[{remote_style}]{remote_val_escaped}[/{remote_style}]{conflict_marker}")
164+
else:
165+
remote_table.add_row(field_name, f"{remote_val_escaped}{conflict_marker}")
156166

157167
# Create panels
158168
local_panel = Panel(

0 commit comments

Comments
 (0)