Emerald Editor Discussion
July 23, 2017, 01:51:45 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: 'Column Mode'  (Read 21621 times)
0 Members and 1 Guest are viewing this topic.
Harry Wood
Prospector
*
Posts: 6


WWW
« on: November 16, 2006, 02:51:56 pm »

When I first saw 'Column Mode' feature of CE (switches selection behavior to take rectangular areas of characters) I thought it was a bit bizarre, but since I've encountered more and more situations where it comes in handy.

It's handy for grabbing just the column of data you want from some column formatted text.

but I also find it very useful the way you can make data line up better by adding spaces. If you hadn't spotted this trick, try dragging a vertical rectangular area with zero characters width, then hit space key several times to add spaces (can also hit other keys to insert other characters across all the selected lines).

Quite quirky and completely unique to Crimson Editor I think, but very useful!
Logged
KjeBja
Senior Miner
***
Posts: 76


« Reply #1 on: December 04, 2006, 08:14:50 am »

I use this feature quite often, both to remove, copy, and add text. However, it would be better if this feature worked the way it does in TextPad, where you just use alt/left click and then drag the cursor along. (I would guess that this way of doing it is copied from Word.) In CE, you have to select/deselect column mode. It's not a big problem, so if the CE way is chosen, I can live with that!
Logged
agent86
Prospector
*
Posts: 3


« Reply #2 on: February 05, 2007, 05:49:20 am »

I have code for this, I think.  It is a hack to Scintilla.

If you get the source to Scintilla, make the following
change and then build the .lib, .dll, .a or .so file as
required by your OS and application. 
 
This change has not been blessed by the Scintilla author(s) because 
Scintilla does not give visible indication of a zero-width rectangular
selection which this solution uses.
 
Also note that this will ignore lines that end prior to the left edge of
the new rectangular selection.
 
In the scintilla/src directory, save your existing Editor.cxx and then...
in Editor.cxx at about line 3356 in the function listed below...
 
void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) {
 bool wasSelection = currentPos != anchor;
 <<<==== insert new code
here.
 ClearSelection();
 bool charReplaceAction = false;
 ///
 
insert the following between the bool wasSelection and ClearSelection()
lines.
 
 
 if(wasSelection && selType == selRectangle ) {
 int startPos;
 int endPos;
 
 int c1 = pdoc->GetColumn(currentPos);
 int c2 = pdoc->GetColumn(anchor);
 int offset = c1 < c2 ? c1 : c2;
 
 pdoc->BeginUndoAction();
 SelectionLineIterator lineIterator(this, false);
 while (lineIterator.Iterate()) {
 startPos = lineIterator.startPos;
 endPos = lineIterator.endPos;
 
 if(pdoc->GetColumn(endPos) >= offset){
 unsigned int chars = lineIterator.endPos - startPos;
 if (0 != chars) {
 pdoc->DeleteChars(startPos, chars);
 }
 pdoc->InsertString(startPos, s, len);
 }
 }
 anchor += len;
 currentPos += len;
 SetRectangularRange();
 pdoc->EndUndoAction();
 }
 else {
 /// then, have the else clause end just before
EnsureCaretVisible()
 }
 EnsureCaretVisible();
 // Avoid blinking during rapid typing:
 
Logged
pn8830
Global Moderator
Jeweller
*****
Posts: 252



« Reply #3 on: March 14, 2007, 09:13:18 pm »

.... However, it would be better if this feature worked the way it does in TextPad, where you just use alt/left click and then drag the cursor along....

This is the reason why CE column mode is so good. It provides a functionality of typing the same word on each of the selected lines. And this is very intuitive, that's why I like it so much. TextPad, that has column mode enabled by default, does not provide such functionality or I should probably say it may have it but it's not so intuitive as in CE (I had to look up the manual and I was not able to find it). Maybe making CE to switch to column mode with Alt+Left Button (or right button for left handed mouse) would be a good idea.
Logged

Entities should not be multiplied beyond necessity
KjeBja
Senior Miner
***
Posts: 76


« Reply #4 on: March 15, 2007, 07:47:37 am »

Maybe making CE to switch to column mode with Alt+Left Button (or right button for left handed mouse) would be a good idea.

Yes, it would be good if one could turn column mode on (and off!) using a key combination; the less I need to use the mouse, the better!
Logged
Matthew1344
Gem Cutter
****
Posts: 103


« Reply #5 on: March 15, 2007, 02:40:04 pm »

In case anybody doesn't know, Alt-C toggles the column mode on and off in CE.

I agree that typing on all selected lines in CE is irreplacable.  It's one of the features that I haven't found anywhere else.  However, I wish I could *paste* into all lines.

Hmm... maybe a macro that types in whatever is on the clipboard would work...

Logged
pn8830
Global Moderator
Jeweller
*****
Posts: 252



« Reply #6 on: March 16, 2007, 05:52:04 am »

However, I wish I could *paste* into all lines.

Hmm... maybe a macro that types in whatever is on the clipboard would work...
I'm not a big fan of macros. I was thinking about such functionality, to paste the same thing on multiple line. To me it seems tricky because it's hard to guess what user wants to do. What if you have more then one line in clipboard? do you want just cyclically paste in selection until selection ends?
Logged

Entities should not be multiplied beyond necessity
KjeBja
Senior Miner
***
Posts: 76


« Reply #7 on: March 16, 2007, 07:33:06 am »

In case anybody doesn't know, Alt-C toggles the column mode on and off in CE.

Thanks, Matthew1344, for pointing this out!
Logged
Matthew1344
Gem Cutter
****
Posts: 103


« Reply #8 on: March 16, 2007, 06:08:42 pm »

What if you have more then one line in clipboard? do you want just cyclically paste in selection until selection ends?
No... only paste the first line.  (?)
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.23 seconds with 19 queries.