Skip to content

Incorrect list highlighting in some edge cases #477

@pursvir

Description

@pursvir

I've found two bugs:

  1. Special symbols, cyrillic letters, simplified chinese hieroglyphs and possibly even more non-latin characters which are inside projects, contexts and key:values make todo.sh treat those as task descriptions and ignore highlighting for those.
    While lsprj and lsc command treat those as projects/contexts.
  2. Some key:values containing several colons are highlighted as key:values whire they are not referring to todo.txt standard.

Environment:

OS: GNU/Linux
todo.sh version: 2.13.0
Bash version: 5.3.3-2
Awk implementation: gawk 5.3.2-1

Steps to reproduce:

  1. Invoke todo.sh ls on the following TODO_FILE:
2024-01-01 абв где ёжз +ИКЛ
икл мно прс @ТУФ
2025-11-27 tell about bug in todo.sh +абвГдеЁжз
@иклМноПрс
να ξαπλώσω στο μπάνιο και να φωνάξω +εύρηκα
:) @---
2025-11-26 @+++
++++ @@@@
Visit Bolshoi theater +Москва
购买蔬菜 +首都
Catch white nights in June 2026 +Санкт-Петербург
首都:都首
аБ:вГ 123456
a::::b is highlighted as KV
AB20 4834 CCED 2210 <>:<> is not highlighted as kv
-:+
2025-05-30 {} (:)
|:-0 is not highlighted as KV

This will cause projects and contexts of those entries to be highlighted as tasks' description parts, while they are not. Cases with key:values are described in the rows themselves.

The problem is in the wrong awk command logic in highlight() function. Changing projects and contexts regexps inside the for loop from /^[+].*[A-Za-z0-9_]$/ to /^[+].+$/ (with [@] for contexts) and from /^[A-Za-z0-9]+:[^ ]+$/ to /^[^:\S]+:[^:\S]+$/ for key:values seems to solve this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions