[Gambas-user] New Editor Side Bar

Tony Morehen tmorehen at ...3602...
Sun Dec 18 05:52:16 CET 2016


Fabian, it looks great and works like a charm.

By the way, I'm working on text editor which would benefit from a couple 
of minor changes to the text editor component.  Could you make 
$hDoc.Lines a read/write property of TextEditor and $hDoc.LineLength a 
read only property?

I working on a search function.  I can use Instr on TextEditor.Text to 
find the appropriate text but I can't select that text because the 
TextEditor.Select function requires Start Column, Start Row, End Column, 
End Row and there is no function to calculate those coordinates from the 
position in the text stream that InStr returns.

Exposing Lines lets me search for text on the same basis as the Select 
function, by row and column.  Exposing LineLength lets me easily write a 
function to go from Instr's text position to Select's column, row 
coordinates.

Indeed, I have already written a function to do that.  It splits 
TextEditor.Text into lines and then uses the String.Len function to 
calculate coordinates.  Unfortunately, it has to do that every time I do 
a search which is redundant given that TextEditor has the same 
information internally.

At some point, it may be useful to add a Select(selectionstart as 
integer, selectionlength as integer) method.  This would make TextEditor 
a virtual drop-in replacement for TextArea.

On 12/12/16 09:00 AM, Fabien Bodard wrote:
> I added a new property to the Gambas code editor. I hope that I have
> sufficiently debugged it to avoid any inconvenience. This bar is drawn
> from the vertical kate scroll bar. It displays a preview of the entire
> code of the file. Of course as I coded in Gambas it is not really a
> preview but rather a simplified rendering taking into account the
> indentation and the length of the lines. A text rendering would have
> cost far too many resources. Some line property remains however
> highlighted as the lines in comment and in the margin the information
> if the row is changed. The marked lines are represented by a yellow
> line.
>
>
> When moving the cursor, the first and last lines of the displayed area
> are indicated by a tooltip. When browsing the bar, a mini editor shows
> the code present at the position indicated by the mouse on the bar. I
> added two features. Ctrl + Click moves the editor directly to the line
> below the mouse pointer. Ctrl + Alt + Click Sets the "magnifying"
> editor to where it is. This makes it possible to have the code portion
> under the eyes. Just click on the "magnifying" editor to hide it.
>
> Give me your impressions, and especially remount me any problem as
> quickly as possible.
>
> Regards,
>






More information about the User mailing list