Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Do not use the blue keys on this terminal.


devel / comp.lang.python / Change the display style of the text on the STACKLINE.

SubjectAuthor
* Change the display style of the text on the STACKLINE.hongy...@gmail.com
`* Re: Change the display style of the text on the STACKLINE.Roland Mueller
 `* Re: Change the display style of the text on the STACKLINE.hongy...@gmail.com
  `* Re: Change the display style of the text on the STACKLINE.Roland Mueller
   +* Re: Change the display style of the text on the STACKLINE.Greg Ewing
   |`- Re: Change the display style of the text on the STACKLINE.Roland Mueller
   `* Re: Change the display style of the text on the STACKLINE.hongy...@gmail.com
    `- Re: Change the display style of the text on the STACKLINE.hongy...@gmail.com

1
Change the display style of the text on the STACKLINE.

<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15070&group=comp.lang.python#15070

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ae9:c007:: with SMTP id u7mr315385qkk.271.1631146804357;
Wed, 08 Sep 2021 17:20:04 -0700 (PDT)
X-Received: by 2002:a0c:eccb:: with SMTP id o11mr34418qvq.48.1631146804058;
Wed, 08 Sep 2021 17:20:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Wed, 8 Sep 2021 17:20:03 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.187; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.187
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
Subject: Change the display style of the text on the STACKLINE.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Thu, 09 Sep 2021 00:20:04 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 13
 by: hongy...@gmail.com - Thu, 9 Sep 2021 00:20 UTC

I'm using the following code in my forked project [1]:

percol.view.STACKLINE = 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s Dir:M-d Dircmd:M-b'

I would like to change the display style of the text mentioned above, for example, to underline some characters in it, as shown below:

_D_ir:M-d

How to achieve this purpose?

[1] https://github.com/hongyi-zhao/ariadne/blob/838179bb4275ac85f5342d9e7d086d6ade3be1de/rc.py#L55

Regards,
HY

Re: Change the display style of the text on the STACKLINE.

<mailman.676.1631192234.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15076&group=comp.lang.python#15076

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: roland.e...@googlemail.com (Roland Mueller)
Newsgroups: comp.lang.python
Subject: Re: Change the display style of the text on the STACKLINE.
Date: Thu, 9 Sep 2021 15:57:02 +0300
Lines: 48
Message-ID: <mailman.676.1631192234.4164.python-list@python.org>
References: <49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
<CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de CwwTvTlNbOvflWXZKqTsawxJSacNP+ZJ3XrcvPd9p76w==
Return-Path: <roland.em0001@googlemail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=googlemail.com header.i=@googlemail.com header.b=n2btqJMw;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.001
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url-ip:140.82.121.4/32':
0.03; 'url-ip:140.82.121/24': 0.03; 'url-ip:140.82/16': 0.03;
'&gt;&gt;&gt;': 0.07; 'e.g.': 0.07; 'url:mailman': 0.09; 'cc:addr
:python-list': 0.09; 'from:addr:googlemail.com': 0.09; 'url-
ip:140/8': 0.12; 'cc:no real name:2**0': 0.13; 'url:github': 0.13;
'import': 0.14; '[1]:': 0.16; 'purpose?': 0.16; 'underline': 0.16;
'url:listinfo': 0.16; 'cc:addr:python.org': 0.19; 'url-
ip:188.166.95.178/32': 0.20; 'url-ip:188.166.95/24': 0.20; 'url-
ip:188.166/16': 0.23; 'skip:_ 10': 0.23; 'code': 0.24; '>>>':
0.26; 'skip:p 30': 0.26; 'cc:2**0': 0.27; 'url-ip:188/8': 0.29;
'text': 0.29; 'it,': 0.31; "i'm": 0.32; 'message-
id:@mail.gmail.com': 0.33; 'using': 0.33; 'header:In-Reply-To:1':
0.33; 'received:google.com': 0.34; 'example,': 0.35; 'following':
0.35; 'received:209.85.208': 0.36; 'display': 0.37; 'change':
0.37; 'received:209.85': 0.38; 'received:209': 0.38; 'use': 0.38;
'mentioned': 0.40; "skip:' 10": 0.40; 'style': 0.63; 'skip:r 40':
0.65; 'below:': 0.67; '[1]': 0.68; 'above,': 0.71; '2021': 0.84;
'characters': 0.84; 'roland': 0.84; 'url:blob': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=FKjorW1a3X8ohv7OozeNxm9xQs3j8/kJQ+4PNlw6/YQ=;
b=n2btqJMwsM7W930RLFJxckosJuCONsWJa/uGQc+eYjU35/hVuF36g0+Suz2OaZueaW
L0twS/eFrCCxKVtfSN0wLpEh01MCFEaitZ4rhTYSc7B948yLybaFx21S7SAovyVXc8N4
XQJvGnYXm9sHHfjfxBgTetGhU+h7s9vVPC1ZMsCxkrHlYQou56D6zJZfJ4aUOZA+/wsy
0Eg2nRN5s0piJpVvSEVbXoBFmkA/j4n66Utc7r/HgUvgKcntBaJL9l8w2/VPpXlpRddT
Mb2vKh36CB35qpAWd/7YkJcnuT5pX2QG7NDxnrfSsDSZoKAaro3LehZ2xrko9/eHAF/3
1ncA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=FKjorW1a3X8ohv7OozeNxm9xQs3j8/kJQ+4PNlw6/YQ=;
b=X15c8a6UG5GK9r57OAntG1wdIDsemeEutHU7SeJAMGCIHw0uk3MIvHsIYPKxJa7V5h
idYnVCF7kMjs2sds0Ik+e2pw+3TsBNUegx550Ig19PqP+rZlDz4L3AqwjMS0cfacDbu3
xm4XQ0tCGC8CXDANoQkDePn9yS0NYfx6DaHAbwkjXU83rqYSbVOgXuWfaTfbolQbZPLP
lnxgqf73E5Em1RIsCWwe70+nLQ4hIiUtl9/762lNZVD+Xu6wv9hJZuqeVqaXCfFl2rwz
MVdqBogLnm+3pBUvydZVv9Asb4Ngpf+RtnOxTWELCKJ5+A85R0zBzt59yNIuzpmmXvhU
pd2Q==
X-Gm-Message-State: AOAM530tf6DO7Iha/99m0z9weGaUiimPCfGscfOeXgdKFXM8Gl7f2y/3
74UhH6iij6ia6KD46F49Di+J9BA17yy59/sBatKKYg3r8S8=
X-Google-Smtp-Source: ABdhPJw2mlrEV0f8kXCOEyOIkeMICmq/RJ/6lDqxX3exevvIdgoML6Ue8ZiVfMeKHNA+eAzJC7JKlLTo2rgzbZqxJMQ=
X-Received: by 2002:a05:6402:b69:: with SMTP id
cb9mr3065898edb.324.1631192233893;
Thu, 09 Sep 2021 05:57:13 -0700 (PDT)
In-Reply-To: <49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.34
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
X-Mailman-Original-References: <49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
 by: Roland Mueller - Thu, 9 Sep 2021 12:57 UTC

Hello

to 9. syysk. 2021 klo 6.53 hongy...@gmail.com (hongyi.zhao@gmail.com)
kirjoitti:

> I'm using the following code in my forked project [1]:
>
> percol.view.STACKLINE = 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s Dir:M-d
> Dircmd:M-b'
>
> I would like to change the display style of the text mentioned above, for
> example, to underline some characters in it, as shown below:
>
> _D_ir:M-d
>
>
You can use e.g. str.replace() or re.sub()

>>> percol.view.STACKLINE = percol.view.STACKLINE.replace('D', '_D_')
Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d _D_ircmd:M-b'

>>> import re

Replace D with _D_
>>> percol.view.STACKLINE = re.sub(r'([D])',
r'_\1_', percol.view.STACKLINE)
Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d _D_ircmd:M-b'

Replace D and M with _D_, _M_
>>> percol.view.STACKLINE = re.sub(r'([DM])', r'_\1_',
percol.view.STACKLINE)
'Fold:F1,F2,F3 Push:C-p Pop:_M_-p Script:_M_-s _D_ir:_M_-d _D_ircmd:_M_-b'

Regards,
Roland

> How to achieve this purpose?
>
> [1]
> https://github.com/hongyi-zhao/ariadne/blob/838179bb4275ac85f5342d9e7d086d6ade3be1de/rc.py#L55
>
> Regards,
> HY
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Re: Change the display style of the text on the STACKLINE.

<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15083&group=comp.lang.python#15083

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a0c:9c48:: with SMTP id w8mr6305843qve.65.1631250280919;
Thu, 09 Sep 2021 22:04:40 -0700 (PDT)
X-Received: by 2002:ac8:4e24:: with SMTP id d4mr6129257qtw.277.1631250280698;
Thu, 09 Sep 2021 22:04:40 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Thu, 9 Sep 2021 22:04:40 -0700 (PDT)
In-Reply-To: <mailman.676.1631192234.4164.python-list@python.org>
Injection-Info: google-groups.googlegroups.com; posting-host=172.105.239.49; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 172.105.239.49
References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com> <mailman.676.1631192234.4164.python-list@python.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>
Subject: Re: Change the display style of the text on the STACKLINE.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 10 Sep 2021 05:04:40 +0000
Content-Type: text/plain; charset="UTF-8"
Lines: 71
 by: hongy...@gmail.com - Fri, 10 Sep 2021 05:04 UTC

On Thursday, September 9, 2021 at 8:57:37 PM UTC+8, Roland Mueller wrote:
> Hello
>
> to 9. syysk. 2021 klo 6.53 hongy...@gmail.com (hongy...@gmail.com)
> kirjoitti:
> > I'm using the following code in my forked project [1]:
> >
> > percol.view.STACKLINE = 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s Dir:M-d
> > Dircmd:M-b'
> >
> > I would like to change the display style of the text mentioned above, for
> > example, to underline some characters in it, as shown below:
> >
> > _D_ir:M-d
> >
> >
> You can use e.g. str.replace() or re.sub()
>
> >>> percol.view.STACKLINE = percol.view.STACKLINE.replace('D', '_D_')
> Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d _D_ircmd:M-b'
>
> >>> import re
>
> Replace D with _D_
> >>> percol.view.STACKLINE = re.sub(r'([D])',
> r'_\1_', percol.view.STACKLINE)
> Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d _D_ircmd:M-b'
>
> Replace D and M with _D_, _M_
> >>> percol.view.STACKLINE = re.sub(r'([DM])', r'_\1_',
> percol.view.STACKLINE)
> 'Fold:F1,F2,F3 Push:C-p Pop:_M_-p Script:_M_-s _D_ir:_M_-d _D_ircmd:_M_-b'
>
> Regards,
> Roland

I tried with the following, but failed to achieve the expected effect:

class Term:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
LIGHTCYAN = '\033[1;36m'
LIGHTGRAY = '\033[0;37m'
YELLOW = '\033[0;33m'
BOLD = '\033[1m'
UNDERLINE = '\033[4m'

[...]

percol.view.STACKLINE = percol.view.STACKLINE.replace('D', Term.UNDERLINE + 'D' + Term.ENDC)

The result will look like this:

Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s ?[4mD?[0mir:M-d ?[4mD?[0mircmd:M-b

Regards,
HY

> > How to achieve this purpose?
> >
> > [1]
> > https://github.com/hongyi-zhao/ariadne/blob/838179bb4275ac85f5342d9e7d086d6ade3be1de/rc.py#L55
> >
> > Regards,
> > HY
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >

Re: Change the display style of the text on the STACKLINE.

<mailman.682.1631254331.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15085&group=comp.lang.python#15085

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: roland.e...@googlemail.com (Roland Mueller)
Newsgroups: comp.lang.python
Subject: Re: Change the display style of the text on the STACKLINE.
Date: Fri, 10 Sep 2021 09:11:58 +0300
Lines: 126
Message-ID: <mailman.682.1631254331.4164.python-list@python.org>
References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
<mailman.676.1631192234.4164.python-list@python.org>
<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>
<CALk2KRUgC4Q2+3DqdMSKTWZ=O=JxzJJ2w4mJ2ff5Jbw+zYMN=g@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de bzupkx+a4DmeRXSoUvwqSAFhpFeFJVW4Q6SKqF59L5BA==
Return-Path: <roland.em0001@googlemail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=googlemail.com header.i=@googlemail.com header.b=SEglYDyl;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.000
X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'url-ip:140.82/16': 0.03;
'this:': 0.03; 'jul': 0.04; '&gt;&gt;&gt;': 0.07; 'e.g.': 0.07;
'influence': 0.07; 'linux': 0.07; 'url:mailman': 0.09; 'cc:addr
:python-list': 0.09; 'from:addr:googlemail.com': 0.09; 'hat':
0.09; 'terminal': 0.09; 'url-ip:140/8': 0.12; 'cc:no real
name:2**0': 0.13; 'url:github': 0.13; 'import': 0.14; '&gt;':
0.14; '[1]:': 0.16; 'effect:': 0.16; 'purpose?': 0.16;
'underline': 0.16; 'wrote:': 0.16; 'that.': 0.16; 'url:listinfo':
0.16; 'python': 0.16; 'cc:addr:python.org': 0.19; 'url-
ip:188.166.95.178/32': 0.20; 'url-ip:188.166.95/24': 0.20; 'url-
ip:188.166/16': 0.23; 'skip:_ 10': 0.23; 'header': 0.24; 'code':
0.24; 'cannot': 0.24; '>>>': 0.26; 'settings': 0.26; 'skip:p 30':
0.26; 'tried': 0.26; 'cc:2**0': 0.27; 'content-disposition:inline;
filename="image.png"': 0.27; 'filename:fname piece:image': 0.27;
'filename:fname:image.png': 0.27; 'image-size:2**11': 0.27;
'image.png]': 0.27; 'output': 0.28; 'url-ip:188/8': 0.29; 'text':
0.29; 'it,': 0.31; 'printed': 0.31; 'but': 0.31; "i'm": 0.32;
'message-id:@mail.gmail.com': 0.33; 'using': 0.33; 'class': 0.33;
'header:In-Reply-To:1': 0.33; 'received:google.com': 0.34;
'example,': 0.35; 'following': 0.35; 'failed': 0.35; 'display':
0.37; 'inside': 0.37; 'change': 0.37; 'received:209.85': 0.38;
'received:209': 0.38; 'use': 0.38; '[image:': 0.40; 'mentioned':
0.40; "skip:' 10": 0.40; "skip:' 20": 0.40; 'skip:? 10': 0.63;
'style': 0.63; 'your': 0.64; 'look': 0.66; 'below:': 0.67; '[1]':
0.68; 'shows': 0.70; 'above,': 0.71; '2021': 0.84; 'bold': 0.84;
'characters': 0.84; 'roland': 0.84; 'strings': 0.84; 'url:blob':
0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=iZ4ZUK8DxYot65tHkP/hmtHwldFkNWgE2JH1s4U69MY=;
b=SEglYDylfr3iUJ7r6L0A3XQ4866M03SqmWSeX/Ty70NnZgT4mqD0ATE80yeqqt3c4h
NhU1YBVD0XJZLuHKOqIgAZRf4EINN5IKWfbRCMsAGZ7J1ZloX2ugnuo1fKMFfGmd22sL
nS3hgFZX0sxSG+s0eIFfAWW4I9BqovfWb0HCGcrk1ME+xJ/gUiVcWUIENp4LXJSvFKVW
OF8UqgvPt9DixnkkMpPVmaUmYbGJcCbbovjv0VtpV5TfhHUOONCw0j/uvzhR7diV2wq6
wb+KIMO16x3dqZO2582cN8MDunSxrmiKuu3f+rRGAerlDDol2wMrX7t2YaW5HCRpzgfA
9xDg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=iZ4ZUK8DxYot65tHkP/hmtHwldFkNWgE2JH1s4U69MY=;
b=GTH0l9cB2HRGhV5mJnzn4dDePUEzWo7qcwmH8UK7lF/YPNDWgMLZURMwBhh6BeHu0r
HXNPLcqi6XCeUYETkG7I5pLkf0vuZmXo7raDS9MG/IHlxy5EBvYTop/GcFHZNV7btl3x
8uHuSPLRmV5+ySxv4Fsn2mSK3LTlRsSTGtrMFkr0BezyDUubCmFgyDscPJGxWcOQy4tt
2DS05tIY0300ahCp18ThFKb3Kp8NqCLSpCNhHWXVhscO6LUwVA7JkyxKfa5PDwmi/P3E
RCDm0yuVtGr6oA5UCH/4hllnkLoZJq3/YxumNiSP7uB5wyMG1ELw31AkANYNgJepg32Z
RT2A==
X-Gm-Message-State: AOAM531+Q3ngeurxZeZj7B4O8zyM2jXmO8zM1kUqON8pLZjT4mziTVrt
IyNY2r0/nL1o7lWABuGpSRh8gC7uqKGWZRzccAAs/0fNuy8=
X-Google-Smtp-Source: ABdhPJyNGWXxASVjL3aOtmeDOSFAcs/ksGyocyrg+W7OMi0GZ39UMMZYYOBnH35oyO4kQC9NIN15ohO91Aqf2AQU0mI=
X-Received: by 2002:a17:906:9452:: with SMTP id
z18mr7494141ejx.25.1631254329452;
Thu, 09 Sep 2021 23:12:09 -0700 (PDT)
In-Reply-To: <71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.34
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CALk2KRUgC4Q2+3DqdMSKTWZ=O=JxzJJ2w4mJ2ff5Jbw+zYMN=g@mail.gmail.com>
X-Mailman-Original-References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
<mailman.676.1631192234.4164.python-list@python.org>
<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>
 by: Roland Mueller - Fri, 10 Sep 2021 06:11 UTC

pe 10. syysk. 2021 klo 8.53 hongy...@gmail.com (hongyi.zhao@gmail.com)
kirjoitti:

> On Thursday, September 9, 2021 at 8:57:37 PM UTC+8, Roland Mueller wrote:
> > Hello
> >
> > to 9. syysk. 2021 klo 6.53 hongy...@gmail.com (hongy...@gmail.com)
> > kirjoitti:
> > > I'm using the following code in my forked project [1]:
> > >
> > > percol.view.STACKLINE = 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s
> Dir:M-d
> > > Dircmd:M-b'
> > >
> > > I would like to change the display style of the text mentioned above,
> for
> > > example, to underline some characters in it, as shown below:
> > >
> > > _D_ir:M-d
> > >
> > >
> > You can use e.g. str.replace() or re.sub()
> >
> > >>> percol.view.STACKLINE = percol.view.STACKLINE.replace('D', '_D_')
> > Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d
> _D_ircmd:M-b'
> >
> > >>> import re
> >
> > Replace D with _D_
> > >>> percol.view.STACKLINE = re.sub(r'([D])',
> > r'_\1_', percol.view.STACKLINE)
> > Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d
> _D_ircmd:M-b'
> >
> > Replace D and M with _D_, _M_
> > >>> percol.view.STACKLINE = re.sub(r'([DM])', r'_\1_',
> > percol.view.STACKLINE)
> > 'Fold:F1,F2,F3 Push:C-p Pop:_M_-p Script:_M_-s _D_ir:_M_-d
> _D_ircmd:_M_-b'
> >
> > Regards,
> > Roland
>
> I tried with the following, but failed to achieve the expected effect:
>
> class Term:
> HEADER = '\033[95m'
> OKBLUE = '\033[94m'
> OKGREEN = '\033[92m'
> WARNING = '\033[93m'
> FAIL = '\033[91m'
> ENDC = '\033[0m'
> LIGHTCYAN = '\033[1;36m'
> LIGHTGRAY = '\033[0;37m'
> YELLOW = '\033[0;33m'
> BOLD = '\033[1m'
> UNDERLINE = '\033[4m'
>
> [...]
>
> percol.view.STACKLINE = percol.view.STACKLINE.replace('D', Term.UNDERLINE
> + 'D' + Term.ENDC)
>
> The result will look like this:
>
> Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s ?[4mD?[0mir:M-d
> ?[4mD?[0mircmd:M-b
>
> I cannot repeat that. Are you sure that the '?' shown in your output are
not due to your terminal settings that influence how strings printed by
Python or inside used terminal are shown?

Python 3.9.6 (default, Jul 16 2021, 00:00:00)
[GCC 11.1.1 20210531 (Red Hat 11.1.1-3)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> UL = '\033[4m'
>>> UL
'\x1b[4m'
>>> ENDC = '\033[0m'
>>> ENDC
'\x1b[0m'

>>> s = UL + 'D' + ENDC
>>> s
'\x1b[4mD\x1b[0m'

>>> s = 'ABCDE'
>>> s = s.replace('D', UL + 'D' + ENDC)
>>> s
'ABC\x1b[4mD\x1b[0mE'

When I call print(s) it even shows ABCD and D is underscored. But copying
the output to mail looses the underscore ...
[image: image.png]

BR,
Roland

> Regards,
> HY
>
>

> > > How to achieve this purpose?
> > >
> > > [1]
> > >
> https://github.com/hongyi-zhao/ariadne/blob/838179bb4275ac85f5342d9e7d086d6ade3be1de/rc.py#L55
> > >
> > > Regards,
> > > HY
> > > --
> > > https://mail.python.org/mailman/listinfo/python-list
> > >
> --
> https://mail.python.org/mailman/listinfo/python-list
>

Re: Change the display style of the text on the STACKLINE.

<iq0ddmFa4jU1@mid.individual.net>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15087&group=comp.lang.python#15087

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: greg.ew...@canterbury.ac.nz (Greg Ewing)
Newsgroups: comp.lang.python
Subject: Re: Change the display style of the text on the STACKLINE.
Date: Fri, 10 Sep 2021 18:48:20 +1200
Lines: 9
Message-ID: <iq0ddmFa4jU1@mid.individual.net>
References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
<mailman.676.1631192234.4164.python-list@python.org>
<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>
<CALk2KRUgC4Q2+3DqdMSKTWZ=O=JxzJJ2w4mJ2ff5Jbw+zYMN=g@mail.gmail.com>
<mailman.682.1631254331.4164.python-list@python.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net 50BmuF38i03zj756K4v+gAn6w+FryxRIu84OTo6EYUF/kQq7E6
Cancel-Lock: sha1:ZF+J82tcjFHM1hEAaA+sVF1NN9o=
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:78.0)
Gecko/20100101 Thunderbird/78.4.0
In-Reply-To: <mailman.682.1631254331.4164.python-list@python.org>
Content-Language: en-US
 by: Greg Ewing - Fri, 10 Sep 2021 06:48 UTC

On 10/09/21 6:11 pm, Roland Mueller wrote:
> When I call print(s) it even shows ABCD and D is underscored. But copying
> the output to mail looses the underscore ...

If the terminal understands unicode, Combining Low Line: U+0332
might help

--
Greg

Re: Change the display style of the text on the STACKLINE.

<mailman.687.1631307275.4164.python-list@python.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15096&group=comp.lang.python#15096

  copy link   Newsgroups: comp.lang.python
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!not-for-mail
From: roland.e...@googlemail.com (Roland Mueller)
Newsgroups: comp.lang.python
Subject: Re: Change the display style of the text on the STACKLINE.
Date: Fri, 10 Sep 2021 23:54:22 +0300
Lines: 13
Message-ID: <mailman.687.1631307275.4164.python-list@python.org>
References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
<mailman.676.1631192234.4164.python-list@python.org>
<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>
<CALk2KRUgC4Q2+3DqdMSKTWZ=O=JxzJJ2w4mJ2ff5Jbw+zYMN=g@mail.gmail.com>
<mailman.682.1631254331.4164.python-list@python.org>
<iq0ddmFa4jU1@mid.individual.net>
<CALk2KRU5OM7Jw9Ak5uNwaD2YpdRha=JPJYymEfsupNhMFdWjXw@mail.gmail.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
X-Trace: news.uni-berlin.de aIrcogvKSHtf2/kFUkrK1A6HjF0ArOpA0xpBBNXhuNXA==
Return-Path: <roland.em0001@googlemail.com>
X-Original-To: python-list@python.org
Delivered-To: python-list@mail.python.org
Authentication-Results: mail.python.org; dkim=pass
reason="2048-bit key; unprotected key"
header.d=googlemail.com header.i=@googlemail.com header.b=A/MfyqX+;
dkim-adsp=pass; dkim-atps=neutral
X-Spam-Status: OK 0.005
X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'string': 0.07; 'cc:addr
:python-list': 0.09; 'from:addr:googlemail.com': 0.09; 'line:':
0.09; 'terminal': 0.09; '&gt;': 0.14; 'cc:no real name:2**0':
0.14; 'greg': 0.16; 'ok.': 0.16; 'received:209.85.218': 0.16;
'received:209.85.218.50': 0.16; 'received:mail-
ej1-f50.google.com': 0.16; 'wrote:': 0.16; 'problem': 0.16; 'pm,':
0.19; 'cc:addr:python.org': 0.20; 'cc:2**0': 0.25; 'output': 0.28;
'message-id:@mail.gmail.com': 0.32; 'but': 0.32; 'header:In-Reply-
To:1': 0.34; 'received:google.com': 0.34; 'received:209.85': 0.37;
'received:209': 0.39; 'shows': 0.67; 'mail.': 0.68; '2021': 0.71;
'low': 0.74; 'roland': 0.84
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=googlemail.com; s=20210112;
h=mime-version:references:in-reply-to:from:date:message-id:subject:to
:cc; bh=ejqMJl3Teg9owvqPY3A252S+VXQPR+21kd4qhY/9CYE=;
b=A/MfyqX+rxUrbb4vhu+W7OEk/9x7oEIzOxyKjUYvJsaahRrwfgcQYVjFIbwa576ZIg
j513Bgvn/Evx7rl+IFsAu92RXvGH7eliXcQ1WG+mTLCsnvp2LuKWW0RTQKeQD16qetHh
Mg3UnVZv2dZP2H5gzBMzOWWoUbEk+aHDw+xsMthQlux6rYr0JTmC8VoDojGQkS+nzSiJ
+Bm56IZrbj1rRONjxICX4WTOvFc2fa4RogK3hjP38uoB5U+AovJLsj2oRQyYl5XS6BwY
nKud732ITinCD+88d3kPqcKJA2iBq6msiYmw2Ez3PIC7UG3YsdNs37/VAI7PlFa0SpNn
smBQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20210112;
h=x-gm-message-state:mime-version:references:in-reply-to:from:date
:message-id:subject:to:cc;
bh=ejqMJl3Teg9owvqPY3A252S+VXQPR+21kd4qhY/9CYE=;
b=4tYC7bh86i44usGmnICWI/Cp7IfBwo83cFJ3Z8pivnQIhJFn5KNcg2fw7XdcSmAzNA
j5i0onln/GS1S21e7d9Oihhef93me1HSFww92OiYvK1vQTfnqsSkC16DhuqbpCfuo8Rf
+pUjNHr+re2kMxJrLb/UsFYD8+oiWFvdRqrK7gpzfWWpD705hcjdjLt3mP740SmWiJT7
v6UZFzFDAgs2p9/xonK+ZfRO6QxXKSjOlwkbAkkc8L3gKkW+zdQN12I28xy08daSK+5z
903tbCO1EBjssRq56mrRmf5irlDuKWMMx6l0UsLdLr5kUb07VDKmuUVKtDQ4Ateavgwf
XqeA==
X-Gm-Message-State: AOAM532BSpn5VRom3HpM6L+hLgdr8fZlHSLgFPdiXOeJG6ZUgSSyxnaP
mSTEElmOdGRBtvnXrUOIL63WbB75dTIOHYQVGTAohv2G
X-Google-Smtp-Source: ABdhPJy4eDeYUjSWDoCVO3ZjLWLckMAXe6fsWhST8McgUyRLzdfjgExUa3rqswUm7oo2wFl8t5/Id3Jwpi4rzqGKjUg=
X-Received: by 2002:a17:906:3e16:: with SMTP id
k22mr11563411eji.280.1631307273889;
Fri, 10 Sep 2021 13:54:33 -0700 (PDT)
In-Reply-To: <iq0ddmFa4jU1@mid.individual.net>
X-Content-Filtered-By: Mailman/MimeDel 2.1.34
X-BeenThere: python-list@python.org
X-Mailman-Version: 2.1.34
Precedence: list
List-Id: General discussion list for the Python programming language
<python-list.python.org>
List-Unsubscribe: <https://mail.python.org/mailman/options/python-list>,
<mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive: <https://mail.python.org/pipermail/python-list/>
List-Post: <mailto:python-list@python.org>
List-Help: <mailto:python-list-request@python.org?subject=help>
List-Subscribe: <https://mail.python.org/mailman/listinfo/python-list>,
<mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID: <CALk2KRU5OM7Jw9Ak5uNwaD2YpdRha=JPJYymEfsupNhMFdWjXw@mail.gmail.com>
X-Mailman-Original-References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com>
<mailman.676.1631192234.4164.python-list@python.org>
<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com>
<CALk2KRUgC4Q2+3DqdMSKTWZ=O=JxzJJ2w4mJ2ff5Jbw+zYMN=g@mail.gmail.com>
<mailman.682.1631254331.4164.python-list@python.org>
<iq0ddmFa4jU1@mid.individual.net>
 by: Roland Mueller - Fri, 10 Sep 2021 20:54 UTC

pe 10. syysk. 2021 klo 17.22 Greg Ewing (greg.ewing@canterbury.ac.nz)
kirjoitti:

> On 10/09/21 6:11 pm, Roland Mueller wrote:
> > When I call print(s) it even shows ABCD and D is underscored. But
> copying
> > the output to mail looses the underscore ...
>
> If the terminal understands unicode, Combining Low Line: U+0332
> might help
>
>
> The problem was to get the string to this mail. In my terminal it was OK.

Re: Change the display style of the text on the STACKLINE.

<2f95335c-6ebc-4917-9bb5-ed9991586a82n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15103&group=comp.lang.python#15103

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:ad4:5489:: with SMTP id q9mr88964qvy.14.1631317411463;
Fri, 10 Sep 2021 16:43:31 -0700 (PDT)
X-Received: by 2002:a05:620a:a85:: with SMTP id v5mr57514qkg.261.1631317411210;
Fri, 10 Sep 2021 16:43:31 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Fri, 10 Sep 2021 16:43:30 -0700 (PDT)
In-Reply-To: <mailman.682.1631254331.4164.python-list@python.org>
Injection-Info: google-groups.googlegroups.com; posting-host=103.138.53.109; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 103.138.53.109
References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com> <mailman.676.1631192234.4164.python-list@python.org>
<CALk2KRUgC4Q2+3DqdMSKTWZ=O=JxzJJ2w4mJ2ff5Jbw+zYMN=g@mail.gmail.com>
<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com> <mailman.682.1631254331.4164.python-list@python.org>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <2f95335c-6ebc-4917-9bb5-ed9991586a82n@googlegroups.com>
Subject: Re: Change the display style of the text on the STACKLINE.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 10 Sep 2021 23:43:31 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 139
 by: hongy...@gmail.com - Fri, 10 Sep 2021 23:43 UTC

On Friday, September 10, 2021 at 2:12:31 PM UTC+8, Roland Mueller wrote:
> pe 10. syysk. 2021 klo 8.53 hongy...@gmail.com (hongy...@gmail.com)
> kirjoitti:
> > On Thursday, September 9, 2021 at 8:57:37 PM UTC+8, Roland Mueller wrote:
> > > Hello
> > >
> > > to 9. syysk. 2021 klo 6.53 hongy...@gmail.com (hongy...@gmail.com)
> > > kirjoitti:
> > > > I'm using the following code in my forked project [1]:
> > > >
> > > > percol.view.STACKLINE = 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s
> > Dir:M-d
> > > > Dircmd:M-b'
> > > >
> > > > I would like to change the display style of the text mentioned above,
> > for
> > > > example, to underline some characters in it, as shown below:
> > > >
> > > > _D_ir:M-d
> > > >
> > > >
> > > You can use e.g. str.replace() or re.sub()
> > >
> > > >>> percol.view.STACKLINE = percol.view.STACKLINE.replace('D', '_D_')
> > > Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d
> > _D_ircmd:M-b'
> > >
> > > >>> import re
> > >
> > > Replace D with _D_
> > > >>> percol.view.STACKLINE = re.sub(r'([D])',
> > > r'_\1_', percol.view.STACKLINE)
> > > Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d
> > _D_ircmd:M-b'
> > >
> > > Replace D and M with _D_, _M_
> > > >>> percol.view.STACKLINE = re.sub(r'([DM])', r'_\1_',
> > > percol.view.STACKLINE)
> > > 'Fold:F1,F2,F3 Push:C-p Pop:_M_-p Script:_M_-s _D_ir:_M_-d
> > _D_ircmd:_M_-b'
> > >
> > > Regards,
> > > Roland
> >
> > I tried with the following, but failed to achieve the expected effect:
> >
> > class Term:
> > HEADER = '\033[95m'
> > OKBLUE = '\033[94m'
> > OKGREEN = '\033[92m'
> > WARNING = '\033[93m'
> > FAIL = '\033[91m'
> > ENDC = '\033[0m'
> > LIGHTCYAN = '\033[1;36m'
> > LIGHTGRAY = '\033[0;37m'
> > YELLOW = '\033[0;33m'
> > BOLD = '\033[1m'
> > UNDERLINE = '\033[4m'
> >
> > [...]
> >
> > percol.view.STACKLINE = percol.view.STACKLINE.replace('D', Term.UNDERLINE
> > + 'D' + Term.ENDC)
> >
> > The result will look like this:
> >
> > Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s ?[4mD?[0mir:M-d
> > ?[4mD?[0mircmd:M-b
> >
> > I cannot repeat that. Are you sure that the '?' shown in your output are
> not due to your terminal settings that influence how strings printed by
> Python or inside used terminal are shown?
>
> Python 3.9.6 (default, Jul 16 2021, 00:00:00)
> [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)] on linux
> Type "help", "copyright", "credits" or "license" for more information.
> >>> UL = '\033[4m'
> >>> UL
> '\x1b[4m'
> >>> ENDC = '\033[0m'
> >>> ENDC
> '\x1b[0m'
>
> >>> s = UL + 'D' + ENDC
> >>> s
> '\x1b[4mD\x1b[0m'
>
> >>> s = 'ABCDE'
> >>> s = s.replace('D', UL + 'D' + ENDC)
> >>> s
> 'ABC\x1b[4mD\x1b[0mE'
>
> When I call print(s) it even shows ABCD and D is underscored.

If I test the code snippet above with ipython/ptpython/python, I got the same result as you described. But the problem I reported here is triggered by running the command line wrapper of the project by `Ctrl-r`, which is worked with curses library. And I also noticed the following file [1] used by the project, which may be pertinent to the problem discussed here.
But till now I still can't think of a solution.

[1] https://github.com/hongyi-zhao/ariadne/blob/master/percol/ansi.py

> But copying
> the output to mail looses the underscore ...
> [image: image.png]
>
> BR,
> Roland
> > Regards,
> > HY
> >
> >
>
>
>
>
> > > > How to achieve this purpose?
> > > >
> > > > [1]
> > > >
> > https://github.com/hongyi-zhao/ariadne/blob/838179bb4275ac85f5342d9e7d086d6ade3be1de/rc.py#L55
> > > >
> > > > Regards,
> > > > HY
> > > > --
> > > > https://mail.python.org/mailman/listinfo/python-list
> > > >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >

Re: Change the display style of the text on the STACKLINE.

<281ff3f5-5e0c-4052-9f04-473a9c96a872n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=15104&group=comp.lang.python#15104

  copy link   Newsgroups: comp.lang.python
X-Received: by 2002:a05:620a:1435:: with SMTP id k21mr84117qkj.442.1631317735477;
Fri, 10 Sep 2021 16:48:55 -0700 (PDT)
X-Received: by 2002:ad4:564e:: with SMTP id bl14mr207783qvb.43.1631317735305;
Fri, 10 Sep 2021 16:48:55 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.python
Date: Fri, 10 Sep 2021 16:48:55 -0700 (PDT)
In-Reply-To: <2f95335c-6ebc-4917-9bb5-ed9991586a82n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=128.199.66.218; posting-account=kF0ZaAoAAACPbiK5gldhAyX5qTd3krV2
NNTP-Posting-Host: 128.199.66.218
References: <CALk2KRViQ0iaubrqTXwBeboYjeTs4LmsQzZGvVOU=s5DjiJ2RA@mail.gmail.com>
<49f73502-68a0-444f-baa5-33e6e136055fn@googlegroups.com> <mailman.676.1631192234.4164.python-list@python.org>
<CALk2KRUgC4Q2+3DqdMSKTWZ=O=JxzJJ2w4mJ2ff5Jbw+zYMN=g@mail.gmail.com>
<71240eba-d7ed-46e5-a98b-9a8fd2fc5169n@googlegroups.com> <mailman.682.1631254331.4164.python-list@python.org>
<2f95335c-6ebc-4917-9bb5-ed9991586a82n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <281ff3f5-5e0c-4052-9f04-473a9c96a872n@googlegroups.com>
Subject: Re: Change the display style of the text on the STACKLINE.
From: hongyi.z...@gmail.com (hongy...@gmail.com)
Injection-Date: Fri, 10 Sep 2021 23:48:55 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 120
 by: hongy...@gmail.com - Fri, 10 Sep 2021 23:48 UTC

On Saturday, September 11, 2021 at 7:43:44 AM UTC+8, hongy...@gmail.com wrote:
> On Friday, September 10, 2021 at 2:12:31 PM UTC+8, Roland Mueller wrote:
> > pe 10. syysk. 2021 klo 8.53 hongy...@gmail.com (hongy...@gmail.com)
> > kirjoitti:
> > > On Thursday, September 9, 2021 at 8:57:37 PM UTC+8, Roland Mueller wrote:
> > > > Hello
> > > >
> > > > to 9. syysk. 2021 klo 6.53 hongy...@gmail.com (hongy...@gmail.com)
> > > > kirjoitti:
> > > > > I'm using the following code in my forked project [1]:
> > > > >
> > > > > percol.view.STACKLINE = 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s
> > > Dir:M-d
> > > > > Dircmd:M-b'
> > > > >
> > > > > I would like to change the display style of the text mentioned above,
> > > for
> > > > > example, to underline some characters in it, as shown below:
> > > > >
> > > > > _D_ir:M-d
> > > > >
> > > > >
> > > > You can use e.g. str.replace() or re.sub()
> > > >
> > > > >>> percol.view.STACKLINE = percol.view.STACKLINE.replace('D', '_D_')
> > > > Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d
> > > _D_ircmd:M-b'
> > > >
> > > > >>> import re
> > > >
> > > > Replace D with _D_
> > > > >>> percol.view.STACKLINE = re.sub(r'([D])',
> > > > r'_\1_', percol.view.STACKLINE)
> > > > Result: 'Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s _D_ir:M-d
> > > _D_ircmd:M-b'
> > > >
> > > > Replace D and M with _D_, _M_
> > > > >>> percol.view.STACKLINE = re.sub(r'([DM])', r'_\1_',
> > > > percol.view.STACKLINE)
> > > > 'Fold:F1,F2,F3 Push:C-p Pop:_M_-p Script:_M_-s _D_ir:_M_-d
> > > _D_ircmd:_M_-b'
> > > >
> > > > Regards,
> > > > Roland
> > >
> > > I tried with the following, but failed to achieve the expected effect:
> > >
> > > class Term:
> > > HEADER = '\033[95m'
> > > OKBLUE = '\033[94m'
> > > OKGREEN = '\033[92m'
> > > WARNING = '\033[93m'
> > > FAIL = '\033[91m'
> > > ENDC = '\033[0m'
> > > LIGHTCYAN = '\033[1;36m'
> > > LIGHTGRAY = '\033[0;37m'
> > > YELLOW = '\033[0;33m'
> > > BOLD = '\033[1m'
> > > UNDERLINE = '\033[4m'
> > >
> > > [...]
> > >
> > > percol.view.STACKLINE = percol.view.STACKLINE.replace('D', Term.UNDERLINE
> > > + 'D' + Term.ENDC)
> > >
> > > The result will look like this:
> > >
> > > Fold:F1,F2,F3 Push:C-p Pop:M-p Script:M-s ?[4mD?[0mir:M-d
> > > ?[4mD?[0mircmd:M-b
> > >
> > > I cannot repeat that. Are you sure that the '?' shown in your output are
> > not due to your terminal settings that influence how strings printed by
> > Python or inside used terminal are shown?
> >
> > Python 3.9.6 (default, Jul 16 2021, 00:00:00)
> > [GCC 11.1.1 20210531 (Red Hat 11.1.1-3)] on linux
> > Type "help", "copyright", "credits" or "license" for more information.
> > >>> UL = '\033[4m'
> > >>> UL
> > '\x1b[4m'
> > >>> ENDC = '\033[0m'
> > >>> ENDC
> > '\x1b[0m'
> >
> > >>> s = UL + 'D' + ENDC
> > >>> s
> > '\x1b[4mD\x1b[0m'
> >
> > >>> s = 'ABCDE'
> > >>> s = s.replace('D', UL + 'D' + ENDC)
> > >>> s
> > 'ABC\x1b[4mD\x1b[0mE'
> >
> > When I call print(s) it even shows ABCD and D is underscored.
> If I test the code snippet above with ipython/ptpython/python, I got the same result as you described. But the problem I reported here is triggered by running the command line wrapper of the project by `Ctrl-r`, which is worked with curses library. And I also noticed the following file [1] used by the project, which may be pertinent to the problem discussed here.
> But till now I still can't think of a solution.
>
> [1] https://github.com/hongyi-zhao/ariadne/blob/master/percol/ansi.py

And refer to the following file used in the project:

https://github.com/hongyi-zhao/ariadne/blob/master/percol/display.py

Regards,
HY

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor