"Interval Highlighting" in latest RBCodeHighlighter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

"Interval Highlighting" in latest RBCodeHighlighter

Travis Griggs-3
OK. I've tried. I've tried really hard. For more than a week. To get used to this new "feature." I can't seem to. The last straw was a couple of minutes ago when it started throwing all kinds of UHEs because somehow it got confused and decided the interval to show was a negative one (i.e. start > stop).

At a high level, I like the idea. The more feedback the better. In reality, I find using the current implementation frustrating. The color used is a saturated light blue. My problem is that often I click at a closure boundary and it highlights and then I'm deceived into thinking it is selected. The color is actually close enough, that it forces me to "think" about it and have to decode what backlit text means, whereas before backlit text has always been an instantaneous recognition that I can simply begin typing and it will overwrite what's there.

I'm curious what others' experiences with this new feature are? Again, I'm not opposed to the idea in general, just the current implementation. If it "flashed" on and off once, that would be quite an improvement. Maybe if some other emphases were used. Or just draw an arc'ed arrow between the two points. Or something. And I think there should definitely be an option to turn it on/off.

I've also seen cases where it highlights wrong for 's. If you put your cursor to the left of the first ' mark, it will highlight all the way to the front of the method.

--
Travis Griggs
Objologist
"Every institution finally perishes by an excess of its own first principle." - Lord Acton



Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Karsten Kusche
Hi Travis,

> At a high level, I like the idea. The more feedback the better. In
> reality, I find using the current implementation frustrating. The
> color used is a saturated light blue. My problem is that often I click
> at a closure boundary and it highlights and then I'm deceived into
> thinking it is selected. The color is actually close enough, that it
> forces me to "think" about it and have to decode what backlit text
> means, whereas before backlit text has always been an instantaneous
> recognition that I can simply begin typing and it will overwrite
> what's there.

I developed that on a windows pc and thus the bright blue is quite easy
to not be confused with the dark-blue of the selection, but as a mac
user I know that this color comes quite close to the normal
selection-color of macos x, so sorry for the confusion. I fully agree
that this color should be changeable in the settings, as well as it
should be able to simply turn it off.
If you want to change it manually you can do that in
HighlightingTextEditorController>>addHighlightingInText:selection:.

I guess a bright yellow would fit better on a mac.

> I'm curious what others' experiences with this new feature are? Again,
> I'm not opposed to the idea in general, just the current
> implementation. If it "flashed" on and off once, that would be quite
> an improvement. Maybe if some other emphases were used. Or just draw
> an arc'ed arrow between the two points. Or something. And I think
> there should definitely be an option to turn it on/off.

I think the flashing could be a cool idea, maybe the
highlighting-process should remove that emphasis, if some brackets are
highlighted.

> I've also seen cases where it highlights wrong for 's. If you put your
> cursor to the left of the first ' mark, it will highlight all the way
> to the front of the method.

I used the #selectWord: method of the controller to find the current
selection, but first the current character is tested if it is a start or
end enclosure, which is done with #startsAnEnclosureWith: and
#endsAnEnclosureWith:.
I think it's quite a good idea to remove the $' and $" from these
methods, as the highlighter itself displays them in different colors
anyway.

Karsten

Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Holger Kleinsorgen-4
Karsten Kusche wrote:
> Hi Travis,
> [..]
>  I fully agree
> that this color should be changeable in the settings, as well as it
> should be able to simply turn it off.

done

> I guess a bright yellow would fit better on a mac.

done (default value)

>> I've also seen cases where it highlights wrong for 's. If you put your
>> cursor to the left of the first ' mark, it will highlight all the way
>> to the front of the method.

fixed

Published as 1.55 in the open repository

Cheers, Holger

Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Karsten Kusche
hey,

thanks a lot!!

Karsten



Holger Kleinsorgen wrote:

> Karsten Kusche wrote:
>> Hi Travis,
>> [..]
>>  I fully agree
>> that this color should be changeable in the settings, as well as it
>> should be able to simply turn it off.
>
> done
>
>> I guess a bright yellow would fit better on a mac.
>
> done (default value)
>
>>> I've also seen cases where it highlights wrong for 's. If you put
>>> your cursor to the left of the first ' mark, it will highlight all
>>> the way to the front of the method.
>
> fixed
>
> Published as 1.55 in the open repository
>
> Cheers, Holger
>
>

Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Travis Griggs-3
In reply to this post by Holger Kleinsorgen-4

On Oct 12, 2006, at 4:33, Holger Kleinsorgen wrote:

Karsten Kusche wrote:
Hi Travis,
[..]
 I fully agree
that this color should be changeable in the settings, as well as it should be able to simply turn it off.

done

I guess a bright yellow would fit better on a mac.

done (default value)

I've also seen cases where it highlights wrong for 's. If you put your cursor to the left of the first ' mark, it will highlight all the way to the front of the method.

fixed

Published as 1.55 in the open repository


Thanks Holger.

The color is an improvement. Being able to turn it off is nice. Though I really want to see it work. So I'm keeping it on for now. It's still easy to mess it up.

The string

'I can''t seem to make this work right'

won't do the right thing. Or writing code with a statement like:

blah ifTrue: [aStream nextPut: $[].

or having comments with any unbalanced form of the target match.

Maybe those are rare enough though that its not pragmatic to care.

Karsten and I have exchanged some emails in the background. I like the idea of drawing the coder's attention to the enclosure. Fundamentally, I think any form of "highlighting" is not the way to do it. Textual highlighting has too many long and established meanings already. That said, I realize the onus is on me, the detractor, to volunteer something better.

Thanks again for making the improvements and publishing them.

--
Travis Griggs
Objologist
One man's blue plane is another man's pink plane.


Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Holger Kleinsorgen-4
Travis Griggs wrote:

> The string
>
> 'I can''t seem to make this work right'
>
> won't do the right thing. Or writing code with a statement like:
>
> blah ifTrue: [aStream nextPut: $[].

This can be hardly fixed unless the highlighing mechanism is
fundamentally changed. Currently it is not integrated into the
highlighting scanner/parser and therefore has to guess what a Character
within the sourcecode means. And as you point out, it makes wrong
assumptions from time to time.

> Karsten and I have exchanged some emails in the background. I like  the
> idea of drawing the coder's attention to the enclosure.  Fundamentally,
> I think any form of "highlighting" is not the way to  do it. Textual
> highlighting has too many long and established  meanings already. That
> said, I realize the onus is on me, the  detractor, to volunteer
> something better.

There probably won't be an ultimate solution. For instance, I don't like
the way Emacs highlights enclosures (flashing the other end of the
enclosure). Actually, I don't like flashing at all.

The following visualisations come to my mind:
- highlighting (like it is done now)
- displaying the enclosure with a different text style
- highlighting the other end of the enclosure
- displaying the other end of the enclosure with a different text style
(e.g. red / bold)
- everything mentioned above with flasing, or static.
- automatically refactoring enclosures that are too complicated to
comprehend at a glance, thereby eliminating the necessity to highlight
the enclosure ;)

Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Travis Griggs-3
On Oct 12, 2006, at 13:12, Holger Kleinsorgen wrote:

Travis Griggs wrote:

The string
'I can''t seem to make this work right'
won't do the right thing. Or writing code with a statement like:
blah ifTrue: [aStream nextPut: $[].

This can be hardly fixed unless the highlighing mechanism is fundamentally changed. Currently it is not integrated into the highlighting scanner/parser and therefore has to guess what a Character within the sourcecode means. And as you point out, it makes wrong assumptions from time to time.

Yes, I thought about this some. I've proven to myself that I can use the highlighting scanner parser to "backColor" enclosures. And it does it "correctly". But if you're doing backlighting, this runs into conflict with the highlighting mechanism of selection in the editor. To do it "right", one could "augment" the highlighting scanner/parser with info about the current insertion point. Then it can do "more" when the insertion point crosses an interesting node. Or... one could simply use the parser to "mark" the matching left and right parens. Basically emphasize each left token with a #left -> increasingCounter emphasis, and the right with the appropriate #right -> currentCounterBeforeIDecreaseIt. Then the text controller can simply check the emphasis of it's current text at the insertion point and go nuts with it.


Karsten and I have exchanged some emails in the background. I like  the idea of drawing the coder's attention to the enclosure.  Fundamentally, I think any form of "highlighting" is not the way to  do it. Textual highlighting has too many long and established  meanings already. That said, I realize the onus is on me, the  detractor, to volunteer something better.

There probably won't be an ultimate solution. For instance, I don't like the way Emacs highlights enclosures (flashing the other end of the enclosure). Actually, I don't like flashing at all.

The following visualisations come to my mind:
- highlighting (like it is done now)
- displaying the enclosure with a different text style
- highlighting the other end of the enclosure
- displaying the other end of the enclosure with a different text style (e.g. red / bold)
- everything mentioned above with flasing, or static.
- automatically refactoring enclosures that are too complicated to comprehend at a glance, thereby eliminating the necessity to highlight the enclosure ;)

There probably isn't an ultimate solution. I actually played with a number of emphases. Some alone, some in isolation. Large/small. Underline. Overline. Strikethrough. Super/Sub script. Various combinations. There are all kinds of issues with many of them. Ultimately, I hate them all. The real intent (in my mind) is given a an enclosure token, draw the users attention to the span of the enclosure and the other token. The "stuff" that's inside the enclosure is almost an afterthought. But any character emphasis draws make the "stuff" in between the focus, and the enclosing tokens are the afterthought. This probably isn't making any sense. :)

Anyway, I tried something a little different. In fact, quite a bit. It may be stupid. But it's at least original. And shows the kind of stuff you can choose to do when you don't use native widgets. I don't think I've ever seen any sort of "enclosure" marking that looks like it. You'll have to load 1.56a to see it though. Curious about reactions. I kind of think it's cute/cool. I might just like it right now because it IS different. You can all hate it.  But you're gonna have to work hard to be more original. :)

--
Travis Griggs
Objologist
"It's [a spec] _the_ single worst way to write software, because it by definition means that the software was written to match theory, not reality" - Linus Torvalds


Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Karsten Kusche
good morning everyone,

i just tried that highlighting and it made me laugh...that kind of
highlighting is just great, unique and really new!!
the only problem is with short distances, but i think no highlighting
should happen, when the distance is just 5 characters.

not sure though if this way of highlighting is not a bit to
'distracting' for some people, maybe there should be a setting to chose
which kind of highlighting should happen (different background or arrows
or both).

Karsten



Travis Griggs wrote:

> On Oct 12, 2006, at 13:12, Holger Kleinsorgen wrote:
>
>> Travis Griggs wrote:
>>
>>> The string
>>> 'I can''t seem to make this work right'
>>> won't do the right thing. Or writing code with a statement like:
>>> blah ifTrue: [aStream nextPut: $[].
>>
>> This can be hardly fixed unless the highlighing mechanism is
>> fundamentally changed. Currently it is not integrated into the
>> highlighting scanner/parser and therefore has to guess what a
>> Character within the sourcecode means. And as you point out, it makes
>> wrong assumptions from time to time.
>
> Yes, I thought about this some. I've proven to myself that I can use
> the highlighting scanner parser to "backColor" enclosures. And it does
> it "correctly". But if you're doing backlighting, this runs into
> conflict with the highlighting mechanism of selection in the editor.
> To do it "right", one could "augment" the highlighting scanner/parser
> with info about the current insertion point. Then it can do "more"
> when the insertion point crosses an interesting node. Or... one could
> simply use the parser to "mark" the matching left and right parens.
> Basically emphasize each left token with a #left -> increasingCounter
> emphasis, and the right with the appropriate #right ->
> currentCounterBeforeIDecreaseIt. Then the text controller can simply
> check the emphasis of it's current text at the insertion point and go
> nuts with it.
>
>>
>>> Karsten and I have exchanged some emails in the background. I like  
>>> the idea of drawing the coder's attention to the enclosure.  
>>> Fundamentally, I think any form of "highlighting" is not the way to  
>>> do it. Textual highlighting has too many long and established  
>>> meanings already. That said, I realize the onus is on me, the  
>>> detractor, to volunteer something better.
>>
>> There probably won't be an ultimate solution. For instance, I don't
>> like the way Emacs highlights enclosures (flashing the other end of
>> the enclosure). Actually, I don't like flashing at all.
>>
>> The following visualisations come to my mind:
>> - highlighting (like it is done now)
>> - displaying the enclosure with a different text style
>> - highlighting the other end of the enclosure
>> - displaying the other end of the enclosure with a different text
>> style (e.g. red / bold)
>> - everything mentioned above with flasing, or static.
>> - automatically refactoring enclosures that are too complicated to
>> comprehend at a glance, thereby eliminating the necessity to
>> highlight the enclosure ;)
>
> There probably isn't an ultimate solution. I actually played with a
> number of emphases. Some alone, some in isolation. Large/small.
> Underline. Overline. Strikethrough. Super/Sub script. Various
> combinations. There are all kinds of issues with many of them.
> Ultimately, I hate them all. The real intent (in my mind) is given a
> an enclosure token, draw the users attention to the span of the
> enclosure and the other token. The "stuff" that's inside the enclosure
> is almost an afterthought. But any character emphasis draws make the
> "stuff" in between the focus, and the enclosing tokens are the
> afterthought. This probably isn't making any sense. :)
>
> Anyway, I tried something a little different. In fact, quite a bit. It
> may be stupid. But it's at least original. And shows the kind of stuff
> you can choose to do when you don't use native widgets. I don't think
> I've ever seen any sort of "enclosure" marking that looks like it.
> You'll have to load 1.56a to see it though. Curious about reactions. I
> kind of think it's cute/cool. I might just like it right now because
> it IS different. You can all hate it.  But you're gonna have to work
> hard to be more original. :)
>
> --
> Travis Griggs
> Objologist
> "It's [a spec] _the_ single worst way to write software, because it by
> definition means that the software was written to match theory, not
> reality" - Linus Torvalds
>
>

Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Travis Griggs-3

On Oct 13, 2006, at 1:47, Karsten Kusche wrote:

good morning everyone,

i just tried that highlighting and it made me laugh...that kind of highlighting is just great, unique and really new!!
the only problem is with short distances, but i think no highlighting should happen, when the distance is just 5 characters.

Yes. Tweaking the parameters is kind of tricky. I was tired and wanted to publish. At one point, I had something nice for "short distances", but it got neglected as I tuned things for longer distances, both on the same line and multiline ones. But I'll see if I can't special case that to get it back. Did you change the color? I found red (or an orange close it) or darkCyan were both nice. I've been using it for the last hour or so, and it's grown on me. The implementation is actually a bit simpler than the highlighting approach. In addition to "short" enclosures, I'd like to do something different for the case where the right token is below the left one AND to the left of the left token.

Thanks for giving it a spin.

--
Travis Griggs
Objologist
"Every institution finally perishes by an excess of its own first principle." - Lord Acton



Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Karsten Kusche

> Yes. Tweaking the parameters is kind of tricky. I was tired and wanted
> to publish. At one point, I had something nice for "short distances",
> but it got neglected as I tuned things for longer distances, both on
> the same line and multiline ones. But I'll see if I can't special case
> that to get it back. Did you change the color? I found red (or an
> orange close it) or darkCyan were both nice. I've been using it for
> the last hour or so, and it's grown on me. The implementation is
> actually a bit simpler than the highlighting approach. In addition to
> "short" enclosures, I'd like to do something different for the case
> where the right token is below the left one AND to the left of the
> left token.
>
i tried a dark blue as color, that worked just nice :-)
maybe an arrow like the one on the return-key would be a good thing for
that kind of constellation

Karsten


Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Holger Kleinsorgen-4
In reply to this post by Travis Griggs-3
Travis Griggs wrote:
> Anyway, I tried something a little different. In fact, quite a bit. It
> may be stupid. But it's at least original. And shows the kind of stuff
> you can choose to do when you don't use native widgets. I don't think
> I've ever seen any sort of "enclosure" marking that looks like it.

It's cute & original, but quite the opposite of what I want. I don't
like eye-catching visualisations that distract me. IMHO it should be
something that is so unobtrusive that it can be ignored in the normal
case of simple enclosures.
Maybe the enclosure highlighting should only performed in nested or very
long enclosures.

PS: Suddenly, some kind of Karaoke-like highlighting comes to my mind ;)

Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Dave Stevenson-2
I think the arcs don't stay long enough to be useful, but if they did
stay longer then ensuring they didn't get in the way would get rather
complicated.  (Sorry, Travis; it was an interesting and fun
implementation, though.)

If by Karaoke-like you mean a colored dot above the enclosure, it sounds
promising.

Dave

Holger Kleinsorgen wrote:

> Travis Griggs wrote:
>> Anyway, I tried something a little different. In fact, quite a bit. It
>> may be stupid. But it's at least original. And shows the kind of stuff
>> you can choose to do when you don't use native widgets. I don't think
>> I've ever seen any sort of "enclosure" marking that looks like it.
>
> It's cute & original, but quite the opposite of what I want. I don't
> like eye-catching visualisations that distract me. IMHO it should be
> something that is so unobtrusive that it can be ignored in the normal
> case of simple enclosures.
> Maybe the enclosure highlighting should only performed in nested or very
> long enclosures.
>
> PS: Suddenly, some kind of Karaoke-like highlighting comes to my mind ;)
>
>

Reply | Threaded
Open this post in threaded view
|

Re: "Interval Highlighting" in latest RBCodeHighlighter

Travis Griggs-3
In reply to this post by Holger Kleinsorgen-4
On Oct 13, 2006, at 2:37, Holger Kleinsorgen wrote:

Travis Griggs wrote:
Anyway, I tried something a little different. In fact, quite a bit. It may be stupid. But it's at least original. And shows the kind of stuff you can choose to do when you don't use native widgets. I don't think I've ever seen any sort of "enclosure" marking that looks like it. 

It's cute & original, but quite the opposite of what I want. I don't like eye-catching visualisations that distract me. IMHO it should be something that is so unobtrusive that it can be ignored in the normal case of simple enclosures.
Maybe the enclosure highlighting should only performed in nested or very long enclosures.

What you want seems like a conflict. You want something, but you don't. :) But that's OK, this whole thing has been somewhat confusing to me. Simply because I've been highlighting enclosures for years in Smalltalk. You click twice on the inside of the enclosing character, and it selects the code. I've always used it for precisely the situation you talk about: the enclosure that is so big and hairy I can't see the end of it. And frankly, that's always been good enough for me. And works great. I've been curious from the get go what prompted this feature in the first place, since that's always seemed so effective to me. I've begun to wonder if others actually know you can do that. It's probably like discovering how many people use ctrl-g versus typing := out.

I've discovered a for more common "slip" of the current enclosure highlighter from just looking for characters. < and > characters. They show up all the time in isolation. As part of -> association messages. By themselves as magnitude comparisons. Or in any one of the three interpretations of >> and <<.

Would this feature actually be better done as a different package? Either approach, uses very little of the same code that the original syntax highlighting uses. It's a related but different thing. I'd like to vote that both approaches be taken out of RBCodeHighlighting and put in a separate package called EnclosureHighlighting which requires CodeHighlighting.

--
Travis Griggs
Objologist
"Is success the potential of what could be, or the reality of what is?"