Open
Conversation
491dbe1 to
e1fd636
Compare
e1fd636 to
f5f213d
Compare
ncurses defines a global variable called TABSIZE which is the number of columns occupied by a tab character. We set this option to the value of the tab-size option. I believe we never rely on TABSIZE because we always expand tabs to the appropriate number of spaces before passing them to ncurses. The following patches will potentially give each screen its own tab-size, which is not possible with the global TABSIZE, so we should not be using it anyway.
The next patch wants to pass in a tab-size other than the global opt_tab_size, so let's add the parameters to enable that. The next commit really only cares about places where we render diff hunks. Hence, keep passing "opt_tab_size" (or for brevity, 0) to calls that never draw diff hunks anyway.
For projects that use tab width != 8, users want to set the "tab-size" config option. Many projects these days already state their preference in a ".editorconfig" file. GitHub honors that file when rendering diffs and blobs. Add an optional dependency to the EditorConfig library to read such files. Prefer the tab-size from EditorConfig, over the "tab-size" config option. Not being able to override the EditorConfig tab-size seems counterintuitive but I don't see why someone would want that, so I'd mayb ewait until someone complains. If we want that we could implement a "tab-size-from-editorconfig" option that defaults to true. Implementation hiccups: Unfortunately, we currently don't always fill "repo.worktree" - only in the special cases where either of $GIT_WORK_TREE or core.worktree is defined. Hence we need to run an extra "git rev-parse --show-toplevel". We do run "git rev-parse --is-inside-worktree [...]" elsewhere but we can't add "--show-toplevel" to that call or else we'd fail when run in bare repos. The use of diff_get_pathname() is a bit wasteful, we should probably refactor this to just remember the last line of type LINE_DIFF_ADD_FILE or LINE_DIFF_HEADER. Closes jonas#840
f5f213d to
6b69ad0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For projects that use tab width != 8, we need to set the "tab-size"
config option. Many projects these days state their preference in a
".editorconfig" file.
Add an optional dependency to the EditorConfig library to read such
files. Prefer the tab-size from EditorConfig, over the "tab-size"
config option. Not being able to override the EditorConfig tab-size
seems counterintuitive but I don't see why someone would want that, so
I'd wait until someone complains. If we want that we could implement a
"tab-size-from-editorconfig" option that defaults to true.
Closes #840