Emerald Editor Discussion
September 19, 2017, 06:08:51 pm *
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: Cursor position  (Read 5639 times)
0 Members and 1 Guest are viewing this topic.
KjeBja
Senior Miner
***
Posts: 76


« on: June 20, 2006, 06:24:50 am »

When editing a file, it would be nice to have the possibility to choose where the cursor should be positioned when you move the cursor up or down. For me, it is often the case that I want to edit several lines, starting in the same position on all lines. This might not always be the case, but when it comes to source files, it is often so.
Logged
Arantor
Site Administrator
Administrator
Master Jeweller
*****
Posts: 618



« Reply #1 on: June 24, 2006, 11:14:33 pm »

I think I understand what you mean with this. If it's what I think it is (and I'll elaborate, please let me know if I got it wrong), while it might be feasible, it brings up two major issues which I'll explain in a moment.

Consider the following (bad) HTML example:
Code:
<ul>
  <li><b>Item 1</b>: Item 1 blurb.</li>
  <li><b>Item 2</b>: Item 2 blurb.</li>
</ul>
If, say, you wanted to add in italics as well as bold (e.g. turn the tags to <b><i>...</i></b>), you can use the cursor to move to the inside of the B tag on item 2 once you'd entered item 1's new tag, then you could press down - in this mode it wouldn't move you to the same point on the next line, it would take you to the previous position on the next line.

So, using | to denote the cursor, under normal circumstances, entering the tag and pressing down would leave you thus:
Code:
<ul>
  <li><b><i>Item 1</b>: Item 1 blurb.</li>
  <li><b>Ite|m 2</b>: Item 2 blurb.</li>
</ul>

But I think what KjeBja is asking for is instead of typing the three characters and pressing down taking to the same column in the next line, it should return you to where you started editing on this line (or however you told it to work), so you'd end up like so:
Code:
<ul>
  <li><b><i>Item 1</b>: Item 1 blurb.</li>
  <li><b>|Item 2</b>: Item 2 blurb.</li>
</ul>
And you'd be ready to add in the next tag.


Issue 1, it will almost certainly mean adding all sorts of hooks into the editing component (Scintilla) in order to make it work. But if we run with it, I'm sure we'll find a way of doing it.

Issue 2, and probably more importantly, how do you tell it where to start? Either it would be a GUI issue (specifying with the mouse and a menu option/preferences?) or you'd have some kind of shortcut to toggle in and out of the mode (like you would do with Insert/Overtype modes)

I suppose the question would be how you as a user would want this to work? EE wouldn't be able to tell where you wanted to start exactly, it would have to be told.
Logged

"Cleverly disguised as a responsible adult!"
Feldon
Gem Cutter
****
Posts: 106


« Reply #2 on: June 25, 2006, 12:56:02 am »

To deal with Arantor's scenario...  You tell EE what column number you want to start on when you move the cursor up or down.

First, this should be set to some default value in a preferences menu.  The range of values would include beginning of line, end of line, current column, or, possibly, a specific column number.  I expect there are some people that would prefer there cursor always went to the end or beginning of a line when they moved the cursor down.

Second, it should also be possible to change the default column on-the-fly while editing, perhaps through a context-menu option that would switch between "mark as default column" and "reset default column".  So, if you right-clicked column 7 and selected "mark as default column", column 7 would temporarily become the default column.  If you right-clicked again and selected "reset default column", it would go back to being whatever was set in the preferences menu.

I think that may be the easiest method at least, and if the mark as default column/reset default column option had a keyboard shortcut too then it would be super easy.
Logged
John Yeung
Senior Miner
***
Posts: 85


« Reply #3 on: December 21, 2006, 05:10:56 am »

I know this is an "old" topic, but I felt like replying anyway:

First, I'd like to say Feldon's suggestions sound pretty good to me.  They seem doable and handle KjeBja's request as stated.

However, it might be simpler (or much more complicated, I don't know) to take on the request from a different angle:  create an easily invokable "frozen cursor column" mode.  When activated, this would keep the cursor in the same column until deactivated.  When inserting text in this mode, the cursor would stay put while the new text appears to its right and shifts the rest of the line to the right.

I haven't thought this through enough to know whether this should apply to everything, not just insertion.  For example, should backspacing make the text to the left of the cursor shift right?  Should using the left and right arrow keys make the entire line shift in the opposite direction?  I mean, how frozen would we want the cursor?

Anyway, something to consider.

John
Logged
Feldon
Gem Cutter
****
Posts: 106


« Reply #4 on: December 21, 2006, 03:49:05 pm »

That's an interesting idea.  As you say, hard to judge whether that would be easier or harder.  Personally, I think it would be harder to implement, but it depends on how the code works.

One thing you made me think of, though, is no matter how its implemented, it might be useful to have a visual reference as to the column the cursor has been assigned/frozen.  So, I would think if you've assigned a particular column other than end-of-line/beginning-of-line, that a light, contrasting-colour line should run down the page immediately before that column number.  Further, if there's a ruler bar at the top of the page, you should be able to use the mouse to physically move that column from side-to-side.

The only catch with all this, I suppose, is that if you aren't using a mono-space font, this would look kind of convoluted.  However, I suppose if you aren't using a mono-spaced font you are presumably not too concerned with this feature to begin with, so I would just hide the line in this case.
Logged
rageboy
Jeweller
*****
Posts: 305

Ankit Singla


« Reply #5 on: April 18, 2007, 09:47:44 pm »

in that particular case, anyway, couldn't one use column mode as implemented in CE?
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.081 seconds with 19 queries.