Skip to content

Commit c171ee9

Browse files
committed
enable undoing on input candidate
1 parent 6ecf0ba commit c171ee9

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

HISTORY.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@
290290
- Renamed "Candidates" as "Input Candidates".
291291
- 2024-XX-YY ver.5.2.0
292292
- Improved "Edit" and "View" menus.
293+
- Enabled to correctly undo input using "Input Candidates".
293294

294295
# 開発履歴 (Japanese)
295296

@@ -896,3 +897,4 @@
896897
- 「候補」を「入力候補」に改名。
897898
- 2024年XX月YY日 ver.5.2.0
898899
- 「編集」「表示」メニューを改良。
900+
- 「入力候補」による入力を正しく元に戻せるようにした。

XG_CandsWnd.hpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -553,6 +553,11 @@ class XG_CandsWnd : public XG_Window
553553
{
554554
XGStringW cand = XgNormalizeString(strCand);
555555

556+
// 元に戻す情報を記録する。
557+
auto sa1 = std::make_shared<XG_UndoData_SetAll>();
558+
auto sa2 = std::make_shared<XG_UndoData_SetAll>();
559+
sa1->Get();
560+
556561
int lo, hi;
557562
if (xg_bCandVertical) {
558563
for (lo = xg_iCandPos; lo > 0; --lo) {
@@ -589,5 +594,9 @@ class XG_CandsWnd : public XG_Window
589594
xword.SetAt(xg_iCandPos, k, cand[m]);
590595
}
591596
}
597+
598+
// 「元に戻す」情報を設定する。
599+
sa2->Get();
600+
xg_ubUndoBuffer.Commit(UC_SETALL, sa1, sa2);
592601
}
593602
};

0 commit comments

Comments
 (0)