I would have raised this as a bug report, but it can’t be reproduced with a barebones vault as EditorSuggest functionality isn’t implemented anywhere by default.
Steps to reproduce
Trigger an EditorSuggest popup while typing
Press tab
Expected result
The line should be indented
Actual result
The line isn’t indented
Similar behaviour can be seen with the home and end keys not functioning.
Pressing escape to dismiss the popup, then pressing tab indents the line as expected.
Additional information
I understand that some keys are reserved for navigating the popup items, but I think tab, home, end keys should be being passed through to the editor to allow users to type unimpeded (unless I’m just missing what they’re used for!).
Relevant bug report in the tasks plugin (includes video demonstration):
Ah that’s very helpful thank you! I’ll leave this thread open as it would be good to get clarification whether this is intended functionality or a bug. I’ll submit this change for discussion in obsidian-tasks in the meantime.
If it is a bug that got fixed, then this workaround would lead to double indenting which would be more annoying than none!
Ah yeah I think that would do the trick, thank you again!
Another issue has cropped up - respecting user preferences regarding tab indents vs spaces. I can’t see an API call that takes care of indenting for us - anyone have any ideas other than inspecting the vault settings and inserting the appropriate characters?
Here’s the snippet I’ve ended up with in the constructor of the class implementing EditorSuggest, which restores indent functionality:
// EditorSuggestor swallows tabs while the suggestor popup is open
// This is a hack to support indenting while popup is open
app.scope.register([], 'Tab', () => {
const editor = this.context?.editor;
if (editor) {
editor.exec('indentMore');
// Returning false triggers preventDefault
// Should prevent double indent if tabs start to get passed through
return false;
}
return true;
});