Re: shortcut for going to edge of ERT frame?

2021-08-11 Thread Andrew Parsloe

On 9/08/2021 7:12 am, Paul A. Rubin wrote:

On 8/8/21 2:01 PM, David Pesetsky wrote:
Is there any way to program a key so that if you are typing within an 
ERT frame, it takes the cursor to the last (or first) character in 
that frame?


Also useful would be a way to exit the frame — landing at at the 
first non-ERT character to the left or right of the frame.


-David
You can bind keys to the functions "inset-begin" (positions the cursor 
before the first character in the inset) and "inset-end" (positions 
the cursor after the last character in the inset). In both cases, the 
cursor remains within the inset.


To exit the inset, you can use "command-sequence inset-end; 
char-forward;".


Paul


But there's a catch with using inset-end or inset-begin like this to 
move out of the inset. If the cursor is at the end of the inset already 
then "command-sequence inset-end; char-forward;" will take you to the 
end of an enclosing inset if there is one, or to the end of your 
document if there is not, which can be disconcerting if all you want to 
do is position the cursor immediately after the inset.


command-sequence line-begin; inset-end; char-right;

takes care of the case when the cursor is already at the end of the 
inset (but still produces the big jump to the end of the document if the 
inset is empty).


Andrew

--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: shortcut for going to edge of ERT frame?

2021-08-08 Thread David Pesetsky
Very helpful, thank you!

> On Aug 8, 2021, at 3:12 PM, Paul A. Rubin  wrote:
> 
> On 8/8/21 2:01 PM, David Pesetsky wrote:
>> Is there any way to program a key so that if you are typing within an ERT 
>> frame, it takes the cursor to the last (or first) character in that frame?
>> 
>> Also useful would be a way to exit the frame — landing at at the first 
>> non-ERT character to the left or right of the frame.
>> 
>> -David
>>   
> You can bind keys to the functions "inset-begin" (positions the cursor before 
> the first character in the inset) and "inset-end" (positions the cursor after 
> the last character in the inset). In both cases, the cursor remains within 
> the inset.
> 
> To exit the inset, you can use "command-sequence inset-end; char-forward;".
> 
> Paul
> 
> -- 
> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users

-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: shortcut for going to edge of ERT frame?

2021-08-08 Thread Christopher Menzel
On 8 Aug 2021, at 1:36 PM, David Pesetsky  wrote:
> On Aug 8, 2021, at 2:09 PM, Chris Menzel  > wrote:
>> 
>> For me, Ctrl-a and Ctrl-e move the cursor in an ERT frame to the first and 
>> last characters of the frame, respectively. However, I'm not sure if this is 
>> because I'm using Emacs keybindings or because I'm using a Mac, which also 
>> uses those keybindings in text areas. 
> 
> Thanks for the reply!  Unfortunately, no luck.
> 
> I have been using the mac keybindings, plus some customizations.  
> Unfortunately, neither with the mac keybindings nor when I change to the 
> emacs keybindings (I was hoping to get the code that way) do I see these 
> actions.  

Huh, weird. I just checked this out on my Linux laptop and selecting the Emacs 
keybindings (Tools → Preferences → Shortcuts → Bind file) gives me the 
Ctrl-a/Ctrl-e behavior noted inside an ERT frame.

> Ctrl-a alone seems to do nothing except display "^a options" on the status 
> bar at the bottom.  With the emacs keybindings, both ctrl-a and ctrl-e yield 
> "unknown function".

Ah, you know what? Ctrl and Cmd are all turned around for me on the Mac. Try 
using Cmd-a and Cmd-e instead! (I had to go into the Shortcuts and explicitly 
assign the functions in question to Ctrl- characters instead of Cmd- 
to get Emacs bindings to work correctly.) I suspect there was a more global way 
to do this in one fell swoop, but I couldn't figure out any other way to do it; 
and it works. ¯\_(ツ)_/¯ But if all you want is some keystroke to get the cursor 
movement you want, you can just use the Cmd- bindings noted.

-chris

-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: shortcut for going to edge of ERT frame?

2021-08-08 Thread Paul A. Rubin

On 8/8/21 2:01 PM, David Pesetsky wrote:

Is there any way to program a key so that if you are typing within an ERT 
frame, it takes the cursor to the last (or first) character in that frame?

Also useful would be a way to exit the frame — landing at at the first non-ERT 
character to the left or right of the frame.

-David
   
You can bind keys to the functions "inset-begin" (positions the cursor 
before the first character in the inset) and "inset-end" (positions the 
cursor after the last character in the inset). In both cases, the cursor 
remains within the inset.


To exit the inset, you can use "command-sequence inset-end; char-forward;".

Paul

--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: shortcut for going to edge of ERT frame?

2021-08-08 Thread David Pesetsky


On Aug 8, 2021, at 2:09 PM, Chris Menzel 
mailto:chris.men...@gmail.com>> wrote:

For me, Ctrl-a and Ctrl-e move the cursor in an ERT frame to the first and last 
characters of the frame, respectively. However, I'm not sure if this is because 
I'm using Emacs keybindings or because I'm using a Mac, which also uses those 
keybindings in text areas.

Thanks for the reply!  Unfortunately, no luck.

I have been using the mac keybindings, plus some customizations.  
Unfortunately, neither with the mac keybindings nor when I change to the emacs 
keybindings (I was hoping to get the code that way) do I see these actions.  
With the mac keybindings, ctrl-e takes me to the end of the on-screen line, but 
not the end of the frame.  Ctrl-a alone seems to do nothing except display "^a 
options" on the status bar at the bottom.  With the emacs keybindings, both 
ctrl-a and ctrl-e yield "unknown function".


Ctrl-o closes the frame and places the cursor to its immediate left; that 
behavior is definitely due to my choice of Emacs keybindings.



Chris Menzel

On Sun, Aug 8, 2021 at 1:01 PM David Pesetsky 
mailto:pese...@mit.edu>> wrote:
Is there any way to program a key so that if you are typing within an ERT 
frame, it takes the cursor to the last (or first) character in that frame?

Also useful would be a way to exit the frame — landing at at the first non-ERT 
character to the left or right of the frame.

-David

--
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users

--
David Pesetsky [pese...@mit.edu]
Department of Linguistics and Philosophy
32-D862 Massachusetts Institute of Technology
77 Massachusetts Avenue
Cambridge, MA 02139 USA
(617) 253-0957 office   (617) 253-5017 fax
http://web.mit.edu/linguistics/www/pesetsky.home.html

-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


Re: shortcut for going to edge of ERT frame?

2021-08-08 Thread Chris Menzel
For me, Ctrl-a and Ctrl-e move the cursor in an ERT frame to the first and
last characters of the frame, respectively. However, I'm not sure if this
is because I'm using Emacs keybindings or because I'm using a Mac, which
also uses those keybindings in text areas. Ctrl-o closes the frame and
places the cursor to its immediate left; that behavior is definitely due to
my choice of Emacs keybindings.

Chris Menzel

On Sun, Aug 8, 2021 at 1:01 PM David Pesetsky  wrote:

> Is there any way to program a key so that if you are typing within an ERT
> frame, it takes the cursor to the last (or first) character in that frame?
>
> Also useful would be a way to exit the frame — landing at at the first
> non-ERT character to the left or right of the frame.
>
> -David
>
> --
> lyx-users mailing list
> lyx-users@lists.lyx.org
> http://lists.lyx.org/mailman/listinfo/lyx-users
>
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users


shortcut for going to edge of ERT frame?

2021-08-08 Thread David Pesetsky
Is there any way to program a key so that if you are typing within an ERT 
frame, it takes the cursor to the last (or first) character in that frame?  

Also useful would be a way to exit the frame — landing at at the first non-ERT 
character to the left or right of the frame.

-David
  
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users