Cursor Not Following Page Movement


#1

Slightly uncertain whether this is a bug, a feature request, or just behaviour that’s expected but not helpful to me personally.

Paging up and down through the document (PgUp and PgDn / Filco KB) the text pages into view as I’d expect, but the cursor stays where it is.

This means that if I move the cursor, I’m transported back up or down the document.

I find this very jarring and incompatible with my expectations coming from Sublime Text.

Is that working as expected? If it’s behaviour that other users generally find intuitive, is there a way I can amend it myself with any kind of workaround?


Cursor behavior makes page jump so insertion point stays in center of page
#2

This is intended, it’s the way that it works in the native OS X text component. But you can also get the behavior your are looking for. Internally there are a number of “page” commands. I’ve listed them here with default keybinding first, followed by internal command name.

Just scroll:

PageUp : scrollPageUp
PageDown : scrollPageDown

Change selection:

Alt-PageUp : pageUp
Alt-PageDown : pageDown

Extend selection:

Shift-PageUp : pageUpAndModifySelection
Shift-PageDown : pageDownAndModifySelection

Those are the defaults, you can change them with a plugin that adds your own keybindings.


#3

Thanks for that - good excyse to dip my toe in the water with plugins


#4

Hi,

I’ve tried to follow this procedure, using the instructions you’ve posted previously for developing a plugin.

With the plugin in place in the Plug-Ins directory, and after a restart, the two taskpaper files look totally empty when I open them - no text on display. no hidden white-on-white text to select etc.

When I move the plugin sub-folder out of the Plug-Ins directory and restart, the taskpaper files open and work without issue.

This is the entireity of the package and main files:

{
    "name": "Hello world",
    "version": "1.0.0",
    "description": "Seans Custom Keys!'",
    "engines": {
        "foldingtext": ">=2.0.0",
        "taskpaper": ">=3.0.0"
    },
    "homepage": "https://mrsean2k.wordpress.com"
}



define(function(require, exports, module) {
    var Extensions = require('ft/core/extensions').Extensions;
    Extensions.addInit(function (editor) {
        editor.addKeyMap({
            'PageUp': pageUpAndModifySelection,
            'PageDown': pageDownAndModifySelection
        });
    });
});

#5

The problem is in:

'PageUp': pageUpAndModifySelection,
'PageDown': pageDownAndModifySelection

It should be:

'PageUp': 'pageUpAndModifySelection',
'PageDown': 'pageDownAndModifySelection'

I didn’t spot this just by looking at the file. Instead I put your plugin in my plugins folder and then opened Help > Software Development Kit > Editor and clicked on the “Inspector” toolbar item. And there the error was pretty easy to see.


#6

Ok, thanks - I think I saw an example that appeared to be a function reference and not a string, and one of the example plugins used an anonymous function inline so I made an incorrect assumption

I think the real problem is that I’ve wandered in as a previously non-FT user without even a cursory look at the documentation. Best do that before any more questions.

Ta!