octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Indentation of current line or selected blocks in the code editor?


From: Torsten
Subject: Re: Indentation of current line or selected blocks in the code editor?
Date: Wed, 15 Nov 2017 00:23:54 +0100

On 14.11.2017 23:49, Richard Crozier wrote:
> 
> 
> On 14/11/17 22:01, John W. Eaton wrote:
>> On 11/08/2017 05:44 PM, John W. Eaton wrote:
>>> On 11/08/2017 03:56 PM, Torsten wrote:
>>>
>>>> There is some smart indentation while typing
>>>> (octave_qscintilla::smart_indent). Maybe we can use parts of it for
>>>> "offline" adjusting the indentation.
>>>
>>> Thanks for the pointer.
>>
>> Here's what I have so far:
>>
>>    http://hg.savannah.gnu.org/hgweb/octave/rev/e0bcd17ac070
>>
>> I pushed it even though it is not complete so that it would be easier
>> to test.  It only adds code and doesn't modify an existing behavior.
>>
>> Currently, this new indent feature is not connected to any keyboard
>> shortcut yet and is only accessible from the Edit -> Format menu in
>> the editor.  What keybinding should it use by default?
>>
> 
> Matlab uses CTRL+Ifor this, as good an option as any?
> 
> While on the subject, Matlab also has a useful function to wrap comment
> paragraphs at 80 characters, preserving the indentation after the
> comment character, e.g.
> 
> %       Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
> lobortis dolor sit amet eros feugiat tincidunt non vitae arcu. Duis
> fringilla massa quis aliquet maximus. Suspendisse in pharetra dui.
> Suspendisse potenti. In in diam at elit tempor sagittis sit amet.
> 
> becomes:
> 
> %       Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec
> %       lobortis dolor sit amet eros feugiat tincidunt non vitae arcu. Duis
> %       fringilla massa quis aliquet maximus. Suspendisse in pharetra dui.
> %       Suspendisse potenti. In in diam at elit tempor sagittis sit amet.
> 
> 
> It really is quite helpful. Is there any interest in implementing this?
> As a fairly chunky start I have ported the python TextWrapper class to
> classdef (see attached files). These already allow an indent to be
> prepended to every wrapped line. This class also handles lots of text
> wrapping edge cases nicely.
> 
> Also Matlab also isn't too clever about it, it just rewraps text comment
> blocks with the same indentation.
> 
> Shortcut for this in Matlab is CTRL+J
> 
> Regards,
> 
> Richard

The octave editor provides a similar feature for line breaking in
comments while typing with the editor's preference "break lines ..." &
"break lines in comments only".

Torsten





reply via email to

[Prev in Thread] Current Thread [Next in Thread]