[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: |
Richard Crozier |
Subject: |
Re: Indentation of current line or selected blocks in the code editor? |
Date: |
Tue, 14 Nov 2017 22:49:14 +0000 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 |
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 University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.
TextWrapper.m
Description: Text Data
test_TextWrapper.m
Description: Text Data
- Indentation of current line or selected blocks in the code editor?, John W. Eaton, 2017/11/07
- Re: Indentation of current line or selected blocks in the code editor?, Ben Abbott, 2017/11/07
- Re: Indentation of current line or selected blocks in the code editor?, Torsten, 2017/11/07
- Re: Indentation of current line or selected blocks in the code editor?, John W. Eaton, 2017/11/07
- Re: Indentation of current line or selected blocks in the code editor?, siko1056, 2017/11/07
- Re: Indentation of current line or selected blocks in the code editor?, John W. Eaton, 2017/11/08
- Re: Indentation of current line or selected blocks in the code editor?, Torsten, 2017/11/08
- Re: Indentation of current line or selected blocks in the code editor?, John W. Eaton, 2017/11/08
- Re: Indentation of current line or selected blocks in the code editor?, John W. Eaton, 2017/11/14
- Re: Indentation of current line or selected blocks in the code editor?,
Richard Crozier <=
- Re: Indentation of current line or selected blocks in the code editor?, Torsten, 2017/11/14