summaryrefslogtreecommitdiffstats
path: root/src/paint.rs
AgeCommit message (Collapse)Author
2020-05-30Bug fix: non-emph styling was incorrectDan Davison
The code was relying on inequality-by-value of e.g. --minus-style and --minus-emph-style. So when those were the same by value, the behavior was incorrect. See also previous commit eec0fb23cfcf64cd2a5da78895112ce7fe3f1108
2020-05-30Hack: add boolean to Style struct to identify non-emph stylesDan Davison
This isn't a correct approach. The problem being addressed is that currently, Style instances are being used to represent things like the presence of an emph section in a line with edit annotations. A consequence is that if an emph and non-emph section are styled the same, then it's impossible to tell that the sections are different in any way at all. I think the correct approach is probably to start using a Struct that models elements such as emph/non-emph to represent these things, and make each such struct instance possess a style.
2020-05-30Add is_omitted field to Style structDan Davison
2020-05-30Make decoration style non-optionalDan Davison
2020-05-29Introduce is_raw style attributeDan Davison
If this attribute is set in --thing-style then the `thing` element text received from git should be passed though unchanged. (It may or may not have a decoration.)
2020-05-28Bug fix: emph background was right-filling if non-emph had no backgroundDan Davison
2020-05-27Change variable namesDan Davison
2020-05-27Bug fix: fix spurious application of non-emph stylesDan Davison
2020-05-26Implement --{commit,file,hunk-header}-{style,decoration-style}Dan Davison
2020-05-23Implement --*-non-emph stylesDan Davison
Fixes #169
2020-05-22Use new Style struct, wrapping ansi_term::StyleDan Davison
2020-05-22Implement hunk styles using style string argumentsDan Davison
- Do not apply foreground syntax style if it is "null syntect style" This isn't really correct. We should find either a valid sentinel value, or a way to only do the superimposing when we're doing syntax-highlighting. - Add --zero-style option (style for unchanged hunk lines) - Implement --color-only using an option rewrite rule
2020-05-22Use ansi_term style data structures instead of syntectDan Davison
2020-05-22Introduce style strings to replace color optionsDan Davison
https://git-scm.com/docs/git-config#Documentation/git-config.txt-color - Support "syntax" pseudo foreground color - Delete the --syntax-highlight CLI option This was never released.
2020-05-20Refactor: consume options when creating configDan Davison
2020-05-17Add new command-line options controlling foreground colorsDan Davison
- Revert "Do not expose new foreground color options yet" This reverts commit 253bc3ac0fe34a8f08c2bf625fcc8bb78de01a4c. - Make test assertions for minus_foreground_color - Fix test: fix detection of foreground color - Add diagnostic output to hunk highlighting test - Disable syntax-highlighting if the user has set foreground colors - Eliminate redundant style modifiers in config - Revert fixed_foreground_style implementation The syntax_style_sections will just contain syntect styles, or else a dummy no-op style. All delta styles will be done in diff_style_sections. - Add more dimensions to grid in hunk highlighting test - Support "none" as a value for background colors - Set foreground colors in a way that's consistent with background colors - Bug fix: don't highlight when there is no theme
2020-05-16Hunk highlighting test and refactoringDan Davison
- New command-line option --syntax highlight to select which category of hunk lines to be syntax highlighted. --highlight-removed is now deprecated. - New hunk highlighting test tests syntax highlighting and background colors - Refactor: construction of style modifiers for config struct - Refactor: compute minus and plus foreground style sections separately - Refactor: foreground style logic - Refactor: rearrange style modifier construction for config - Refactor: change variable name: => highlight_minus_lines - Refactor: clean up --color-only config implementation
2020-05-01Experimental: assume naive line pairings are homologousDan Davison
Experimental feature controlled by environment variable DELTA_EXPERIMENTAL_MAX_LINE_DISTANCE_FOR_NAIVELY_PAIRED_LINES.
2020-04-30Ensure that line is in normal background state before filling rightDan Davison
Thanks @da-x
2020-04-30Emit ANSI reset at end of line, after ANSI fill-right instructionDan Davison
2020-04-30Use ANSI CSI "Erase in Line" code instead of right-paddingDan Davison
Fixes #136
2020-04-15Merge branch 'master' into width-calc-fixDan Davison
2020-04-12Horrible hack working around my failure to fix a bug properlyDan Davison
At the parent commit da473302, some lines are being incorrectly truncated at word boundaries. It's something to do with an interaction between (a) the changes made in da473302 in order to implement --retain-plus-minus-markers, and (b) the logic in tokenize(). This commit works around that by reinstating the leading space character during tokenization and syntax highlighting, and then removing it afterwards in a hacky way.
2020-04-12Add --keep-plus-minus-markers optionDan Davison
2020-04-11Refactor: change order of argumentsDan Davison
2020-04-11Refactor: do not expose command line options struct in config structDan Davison
2020-03-03Support specifying color by ANSI 256 color palette indexDan Davison
2020-03-02Use ansi_term crate and bat's helpers for painting textDan Davison
2020-03-01Support 256-color terminal environmentsDan Davison
Fixes #110 With this commit, delta enters "24 bit color mode" iff either of the following are true: 1. The --24-bit-color command line option value is "always" 2. The --24-bit-color command line option value is "auto" and the COLORTERM environment variable is set to "truecolor" or "24bit". See https://gist.github.com/XVilka/8346728#true-color-detection https://github.com/sharkdp/bat/blob/7779d9f6221b3e98c43a43ceb5596ba285fdf4f8/src/bin/bat/app.rs#L29-L33 Otherwise, delta enters "8-bit color mode". In "24 bit color mode", delta will 1. Emit 24-bit RGB color shell escape sequences that will only be displayed correctly by a terminal application that supports 24 bit colors. 2. Select default background colors that will only be displayed correctly by a terminal application that supports 24 bit colors. In "8-bit color mode", delta will 1. Emit color shell escape sequences specifying the entry in the ANSI 256 color palette that is closest (according to the ansi_colours library) to the requested color. 2. Select default background colors that will work well in a terminal application that supports 8-bit color but not 24-bit color.
2020-02-27Provide CLI options for all colorsDan Davison
- Fixes #99, #103 - Support both RGB and ANSI codes - Eliminate (almost) ansi_term crate in favor of syntect for representing colors
2019-12-12Fix ansi-light, ansi-dark, and base16 themesDan Davison
Fixes #54 See https://github.com/sharkdp/bat/pull/543
2019-11-17Allow ignoring `git diff` virtual pathMarcelo Lima
2019-11-14Properly calculate string widths with unicode_widthWang Xuerui
Fixes diffs rendering with lines containing CJK characters.
2019-10-17Apply background colors to unrecognized file typesDan Davison
If a theme is selected, foreground highlighting will be highlighted as .txt. If theme=none there will be no foreground highlighting. Fixes #34
2019-10-13Add dyn to suppress warningJason Shirk
2019-10-01Support --theme=noneDan Davison
Fixes #14
2019-09-06Fix hunk meta line decorationDan Davison
2019-09-03Only trim terminating newline when it was added articificiallyDan Davison
2019-08-08ClippyDan Davison
2019-08-08Honor --width: right-pad with background-styled spacesDan Davison
2019-08-06Clean up distance-metricsDan Davison
2019-08-06Use Needleman-Wunsch / Wagner-Fischer algorithmDan Davison
2019-07-28Rename edit-related entitiesDan Davison
2019-07-28Infer homologous pairs of linesDan Davison
2019-07-27Use same lifetime for minus and plus linesDan Davison
2019-07-25Use original strings without copying when adding ansi color codesDan Davison
2019-07-24.truncate(0) => .clear()Dan Davison
2019-07-21Painter struct constructorDan Davison
2019-07-21Don't paint zero-length textDan Davison
2019-07-20Parameterize edit inference function over abstract operation tagsDan Davison
This remains tightly coupled to syntect's data structure, i.e. [(Style, &str), ...] but removes any explicit mention of styles in the edit module.