Wednesday, June 2, 2010

Re: Formatting help files

Pablo Giménez wrote:
> 2010/6/2 Stahlman Family <brettstahlman@comcast.net>
>
>>
>> Pablo Giménez wrote:
>> ...[snip]...
>>
>>
>> Pablo,
>>>> Thanks for the screenshot. I'll check into it tonight when I have
>>>> access to a real terminal on my Linux system at home. Do you mind
>>>> telling me what colorscheme and terminal you're using? Also, what type
>>>> of region is being applied to the text with the grey background (e.g.,
>>>> "TDVIM USER MANUAL")? (I'm guessing it's bold-italic, and you're using
>>>> a color terminal that doesn't really support italic, but displays it
>>>> as reverse video instead...)
>>>>
>>>> Probably is this, because I was wondering why the italics doesn´t appear
>>> in
>>> the terminal.
>>> Yep it is trying to use bold italics.
>>> The color scheme is CodeFactory:
>>> http://www.vim.org/scripts/script.php?script_id=3079
>>>
>> Pablo,
>> I think I understand what's going on... If I'm correct, you are unable to
>> hide the special characters because your terminal's default background color
>> is black, but its "color palette" doesn't contain black. Note that in
>> addition to the default "Text color" and "Background color", color terminals
>> have what is known as a "Color palette". The colors in the color palette
>> (also known as the color cube) are completely independent of the Text color
>> and Background color. Vim's ctermfg/ctermbg mechanism works properly only
>> for colors in the color palette: thus, setting ctermbg or ctermfg to the
>> default Background color won't work unless the default Background color
>> happens to be in the color palette. In other words, the workarounds will
>> work only if the default background color is in the color palette.
>>
> Mmmm I am also using gnome-terminal and I have tried with both Linux console
> and Xterm Built-in schemes. both have black in the palette and the
> workaroundusing the autocommand is not working.
> when I type:
> :hi Ignore ctermfg=black
> it works but not automatically using autocommands.
> If I type :au to get the list of all the autocommands I got this:
> colorStarted ColorScheme
> * hi Ignore ctermfg=black
> Refresh
> So it seems that the command is properly registered and should be working.
> Is the same command I use from teh command line so it should be doing
> something.

Hmmm... That's very strange. Are you sure that the `hi Ignore
ctermfg=black' command is never executed? I'm wondering whether it's
possible that something else is changing the Ignore ctermfg setting
after the `hi Ignore' command... There are several ways you could check
this. The simplest is probably to run `:hi Ignore' at the command line,
both just before and just after changing the colorscheme, to see what
happens to ctermfg. Note that you can also set 'verbose' just before
running `:colorscheme' to see the exact sequence of commands that are
executed. (`set verbose=0' gets you out of verbose mode.)

> And because the command works from the command line I suppose the terminal
> color palette has black.

Actually, you won't get an error for a standard color name such as
"black", even if the color palette doesn't contain it. You would get an
error only for an unknown color name such as "somesillycolor".

>
> I have attached a screenshot which shows the same text in gvim, gnome-
> terminal, and below xterm and gnome-termnial color settings.

> Another problem seems to be the lack of italics support in my terminals
> both, gnome-terminal and xterm don't shpw italics characters.
> I have been googling a little but there aren't too much help for this. In
> the gnome-terminal the only setting related to font style is enable/disable
> bold fonts. How do you enable italics in your terminals.
> I am using Deja Vu Sans Mono as the font for gnome-terminal.

I seem to remember urxvt supporting italic, but it doesn't seem to be
working for me now. I'll investigate and get back with you...

>
> Finally as a temp workaround One thing I can do is to disable text
> formatting when a txtfmt file is opened in a non-gui environment and also if
> it would be possible delete the funny characters, but just in the buffer not
> in the file itself, it is possible?

Yes. Removing the characters in the buffer is fairly simple. Note that
you can run...
:ShowTokenMap
...in a Txtfmt buffer to see which character codes are used for the
various formatting regions. (You should be aware that the range of
characters used is configurable.)

:help txtfmtTokrange

For a utf-8 encoding, the default range is 0xE000-0xE019. Thus, to get
rid of all tokens in a buffer, I could do something like this:

%s/[\ue000-\ue019]//g

Of course, you probably would want to implement with autocommands in
such a way that the original file cannot be modified by the person
viewing it in a color terminal. I'm thinking of a solution that involves
reading a copy of the file into a readonly, "no file" buffer and then
deleting the tokens. Since a "no file" buffer is not associated with a
file, there would be no risk of the person viewing the file overwriting
the original file containing the tokens. I'll try to come up with a
possible implementation and get back with you after testing it...

Sincerely,
Brett Stahlman


> This way no matter user's terminal settings you can offer a workaround, just
> disable any kind of formatting in your bufferm, and at least give something
> readable.

>
> cheers and thanks for your help
>
>> I don't know what color terminal you're using, but I was able to reproduce
>> what you were seeing in gnome-terminal. I was able to fix it by changing to
>> a color palette that contained black...
>>
>> On the gnome-terminal title bar...
>>
>> Edit->Profile Preferences...
>>
>> ...brings up a dialog with multiple tabs. On the "Colors" tab, you can
>> define the default foreground and background colors with the "Text color"
>> and "Background color" color pickers. Under "Palette", there's a combo box
>> that allows you to select from a number of built-in schemes. I was
>> originally using "Tango", which had a couple different shades of grey, but
>> no black. The others (Linux console, XTerm and Rxvt) all had black as the
>> first color in the palette. After I had switched to "Linux console", the
>> workarounds were successful...
>>
>> Sincerely,
>>
>> Brett Stahlman
>>
>>
>>> ...[snip]...
>> --
>> You received this message from the "vim_use" maillist.
>> Do not top-post! Type your reply below the text you are replying to.
>> For more information, visit http://www.vim.org/maillist.php
>>
>
>
>

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment