all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Fixing cursor height when setting line-spacing
@ 2023-08-05  5:44 Karan Ahlawat
  2023-08-05  7:01 ` Eli Zaretskii
  2023-08-05 10:41 ` Yuri Khan
  0 siblings, 2 replies; 10+ messages in thread
From: Karan Ahlawat @ 2023-08-05  5:44 UTC (permalink / raw)
  To: help-gnu-emacs

Hi all,

I'll get straight to the point.

I set the line-height variable to be a positive integer (16). My 
cursor-type is set to t. Now, whenever I move the cursor to the end of a 
line, the height of the cursor is equal to the entire line height. But 
anywhere else on the line, it's equal to the height of the character 
under the cursor.

I searched the mailing lists for some similar issue, and found one mail 
chain where it is described that since the EOL has no displayable glyph, 
the cursor height is set equal to the line height.

I'd like this to always be the case, i.e, the cursor height to always be 
equal to the line height, EOL or not. This is a personal preference and 
so I don't think it is a bug, I just think it looks good in VSCode and 
other editors.

I tried using the HBAR and BAR cursor-type, but whenever they are on a 
character, the character is hidden underneath them, whereas in the 
default cursor-type, the character's foreground color is switched 
appropriately.

This is my first time on a mailing list, so if I missed etiquette, 
kindly let me know.

Cheers,

Karan




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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05  5:44 Fixing cursor height when setting line-spacing Karan Ahlawat
@ 2023-08-05  7:01 ` Eli Zaretskii
  2023-08-05  7:41   ` Karan Ahlawat
       [not found]   ` <77dc7b13-d4a7-4d63-8f03-226cb06449e8@gmail.com>
  2023-08-05 10:41 ` Yuri Khan
  1 sibling, 2 replies; 10+ messages in thread
From: Eli Zaretskii @ 2023-08-05  7:01 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 5 Aug 2023 11:14:15 +0530
> From: Karan Ahlawat <ahlawatkaran12@gmail.com>
> 
> I set the line-height variable to be a positive integer (16). My 
> cursor-type is set to t. Now, whenever I move the cursor to the end of a 
> line, the height of the cursor is equal to the entire line height. But 
> anywhere else on the line, it's equal to the height of the character 
> under the cursor.
> 
> I searched the mailing lists for some similar issue, and found one mail 
> chain where it is described that since the EOL has no displayable glyph, 
> the cursor height is set equal to the line height.
> 
> I'd like this to always be the case, i.e, the cursor height to always be 
> equal to the line height, EOL or not. This is a personal preference and 
> so I don't think it is a bug, I just think it looks good in VSCode and 
> other editors.

There's no such feature in Emacs, AFAIK.  The default cursor is just
the character at point displayed in inverse video, so it always has
the dimensions of the character as its font provides them.

My question is why do you set line-height to a non-nil value? what do
you want to accomplish with that setting?

(Btw, there's no line-height variable, only line-height text
property.)



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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05  7:01 ` Eli Zaretskii
@ 2023-08-05  7:41   ` Karan Ahlawat
       [not found]   ` <77dc7b13-d4a7-4d63-8f03-226cb06449e8@gmail.com>
  1 sibling, 0 replies; 10+ messages in thread
From: Karan Ahlawat @ 2023-08-05  7:41 UTC (permalink / raw)
  To: help-gnu-emacs

On 05/08/23 12:31, Eli Zaretskii wrote:

> There's no such feature in Emacs, AFAIK.  The default cursor is just
> the character at point displayed in inverse video, so it always has
> the dimensions of the character as its font provides them.
>
> My question is why do you set line-height to a non-nil value? what do
> you want to accomplish with that setting?
>
> (Btw, there's no line-height variable, only line-height text
> property.)
I miswrote, my apologies.

I meant to say, I set the line-spacing variable (not the line-height).

I was looking into the C source code and debugging Emacs to try and 
figure out how the height of a cursor at the EOL is decided (with no luck).

Anyways, the effect I want to accomplish is, after setting line-spacing 
to a value, I'd want the cursor to always be the full line of the 
height, and not the character underneath. I'd attach an image showing 
exactly what I want to reproduce, but I'm not sure if image attachments 
are okay or even usable in a mailing list.

Cheers,

Karan Ahlawat


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

* Re: Fixing cursor height when setting line-spacing
       [not found]   ` <77dc7b13-d4a7-4d63-8f03-226cb06449e8@gmail.com>
@ 2023-08-05  7:51     ` Eli Zaretskii
  2023-08-05  8:08       ` Karan Ahlawat
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2023-08-05  7:51 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 5 Aug 2023 12:52:14 +0530
> From: Karan Ahlawat <ahlawatkaran12@gmail.com>
> 
> I miswrote, my apologies.
> 
> I meant to say, I set the line-spacing variable (not the line-height). 
> 
> I was looking into the C source code and debugging Emacs to try and figure out how the height of a
> cursor at the EOL is decided (with no luck).
> 
> Anyways, the effect I want to accomplish is, after setting line-spacing to a value, I'd want the cursor to
> always be the full line of the height, and not the character underneath. I'd attach an image showing
> exactly what I want to reproduce, but I'm not sure if image attachments are okay or even usable in a
> mailing list.

First, please reply to the list, not just to me in personal email
(please use Reply All or a similar function of your email program).

And second, I asked what do you want to achieve by setting
line-spacing, not how you would like to see the cursor displayed.  I
understand how you want to see the cursor, there's no need for posting
images.

Anyway, the only suggestion to have the cursor of the same height even
when you set line-spacing non-nil is to set cursor-type to 'bar.  Then
you will have the cursor displayed as a vertical bar whose height is
the height of the line.  We currently don't have a way of doing this
with the default box cursor.



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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05  7:51     ` Eli Zaretskii
@ 2023-08-05  8:08       ` Karan Ahlawat
  2023-08-05  8:19         ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Karan Ahlawat @ 2023-08-05  8:08 UTC (permalink / raw)
  To: help-gnu-emacs

On 05/08/23 13:21, Eli Zaretskii wrote:
> First, please reply to the list, not just to me in personal email
> (please use Reply All or a similar function of your email program).
>
> And second, I asked what do you want to achieve by setting
> line-spacing, not how you would like to see the cursor displayed.  I
> understand how you want to see the cursor, there's no need for posting
> images.
>
> Anyway, the only suggestion to have the cursor of the same height even
> when you set line-spacing non-nil is to set cursor-type to 'bar.  Then
> you will have the cursor displayed as a vertical bar whose height is
> the height of the line.  We currently don't have a way of doing this
> with the default box cursor.

Sorry for the inconvenience, I'm still trying to figure out my way 
around mailing lists and replies on the list.

By setting line-spacing, I want to add space above and below the line. I 
know line-spacing is only for space below the line, and as such have 
applied a patch to a local checkout of the Emacs source code to split 
the space evenly above and below the line.

Lastly, I did set the cursor-type to 'bar. While that works, the cursor 
now becomes opaque, in a sense, and I'm unable to see the character 
below the cursor.

Cheers,

Karan Ahlawat




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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05  8:08       ` Karan Ahlawat
@ 2023-08-05  8:19         ` Eli Zaretskii
  2023-08-05  8:43           ` Karan Ahlawat
  0 siblings, 1 reply; 10+ messages in thread
From: Eli Zaretskii @ 2023-08-05  8:19 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 5 Aug 2023 13:38:02 +0530
> From: Karan Ahlawat <ahlawatkaran12@gmail.com>
> 
> By setting line-spacing, I want to add space above and below the line.

I understand, but I'm asking why do you want that space.  What is
wrong with the default spacing between lines?

> Lastly, I did set the cursor-type to 'bar. While that works, the cursor 
> now becomes opaque, in a sense, and I'm unable to see the character 
> below the cursor.

The bar cursor is very thin, and you can make it even thinner:

  M-: (setq cursor-type '(bar . 1)) RET

The above will display the cursor as a 1-pixel thin vertical line,
which cannot possibly obscure the character.



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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05  8:19         ` Eli Zaretskii
@ 2023-08-05  8:43           ` Karan Ahlawat
  2023-08-05  9:30             ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Karan Ahlawat @ 2023-08-05  8:43 UTC (permalink / raw)
  To: help-gnu-emacs


On 05/08/23 13:49, Eli Zaretskii wrote:
> I understand, but I'm asking why do you want that space.  What is
> wrong with the default spacing between lines?

There is nothing wrong with the default spacing. It's just that the font 
I prefer to use, looks a lot better with extra spacing between the lines.

> The bar cursor is very thin, and you can make it even thinner:
>
>    M-: (setq cursor-type '(bar . 1)) RET
>
> The above will display the cursor as a 1-pixel thin vertical line,
> which cannot possibly obscure the character.

Yes, it is thin enough not to obscure the character. But I prefer a 
block style cursor. So, is there any way to combine the two facts, in a 
way that the character isn't hidden?

Cheers,

Karan


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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05  8:43           ` Karan Ahlawat
@ 2023-08-05  9:30             ` Eli Zaretskii
  0 siblings, 0 replies; 10+ messages in thread
From: Eli Zaretskii @ 2023-08-05  9:30 UTC (permalink / raw)
  To: help-gnu-emacs

> Date: Sat, 5 Aug 2023 14:13:09 +0530
> From: Karan Ahlawat <ahlawatkaran12@gmail.com>
> 
> > The bar cursor is very thin, and you can make it even thinner:
> >
> >    M-: (setq cursor-type '(bar . 1)) RET
> >
> > The above will display the cursor as a 1-pixel thin vertical line,
> > which cannot possibly obscure the character.
> 
> Yes, it is thin enough not to obscure the character. But I prefer a 
> block style cursor. So, is there any way to combine the two facts, in a 
> way that the character isn't hidden?

No, we don't have such a feature in Emacs.



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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05  5:44 Fixing cursor height when setting line-spacing Karan Ahlawat
  2023-08-05  7:01 ` Eli Zaretskii
@ 2023-08-05 10:41 ` Yuri Khan
  2023-08-05 11:52   ` Karan Ahlawat
  1 sibling, 1 reply; 10+ messages in thread
From: Yuri Khan @ 2023-08-05 10:41 UTC (permalink / raw)
  To: Karan Ahlawat; +Cc: help-gnu-emacs

On Sat, 5 Aug 2023 at 12:45, Karan Ahlawat <ahlawatkaran12@gmail.com> wrote:

> I set the line-height variable to be a positive integer (16). My
> cursor-type is set to t. Now, whenever I move the cursor to the end of a
> line, the height of the cursor is equal to the entire line height. But
> anywhere else on the line, it's equal to the height of the character
> under the cursor.

I am using a non-zero line-spacing value and I don’t observe a
difference in the block cursor size in my normal usage. This is likely
because my normal usage includes ‘global-whitespace-mode’ for most
editing modes, with a display mapping for the newline character. I
have customized the ‘whitespace-space’ face to be very unobtrusive.

‘whitespace-mode’ modifies the display of spaces, tab characters, and
newlines, so you can see the difference where it would not otherwise
be visible. With it enabled, from redisplay’s point of view, the
cursor is never at the end of line — instead, it’s on the glyph
substituted for the newline, so the cursor at the logical end of line
has the same height as within the line.



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

* Re: Fixing cursor height when setting line-spacing
  2023-08-05 10:41 ` Yuri Khan
@ 2023-08-05 11:52   ` Karan Ahlawat
  0 siblings, 0 replies; 10+ messages in thread
From: Karan Ahlawat @ 2023-08-05 11:52 UTC (permalink / raw)
  To: Yuri Khan; +Cc: help-gnu-emacs

On 05/08/23 16:11, Yuri Khan wrote:

> On Sat, 5 Aug 2023 at 12:45, Karan Ahlawat<ahlawatkaran12@gmail.com>  wrote:
>
>> I set the line-height variable to be a positive integer (16). My
>> cursor-type is set to t. Now, whenever I move the cursor to the end of a
>> line, the height of the cursor is equal to the entire line height. But
>> anywhere else on the line, it's equal to the height of the character
>> under the cursor.
> I am using a non-zero line-spacing value and I don’t observe a
> difference in the block cursor size in my normal usage. This is likely
> because my normal usage includes ‘global-whitespace-mode’ for most
> editing modes, with a display mapping for the newline character. I
> have customized the ‘whitespace-space’ face to be very unobtrusive.
>
> ‘whitespace-mode’ modifies the display of spaces, tab characters, and
> newlines, so you can see the difference where it would not otherwise
> be visible. With it enabled, from redisplay’s point of view, the
> cursor is never at the end of line — instead, it’s on the glyph
> substituted for the newline, so the cursor at the logical end of line
> has the same height as within the line.

Hello, thank you for your advice as well. Right now I've decided to try 
and get used to BAR cursor. If I can't though, I will most likely use 
whitespace mode as well, to keep it consistent overall.

Cheers,

Karan


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

end of thread, other threads:[~2023-08-05 11:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-05  5:44 Fixing cursor height when setting line-spacing Karan Ahlawat
2023-08-05  7:01 ` Eli Zaretskii
2023-08-05  7:41   ` Karan Ahlawat
     [not found]   ` <77dc7b13-d4a7-4d63-8f03-226cb06449e8@gmail.com>
2023-08-05  7:51     ` Eli Zaretskii
2023-08-05  8:08       ` Karan Ahlawat
2023-08-05  8:19         ` Eli Zaretskii
2023-08-05  8:43           ` Karan Ahlawat
2023-08-05  9:30             ` Eli Zaretskii
2023-08-05 10:41 ` Yuri Khan
2023-08-05 11:52   ` Karan Ahlawat

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.