[TxMt] Re: Block Caret for writers (not only for LaTeX)

Ronald Wampler rdwampler at gmail.com
Sat Jul 18 15:59:24 UTC 2015


On Fri, Jul 17, 2015 at 8:16 PM, Novitzky Peter <pnovitzky at gmail.com> wrote:
> From all the possible options changing the vertical line bar to block caret is still the simplest and most straightforward way.
>
> All I found, if somebody finds it helpful, is this page at the Apple Developer site:
>
> https://developer.apple.com/library/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextView_Class/index.html#//apple_ref/occ/instm/NSTextView/drawInsertionPointInRect:color:turnedOn:
>
> As much as I understand it, the change should be called with the  - (void)drawInsertionPointInRect:(NSRect)aRect with all its options. Just in case somebody finds this helpful for the commit...
>
For various reasons, TextMate uses a custom text view, which is not a
subclass of NSTextView, so the above solution is not applicable. The
relevant part of the code base to change the rendering of the caret is
here:

https://github.com/textmate/textmate/blob/master/Frameworks/layout/src/layout.cc#L307

If you are comfortable downloading the source and compiling it, you
can change the above line to something like:

res.push_back(OakRectMake(r1.origin.x, r1.origin.y,
_metrics->column_width(), r1.size.height));

I have not fully test it, so I don't know if it's the ideal solution.
Also, you might want to change the caret color to be somewhat
transparent in whatever theme you are using. To get it upstream, it
would have to be hidden and "themeable" in some way I imagine, which
would be more involved.


> Peter
>
> On 18 Jul 2015, at 00:34 am, Graham Heath <graham.p.heath at gmail.com> wrote:
>
>> Would it be enough to increase the frequency of the blinking of the caret. Seems to me that a frenetically blinking cursor would be more easily seen.
>>
>> Though TextMate doesn't respect the following system settings, maybe it should?
>> defaults write -g NSTextInsertionPointBlinkPeriodOff -float 0.1
>> defaults write -g NSTextInsertionPointBlinkPeriodOn -float 0.1
>>
>> This comes from the following SuperUser post, which is actually about disabling the blinking, but seemed relevant any way.
>>
>> http://superuser.com/questions/466660/how-to-disable-blinking-caret-when-editing-text-in-os-x
>>
>> Also some of this issue could be helped by, yet another, request for the "highlight current line" feature.
>>
>> Thanks,
>>
>> On Fri, Jul 17, 2015 at 8:41 AM, Novitzky Peter <pnovitzky at gmail.com> wrote:
>> So far I coloured the vertical bar caret with a contrast colour against the background, but even this is not ideal. Especially if the window loses focus...
>>
>> Thanks though for the suggestions. I appreciate it a lot.
>>
>> Patience is the art of hoping. ;)
>>
>> Peter
>>
>>
>> On 17 Jul 2015, at 16:37 pm, Rob McBroom <mailinglist0 at skurfer.com> wrote:
>>
>> > On 17 Jul 2015, at 10:47, Novitzky Peter wrote:
>> >
>> >> Thanks for your advice for using the shortcuts. However, they are not really what is desirable here.
>> >
>> > I know what you ultimately want. I don’t know if you’ll get it next week, or never.
>> >
>> > I was just offering suggestions for things you can do today.
>> >
>> > --
>> > Rob McBroom
>> > http://www.skurfer.com/
>> >
>> > _______________________________________________
>> > textmate mailing list
>> > textmate at lists.macromates.com
>> > http://lists.macromates.com/listinfo/textmate
>>
>>
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/listinfo/textmate
>>
>>
>>
>> --
>>
>> Graham P Heath
>>
>> _______________________________________________
>> textmate mailing list
>> textmate at lists.macromates.com
>> http://lists.macromates.com/listinfo/textmate
>
>
> _______________________________________________
> textmate mailing list
> textmate at lists.macromates.com
> http://lists.macromates.com/listinfo/textmate


More information about the textmate mailing list