Code Monkey home page Code Monkey logo

Comments (6)

morat523035 avatar morat523035 commented on May 27, 2024

Try these:

window.goDoCommand('cmd_scrollTop');
window.goDoCommand('cmd_scrollBottom');
window.goDoCommand('cmd_moveUp2');
window.goDoCommand('cmd_moveDown2');
window.goDoCommand('cmd_moveTop');
window.goDoCommand('cmd_moveBottom');

I tested the move commands with the following text in the compose window.

The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.

Reference...

http://searchfox.org/mozilla-esr78/source/dom/base/nsGlobalWindowCommands.cpp
http://searchfox.org/mozilla-esr78/search?path=ShortcutKeyDefinitions.cpp

from tbkeys.

DKroot avatar DKroot commented on May 27, 2024

Thanks a bunch! I think I can do what I need with these!

Re: the first point, I wrote it poorly: what I really need is to be able to go to the top and bottom of the message list. Any way to do these? cmd_scrollTop/cmd_scrollBottom scrolls the current message (which is also useful).

from tbkeys.

morat523035 avatar morat523035 commented on May 27, 2024

Try these:

  • move thread pane selection to top
(function () {
  var tree = window.document.getElementById('threadTree');
  tree.ensureRowIsVisible(0);
  tree.view.selection.select(0);
})();
  • move thread pane selection to bottom
(function () {
  var tree = window.document.getElementById('threadTree');
  var rowCount = tree.view.rowCount;
  tree.ensureRowIsVisible(rowCount - 1);
  tree.view.selection.select(rowCount - 1);
})();
  • move thread pane selection up a page
(function () {
  var tree = window.document.getElementById('threadTree');
  var currentIndex = tree.view.selection.currentIndex;
  var pageUpIndex = currentIndex - (tree.getPageLength() - 1);
  if (pageUpIndex < 0) {
    tree.ensureRowIsVisible(0);
    tree.view.selection.select(0);
  } else {
    tree.ensureRowIsVisible(pageUpIndex);
    tree.view.selection.select(pageUpIndex);
  }
})();
  • move thread pane selection down a page
(function () {
  var tree = window.document.getElementById('threadTree');
  var rowCount = tree.view.rowCount;
  var currentIndex = tree.view.selection.currentIndex;
  var pageDownIndex = currentIndex + (tree.getPageLength() - 1);
  if (pageDownIndex > rowCount - 1) {
    tree.ensureRowIsVisible(rowCount - 1);
    tree.view.selection.select(rowCount - 1);
  } else {
    tree.ensureRowIsVisible(pageDownIndex);
    tree.view.selection.select(pageDownIndex);
  }
})();

from tbkeys.

DKroot avatar DKroot commented on May 27, 2024

Thank you! Everything is working as I need to now, except one thing. I bound Home/End to line beginning/end in Compose key bindings:

{
  "home": "cmd:cmd_moveUp2",
  "end": "cmd:cmd_moveDown2"
}

They work as expected, but Shift+Home/Shift+End select till document beginning/end instead.

How can I fix this?

from tbkeys.

morat523035 avatar morat523035 commented on May 27, 2024

I don't understand what you are asking.

Here are the default commands for those shortcuts on Windows.

  • home - go to beginning of line
  • end - go to end of line
  • shift+home - select to start of line
  • shift+end - select to end of line

Try the following compose key bindings in settings using the tbkey addon.

{
  "home": "window.alert('home');",
  "end": "window.alert('end');",
  "shift+home": "window.alert('shift+home');",
  "shift+end": "window.alert('shift+end');"
}

If the example works correctly, then change the commands to whatever you want.

from tbkeys.

DKroot avatar DKroot commented on May 27, 2024

Got it! Case closed:

{
  "home": "cmd:cmd_moveUp2",
  "end": "cmd:cmd_moveDown2",
  "shift+home": "cmd:cmd_selectUp2",
  "shift+end": "cmd:cmd_selectDown2"
}

from tbkeys.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.