On 2010-09-07, Pavel Sanda wrote:
> Guenter Milde wrote:
>> The generic version of this would be an LFUN that re-lyxes the selection.
>> As in math and relyx of files, any unknown construct will be converted to
>> an ERT box.

> yes elegant solutions which looks even less invasive from the coding view. no
> new ert inset, just new lfun which checks whether we are inside ert and then
> replace inset with the result of relyx... 

For consistency with the current math conversions and ease of use, I
suggest the following behaviour (pseudo code):

    if "selection is defined":
       pass
    elif "we are inside an ERT inset":
       select ERT inset content
       dissolve ERT
    else
       select word    # word-backward; word-forward-select
       
    relyx selection
    
    replace selection with result


Maybe we can provide an even more generic interface with the lfuns:

  clipboard-paste import <format>
    convert clipboard from <format> to LyX markup and insert

  copy-export <format>
    copy selection 
    convert into <format>
    put into clipboard
  
  cut-export <format>
    cut selection
    convert into <format>
    put into clipboard

were <format> can be everything LyX knows to import (LaTeX, HTML, CSV,
...).

Then we might define

  import-selection <format>
    cut
    clipboard-paste import <format>

and also

  relyx
    cut
    clipboard-paste import LaTeX

as special cases. However, this changes the clipboard content, so maybe a
separate implementation is better.

Günter
      

Reply via email to