Skip to content

Bug Report #2067

Description

@nonPointer

Diagnostic output

jrnl: v4.3
Python: 3.14.3 (main, Feb  3 2026, 15:32:20) [Clang 17.0.0 (clang-1700.6.3.2)]
OS: Darwin 25.3.0

Fresh installation by brew install jrnl.

Current Behavior

When typing Chinese characters (or CJK characters, which are double-width/full-width) directly in the command line prompt for jrnl, the terminal does not correctly calculate the visual width of the characters during deletion.

Specifically:

Pressing Backspace to delete a Chinese character only moves the cursor back by 1 visual cell instead of 2.

This results in "ghost characters" or visual artifacts remaining on the screen.

The cursor position becomes misaligned with the actual text content, making it difficult to edit the entry before hitting Enter.

Expected Behavior

The cursor should move back 2 visual cells when a double-width CJK character is deleted, ensuring that the visual display stays in sync with the actual string buffer. The terminal should correctly clear the entire width of the deleted character.

Repro Steps

  1. Open macOS terminal
  2. Run jrnl to start a new entry.
  3. Type a few Chinese characters (e.g., 你好世界).
  4. Press Backspace several times to delete the characters.
  5. Observe that the cursor remains stuck in the middle of characters or leaves trailing fragments of the deleted text on the line.

Debug output

[11:00:38] DEBUG    Logging start                                                                                                                                                                                                                   main.py:32
           DEBUG    Parsed args:                                                                                                                                                                                                                    main.py:42
                    Namespace(debug=True, preconfig_cmd=None, postconfig_cmd=None, filename=None, text=[], template=None, on_date=None, today_in_history=False, month=None, day=None, year=None, start_date=None, end_date=None, contains=None,               
                    strict=False, starred=False, tagged=False, limit=None, excluded=[], edit=False, delete=False, change_time=None, export=False, tags=False, short=False, config_override=[], config_file_path='', exclude_starred=False,                    
                    exclude_tagged=False)                                                                                                                                                                                                                     
           DEBUG    Reading configuration from file /Users/{redacted}/.config/jrnl/jrnl.yaml                                                                                                                                                      install.py:91
           DEBUG    Using configuration:                                                                                                                                                                                                        install.py:117
                    "{                                                                                                                                                                                                                                        
                        'colors': {                                                                                                                                                                                                                           
                            'body': 'none',                                                                                                                                                                                                                   
                            'date': 'black',                                                                                                                                                                                                                  
                            'tags': 'yellow',                                                                                                                                                                                                                 
                            'title': 'cyan'                                                                                                                                                                                                                   
                        },                                                                                                                                                                                                                                    
                        'default_hour': 9,                                                                                                                                                                                                                    
                        'default_minute': 0,                                                                                                                                                                                                                  
                        'editor': '',                                                                                                                                                                                                                         
                        'encrypt': False,                                                                                                                                                                                                                     
                        'highlight': True,                                                                                                                                                                                                                    
                        'indent_character': '|',                                                                                                                                                                                                              
                        'journals': {                                                                                                                                                                                                                         
                            'default': {'journal': '/Users/{redacted}/Downloads/jrnl/journal.txt'}                                                                                                                                                             
                        },                                                                                                                                                                                                                                    
                        'linewrap': 79,                                                                                                                                                                                                                       
                        'tagsymbols': '#@',                                                                                                                                                                                                                   
                        'template': False,                                                                                                                                                                                                                    
                        'timeformat': '%F %r',                                                                                                                                                                                                                
                        'version': 'v4.3'                                                                                                                                                                                                                     
                    }"                                                                                                                                                                                                                                        
           DEBUG    Using journal name: default                                                                                                                                                                                                  config.py:206
           DEBUG    Updating configuration with specific journal overrides:                                                                                                                                                                      config.py:111
                    {'journal': '/Users/{redacted}/Downloads/jrnl/journal.txt'}                                                                                                                                                                                
           DEBUG    Scoped config:                                                                                                                                                                                                               config.py:120
                    {                                                                                                                                                                                                                                         
                        'colors': {                                                                                                                                                                                                                           
                            'body': 'none',                                                                                                                                                                                                                   
                            'date': 'black',                                                                                                                                                                                                                  
                            'tags': 'yellow',                                                                                                                                                                                                                 
                            'title': 'cyan'                                                                                                                                                                                                                   
                        },                                                                                                                                                                                                                                    
                        'default_hour': 9,                                                                                                                                                                                                                    
                        'default_minute': 0,                                                                                                                                                                                                                  
                        'editor': '',                                                                                                                                                                                                                         
                        'encrypt': False,                                                                                                                                                                                                                     
                        'highlight': True,                                                                                                                                                                                                                    
                        'indent_character': '|',                                                                                                                                                                                                              
                        'journals': {                                                                                                                                                                                                                         
                            'default': {'journal': '/Users/{redacted}/Downloads/jrnl/journal.txt'}                                                                                                                                                             
                        },                                                                                                                                                                                                                                    
                        'linewrap': 79,                                                                                                                                                                                                                       
                        'tagsymbols': '#@',                                                                                                                                                                                                                   
                        'template': False,                                                                                                                                                                                                                    
                        'timeformat': '%F %r',                                                                                                                                                                                                                
                        'version': 'v4.3',                                                                                                                                                                                                                    
                        'journal': '/Users/{redacted}/Downloads/jrnl/journal.txt'                                                                                                                                                                              
                    }                                                                                                                                                                                                                                         
           DEBUG    open_journal 'default'                                                                                                                                                                                                      Journal.py:485
           DEBUG    start                                                                                                                                                                                                                 BaseEncryption.py:16
           DEBUG    start                                                                                                                                                                                                                   NoEncryption.py:12
           DEBUG    decrypting                                                                                                                                                                                                            BaseEncryption.py:29
           DEBUG    decrypting                                                                                                                                                                                                              NoEncryption.py:19
           DEBUG    opened Journal with 0 entries                                                                                                                                                                                               Journal.py:136
           DEBUG    Append mode: starting                                                                                                                                                                                                    controller.py:142
           DEBUG    Get template:                                                                                                                                                                                                            controller.py:183
                    --template: None                                                                                                                                                                                                                          
                    from config: False     

Other Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🆕New!bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions