Menu

#903 Ctrl+Z incorrectly erases contents of segment Note

6.1
open-fixed
None
5
2026-02-05
2018-04-03
No

Windows 10 64-bit, OmegaT 4.1.3_2

  • Open a project
  • Go to some segment
  • Enter some text into the Notes pane
  • Move to another segment
  • Save the project
  • Go back to the Notes pane of the segment which has the note
  • Do the menu command Edit / Undo Last Action (Ctrl+Z)
  • Notice how nothing happens to the note (as expected)
  • Now, instead of using the menu, press Ctrl+Z on the keyboard
  • Notice how the note is erased

Expected: Ctrl+Z should do the same as the menu option (where the accelerator Ctrl+Z is mentioned)

Discussion

  • Hiroshi Miura

    Hiroshi Miura - 2024-02-03

    I can reproduce the behavior on master branch.

    When observed in debugger, I find that when selecting Edit>Undo Last Action, a focus is not in a Note pane because menu dialog has, so Undo action is try against main editor.

    When entering Ctrl-Z with the focus in Note pane, Undo action calls a function of Note undo()

    In MainWindowMenuHandler.java:462

        public void editUndoMenuItemActionPerformed() {
            Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();
            if (focused == Core.getNotes()) {
                Core.getNotes().undo();
            } else {
                Core.getEditor().undo();
            }
        }
    

    This explains a behavior.

     
    👍
    1
    • Hiroshi Miura

      Hiroshi Miura - 2024-02-03

      When OmegaT saves the project, EditroController#commitAndDeactivate is called. the metohd calls UndoManager#reset during the process.
      OmegaT does not call similar function of Note pane controller, and there is no similar method in the pane.

       

      Last edit: Hiroshi Miura 2024-02-03
      • Hiroshi Miura

        Hiroshi Miura - 2024-02-03

        A fact is slightly different. Note pane does not have a different lifecycle than Editor pane.
        Editor pane contents is lived during editing a source file.
        Note pane contents is alive during editing a target ** segment.**
        When moving next segment, Note pane start new editor history.

        After saving the project, and go back to the segment with note, note pane has a history;

        1. clear pane
        2. automatically inserted a note text from editor pane.
        3. Ctrl-Z
        4. undo step 2.

        We can reset edit history after step 2 then it will become intended behavior.

         
  • Hiroshi Miura

    Hiroshi Miura - 2024-02-03
     
  • Hiroshi Miura

    Hiroshi Miura - 2024-02-03
    • assigned_to: Hiroshi Miura
     
  • Hiroshi Miura

    Hiroshi Miura - 2024-02-12
    • status: open --> open-fixed
     
  • Hiroshi Miura

    Hiroshi Miura - 2026-02-05
    • Group: 4.1 --> 6.1
     

Log in to post a comment.

MongoDB Logo MongoDB