tumashu / posframe

Pop a posframe (just a child-frame) at point, posframe is a **GNU ELPA** package!
450 stars 58 forks source link

Editing text on a frame #114

Closed foodeater123 closed 2 years ago

foodeater123 commented 2 years ago

I had a idea to make the scratch buffer pop up for temporary notes using posframe, however when it pop ups it does not allow me to edit the text on the posframe frame itself.

Code: (defun show-misc-posframe () (interactive) (when (posframe-workable-p) (posframe-show "scratch" :border-color "#ee7b29" :border-width 2 :poshandler 'posframe-poshandler-frame-center :height (round( (frame-height) 0.90)) :width (round( (frame-width) 0.75)) ; :override-parameters '((cursor-type box)) ) ) (with-current-buffer "scratch" (setq-local cursor-type t) (setq-local cursor-in-non-selected-windows 'box)) )

Screen Shot 2022-06-24 at 7 24 31 pm

tumashu commented 2 years ago

Yes, at the moment, posframe do not get focus, so it only can show and can not select and edit.

foodeater123 commented 2 years ago

Would there be any workaround to this, if posframe can have focus it would be possible for even a pop up shell. How do modes like posframe vertico focus on the pop up

tumashu commented 2 years ago

I do not know more about focus, may be you can read code and try, forcus seem to hard deal with

tumashu commented 2 years ago

maybe you should search package list, maybe other package has this feature

foodeater123 commented 2 years ago

Is there any temporary workaround

zhenhua-wang commented 2 years ago

@RadonBurner It seems you can edit the buffer in posframe by having :accept-focus t in posframe-show. I don't know if this is correct usage though.

foodeater123 commented 2 years ago

@zhenhua-wang Thanks, is there anyway to to show cursor when focusing, I got the cursor to show with (with-current-buffer buffer (setq-local cursor-type t) (setq-local cursor-in-non-selected-windows 'box))

but the cursor does not move when I type or use arrow keys, it just sits there

zhenhua-wang commented 2 years ago

What you did above was correct. You also need to set :override-parameters '((cursor-type . box)) inside posframe-show.