Re: Selecting a portion of text in editor pane

"Martin Půda (as mapuda at seznam dot cz)" <[email protected]>
Newsgroups gmane.lisp.lispworks.general
Message-ID <[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) <lisp-hug@lispworks.
com>
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 
"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.