Skip to content

Escape sequences in description does not work. #369

Description

@zbigniew-polito

When I put valid OSC-8 escape sequence into Description text field. It does not get displayed correctly.

To Reproduce
~/.vit/formatters/description.py :

from functools import reduce

from vit.formatter import String
from vit.util import unicode_len

jira_url='https://someurl.com/browse/'

#echo -e '\e]8;;http://example.com\e\\This is a link\e]8;;\e\\

class Description(String):
  def format(self, description, task):
        if not description:
            return self.empty()
        try:
            jiraid, description = description.split(":",1)
            link = f"\x1b]8;;{jira_url}{jiraid}\x07{jiraid}\x1b]8;;\x07"
            print(link)
        except:
            pass

        width = unicode_len(description)
        colorized_description = self.colorize_description(description)
        if task['annotations']:
            annotation_width, colorized_description = self.format_combined(colorized_description, task)
            if annotation_width > width:
                width = annotation_width

        try:
            colorized_description[0]= (colorized_description[0][0],link+":"+colorized_description[0][1])
            return (width+len(jiraid), colorized_description)
        except:
            return (width, colorized_description)


    ...rest of missing Description methods copied from oryginal Description class ...

Expected behavior

Inside of vit, on the main screen with tasks list, a task with description:

SOME-ID: Some task description

should get printed as:

SOME-ID: Some task description

where SOME-ID is due to being OSC-8 escaped a clickable element within terminal making it a working valid hyperlink that opens web-browser at specified address when clicked with mouse pointer.

now the observed behavior is :

?]8;;https://someurl.com/browse/SOME-ID?SOME-ID?]8;;?: Some task description

gets printed while description string outputted with print(link) gets parsed by terminal correctly and is a valid hyperlink

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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