Merge branch 'main' into feat/colors

This commit is contained in:
quenousimporte 2023-09-26 10:42:26 +02:00
commit b38befaa87
1 changed files with 28 additions and 0 deletions

28
main.js
View File

@ -2441,6 +2441,34 @@ function mainkeydownhandler()
{ {
commandpalette(); commandpalette();
} }
else if (event.ctrlKey && event.shiftKey && event.keyCode == "40")
{
var pos = md.selectionStart;
var index = (md.value.substr(0, pos).match(/\n/g) || []).length;
var lines = md.value.split("\n");
if (index < lines.length - 1)
{
var line = lines.splice(index, 1);
lines.splice(index + 1, 0, line);
seteditorcontent(lines.join("\n"));
setpos(pos + lines[index].length + 1);
}
event.preventDefault();
}
else if (event.ctrlKey && event.shiftKey && event.keyCode == "38")
{
var pos = md.selectionStart;
var index = (md.value.substr(0, pos).match(/\n/g) || []).length;
var lines = md.value.split("\n");
if (index > 0)
{
var line = lines.splice(index, 1);
lines.splice(index - 1, 0, line);
seteditorcontent(lines.join("\n"));
setpos(pos - lines[index].length - 1);
}
event.preventDefault();
}
else else
{ {
commands.filter(c => c.shortcut) commands.filter(c => c.shortcut)