Skip to content

Conversation

@wiemmo
Copy link

@wiemmo wiemmo commented Dec 25, 2025

This PR changes the behavior of the "Show Original" split view feature. Previously, the original text was captured when a line was first selected. Now, all original texts are stored when the file is loaded, and the split view always shows the text as it was at file load time, regardless of subsequent edits.

Changes

  • Added std::map<int, std::string> initial_texts_map to store all original texts by line ID
  • Added OnFileOpen() handler that saves all original texts when file is loaded
  • Modified OnActiveLineChanged() to retrieve original text from map instead of current line text
  • Updated tooltip text to reflect new behavior

Benefits

  1. Consistent original text: The split view now always shows the text as it was when the file was loaded
  2. Better for translation: Translators can see the original text even after making edits to the line

- Store all original line texts in a map when file is loaded
- Update split view to always show original text from file load time
- Original text is now preserved regardless of subsequent edits
- Updated tooltip to reflect new behavior

This ensures that the 'Show Original' split view always displays
the text as it was when the file was first loaded, making it more
useful for translation workflows where you need to see the original
text even after making edits.
@arch1t3cht
Copy link
Member

arch1t3cht commented Dec 26, 2025

  1. Was this PR and/or its description LLM-generated? If so, please detail which parts were generated to which extent.

  2. I'm not sure if this is really an improvement over the previous behavior. At most it's a sidegrade (which I am generally hesitant to merge with the current state of the project, see Current Project Roadmap #485). I agree that the "Show Original" box has limited utility at the moment since editing a line and then switching to another line and back will lose the original "original", but this solution just shifts the issues elsewhere. With this implementation the "original" versions are only saved when the file is initially opened. Suppose a translator's workflow starts by copying a transcription into the file from elsewhere - then they would need to reload the file for the "original" lines to update. Similarly, I believe that copy/pasting a line will cause the copy to not have an "original" line set, and cut/pasting lines or applying Lua scripts to them will destroy their "original" since the line's ID will change.

    My current impression of the "Show original" box is that it does not really have a chance of working well at all, since there's no way to tell what exactly the user deems the "original" to be, and when the "original" should be preserved (of course one could make the user specify this manually somehow, but I do not yet know of a way to do this that would be convenient enough to be useful). I'm happy to be proven wrong here, but I think any change to the "Show original" box should be preceded by a proposal discussing the new behavior instead of jumping directly to code.

@petzku
Copy link
Contributor

petzku commented Dec 26, 2025

there's no way to tell what exactly the user deems the "original" to be,

Perhaps the best solution would be showing all previous iterations of the line? i.e. push the initial state on file load, and then all states every time the line is switched to/away from. This definitely comes with its share of issues, though.

Similarly, I believe that copy/pasting a line will cause the copy to not have an "original" line set, and cut/pasting lines or applying Lua scripts to them will destroy their "original" since the line's ID will change.

I'm afraid you're right here.


The most significant improvement I would hope for (that still seems reasonable in scope) is that, currently, running any Lua macro that manipulates the active line “resets” the contents of the original. This is very awkward when using macros such as arch.RWTools' line break shifting. If it were possible to detect that the “active” line hasn't changed and not reload the original-line-content in this case, I think it would already go a fairly long way, at least for users such as myself.

@wiemmo
Copy link
Author

wiemmo commented Dec 26, 2025

  1. Part of description and concept of implementation.
  2. As far as I know (from personal communication), many users would actually find this behavior convenient — when the original text doesn’t change during work with the file. In essence, the “Show Original” feature effectively becomes a kind of "Translation Mode". Anyaway , I agree that it may have been too ealry to make a PR. Honestly, I haven’t contributed before, and it just felt easier to propose a small change than to open an issue.

@wiemmo
Copy link
Author

wiemmo commented Dec 26, 2025

So, I think it's better to close this PR.
I would be grateful if you could consider implementing a change that prevents the original line from being updated every time it is selected.
Sorry for any inconvenience.

@wiemmo wiemmo closed this Dec 29, 2025
@wiemmo wiemmo deleted the feature/split-view-original-on-file-load branch December 29, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants