<div dir="ltr">Yeah, the thing is that the buffer-selection-info gets secretly switched in and out of the buffer by Cocoa code (that's what I meant about it being a back-door kludge, and that's why I suggested grepping for references - to find where it gets fiddled with).<div><br></div><div>Alternatively, try doing whatever you're doing inside hi::handle-hemlock-event (pass a function as the second argument). That should insure that whatever weirdness we do around hemlock events also gets done around your code. Just running on the main thread is not enough context for doing editor things, at least not any more.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 17, 2014 at 3:09 PM, Ron Garret <span dir="ltr"><<a href="mailto:ron@flownet.com" target="_blank">ron@flownet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Thanks for the hint, Gail, but I’m afraid that doesn’t help much. BUFFER-SELECTION-INFO is just an accessor into the buffer class. If I look at the selection-info object in my buffer, it looks like this:<div><br></div><div><div>#S(HI::SELECTION-INFO :POINT #<Hemlock Mark "XX^baz"></div><div> :%MARK #<Hemlock Mark "^XXbaz"> :MARK-RING #<Hemlock Ring></div><div> :REGION-ACTIVE NIL :VIEW NIL)</div><div><br></div><div>which looks correct to me. The point is where it should be (after the “XX”) but the cursor in the window is still at the end of the buffer. The peculiar result is that if I type into the buffer, characters get added at the end, and if I call hi:insert-character, they get added at the point position (and then all hell breaks loose and lines start to vanish from the display).</div><div><div class="h5"><div><br></div><div><br></div><div><div><div>On Oct 17, 2014, at 11:22 AM, Gail Zacharias <<a href="mailto:gz@clozure.com" target="_blank">gz@clozure.com</a>> wrote:</div><br><blockquote type="cite"><div dir="ltr"><div>One of the things that has changed hemlock is that cursor position is no longer per buffer, it is per view. This is to allow multiple views on the same buffer.</div><div><br></div><div>Beware that the currently implementation of this is a back-door kludge, and leaks Cocoa stuff into Hemlock code, and I plan to change it as soon as I get some time to work on it. But for now, you might want to grep references to buffer-selection-info.</div><div><br></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Oct 17, 2014 at 2:07 PM, Ron Garret <span dir="ltr"><<a href="mailto:ron@flownet.com" target="_blank">ron@flownet.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Yes, obviously something in Hemlock has changed. Mostly for the better, because a lot of my old private hacks are no longer needed. But this one thing is just driving me bananas. I’ve spend hours groveling through the source thinking, “It just can’t be that hard to figure this out.” Well, yeah, it is that hard (at least for me). But maybe I’m just getting too old for this sort of thing. :-(<br>
<br>
I’ve managed to figure out this much: when you call (say) hi:insert-character, that in turn calls hemlock-ext:buffer-note-insertion, which calls #/noteHemlockInsertionAtPosition:length:extra:, which calls a whole bunch of cocoa functions to update the window. But it doesn’t update the cursor position.<br>
<br>
it really seems like this ought to work, but it doesn’t:<br>
<br>
(setf ts (gui::make-textstorage-for-hemlock-buffer b))<br>
(easygui::running-on-main-thread ()<br>
(gui::update-hemlock-selection ts))<br>
<span><font color="#888888"><br>
rg<br>
</font></span><div><div><br>
On Oct 17, 2014, at 8:19 AM, Arthur Cater <<a href="mailto:arthur.cater@ucd.ie" target="_blank">arthur.cater@ucd.ie</a>> wrote:<br>
<br>
> Hi Ron,<br>
><br>
> This may not be relevant to your issue but just in case it is I offer it up.<br>
><br>
> I'm just upgrading from ccl1.7 to ccl1.10 and I find my "clickable" contrib doesn't<br>
> work any more, most obviously because gui::compute-temporary-attributes has changed,<br>
> and gui::set-temporary-character-attributes no longer exists. (My reward for<br>
> tinkering with unexported functions I guess. Must have gsoh!) My code had also<br>
> redefined hi::handle-hemlock-event and hi::stream-write-char and hi::stream-write-string.<br>
> I had recently been noticing other things about clickable and so I suspect maybe it hadn't<br>
> worked properly since 1.6.<br>
><br>
> I noticed along the way that ordinary use of the editor was acting strangely.<br>
> Putting the cursor somewhere in a file and typing text put the new text at the<br>
> top of the file, while maintaining cursor position.<br>
><br>
> If you're using my clickable contrib then maybe I'm to blame. If (as is likely) you're not<br>
> then maybe other hacks to hemlock that you privately use are running foul of these<br>
> (...temporary-attributes) or other changes inside hemlock. Point is, there have been<br>
> changes to hemlock's internals.<br>
><br>
> But you most likely thought of that. Just in case ...<br>
><br>
> Arthur<br>
><br>
> On Oct 17, 2014, at 2:51 AM, Ron Garret wrote:<br>
><br>
>> This is really driving me nuts. If I do this:<br>
>><br>
>><br>
>> (setf b (hi:hemlock-view-buffer (ed)))<br>
>><br>
>> (let ((hi::*current-buffer* b))<br>
>> (hi:insert-string (hi:buffer-point b)<br>
>> "baz<br>
>> bar<br>
>> bing<br>
>> "))<br>
>><br>
>> (hi:move-mark (hi:buffer-point b) (hi:buffer-start-mark b))<br>
>><br>
>> (let ((hi::*current-buffer* b)) (hi:insert-character (hi:buffer-point b) #\X))<br>
>><br>
>><br>
>> The X gets inserted at the start of the buffer just as I would expect, but if I then click on the window the cursor is still at the end of the buffer, and if I type a character, that gets inserted at the end of the buffer.<br>
>><br>
>> (If I then call the last line again, I get another X at the beginning of the buffer, and the “bar” and “bing” lines disappear!)<br>
>><br>
>> So clearly moving the buffer point around is not the same as moving the cursor around. How do I move the cursor???<br>
>><br>
>> rg<br>
>><br>
>><br>
>> On Oct 5, 2014, at 7:58 AM, Ron Garret <<a href="mailto:ron@flownet.com" target="_blank">ron@flownet.com</a>> wrote:<br>
>><br>
>>> This appears to be a regression. It works properly even without my patch in 1.8 but doesn’t work in 1.10. Apparently the problem is caused by some change deep in the GUI code because the code for editor-execute-expression-command and move-mark have not changed AFAICT.<br>
>>><br>
>>> I’ve opened a ticket.<br>
>>><br>
>>> On Oct 4, 2014, at 5:51 PM, Ron Garret <<a href="mailto:ron@flownet.com" target="_blank">ron@flownet.com</a>> wrote:<br>
>>><br>
>>>> I want to move the cursor in the top listener to the end of the buffer. It seems like this should work but it doesn’t.<br>
>>>><br>
>>>> (in-package :hemlock-interface)<br>
>>>> (setf b (gui::hemlock-buffer (#/topListener gui::hemlock-listener-document)))<br>
>>>> (move-mark (buffer-point b) (buffer-end-mark b))<br>
>>>><br>
>>>> What I’m really trying to accomplish is to insure that the bottom of the top listener is visible after doing an eval-region in an editor window. This is supposed to happen automatically, but it has never worked. I had a patch that fixed this, but the patch stopped working in version 1.10.<br>
>>>><br>
>>>> Thanks,<br>
>>>> rg<br>
>>>><br>
>>>> _______________________________________________<br>
>>>> Openmcl-devel mailing list<br>
>>>> <a href="mailto:Openmcl-devel@clozure.com" target="_blank">Openmcl-devel@clozure.com</a><br>
>>>> <a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" target="_blank">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br>
>>><br>
>>> _______________________________________________<br>
>>> Openmcl-devel mailing list<br>
>>> <a href="mailto:Openmcl-devel@clozure.com" target="_blank">Openmcl-devel@clozure.com</a><br>
>>> <a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" target="_blank">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br>
>><br>
>> _______________________________________________<br>
>> Openmcl-devel mailing list<br>
>> <a href="mailto:Openmcl-devel@clozure.com" target="_blank">Openmcl-devel@clozure.com</a><br>
>> <a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" target="_blank">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br>
><br>
<br>
_______________________________________________<br>
Openmcl-devel mailing list<br>
<a href="mailto:Openmcl-devel@clozure.com" target="_blank">Openmcl-devel@clozure.com</a><br>
<a href="https://lists.clozure.com/mailman/listinfo/openmcl-devel" target="_blank">https://lists.clozure.com/mailman/listinfo/openmcl-devel</a><br>
</div></div></blockquote></div><br></div>
</blockquote></div><br></div></div></div></div></div></blockquote></div><br></div>