single-line string?

Steven Schveighoffer schveiguy at yahoo.com
Thu Apr 14 07:58:26 PDT 2011


On Thu, 14 Apr 2011 10:49:58 -0400, spir <denis.spir at gmail.com> wrote:

> Hello,
>
> This may be a feature request for a single-line string syntactic form  
> --if ever others are annoyed as well, see below. One possible form may  
> be:
>      str = s"abc";
> I have myself long found it stupid to separate single- and multi-line  
> string, since there is no formal reason for that. But there are  
> practical consequences on code edition I did not imagine until I started  
> coding in a language not making this distinction... namely D.
>
> Problem:
>
> In my editor, Geany, each time I press '"', the whole code (actually the  
> rest of the code from the current cursor position) is re-scanned,  
> re-interpreted, re-displayed. This is fully logical and in itself is not  
> a major issue in Geany because it is very light & fast. I wonder how  
> this goes with heavier editors or real IDEs.
> But the real point is that this causes a big usability problem, namely  
> that all (the rest of) code suddenly gets unfolded! If I want to go on  
> editing comfortably, I then need to refold all and manually re-unfold  
> the part(s) I'm currently working on. Very annoying. Imagine a debugging  
> session requiring debug prints here & there...
>
> This is a bug of the editor, indeed, but since Geany is based on  
> Scintilla's editon component, I guess this bug may be widely shared. A  
> solution may be that opening of a (possibly multi-line) string should  
> limit the reinterpretation scope to the current logical line, or simply  
> suspend it, until either the string is closed, or said line is quit (via  
> arrows or mouse). Also, the bug happens even if I use Geany's feature of  
> auto-closing delimiters, meaning when I press '"' '""' is written out (a  
> feature I hate anyway for code edition). I would like to know how & how  
> well other editors deal with all of that (especially but not only emacs  
> and vim).

Not sure about folding in vim, since I generally do not use vim's folding  
features, but it does temporarily syntax highlight the rest of the file as  
if it were a string.  However, vim does not re-interpret/display the  
entire file, it generally only cares about the visible portion.

In NetBeans, you can set it up to insert two quotes when you type one  
(i.e. auto-closing delimiters).  However, I use that to edit PHP and HTML,  
so I'm not sure how that compares.

I'd say your best bet is to get the bug fixed in your editor.  Changing  
the language is wholly inappropriate to address an editor bug, especially  
when it's only one editor, and one person's preference that is being  
affected.

-Steve


More information about the Digitalmars-d mailing list