Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Switching programming languages causes undo to restore text in the wrong language

オープン
#365 コメント 4 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@Chingyong0905 がすでに取り組んでいます。

2026年10月19日 から。

  • #456 @Chingyong0905 による — オープン

評価

この issue はまだ評価されていません。

説明

Observed behavior

Undo after switching languages can restore text deleted in another language. In manual testing, undo in JavaScript restored BBB deleted from Python, and undo in Python restored 222 deleted from JavaScript.

The original report described this as cleared undo history. Further testing shows that this description is incomplete: some simple cases restore the deleted text, while interleaved edits across languages can produce incorrect results.

Expected behavior

Each programming language should retain its own undo/redo history. Undo and redo should affect only the current language's edits. Switching languages should not be an undoable edit.

Reproduction

Keep the starter code in both languages. Append the following text below it rather than replacing the starter code.

  1. In Python, append two lines: AAA and BBB.
  2. Switch to JavaScript and append two lines: 111 and 222.
  3. Select only the text 222 and delete it, leaving the newline.
  4. Switch to Python, select only BBB, and delete it, leaving the newline.
  5. Switch back to JavaScript and press Ctrl+Z. Expected: restore 222. Observed manually: BBB appears instead.
  6. Switch back to Python and press Ctrl+Z. Expected: restore BBB. Observed manually: 222 appears instead.

These cross-language results are from manual testing; this sequence has not yet been verified by an automated regression test.

Original reproduction
  1. Enter several lines in Python.
  2. Delete a line and press Ctrl+Z to confirm that undo works.
  3. Delete the line again.
  4. Switch to another language and back to Python.
  5. Press Ctrl+Z to restore the deleted line.

A simplified automated version of this sequence passes on commit 3198a99ed99be8930371d9fe7480b1e565c56488 with Chrome 156.0.8078.47. Passing this case does not establish that histories are isolated between languages.

Proposed approach

Use a bounded in-page undo/redo history for each language. Switching languages selects the corresponding buffer and history without recording an edit.

Record typed input, paste, cut, drop, each IME composition as one entry, and programmatic edits through applyEditorEdit, including Tab, Shift+Tab, Ctrl+/, and the starter-code restore in #398. Undo and redo restore selection bounds and direction, preserving the behavior from #390, and update the saved code, editor display, and existing synchronization.

Route Ctrl+Z, Ctrl+Shift+Z, Ctrl+Y, their applicable macOS equivalents, and browser historyUndo/historyRedo actions through this history.

Retain the original five-step regression test and add the cross-language reproduction above, including redo checks. Cover each edit path with undo and redo tests.

Original report version and environment

CodeTrial: 0.1.0 (5b4d8c7)
OS: Windows 11 Home Single Language, Version 25H2 (Build 26200.9711)
Browser: Google Chrome 155.0.8059.80 (64-bit)
Interview loop: Coding interview
Problem: Sensor Calibration Index (LeetCode 108)
REACTO or STAR step: Code
Reconnect: None

Follow-up testing

Local checkout: 3198a99ed99be8930371d9fe7480b1e565c56488
Automated test browser: Google Chrome 156.0.8078.47
Cross-language reproduction: manually observed with Python and JavaScript.

Public data confirmation
  • I removed credentials, session tokens, candidate recordings, and personal interview content from this public report.
主要言語
Rust
スター
177
フォーク
100
平均マージ
1日 11時間
マージ済み PR(30日)
182

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

sysprog21/codetrial のほかの issue

sysprog21/codetrial の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。