Greasy Fork is available in English.

Bunpro: Prevent cursor from jumping to end of input field

Restores the cursor position after romaji get converted to kana

// ==UserScript==
// @name         Bunpro: Prevent cursor from jumping to end of input field
// @description  Restores the cursor position after romaji get converted to kana
// @version      0.1.4
// @namespace    https://pampel.dev
// @author       pampel
// @run-at       document-start
// @match        https://bunpro.jp/*
// @match        https://www.bunpro.jp/*
// @grant        none
// ==/UserScript==

'use strict';

addEventListener("turbolinks:load", () => {
  let inputElem = document.querySelector("#study-answer-input");
  if (!inputElem)
    return;

  let oldEndPos = 0;
  let oldValue = "";
  let imeActive = false;

  function listener() {
    // only needed for chrome || firefox
    if (document.activeElement !== inputElem || imeActive)
      return;

    if (oldValue !== inputElem.value && inputElem.selectionEnd === inputElem.value.length)
      inputElem.selectionEnd = inputElem.value.length - oldValue.length + oldEndPos;

    oldEndPos = inputElem.selectionEnd;
    oldValue = inputElem.value;
  }

  // firefox version
  inputElem.addEventListener('selectionchange', listener);
  inputElem.addEventListener('compositionstart', () => imeActive = true);
  inputElem.addEventListener('compositionend', () => imeActive = false);

  // chrome version
  document.addEventListener('selectionchange', listener);
});