Re: Selecting a portion of text in editor pane
"Krupka Michal (as michal dot krupka at upol dot cz)" <[email protected]>
| Newsgroups | gmane.lisp.lispworks.general |
|---|---|
| Message-ID | <[email protected]> |
Well, if I break the test to parts like this:
(setf my-editor (make-instance 'capi:editor-pane
:text "This is the first line of text.
This is the second line.
And here is the third line.
Finally, the fourth line of text."
:visible-min-height 150
:visible-min-width 400))
(capi:contain my-editor)
(progn
(setf (editor:variable-value "Highlight Active Region" :buffer (capi:editor-pane-buffer my-editor)) t)
(select-some-text my-editor))
then the last form doesn't always work for me. Just try to click to several places of text or select some parts of it and then evaluate the last form.
Michal
> 22. 9. 2025 v 10:37, Martin Půda (as mapuda at seznam dot cz) <[email protected]>:
>
> Something like this?
>
> (defun select-some-text (editor-pane)
> (capi:apply-in-pane-process
> editor-pane
> (lambda ()
> (let* ((buffer (capi:editor-pane-buffer editor-pane))
> (buffer-point (editor:buffer-point buffer))
> (start-point (editor:copy-point buffer-point :temporary))
> (end-point (editor:copy-point buffer-point :temporary)))
>
> (editor:line-offset start-point 1 5)
> (editor:line-offset end-point 2 3)
> (editor:move-point buffer-point start-point)
> (editor:set-current-mark end-point)
>
> (print (capi:editor-pane-selected-text editor-pane))))))
>
> (let ((my-editor (make-instance 'capi:editor-pane
> :text "This is the first line of text.
> This is the second line.
> And here is the third line.
> Finally, the fourth line of text."
> :visible-min-height 150
> :visible-min-width 400)))
> (capi:contain my-editor)
> (setf (editor:variable-value "Highlight Active Region" :buffer (capi:editor-pane-buffer my-editor)) t)
> (select-some-text my-editor))
>
>
> ---------- Původní e-mail ----------
> Od: Krupka Michal (as michal dot krupka at upol dot cz) <[email protected]>
> Komu: Lisp Hug Lispworks <[email protected]>
> Datum: 21. 9. 2025 22:19:47
> Předmět: Selecting a portion of text in editor pane
> Hello,
>
> I need to select a part of text in capi:editor-pane given two buffer points. I tried this (inside a correct process) but it doesn't work correctly:
>
> (editor:use-buffer (capi:editor-pane-buffer my-pane)
> (editor:move-point (editor:current-point) point-1)
> (editor:set-current-mark point-2))
>
> Any advice? Thanks.
>
> Michal
>
> _______________________________________________
> Lisp Hug - the mailing list for LispWorks users
> [email protected]
> http://www.lispworks.com/support/lisp-hug.html
_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html