Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: replit/codemirror-emacs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: overleaf/codemirror-emacs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master-overleaf
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 3 commits
  • 3 files changed
  • 2 contributors

Commits on Sep 25, 2024

  1. Copy the full SHA
    b249986 View commit details
  2. Copy the full SHA
    ff7ac4f View commit details
  3. Add customized killLine behaviour

    Useful for registering a visual-line-mode killLine for example.
    hrjakobsen authored and aeaton-overleaf committed Sep 25, 2024
    Copy the full SHA
    7b2b409 View commit details
Showing with 19 additions and 4 deletions.
  1. +8 −0 bin/build.js
  2. +4 −2 package.json
  3. +7 −2 src/index.ts
8 changes: 8 additions & 0 deletions bin/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env node

import { build } from '@marijn/buildtool'
import * as path from 'path'

build(path.resolve('src/index.ts'), { pureTopCalls: false }).then(result => {
if (!result) process.exit(1)
})
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -5,8 +5,9 @@
"scripts": {
"dev": "vite ./dev",
"test": "cm-runtests",
"build": "cm-buildhelper src/index.ts",
"prepublishOnly": "npm run build"
"build": "bin/build.js",
"prepublishOnly": "npm run build",
"prepare": "npm run build"
},
"keywords": [
"editor",
@@ -35,6 +36,7 @@
"@codemirror/language": "^6.1.0",
"@codemirror/lang-javascript": "^6.0.0",
"@codemirror/lang-xml": "^6.0.0",
"@marijn/buildtool": "^0.1.2",
"vite": "^2.3.8"
},
"repository": {
9 changes: 7 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -113,7 +113,8 @@ var specialKey: Record<string, string> = {
Return: 'Return', Escape: 'Esc', Insert: 'Ins',
ArrowLeft: 'Left', ArrowRight: 'Right', ArrowUp: 'Up', ArrowDown: 'Down',
Enter: 'Return', Divide: '/', Slash: '/', Multiply: '*',
Subtract: '-', Minus: "-", Equal: '=',
Subtract: '-', Minus: "-", Equal: '=', Semicolon: ';', Comma: ',',
Period: '.',
};
var ignoredKeys: any = { Shift: 1, Alt: 1, Command: 1, Control: 1, CapsLock: 1 };

@@ -733,10 +734,14 @@ EmacsHandler.addCommands({
},
},
killLine: {
exec: function (handler: EmacsHandler) {
exec: function (handler: EmacsHandler, selectionCommand?: (view: EditorView) => any) {
handler.pushEmacsMark(null);
// don't delete the selection if it's before the cursor
handler.clearSelection();
if (selectionCommand) {
selectionCommand(handler.view);
}

var view = handler.view;
var state = view.state