unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* TTY Vertical divider face?
@ 2005-05-30  2:41 Len Trigg
  2005-05-31 21:50 ` Len Trigg
  0 siblings, 1 reply; 38+ messages in thread
From: Len Trigg @ 2005-05-30  2:41 UTC (permalink / raw)



Hi all,

How can I set the face used to display the vertical divider that
separates side-by-side windows (I am running in a TTY).  I was
initially told that modeline-inactive face would do the trick, but I
think my question was misunderstood.  It would seems a strange
omission if such a thing were not possible.

I have tried compiling emacs myself (actually the current multi-tty
branch), and I can see in dispnew.c where the '|' character is used
for the vertical divider, but do not understand how to associate a
face with that.  Any ideas?


Cheers,
Len.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-05-30  2:41 TTY Vertical divider face? Len Trigg
@ 2005-05-31 21:50 ` Len Trigg
  2005-06-06 13:27   ` Juri Linkov
  2005-06-08 20:32   ` Juri Linkov
  0 siblings, 2 replies; 38+ messages in thread
From: Len Trigg @ 2005-05-31 21:50 UTC (permalink / raw)


Len Trigg wrote:
> How can I set the face used to display the vertical divider that
> separates side-by-side windows (I am running in a TTY).  I was
> initially told that modeline-inactive face would do the trick, but I
> think my question was misunderstood.  It would seems a strange
> omission if such a thing were not possible.

I had tried googling for answers to this before I posted, but lacked
the right keywords.  Kim Storm gave me some clues and I found that the
following code works:

(set-display-table-slot standard-display-table
			'vertical-border
			(let* ((face 'mode-line)
			       (face-offset (lsh (face-id face) 19)))
			  (+ face-offset ?|)))

(FYI, I actually found the information in a fairly old bug report
where they were using isearch rather than mode-line face and it
segfaulted emacs -- and in that case it still does).  I'm posting my
reply here so that hopefully it'll be easier for people to find in
searches in the future.

I'd like to also suggest that this be made a default, perhaps using a
specific vertical-border-face, to be more consistent with how the rest
of face customization works.

Cheers,
Len.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-05-31 21:50 ` Len Trigg
@ 2005-06-06 13:27   ` Juri Linkov
  2005-06-07  5:12     ` Miles Bader
  2005-06-08 20:32   ` Juri Linkov
  1 sibling, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-06 13:27 UTC (permalink / raw)
  Cc: emacs-devel

>> How can I set the face used to display the vertical divider that
>> separates side-by-side windows (I am running in a TTY).  I was
>> initially told that modeline-inactive face would do the trick, but I
>> think my question was misunderstood.  It would seems a strange
>> omission if such a thing were not possible.
>
> I had tried googling for answers to this before I posted, but lacked
> the right keywords.  Kim Storm gave me some clues and I found that the
> following code works:
>
> (set-display-table-slot standard-display-table
> 			'vertical-border
> 			(let* ((face 'mode-line)
> 			       (face-offset (lsh (face-id face) 19)))
> 			  (+ face-offset ?|)))
>
> I'd like to also suggest that this be made a default, perhaps using a
> specific vertical-border-face, to be more consistent with how the rest
> of face customization works.

Using inverse colors for the vertical border on a TTY (where the
border is displayed as a dash line) seems like a natural default.
Is it possible to set inverse colors for the vertical border
by default without using the display table?

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-06 13:27   ` Juri Linkov
@ 2005-06-07  5:12     ` Miles Bader
  2005-06-07 15:03       ` Juri Linkov
  2005-06-08 12:02       ` Richard Stallman
  0 siblings, 2 replies; 38+ messages in thread
From: Miles Bader @ 2005-06-07  5:12 UTC (permalink / raw)
  Cc: Len Trigg, emacs-devel

On 6/6/05, Juri Linkov <juri@jurta.org> wrote:
> Is it possible to set inverse colors for the vertical border
> by default without using the display table?

It's easy just using the same method Len used in lisp.  Any objection
to the following patch?  Should it use a different face (note that the
actual face that ends up being used by this code is
`mode-line-inactive', even though the code says MODE_LINE_FACE_ID; I'm
not sure why this is)?

2005-06-07  Miles Bader  <miles@gnu.org>

	* dispnew.c (build_frame_matrix_from_leaf_window): Display
	vertical window-separator on ttys using mode-line face by default.

--- orig/src/dispnew.c
+++ mod/src/dispnew.c
@@ -2724,7 +2724,7 @@
 	  struct Lisp_Char_Table *dp = window_display_table (w);
 	  right_border_glyph = (dp && INTEGERP (DISP_BORDER_GLYPH (dp))
 				? XINT (DISP_BORDER_GLYPH (dp))
-				: '|');
+				: ('|' + (MODE_LINE_FACE_ID << FACE_ID_BITS)));
 	}
     }
   else

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-07  5:12     ` Miles Bader
@ 2005-06-07 15:03       ` Juri Linkov
  2005-06-07 23:00         ` Miles Bader
  2005-06-08 12:02       ` Richard Stallman
  1 sibling, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-07 15:03 UTC (permalink / raw)
  Cc: len, emacs-devel, miles

> It's easy just using the same method Len used in lisp.  Any objection
> to the following patch?
>
> Should it use a different face

I think yes.  I'd personally set its both background and foreground
colors to "white" to display the vertical border as a solid
1-character-wide white line.

> (note that the actual face that ends up being used by this code is
> `mode-line-inactive', even though the code says MODE_LINE_FACE_ID;
> I'm not sure why this is)?

I tried your patch, but instead of either `mode-line' or
`mode-line-inactive' it displays the vertical border in the
`fringe' face.  But maybe this is good.  We can reuse `fringe'
face for the vertical border because fringes are not available
on text-only terminals.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-07 15:03       ` Juri Linkov
@ 2005-06-07 23:00         ` Miles Bader
  0 siblings, 0 replies; 38+ messages in thread
From: Miles Bader @ 2005-06-07 23:00 UTC (permalink / raw)
  Cc: len, emacs-devel, miles

On 6/8/05, Juri Linkov <juri@jurta.org> wrote:
> > Should it use a different face
> 
> I think yes.  I'd personally set its both background and foreground
> colors to "white" to display the vertical border as a solid
> 1-character-wide white line.

Hmmm, it's an interesting idea in that it displays a "dashless" block
by default, but still does the right thing if the terminal doesn't
handle reverse-video for some reason (this used to be an issue in the
'80s anyway :-).

However I think doing that makes it harder to follow the user's
customizations, since such a face couldn't just inherit from
`mode-line' (it could inherit, but then would have to set the
foreground to something explicit, which would often be wrong for
customized mode-line faces).

A slightly more complex alternative would be to do a "face
displayable" test on the "vertical divider" face, and if it's
displayable, use a space instead of "|" as the character...  Then just
inheriting directly from mode-line would work usually.

> > (note that the actual face that ends up being used by this code is
> > `mode-line-inactive', even though the code says MODE_LINE_FACE_ID;
> > I'm not sure why this is)?
> 
> I tried your patch, but instead of either `mode-line' or
> `mode-line-inactive' it displays the vertical border in the
> `fringe' face.  But maybe this is good.  We can reuse `fringe'
> face for the vertical border because fringes are not available
> on text-only terminals.

It sounds like it's randomly choosing some other face than what was
requested, which I think is not good even if it often works out...:-) 
I'll try to see what's going on...

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-07  5:12     ` Miles Bader
  2005-06-07 15:03       ` Juri Linkov
@ 2005-06-08 12:02       ` Richard Stallman
  1 sibling, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2005-06-08 12:02 UTC (permalink / raw)
  Cc: juri, len, emacs-devel

    to the following patch?  Should it use a different face (note that the
    actual face that ends up being used by this code is
    `mode-line-inactive', even though the code says MODE_LINE_FACE_ID; I'm
    not sure why this is)?

Defaulting to mode-line-inactive seems better than defaulting
mode-line, but if it is implemented this way, there should be a
comment to explain that this code doesn't do what you might have
expected it to do.

However, on principle it seems wrong to use mode-line-inactive
directly.  There ought to be a separate named face to control this.
It could default to mode-line-inactive.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-05-31 21:50 ` Len Trigg
  2005-06-06 13:27   ` Juri Linkov
@ 2005-06-08 20:32   ` Juri Linkov
  2005-06-14 22:31     ` Richard Stallman
  1 sibling, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-08 20:32 UTC (permalink / raw)
  Cc: len

There is something wrong with handling faces in display tables on
character terminals.  Putting a character with an added face to the
display table slot results in a different face displayed.
Some faces even cause Emacs to crash.  For example, Emacs started
with `emacs -Q -nw' crashes on GNU/Linux with the following code:

(progn
  (setq standard-display-table (make-display-table))
  (set-display-table-slot standard-display-table 'vertical-border
                          (+ (lsh (face-id 'isearch) 19) ? ))
  (split-window-horizontally))

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-08 20:32   ` Juri Linkov
@ 2005-06-14 22:31     ` Richard Stallman
  2005-06-18 13:59       ` Juri Linkov
  0 siblings, 1 reply; 38+ messages in thread
From: Richard Stallman @ 2005-06-14 22:31 UTC (permalink / raw)
  Cc: len, emacs-devel

    There is something wrong with handling faces in display tables on
    character terminals.  Putting a character with an added face to the
    display table slot results in a different face displayed.
    Some faces even cause Emacs to crash.

I think I have fixed this.  I will check it in a day or two from now.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-14 22:31     ` Richard Stallman
@ 2005-06-18 13:59       ` Juri Linkov
  2005-06-19  3:51         ` Richard Stallman
  0 siblings, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-18 13:59 UTC (permalink / raw)
  Cc: len, emacs-devel

>     There is something wrong with handling faces in display tables on
>     character terminals.  Putting a character with an added face to the
>     display table slot results in a different face displayed.
>     Some faces even cause Emacs to crash.
>
> I think I have fixed this.  I will check it in a day or two from now.

Yes, now it works.

> Defaulting to mode-line-inactive seems better than defaulting
> mode-line, but if it is implemented this way, there should be a
> comment to explain that this code doesn't do what you might have
> expected it to do.
>
> However, on principle it seems wrong to use mode-line-inactive
> directly.  There ought to be a separate named face to control this.
> It could default to mode-line-inactive.

How about adding this face now?

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-18 13:59       ` Juri Linkov
@ 2005-06-19  3:51         ` Richard Stallman
  2005-06-20  9:09           ` Miles Bader
  0 siblings, 1 reply; 38+ messages in thread
From: Richard Stallman @ 2005-06-19  3:51 UTC (permalink / raw)
  Cc: len, emacs-devel

    > However, on principle it seems wrong to use mode-line-inactive
    > directly.  There ought to be a separate named face to control this.
    > It could default to mode-line-inactive.

    How about adding this face now?

Please do.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-19  3:51         ` Richard Stallman
@ 2005-06-20  9:09           ` Miles Bader
  2005-06-20 10:14             ` Miles Bader
  0 siblings, 1 reply; 38+ messages in thread
From: Miles Bader @ 2005-06-20  9:09 UTC (permalink / raw)
  Cc: Juri Linkov, len, emacs-devel

On 6/19/05, Richard Stallman <rms@gnu.org> wrote:
>     > However, on principle it seems wrong to use mode-line-inactive
>     > directly.  There ought to be a separate named face to control this.
>     > It could default to mode-line-inactive.
> 
>     How about adding this face now?
> 
> Please do.

I'll do this.

What should the face be called?  `divider'?  `window-divider'? 
`vertical-divider'?

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-20  9:09           ` Miles Bader
@ 2005-06-20 10:14             ` Miles Bader
  2005-06-20 10:48               ` Miles Bader
                                 ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Miles Bader @ 2005-06-20 10:14 UTC (permalink / raw)
  Cc: Juri Linkov, len, emacs-devel

On 6/20/05, Miles Bader <snogglethorpe@gmail.com> wrote:
> What should the face be called?  `divider'?  `window-divider'?
> `vertical-divider'?

The name used for the display table slot is `vertical-divider' so I'll
use that for the face too.

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-20 10:14             ` Miles Bader
@ 2005-06-20 10:48               ` Miles Bader
  2005-06-20 15:06               ` Johan Bockgård
  2005-06-21  2:00               ` Richard Stallman
  2 siblings, 0 replies; 38+ messages in thread
From: Miles Bader @ 2005-06-20 10:48 UTC (permalink / raw)
  Cc: Juri Linkov, len, emacs-devel

OK done.

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-20 10:14             ` Miles Bader
  2005-06-20 10:48               ` Miles Bader
@ 2005-06-20 15:06               ` Johan Bockgård
  2005-06-21  0:11                 ` Miles Bader
  2005-06-21  2:00               ` Richard Stallman
  2 siblings, 1 reply; 38+ messages in thread
From: Johan Bockgård @ 2005-06-20 15:06 UTC (permalink / raw)


Miles Bader <snogglethorpe@gmail.com> writes:

> The name used for the display table slot is `vertical-divider' so
> I'll use that for the face too.

FWIW, the display table slot is called `vertical-border'.

-- 
Johan Bockgård

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-20 15:06               ` Johan Bockgård
@ 2005-06-21  0:11                 ` Miles Bader
  2005-06-21  0:21                   ` Miles Bader
  0 siblings, 1 reply; 38+ messages in thread
From: Miles Bader @ 2005-06-21  0:11 UTC (permalink / raw)


On 6/21/05, Johan Bockgård <bojohan+news@dd.chalmers.se> wrote:
> > The name used for the display table slot is `vertical-divider' so
> > I'll use that for the face too.
> 
> FWIW, the display table slot is called `vertical-border'.

Ack, you're right!  I guess I'll go change the face name to match...

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-21  0:11                 ` Miles Bader
@ 2005-06-21  0:21                   ` Miles Bader
  2005-06-21 15:13                     ` Richard M. Stallman
                                       ` (2 more replies)
  0 siblings, 3 replies; 38+ messages in thread
From: Miles Bader @ 2005-06-21  0:21 UTC (permalink / raw)


On 6/21/05, Miles Bader <snogglethorpe@gmail.com> wrote:
> On 6/21/05, Johan Bockgård <bojohan+news@dd.chalmers.se> wrote:
> > > The name used for the display table slot is `vertical-divider' so
> > > I'll use that for the face too.
> >
> > FWIW, the display table slot is called `vertical-border'.
> 
> Ack, you're right!  I guess I'll go change the face name to match...

Hmmm on the other hand, there's already a face `border', with a
different meaning (for setting the X border pixel color).

The name `vertical-border' seems slightly strange too -- the word
"border" seems to typically imply an "outer" border, dividing inside
from outside; calling the line between windows a border sounds
slightly strange to me (though it's technically correct I guess).

Maybe it would be better to keep the face-name as `vertical-divider',
and also change the name of the display-table slot to match (it's easy
to provide a backward-compatibility alias for that).

What do other people think?

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-20 10:14             ` Miles Bader
  2005-06-20 10:48               ` Miles Bader
  2005-06-20 15:06               ` Johan Bockgård
@ 2005-06-21  2:00               ` Richard Stallman
  2 siblings, 0 replies; 38+ messages in thread
From: Richard Stallman @ 2005-06-21  2:00 UTC (permalink / raw)
  Cc: juri, len, emacs-devel

    The name used for the display table slot is `vertical-divider' so I'll
    use that for the face too.

Using the same name is wise, but indeed it is `vertical-border'.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-21  0:21                   ` Miles Bader
@ 2005-06-21 15:13                     ` Richard M. Stallman
  2005-06-21 16:29                     ` Juri Linkov
  2005-06-21 22:59                     ` Richard M. Stallman
  2 siblings, 0 replies; 38+ messages in thread
From: Richard M. Stallman @ 2005-06-21 15:13 UTC (permalink / raw)
  Cc: emacs-devel

    Maybe it would be better to keep the face-name as `vertical-divider',
    and also change the name of the display-table slot to match (it's easy
    to provide a backward-compatibility alias for that).

    What do other people think?

I don't like "divider" much.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-21  0:21                   ` Miles Bader
  2005-06-21 15:13                     ` Richard M. Stallman
@ 2005-06-21 16:29                     ` Juri Linkov
  2005-06-22  0:21                       ` Miles Bader
  2005-06-21 22:59                     ` Richard M. Stallman
  2 siblings, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-21 16:29 UTC (permalink / raw)
  Cc: emacs-devel, miles

> Hmmm on the other hand, there's already a face `border', with a
> different meaning (for setting the X border pixel color).

Is it possible to reuse the same face for vertical divider with an
additional spec like '(((type tty) :inherit mode-line-inactive))?

> The name `vertical-border' seems slightly strange too -- the word
> "border" seems to typically imply an "outer" border, dividing inside
> from outside; calling the line between windows a border sounds
> slightly strange to me (though it's technically correct I guess).

A vertical divider between two windows is the right border for the
left window, and the left border for the right window.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-21  0:21                   ` Miles Bader
  2005-06-21 15:13                     ` Richard M. Stallman
  2005-06-21 16:29                     ` Juri Linkov
@ 2005-06-21 22:59                     ` Richard M. Stallman
  2005-06-22  0:02                       ` Miles Bader
  2 siblings, 1 reply; 38+ messages in thread
From: Richard M. Stallman @ 2005-06-21 22:59 UTC (permalink / raw)
  Cc: emacs-devel

    Maybe it would be better to keep the face-name as `vertical-divider',
    and also change the name of the display-table slot to match (it's easy
    to provide a backward-compatibility alias for that).

    What do other people think?

I like "border" better than "divider".

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-21 22:59                     ` Richard M. Stallman
@ 2005-06-22  0:02                       ` Miles Bader
  0 siblings, 0 replies; 38+ messages in thread
From: Miles Bader @ 2005-06-22  0:02 UTC (permalink / raw)
  Cc: emacs-devel, miles

On 6/22/05, Richard M. Stallman <rms@gnu.org> wrote:
>     Maybe it would be better to keep the face-name as `vertical-divider',
>
> I like "border" better than "divider".

Fair enough.

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-21 16:29                     ` Juri Linkov
@ 2005-06-22  0:21                       ` Miles Bader
  2005-06-22 13:03                         ` Juri Linkov
  0 siblings, 1 reply; 38+ messages in thread
From: Miles Bader @ 2005-06-22  0:21 UTC (permalink / raw)
  Cc: emacs-devel, miles

On 6/22/05, Juri Linkov <juri@jurta.org> wrote:
> > Hmmm on the other hand, there's already a face `border', with a
> > different meaning (for setting the X border pixel color).
> 
> Is it possible to reuse the same face for vertical divider with an
> additional spec like '(((type tty) :inherit mode-line-inactive))?

That sounds pretty forced.  Ideally I'd like to rename the current
`border' face to something like `frame-border' (which is more
accurate), but I don't know if it's worth the trouble.

> A vertical divider between two windows is the right border for the
> left window, and the left border for the right window.

Technically that may be true, but I don't think most users perceive it
that way -- the vertical dividers only ever show up between pairs of
windows, and are not linked to either one; they really do act like
"dividers".  Contrast this with mode/header-lines, which show up with
single windows, and are clearly connected with their window.

However, I don't really care very much and Richard likes
vertical-border better, so I'll use that.

-Miles
-- 
Do not taunt Happy Fun Ball.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-22  0:21                       ` Miles Bader
@ 2005-06-22 13:03                         ` Juri Linkov
  2005-06-23  0:54                           ` Richard M. Stallman
  0 siblings, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-22 13:03 UTC (permalink / raw)
  Cc: emacs-devel, miles

> Ideally I'd like to rename the current `border' face to something
> like `frame-border' (which is more accurate), but I don't know if
> it's worth the trouble.

It makes sense to use the new `vertical-border' face not only
for defining a vertical divider on character terminals, but also
on X for defining the foreground color of the vertical thin line
between windows.  Currently its color is the same as the default
foreground color, but users might expect that the same face defines
the color of the vertical separator line on X too.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-22 13:03                         ` Juri Linkov
@ 2005-06-23  0:54                           ` Richard M. Stallman
  2005-06-23  7:48                             ` Kim F. Storm
  0 siblings, 1 reply; 38+ messages in thread
From: Richard M. Stallman @ 2005-06-23  0:54 UTC (permalink / raw)
  Cc: miles, snogglethorpe, emacs-devel

    It makes sense to use the new `vertical-border' face not only
    for defining a vertical divider on character terminals, but also
    on X for defining the foreground color of the vertical thin line
    between windows.

That seems natural.

Is that line present even when there is a scroll bar?

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-23  0:54                           ` Richard M. Stallman
@ 2005-06-23  7:48                             ` Kim F. Storm
  2005-06-27 23:54                               ` Juri Linkov
  2005-06-27 23:54                               ` Juri Linkov
  0 siblings, 2 replies; 38+ messages in thread
From: Kim F. Storm @ 2005-06-23  7:48 UTC (permalink / raw)
  Cc: Juri Linkov, snogglethorpe, emacs-devel, miles

"Richard M. Stallman" <rms@gnu.org> writes:

>     It makes sense to use the new `vertical-border' face not only
>     for defining a vertical divider on character terminals, but also
>     on X for defining the foreground color of the vertical thin line
>     between windows.
>
> That seems natural.
>
> Is that line present even when there is a scroll bar?

Yes.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-23  7:48                             ` Kim F. Storm
@ 2005-06-27 23:54                               ` Juri Linkov
  2005-06-28  8:25                                 ` Kim F. Storm
  2005-06-28 18:47                                 ` Richard M. Stallman
  2005-06-27 23:54                               ` Juri Linkov
  1 sibling, 2 replies; 38+ messages in thread
From: Juri Linkov @ 2005-06-27 23:54 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

[-- Attachment #1: Type: text/plain, Size: 694 bytes --]

>>     It makes sense to use the new `vertical-border' face not only
>>     for defining a vertical divider on character terminals, but also
>>     on X for defining the foreground color of the vertical thin line
>>     between windows.
>>
>> That seems natural.
>>
>> Is that line present even when there is a scroll bar?
>
> Yes.

I want also to fix the problem where the vertical border steals
1 pixel from the text area of the right window.  This makes some
letters indistinguishable.  The patch below draws the vertical border
1 pixel left when there are no scroll bars and no left fringes.
These screenshots demonstrate how the vertical border looks
before and after applying the patch:


[-- Attachment #2: old.png --]
[-- Type: image/png, Size: 1225 bytes --]

[-- Attachment #3: new.png --]
[-- Type: image/png, Size: 1237 bytes --]

[-- Attachment #4: Type: text/plain, Size: 883 bytes --]


Index: src/xdisp.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
retrieving revision 1.1028
diff -c -r1.1028 xdisp.c
*** src/xdisp.c	25 Jun 2005 22:35:42 -0000	1.1028
--- src/xdisp.c	27 Jun 2005 23:11:18 -0000
***************
*** 22400,22405 ****
--- 22400,22408 ----
        window_box_edges (w, -1, &x0, &y0, &x1, &y1);
        y1 -= 1;
  
+       if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
+ 	x1 -= 1;
+ 
        rif->draw_vertical_window_border (w, x1, y0, y1);
      }
    else if (!WINDOW_LEFTMOST_P (w)
***************
*** 22410,22415 ****
--- 22413,22421 ----
        window_box_edges (w, -1, &x0, &y0, &x1, &y1);
        y1 -= 1;
  
+       if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
+ 	x0 -= 1;
+ 
        rif->draw_vertical_window_border (w, x0, y0, y1);
      }
  }

-- 
Juri Linkov
http://www.jurta.org/emacs/

[-- Attachment #5: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-23  7:48                             ` Kim F. Storm
  2005-06-27 23:54                               ` Juri Linkov
@ 2005-06-27 23:54                               ` Juri Linkov
  2005-06-28  8:29                                 ` Kim F. Storm
                                                   ` (2 more replies)
  1 sibling, 3 replies; 38+ messages in thread
From: Juri Linkov @ 2005-06-27 23:54 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

>>     It makes sense to use the new `vertical-border' face not only
>>     for defining a vertical divider on character terminals, but also
>>     on X for defining the foreground color of the vertical thin line
>>     between windows.
>>
>> That seems natural.
>>
>> Is that line present even when there is a scroll bar?
>
> Yes.

What about such a patch?  I have tested it on GNU/Linux, but the
change in w32term.c is untested.  I hope someone will test it
on Windows.

Index: src/xterm.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/xterm.c,v
retrieving revision 1.867
diff -c -r1.867 xterm.c
*** src/xterm.c	6 Jun 2005 21:27:50 -0000	1.867
--- src/xterm.c	27 Jun 2005 23:09:09 -0000
***************
*** 535,540 ****
--- 535,546 ----
       int x, y0, y1;
  {
    struct frame *f = XFRAME (WINDOW_FRAME (w));
+   struct face *face;
+ 
+   face = FACE_FROM_ID (f, VERTICAL_BORDER_FACE_ID);
+   if (face)
+     XSetForeground (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc,
+ 		    face->foreground);
  
    XDrawLine (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
  	     f->output_data.x->normal_gc, x, y0, x, y1);

Index: src/w32term.c
===================================================================
RCS file: /cvsroot/emacs/emacs/src/w32term.c,v
retrieving revision 1.225
diff -c -r1.225 w32term.c
*** src/w32term.c	13 Jun 2005 12:18:31 -0000	1.225
--- src/w32term.c	27 Jun 2005 23:09:09 -0000
***************
*** 507,512 ****
--- 507,513 ----
    struct frame *f = XFRAME (WINDOW_FRAME (w));
    RECT r;
    HDC hdc;
+   struct face *face;
  
    r.left = x;
    r.right = x + 1;
***************
*** 514,520 ****
    r.bottom = y1;
  
    hdc = get_frame_dc (f);
!   w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r);
    release_frame_dc (f, hdc);
  }
  
--- 515,526 ----
    r.bottom = y1;
  
    hdc = get_frame_dc (f);
!   face = FACE_FROM_ID (f, VERTICAL_BORDER_FACE_ID);
!   if (face)
!     w32_fill_rect (f, hdc, face->foreground, &r);
!   else
!     w32_fill_rect (f, hdc, FRAME_FOREGROUND_PIXEL (f), &r);
! 
    release_frame_dc (f, hdc);
  }
  

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-27 23:54                               ` Juri Linkov
@ 2005-06-28  8:25                                 ` Kim F. Storm
  2005-06-28 23:54                                   ` Juri Linkov
  2005-06-28 18:47                                 ` Richard M. Stallman
  1 sibling, 1 reply; 38+ messages in thread
From: Kim F. Storm @ 2005-06-28  8:25 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

Juri Linkov <juri@jurta.org> writes:

>>>     It makes sense to use the new `vertical-border' face not only
>>>     for defining a vertical divider on character terminals, but also
>>>     on X for defining the foreground color of the vertical thin line
>>>     between windows.
>>>
>>> That seems natural.
>>>
>>> Is that line present even when there is a scroll bar?
>>
>> Yes.
>
> I want also to fix the problem where the vertical border steals
> 1 pixel from the text area of the right window.  This makes some
> letters indistinguishable.  The patch below draws the vertical border
> 1 pixel left when there are no scroll bars and no left fringes.
> These screenshots demonstrate how the vertical border looks
> before and after applying the patch:


I think we need to address this problem, and your change may work --
but what happens if the window on the left has a scroll bar on the
right?

I have been considering the following approach:

- if there are no scroll-bars, your approach is good.

- if window has a scroll-bar on the left, reduce width of
  scroll-bar by one pixel, and put line on the left side of
  the scroll-bar.

- if window has scroll-bar on the right, and the window
  on the left of this window also has scroll-bar on right,
  reduce width of other window's scroll-bar and put line
  on right side of that scroll-bar.

- if window has scroll-bar on right, and window on
  the left has scroll-bar on left, don't show the
  vertical line (the dual scroll-bars next to each other
  is enough to show which window the scroll-bars belong to).


Actually, in most cases, the scroll-bars are already a little
narrower than a full multiple of the column width, so there may
already be room for the vertical line without reducing the
scroll-bar width.


So although your change may give good results in most cases,
I think there are cases where it may fail (if you happen to
move the vertical line into an area occupied by a scroll bar...



>
>
>
>
>
>
> Index: src/xdisp.c
> ===================================================================
> RCS file: /cvsroot/emacs/emacs/src/xdisp.c,v
> retrieving revision 1.1028
> diff -c -r1.1028 xdisp.c
> *** src/xdisp.c	25 Jun 2005 22:35:42 -0000	1.1028
> --- src/xdisp.c	27 Jun 2005 23:11:18 -0000
> ***************
> *** 22400,22405 ****
> --- 22400,22408 ----
>         window_box_edges (w, -1, &x0, &y0, &x1, &y1);
>         y1 -= 1;
>   
> +       if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
> + 	x1 -= 1;
> + 
>         rif->draw_vertical_window_border (w, x1, y0, y1);
>       }
>     else if (!WINDOW_LEFTMOST_P (w)
> ***************
> *** 22410,22415 ****
> --- 22413,22421 ----
>         window_box_edges (w, -1, &x0, &y0, &x1, &y1);
>         y1 -= 1;
>   
> +       if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
> + 	x0 -= 1;
> + 
>         rif->draw_vertical_window_border (w, x0, y0, y1);
>       }
>   }
>
> -- 
> Juri Linkov
> http://www.jurta.org/emacs/

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-27 23:54                               ` Juri Linkov
@ 2005-06-28  8:29                                 ` Kim F. Storm
  2005-06-28 23:54                                   ` Juri Linkov
  2005-06-28 18:47                                 ` Richard M. Stallman
  2005-07-02  0:54                                 ` David Hunter
  2 siblings, 1 reply; 38+ messages in thread
From: Kim F. Storm @ 2005-06-28  8:29 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

Juri Linkov <juri@jurta.org> writes:

> What about such a patch? 

Maybe you should ignore the vertical-border face if its foreground
is unspecified?

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-27 23:54                               ` Juri Linkov
  2005-06-28  8:29                                 ` Kim F. Storm
@ 2005-06-28 18:47                                 ` Richard M. Stallman
  2005-07-02  0:54                                 ` David Hunter
  2 siblings, 0 replies; 38+ messages in thread
From: Richard M. Stallman @ 2005-06-28 18:47 UTC (permalink / raw)
  Cc: miles, emacs-devel, snogglethorpe, storm

    What about such a patch?  I have tested it on GNU/Linux, but the
    change in w32term.c is untested.  I hope someone will test it
    on Windows.

Please install the non-Windows part of the patch.  Those who support
Emacs on Windows can decide what to do with the other part.  (Someone
who's interested in Mac's might want to patch the mac files for this.)

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-27 23:54                               ` Juri Linkov
  2005-06-28  8:25                                 ` Kim F. Storm
@ 2005-06-28 18:47                                 ` Richard M. Stallman
  1 sibling, 0 replies; 38+ messages in thread
From: Richard M. Stallman @ 2005-06-28 18:47 UTC (permalink / raw)
  Cc: miles, emacs-devel, snogglethorpe, storm

    I want also to fix the problem where the vertical border steals
    1 pixel from the text area of the right window.  This makes some
    letters indistinguishable.  The patch below draws the vertical border
    1 pixel left when there are no scroll bars and no left fringes.

I agree with this change, but meanwhile, this is another instance of
why we need to be able to have frames and windows whose widths are not
even multiples of the default character box.

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-28  8:29                                 ` Kim F. Storm
@ 2005-06-28 23:54                                   ` Juri Linkov
  2005-06-29  9:02                                     ` Kim F. Storm
  0 siblings, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-28 23:54 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

> Maybe you should ignore the vertical-border face if its foreground
> is unspecified?

When the foreground is unspecified, then it uses the default
foreground, which is ok.

I'm sorry I forgot to post another part of changes in faces.el.
The `vertical-border' face should inherit from `mode-line-inactive'
only on tty.  It has an inappropriate foreground color for the
vertical border on X.  Without any specification, on X it will
use the default foreground color:

Index: lisp/faces.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/faces.el,v
retrieving revision 1.325
diff -u -r1.325 faces.el
--- lisp/faces.el	25 Jun 2005 23:48:27 -0000	1.325
+++ lisp/faces.el	29 Jun 2005 00:05:22 -0000
@@ -1871,7 +1878,7 @@
   :group 'basic-faces)
 
 (defface vertical-border
-  '((default :inherit mode-line-inactive))
+  '((((type tty)) :inherit mode-line-inactive))
   "Face used for vertical window dividers on ttys."
   :version "22.1"
   :group 'modeline

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-28  8:25                                 ` Kim F. Storm
@ 2005-06-28 23:54                                   ` Juri Linkov
  2005-06-29  9:12                                     ` Kim F. Storm
  0 siblings, 1 reply; 38+ messages in thread
From: Juri Linkov @ 2005-06-28 23:54 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

> So although your change may give good results in most cases,
> I think there are cases where it may fail (if you happen to
> move the vertical line into an area occupied by a scroll bar...

Currently there is no vertical border when there are no scroll bars
on either side of the window.  My fix was intended only for this case
(no scroll bars and no fringes).  As I understand, you propose to
display the vertical border even with scroll bars.  Perhaps this
requires considerable changes in the display code, so if you will
implement that (after the release?), then of course you have to
reconsider the case that displays the vertical border one
pixel left.

-- 
Juri Linkov
http://www.jurta.org/emacs/

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-28 23:54                                   ` Juri Linkov
@ 2005-06-29  9:02                                     ` Kim F. Storm
  0 siblings, 0 replies; 38+ messages in thread
From: Kim F. Storm @ 2005-06-29  9:02 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

Juri Linkov <juri@jurta.org> writes:

>> Maybe you should ignore the vertical-border face if its foreground
>> is unspecified?
>
> When the foreground is unspecified, then it uses the default
> foreground, which is ok.

Ok.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-28 23:54                                   ` Juri Linkov
@ 2005-06-29  9:12                                     ` Kim F. Storm
  0 siblings, 0 replies; 38+ messages in thread
From: Kim F. Storm @ 2005-06-29  9:12 UTC (permalink / raw)
  Cc: snogglethorpe, emacs-devel, rms, miles

Juri Linkov <juri@jurta.org> writes:

> Currently there is no vertical border when there are no scroll bars
> on either side of the window.  My fix was intended only for this case
> (no scroll bars and no fringes).

Then your change is ok.

> As I understand, you propose to
> display the vertical border even with scroll bars.  Perhaps this
> requires considerable changes in the display code, so if you will
> implement that (after the release?), then of course you have to
> reconsider the case that displays the vertical border one
> pixel left.

Yes, but the current behaviour works alright, so there is no need to
pursue this any further.

-- 
Kim F. Storm <storm@cua.dk> http://www.cua.dk

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-06-27 23:54                               ` Juri Linkov
  2005-06-28  8:29                                 ` Kim F. Storm
  2005-06-28 18:47                                 ` Richard M. Stallman
@ 2005-07-02  0:54                                 ` David Hunter
  2005-07-02 10:53                                   ` Eli Zaretskii
  2 siblings, 1 reply; 38+ messages in thread
From: David Hunter @ 2005-07-02  0:54 UTC (permalink / raw)
  Cc: emacs-devel

Juri Linkov wrote:
> What about such a patch?  I have tested it on GNU/Linux, but the
> change in w32term.c is untested.  I hope someone will test it
> on Windows.

FWIW, the patch looks okay on Windows.  I customized vertical-border to make a pink window border.  (I don't know why, but more importantly, I can.)
-Dave

^ permalink raw reply	[flat|nested] 38+ messages in thread

* Re: TTY Vertical divider face?
  2005-07-02  0:54                                 ` David Hunter
@ 2005-07-02 10:53                                   ` Eli Zaretskii
  0 siblings, 0 replies; 38+ messages in thread
From: Eli Zaretskii @ 2005-07-02 10:53 UTC (permalink / raw)
  Cc: juri, emacs-devel

> Date: Fri, 01 Jul 2005 20:54:56 -0400
> From: David Hunter <hunterd_42@comcast.net>
> Cc: emacs-devel@gnu.org
> 
> Juri Linkov wrote:
> > What about such a patch?  I have tested it on GNU/Linux, but the
> > change in w32term.c is untested.  I hope someone will test it
> > on Windows.
> 
> FWIW, the patch looks okay on Windows.  I customized vertical-border to make a pink window border.  (I don't know why, but more importantly, I can.)

Thanks for testing.  I installed that patch.

^ permalink raw reply	[flat|nested] 38+ messages in thread

end of thread, other threads:[~2005-07-02 10:53 UTC | newest]

Thread overview: 38+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-05-30  2:41 TTY Vertical divider face? Len Trigg
2005-05-31 21:50 ` Len Trigg
2005-06-06 13:27   ` Juri Linkov
2005-06-07  5:12     ` Miles Bader
2005-06-07 15:03       ` Juri Linkov
2005-06-07 23:00         ` Miles Bader
2005-06-08 12:02       ` Richard Stallman
2005-06-08 20:32   ` Juri Linkov
2005-06-14 22:31     ` Richard Stallman
2005-06-18 13:59       ` Juri Linkov
2005-06-19  3:51         ` Richard Stallman
2005-06-20  9:09           ` Miles Bader
2005-06-20 10:14             ` Miles Bader
2005-06-20 10:48               ` Miles Bader
2005-06-20 15:06               ` Johan Bockgård
2005-06-21  0:11                 ` Miles Bader
2005-06-21  0:21                   ` Miles Bader
2005-06-21 15:13                     ` Richard M. Stallman
2005-06-21 16:29                     ` Juri Linkov
2005-06-22  0:21                       ` Miles Bader
2005-06-22 13:03                         ` Juri Linkov
2005-06-23  0:54                           ` Richard M. Stallman
2005-06-23  7:48                             ` Kim F. Storm
2005-06-27 23:54                               ` Juri Linkov
2005-06-28  8:25                                 ` Kim F. Storm
2005-06-28 23:54                                   ` Juri Linkov
2005-06-29  9:12                                     ` Kim F. Storm
2005-06-28 18:47                                 ` Richard M. Stallman
2005-06-27 23:54                               ` Juri Linkov
2005-06-28  8:29                                 ` Kim F. Storm
2005-06-28 23:54                                   ` Juri Linkov
2005-06-29  9:02                                     ` Kim F. Storm
2005-06-28 18:47                                 ` Richard M. Stallman
2005-07-02  0:54                                 ` David Hunter
2005-07-02 10:53                                   ` Eli Zaretskii
2005-06-21 22:59                     ` Richard M. Stallman
2005-06-22  0:02                       ` Miles Bader
2005-06-21  2:00               ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).