{"record":{"id":"c0982c332cba88bc","repo":"jesseduffield/lazygit","slug":"ignoring-whitespace-is-not-supported-in-this-view","errorCode":null,"errorMessage":"Ignoring whitespace is not supported in this view","messagePattern":"Ignoring whitespace is not supported in this view","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/gui/controllers/toggle_whitespace_action.go","lineNumber":25,"sourceCode":"\t\"github.com/jesseduffield/lazygit/pkg/gui/types\"\n\t\"github.com/samber/lo\"\n)\n\ntype ToggleWhitespaceAction struct {\n\tc *ControllerCommon\n}\n\nfunc (self *ToggleWhitespaceAction) Call() error {\n\tcontextsThatDontSupportIgnoringWhitespace := []types.ContextKey{\n\t\tcontext.STAGING_MAIN_CONTEXT_KEY,\n\t\tcontext.STAGING_SECONDARY_CONTEXT_KEY,\n\t\tcontext.PATCH_BUILDING_MAIN_CONTEXT_KEY,\n\t}\n\n\tif lo.Contains(contextsThatDontSupportIgnoringWhitespace, self.c.Context().Current().GetKey()) {\n\t\t// Ignoring whitespace is not supported in these views. Let the user\n\t\t// know that it's not going to work in case they try to turn it on.\n\t\treturn errors.New(self.c.Tr.IgnoreWhitespaceNotSupportedHere)\n\t}\n\n\tself.c.UserConfig().Git.IgnoreWhitespaceInDiffView = !self.c.UserConfig().Git.IgnoreWhitespaceInDiffView\n\n\tself.c.Context().CurrentSide().HandleFocus(types.OnFocusOpts{})\n\treturn nil\n}\n","sourceCodeStart":7,"sourceCodeEnd":33,"githubUrl":"https://github.com/jesseduffield/lazygit/blob/c477a2959b229fbf3284be0d4d2904ab61ec3c94/pkg/gui/controllers/toggle_whitespace_action.go#L7-L33","documentation":"Returned by ToggleWhitespaceAction.Call when the user toggles 'ignore whitespace in diff view' while the current context is one of the staging main/secondary or patch-building main contexts. Those views implement custom line-level diff handling that cannot reproduce a whitespace-ignoring diff, so the toggle is blocked with an explanatory message.","triggerScenarios":"Pressing the ignore-whitespace keybinding while focused on STAGING_MAIN, STAGING_SECONDARY, or PATCH_BUILDING_MAIN context (lo.Contains match on the context key list).","commonSituations":"User is mid line-staging and wants to ignore indentation noise from a refactor; toggle attempted without leaving the staging view first.","solutions":["Leave the staging/patch-building view (escape back to the files or commits panel) before toggling whitespace ignoring.","Set git.ignoreWhitespaceInDiffView: true in the config so it is already on before entering staging.","Stage at the hunk/line level with whitespace noise in mind, or fix the whitespace in a separate commit first."],"exampleFix":"# before\n# toggled while inside staging view -> error\n\n# after\n# ~/.config/lazygit/config.yml\ngit:\n  ignoreWhitespaceInDiffView: true","handlingStrategy":"validation","validationCode":"unsupported := []types.ContextKey{\n    context.STAGING_MAIN_CONTEXT_KEY,\n    context.STAGING_SECONDARY_CONTEXT_KEY,\n    context.PATCH_BUILDING_MAIN_CONTEXT_KEY,\n}\nif lo.Contains(unsupported, self.c.Context().Current().GetKey()) {\n    // hide/disable the whitespace toggle in this context\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Disable the ignore-whitespace keybinding via DisabledReason in the unsupported contexts.","Set git.ignoreWhitespaceInDiffView in config before entering staging views.","Normalize whitespace (editor/CI) so diff noise does not require the toggle mid-staging."],"tags":["ui","whitespace","staging","context-guard"],"backgroundTag":null,"analyzedSha":"c477a2959b229fbf3284be0d4d2904ab61ec3c94","analyzedAt":"2026-08-15T08:34:32.451Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}