Home Download Buy Blog Forum Support

How: Cursor beyond end-of-line?

How: Cursor beyond end-of-line?

Postby gwideman on Fri Feb 01, 2013 2:05 pm

Hi all, I'd appreciate if someone could tell me if Sublime has a mode, plugin or whatever, in which the cursor/caret can move beyond end-of line, primarily when arrow-keying the cursor vertically.

That is to say, if the cursor starts at horizontal position say 50, as I arrow up or down I don't want the cursor to be forced leftward to the end of lines which are shorter than 50. (As a subsidiary point, if I start typing at the beyond-end-of line position, the editor should insert spaces to that point.) This behavior is an edit mode available in several editors I use, and I can't work efficiently without it.

FWIW, this other post relates to this same feature: https://www.sublimetext.com/forum/viewtopic.php?f=4&t=5197
but I didn't see a reply.

Thanks,

Graham
gwideman
 
Posts: 3
Joined: Fri Feb 01, 2013 1:53 pm

Re: How: Cursor beyond end-of-line?

Postby qgates on Fri Feb 01, 2013 7:30 pm

What you're asking for is Virtual space, something that I love too and grew very accustomed to back in the days of Brief and my current "other" editor, Crisp.

Vote it up here:
http://sublimetext.userecho.com/topic/8 ... ite-space/

We need this because it makes in-line commenting a breeze (something that *is* valuable from time to time), facilitates column selection, copying and insertion to arbitrary places in the text, and is very handy for working with certain other kinds of text files. When your used to that freedom, the current paradigm feels very constraining, and I still go back to other editors when needed to use this facility.

Done intelligently, it would fill whitespace to the left with spaces where there is text on the line to the left, and tabs (and extra spaces if necessary) where the line is empty if the editor is using tabs as its primary indenting whitespace.

That, along with definable tabstop positions, are my biggest headaches with Sublime. Definable tabstops are needed to allow the above intelligent virtual space behaviour. In Brief I could set tabstops to "5 20 24", which would set tabstops at those columns and the remaining tabstops would repeat the distance of the last two (28, 32, 36 etc).

The trouble with Sublime is that while it's nice for editing "modern" languages like PHP and JS, it's a PITA for working with older languages or other "programmer" text files, for example Windiff output (which tabulates varying-length filename and file CRCs). A file thats been edited by another developer with a a particular IDE/language that prefers tabs and particular tabstops (COBOL being a good example) cannot be brought into Sublime looking right. The usual reason is that tabstops cannot be defined; were that the case, you could load up a file with correct tabstops and everthing looks dandy. The perfect editor should be a one-stop for everyone's editing requirements, and for now I have to drive two editors for my programming needs.

FichtFoll's suggestion on userecho to implement virtual space as a plugin is a possibility. The methodology is to append lots of whitespace to the end of each line in a file, allow "free editing", then trim trailing whitespace on save. But this is less than ideal for several reasons:

1. Inability to distinguish virtual space from real space (Brief does this by allowing the cursor to change over virtual space - lovely!)
2. Time to append and strip extra whitespace on load (or "start editing virtually") and save with extremely large files
3. Inability to support the above-mentioned intelligent behaviour when the user prefers tabs for a given filetype

I hope Jon's considering this.
qgates
 
Posts: 230
Joined: Mon Nov 05, 2012 4:33 pm

Re: How: Cursor beyond end-of-line?

Postby gwideman on Sat Feb 02, 2013 3:06 pm

Thanks qgates for your reply, that'll save some time looking for a solution. FWIW, I myself don't have a pressing need for the individually settable tabstops you mention, I mainly want virtual space for less-distracting and entirely predictable arrow-key navigation.

Not having virtual space capability is a fairly serious deal for me. Sure I can work without it, but it's higher friction. (And I certainly expect there to be varying experiences and preferences on this point.)

For what it's worth, Visual Studio, Embarcadero's IDEs, EditPad and Notepad++ all have optional virtual space behavior. As far as I can see, Eclipse and NetBeans do not, and it's partly because of those last two not having it that I'm on the lookout for clever editors, especially cross-platform ones (which EditPad and Notepad++ are not).

Sigh. OK, I'll add a vote on userecho, but with 3289 issues over there, and this one approximately 95th on the list, it's hard to see how this is going to get done :-(.
gwideman
 
Posts: 3
Joined: Fri Feb 01, 2013 1:53 pm

Re: How: Cursor beyond end-of-line?

Postby gwideman on Sat Feb 02, 2013 3:28 pm

Oh, and I forgot to mention -- yes, Brief was a lovely editor, for its day!
gwideman
 
Posts: 3
Joined: Fri Feb 01, 2013 1:53 pm

Re: How: Cursor beyond end-of-line?

Postby lunixbochs on Sun Feb 03, 2013 12:46 pm

A plugin for virtual space when using the arrow keys to move would be extremely easy. I think we'd need editor support to do it with the mouse.
lunixbochs
 
Posts: 91
Joined: Fri Oct 08, 2010 10:18 pm

Re: How: Cursor beyond end-of-line?

Postby FichteFoll on Sun Feb 03, 2013 1:45 pm

You can override the "run_" method of commands to grab the mouse event params when called from a mouse binding. This could be used with layout and something to translate it into buffer coordinates and then you'll be able to fill remaining stuff with spaces. I didn't test it but according to what I grabbed up in the time I wrote some packages this should be possible.
FichteFoll
 
Posts: 408
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: How: Cursor beyond end-of-line?

Postby adzenith on Sun Feb 03, 2013 3:13 pm

Translating it into buffer coordinates is the hard part...
adzenith
 
Posts: 1217
Joined: Mon Oct 19, 2009 9:12 pm

Re: How: Cursor beyond end-of-line?

Postby FichteFoll on Sun Feb 03, 2013 3:22 pm

After experimenting with viewports and layouts (and ther vectors respectively) it seems that these vectors have pixels as their base dimension and just support floating numbers with them. However, the x and y positions from the mouse event seem to be relative the the client and the viewport vectors relative to the, well, viewport. This get's complicated when the menu is visible or tabs are visible or the sidebar and results in various desyncs.

So, at least with the current API it seems not possible (though, I didn't really spend much time on it).
FichteFoll
 
Posts: 408
Joined: Fri Mar 16, 2012 11:49 pm
Location: Germany

Re: How: Cursor beyond end-of-line?

Postby qgates on Mon Feb 04, 2013 2:30 am

"Kludges" in the area of appending EOL whitespace to implement virtual space will play havoc with using copy and paste when not across line boundaries. I did think about implementing this myself a while ago, but for the reasons above it just seemed fairly pointless.

Especially as I remember at some point in the past Jon alluding to a proper implementation of this being on the roadmap for Sublime.
qgates
 
Posts: 230
Joined: Mon Nov 05, 2012 4:33 pm

Re: How: Cursor beyond end-of-line?

Postby stele on Thu Apr 11, 2013 4:27 pm

qgates wrote:What you're asking for is Virtual space, something that I love too and grew very accustomed to back in the days of Brief and my current "other" editor, Crisp.


I'm making the movie to ST from Crisp myself, but it's going to be a battle, as I've been using Crisp for 20 years. I already found Origami (for fast splitting control with keyboard). As we seem to be the only two Crisp users here, do you have any tips or tricks to help make the transition to Sublime smoother? I was considering making a "Sublime for Crisp Users" thread to keep track of such things.
stele
 
Posts: 1
Joined: Thu Apr 11, 2013 4:22 pm


Return to General Discussion

Who is online

Users browsing this forum: Google [Bot] and 20 guests