shortcut for going to edge of ERT frame?

Andrew Parsloe ajparsloe at gmail.com
Wed Aug 11 23:07:04 UTC 2021


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



More information about the lyx-users mailing list