Partial patch for block caret display

149 views
Skip to first unread message

John Ehresman

unread,
Dec 20, 2016, 4:51:09 PM12/20/16
to scintilla...@googlegroups.com
Hi,

I want a block caret that displays over the character at the end of a
selection like the cursor in vi does. I've attached a proof of concept
patch. Two questions: is this the best way to do this? And, should I
add a new caret style for this behavior or just modify how the existing
CARETSTYLE_BLOCK works?

Thanks,

John
block-caret.diff

Neil Hodgson

unread,
Dec 20, 2016, 5:23:57 PM12/20/16
to scintilla...@googlegroups.com
John Ehresman:

> I want a block caret that displays over the character at the end of a selection like the cursor in vi does. I've attached a proof of concept patch. Two questions: is this the best way to do this?

It looks reasonable to me. The drag state looks to be taken care of. Inverted range (caret before anchor) should be OK.

Well, maybe a comment: // Show block caret on last character of non-empty selection

> And, should I add a new caret style for this behavior or just modify how the existing CARETSTYLE_BLOCK works?

That will depend on whether the other users of CARETSTYLE_BLOCK always want this behaviour.

Neil

Nicholai Benalal

unread,
Dec 20, 2016, 6:28:49 PM12/20/16
to scintilla...@googlegroups.com


On 20 December 2016 at 23:23:52 +01:00, Neil Hodgson <nyama...@me.com> wrote:
And, should I add a new caret style for this behavior or just modify how the existing CARETSTYLE_BLOCK works?

That will depend on whether the other users of CARETSTYLE_BLOCK always want this behaviour.


This patch looks very good and in my opinion, there's no need for an extra caret style as I think the modified behaviour is what most people would expect from a caret mode. Actually, I raised this back in 2011 but failed to get much traction ;-). Possibly because I failed in explaining the issue properly.












John Ehresman

unread,
Dec 21, 2016, 10:40:48 AM12/21/16
to scintilla...@googlegroups.com
I can't think of a good rationale for the old behavior, but it is a
change and not 100% backwards compatible.

Thanks,

John

Neil Hodgson

unread,
Jan 22, 2017, 11:12:04 PM1/22/17
to Scintilla mailing list
The patch to display the block caret on the last character of the selection was committed as
https://sourceforge.net/p/scintilla/code/ci/d29f1dad85ac3ec2a57c9341c5bd62a05c07d1e0/
If any one wants the previous behaviour to remain possible with this as an option then they should say so.

Neil

Matthew Brush

unread,
Mar 23, 2017, 12:23:34 AM3/23/17
to scintilla...@googlegroups.com
Why should the block caret behave different from the I-beam caret? If
it's not just a different presentation, it should have a separate
setting to make it behave differently rather than breaking
normal/existing behaviour, IMO.

Related:
https://sourceforge.net/p/scintilla/bugs/1924/
https://github.com/geany/geany/issues/1442

Regards,
Matthew Brush

Semyon Filippov

unread,
Mar 23, 2017, 12:44:49 AM3/23/17
to scintilla-interest, nyama...@me.com
I definitely prefer the old behavior. Not only it was uniform with non-block caret style and some other text editors (where shift+arrow moves the cursor), but also it was easier to see that the last character is selected. Perhaps, the latter is a matter of habit, but I this it's a matter of user experience as well.

Semyon

Neil Hodgson

unread,
Mar 24, 2017, 6:29:53 PM3/24/17
to Scintilla mailing list
Matthew Brush:

> Why should the block caret behave different from the I-beam caret? If it's not just a different presentation, it should have a separate setting to make it behave differently rather than breaking normal/existing behaviour, IMO.

It would be reasonable to implement another choice for SCI_SETCARETSTYLE if any of the interested parties want to work on this. Something like CARETSTYLE_BLOCKATEND.

Neil

Semyon Filippov

unread,
Mar 25, 2017, 5:37:16 AM3/25/17
to scintilla-interest, nyama...@me.com


On Saturday, March 25, 2017 at 5:29:53 AM UTC+7, Neil Hodgson wrote:

    It would be reasonable to implement another choice for SCI_SETCARETSTYLE if any of the interested parties want to work on this. Something like CARETSTYLE_BLOCKATEND.

   Neil


I'm interested in such choice, but I'm not skilled at C++, sorry. I would be very thankful if someone else would implement this )

Semyon
Reply all
Reply to author
Forward
0 new messages