Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit the context shown in changed outputs à la git-diff #746

Open
cjerdonek opened this issue Feb 6, 2024 · 0 comments
Open

Limit the context shown in changed outputs à la git-diff #746

cjerdonek opened this issue Feb 6, 2024 · 0 comments

Comments

@cjerdonek
Copy link

Currently, if the "outputs" for a cell contain a change, nbdime shows the entire list of outputs for both, even if the change is small and the full list of outputs large. This can result in large areas of unchanged text. See the screenshot below, which shows a simplified example containing eight output items preceding a deleted output item (though imagine this being 100 hundred items).

It would be better if nbdime used e.g. Git's approach of showing a limited and/or configurable amount of context. For example, git-diff has the --unified=<n> option, which "Generate[s] diffs with lines of context instead of the usual three."

In nbdime's case, it could for starters use individual items in the "outputs" list as a stand-in for lines (as the "outputs" key-value is a list of output items), as opposed to individual lines within each output item. (The latter could be a more advanced approach considered later.)

Screen Shot 2024-02-06 at 10 21 44 AM

In this example, the json looks like this (excerpt):

   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AAA\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "AAA\n"
     ]
    },
    ...
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

No branches or pull requests

1 participant