Recent

Author Topic: Column Mode in SynEdit  (Read 9486 times)

Edson

  • Hero Member
  • *****
  • Posts: 1301
Column Mode in SynEdit
« on: August 02, 2013, 08:14:47 pm »
Sorry for my English. I'm new in this forum, and in Lazarus too.  But I must say It's a great tool.

I've been testing the SynEdit control. I've made some advances in little programs, but I have one doubt: Is there a column-edit mode in SynEdit.?
I'm not talking about selecting in column-mode, but editing several lines simultaneously, like we can do in Notepad++ o UltraEdit.

Thanks in advance.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Column Mode in SynEdit
« Reply #1 on: August 02, 2013, 10:46:10 pm »
I don't use those editors, so I don't know what you mean.

But I use lazarus to copy and move colums yes.  For that, it is easier to switch lazarus to persistent blocks (tools->editor->general->selection->persistent blocks)

Then all normal block operations work on the column block.


taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Column Mode in SynEdit
« Reply #2 on: August 02, 2013, 11:12:10 pm »
take a look on the gif at http://notepad-plus-plus.org/features/column-mode-editing.html for a quick overview of column editing.

As far as I know synedit does not support something similar although the sync edit from the IDE is close but more fine grained.
« Last Edit: August 02, 2013, 11:13:55 pm by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Column Mode in SynEdit
« Reply #3 on: August 02, 2013, 11:31:57 pm »
as taazz said: there is no exact match, but http://wiki.lazarus.freepascal.org/New_IDE_features_since#Syncron-Edit

in fact syncro edit could be extended with not too much effort, to do the column thing. basically it needs to use the selected part of each line as a cell, instead of same words.

anyone is welcome to try and supply a patch

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Column Mode in SynEdit
« Reply #4 on: August 03, 2013, 12:06:44 am »
Thanks all, for your quick responses.

It's clear for me, the situation. SynEdit is a very good component like it is. I would like to propose a patch, but my knowledge is still very basic.

I needed that feature (Column Mode Editing) on a program, but i have implemented it, on an alternative way.

I intercept the keys, when mi editor is in ColumnMode (SelectionMode = smColumn), and process the action, using the Clipboard to enter the key pressed as it would be a "Paste in Column Mode": and I keep the Column Mode.

It works OK for me now. Although I lost the Clipboard information.

My problem now is ¿How can I change the cursor in order to indicate that the Editor is in Column Mode?

Thanks.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Column Mode in SynEdit
« Reply #5 on: August 03, 2013, 08:44:43 am »
My problem now is ¿How can I change the cursor in order to indicate that the Editor is in Column Mode?

There is no build in way.

There is
Code: [Select]
   TSynCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock);

    property InsertCaret: TSynEditCaretType read FInsertCaret write SetInsertCaret default ctVerticalLine;
    property OverwriteCaret: TSynEditCaretType read FOverwriteCaret write SetOverwriteCaret default ctBlock;
But it does not allow for a multiline caret/cursor.

You would have to look for the class TSynEditScreenCaret in components/synedit/syneditpointclasses.pas

Look at  TSynEditScreenCaret.UpdateDisplayType
To change it, you have to find all the places where TSynEditScreenCaret is used/called. And you need to pass the height.



Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Column Mode in SynEdit
« Reply #6 on: August 03, 2013, 07:40:22 pm »
Thanks Martin,

It's a good information. I will try.
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Column Mode in SynEdit
« Reply #7 on: September 28, 2014, 08:03:15 pm »
It's an old topic, I know.

I just one to say that a basic column mode edit, for SynEdit, is implemented in my library SynFacilUtils:

https://github.com/t-edson/SynFacilUtils

Just configuring the editor with TSynFacilEditor.Create(), give to the control the column mode.

Moreover, SynFacilUtils contain several utilities for creating editors with SynEdit, like working with different line terminators (UNIX, DOS, MAC) and formats(UTF8, win-1252), and include routines for to manage the common messages like "File has been modified. Save?"


Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Column Mode in SynEdit
« Reply #8 on: March 24, 2015, 02:18:28 am »
Multi Caret was added in Lazarus 1.5

Edson

  • Hero Member
  • *****
  • Posts: 1301
Re: Column Mode in SynEdit
« Reply #9 on: March 24, 2015, 05:06:32 am »
Good. :)
Is there some documentation?
Lazarus 2.2.6 - FPC 3.2.2 - x86_64-win64 on Windows 10

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9794
  • Debugger - SynEdit - and more
    • wiki
Re: Column Mode in SynEdit
« Reply #10 on: March 24, 2015, 05:18:32 am »
Not much. Also there are only multi carets. Not multi selections.

http://wiki.lazarus.freepascal.org/New_IDE_features_since#Multi_Caret
http://wiki.lazarus.freepascal.org/IDE_Window:_Editor_Options_General#Multi_carets_commands_.28Lazarus_1.5.29

Mouse and keys can be configured.

As well as keys to toggle between "moveable carets" and none "moveable"

By default, using column selection (square selection; alt-shift-up/down) in none moveable, that is cursor movement, instead of typing text, cancels. But that can be changed.

Setting by mouse, is by default moveable.

Setting with shift-ctrl-insert is moveable too.

---
I need to write more....

 

TinyPortal © 2005-2018