bugGNU nano - Bugs: bug #56525, [Request] allow to use 'italic' as...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #56525: [Request] allow to use 'italic' as a color modifier in syntax definitions

Submitter:  Benno Schulenberg <bens>
Submitted:  Thu 20 Jun 2019 09:32:43 AM UTC
   
 
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Thu 30 Jul 2020 07:12:10 AM UTC, comment #12: 

Released in nano-5.0.

Benno Schulenberg <bens>
Group administrator
Thu 18 Jun 2020 01:34:42 PM UTC, comment #11: 

Addition of 'italic' is fixed in git, commit fae2eead.

Benno Schulenberg <bens>
Group administrator
Tue 16 Jun 2020 09:01:17 AM UTC, comment #10: 

The separation of "bold" and "light" has been posted as bug #58503 and fixed.  After that, it is simple to also add "italic".

(file #49275)

Benno Schulenberg <bens>
Group administrator
Fri 06 Sep 2019 09:53:56 AM UTC, comment #9: 


> The 'bold' attribute does the same as the 'bright' prefix


There's a huge legacy confusion here. Some terminal emulators have recently began cleaning up this confusion, so that the 16 (or 256) palette colors (let alone 16M true colors) and an orthogonal bold property which doesn't tamper with the color are available.

- xterm has had a "+pc" switch for ages
- urxvt has had a "+is" switch for ages
- vte 0.52 (gnome-terminal 3.28 and many other terminals) added such a config option, and vte 0.56 (gnome-terminal 3.32) made it the default to fully separate the two properties: https://bugzilla.gnome.org/show_bug.cgi?id=762247
- kitty only supports this mode where these two are orthogonal: https://github.com/kovidgoyal/kitty/issues/197
- alacritty is now considering flipping the default: https://github.com/jwilm/alacritty/issues/2779

Correspondingly, it would be great if nano could follow this pattern, offer (at least) 16 different colors (perhaps named like "cyan", "brightcyan", "white", "lightgray" etc.), and independently from this, a bold parameter. Some terminals would sure wash some combinations together, but at least users would have the possibility to reach all of the combinations in some (apparently more and more) terminal emulators.

Egmont Koblinger <egmont>
Fri 06 Sep 2019 09:43:40 AM UTC, comment #8: 


> not all terminals support italic


Not all, but most graphical ones do.

> it was introduced in ncurses 6.0


ncurses releases weekly patches, most distributions ship such patches rather than the latest major versrion (which are quite rare). Italic support was added in ncurses-5.9-20130831, i.e. 6 years ago. Most systems have it by now.

Egmont Koblinger <egmont>
Sat 03 Aug 2019 12:52:55 AM UTC, comment #7: 

It is more complicated to require attributes after the colors, and I don't have time nor desire to rewrite the patch for that.

Removing set_attribute() is fine, since adding a third color or attributes after the colors doesn't produce any error message.

And I use reverse more than underline, 8 vs 6. It unlocks 9 additional background colors, 8 bold and 1 for default text color.

reverse,brightred,black -> black,brightred
reverse -> default_bg,default_fg

Brand Huntsman <brand>
Fri 02 Aug 2019 03:25:29 PM UTC, comment #6: 

Of course changing the behavior of selected text would be a separate issue, but it would allow to include italics in a smoother way.  But let's forget it: the user will have to get used to the italics disappearing when selecting text with nano.

Now, about the patches themselves.  As the keyword is 'color' or 'icolor', I would want the color names to come first, and any attribute to come after the foreground and background color names.  (Any one of the three can be left out, of course.)

The 'bold' attribute does the same as the 'bright' prefix, so it's superfluous; leave it out.  And as I don't see how 'reverse' is useful: leave it out too -- it can always be added later; it isn't needed to get italics working.  The 'underline' is fine, as it's so close to the italics feature (although I will never use it, because it looks ugly).

The  set_attribute() function is overkill.  Specifying an attribute multiple times is not an error, it has no bad effects, it's just a tiny waste of time.

The commit message of the first patch needs to explain why the refactoring is needed.

Benno Schulenberg <bens>
Group administrator
Fri 02 Aug 2019 02:19:55 PM UTC, comment #5: 

Changing the behavior of selected text has nothing to do with this feature and should be dealt with separately. But the selectedcolor set by the user should be applied to the entire selection, without nano making changes that could produce unreadable text (blue text is selected using only a blue background).

The best way to handle this is to add a new setting to enable reverse video selections, and override selectedcolor. For each selected character, output its normal attributes but swap the fg/bg colors. This is how urxvt handles text selected with the mouse. But I prefer selectedcolor because it differentiates between nano's selection and X's selection.

Brand Huntsman <brand>
Fri 02 Aug 2019 01:17:29 PM UTC, comment #4: 

Hmm, yeah -- apparently ncurses is pretty clever: it drops the A_ITALIC for a Linux console.  So that's fine.

But... when a piece of text gets selected... the italic attribute disappears.  Of course, this is to be expected, seeing how things work, but for the user I think this will be quite unexpected.  :|

In joe, the italics are retained when text gets selected (and all the coloring too).  I don't about other editors; I haven't figured out how to get italics there.  Hmmm...  Maybe we should change the highlighting of selected text so that it changes only the background color (if that is possible)?

Benno Schulenberg <bens>
Group administrator
Thu 01 Aug 2019 10:40:02 PM UTC, comment #3: 

We might not need to do anything, ncurses appears to remove attributes not supported by the terminal.

echo -e "\033[3mABC\033[0;31;3mABC\033[0m"
echo -e "\033[4mABC\033[0;31;4mABC\033[0m"

Linux will display them as green and cyan, a terminal with italic and underline will use default color and red.

Now install the patches, configure a syntax to use italic (or underline) and make sure it works in a terminal. Then view that file in a linux console. For me, it uses the color I configured in the syntax, or default color if the color rule lacks a color.

Brand Huntsman <brand>
Thu 01 Aug 2019 05:49:32 PM UTC, comment #2: 

(I had nothing against italics by itself.  But you were bundling the italics patch and other things with the extra-colors stuff.  That is what I protested against: when doing extra colors, just do the extra colors, don't do anything else.  Focus.)

Are there other terminals than the Linux console that use colors to represent italic and underline?  If it's only the Linux console, then we could suppress those attributes when on_a_vt is TRUE.  But if there are more terminals...

Benno Schulenberg <bens>
Group administrator
Sat 29 Jun 2019 10:25:59 AM UTC, comment #1: 

I got the impression you didn't want italic or underline support:
https://lists.gnu.org/archive/html/nano-devel/2018-02/msg00122.html

Just an FYI, not all terminals support italic, and it was introduced in ncurses 6.0, so systems with older ncurses won't support it. And terminals that do support it, often need a font configured to display italic. Any default syntax that uses it shouldn't rely solely on the italic attribute to highlight some text. And some terminals (linux console) use colors to represent italic and underline.

    From /usr/src/linux/Documentation/admin-guide/kernel-parameters.txt
    vt.italic=  [VT] Default color for italic text; 0-15.
            Default: 2 = green.
    vt.underline=   [VT] Default color for underlined text; 0-15.
            Default: 3 = cyan.

The attached files add support for attributes, but the italic error message should be removed if you plan to use it in default syntaxes.

(file #47142, file #47143)

Brand Huntsman <brand>
Thu 20 Jun 2019 09:32:43 AM UTC, original submission:  

As I've seen that my terminal emulator is capable of presenting text in an italic font, it would be nice if nano's syntaxes could make use of this.  I think I would want to print all comments in all syntaxes in italics.

(The terminal can also do underline; I don't think I would use that, but when we add italics, we might as well add underline.)

Benno Schulenberg <bens>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by egmont (Posted a comment)
  • -email is unavailable- added by brand (Updated the item)
  • -email is unavailable- added by bens (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-07-30 bens Open/ClosedOpen Closed
    2020-06-18 bens StatusIn Progress Fixed
    2020-06-16 bens Attached File- Added 0001-rcfile-introduce-the-modifier-italic-for-slanted-tex.patch, #49275
        StatusNone In Progress
        Assigned toNone bens
    2019-10-16 bens StatusIn Progress None
    2019-08-02 bens StatusNone In Progress
        Summary[Request] allow to use italics as a color modifier in syntax definitions [Request] allow to use 'italic' as a color modifier in syntax definitions
    2019-06-29 brand Attached File- Added 0001-refactor-parse_color_names-function.patch, #47142
        Attached File- Added 0002-add-bold-italic-reverse-and-underline-attributes.patch, #47143

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code