mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-17 22:14:53 +02:00
Add an option to control highlighting of moved lines
This commit is contained in:
@@ -65,6 +65,10 @@ Can be specified multiple times to use multiple patterns. For example::
|
||||
''',
|
||||
)
|
||||
|
||||
opt('mark_moved_lines', 'yes', option_type='to_bool', long_text='''
|
||||
Highlight lines that are moved, that is removed from the left and added to the right
|
||||
differently, using the :opt:`moved_bg` color.''')
|
||||
|
||||
opt('word_diff_mode', 'words', choices=('words', 'central'),
|
||||
long_text='''
|
||||
The algorithm to use for highlighting which parts of changed lines differ.
|
||||
@@ -153,10 +157,10 @@ opt('added_margin_bg', '#cdffd8', option_type='to_color')
|
||||
opt('dark_added_margin_bg', '#31503d', option_type='to_color')
|
||||
|
||||
opt('moved_bg', '#fffde7', option_type='to_color', long_text='Moved text backgrounds (same text that was removed in one place and added in another)')
|
||||
opt('dark_moved_bg', '#2c2200', option_type='to_color')
|
||||
opt('dark_moved_bg', '#003333', option_type='to_color')
|
||||
|
||||
opt('moved_margin_bg', '#fff3b0', option_type='to_color')
|
||||
opt('dark_moved_margin_bg', '#4a3800', option_type='to_color')
|
||||
opt('dark_moved_margin_bg', '#00495b', option_type='to_color')
|
||||
|
||||
opt('filler_bg', '#fafbfc', option_type='to_color', long_text='Filler (empty) line background')
|
||||
opt('dark_filler_bg', '#262c36', option_type='to_color')
|
||||
|
||||
@@ -544,7 +544,7 @@ func parse_patch(raw string, left_lines, right_lines []string) (ans *Patch, err
|
||||
ans.largest_line_number = ans.all_hunks[len(ans.all_hunks)-1].largest_line_number
|
||||
}
|
||||
err = ans.compute_centers(left_lines, right_lines)
|
||||
if err == nil {
|
||||
if err == nil && conf.Mark_moved_lines {
|
||||
ans.detect_moved_lines(left_lines, right_lines)
|
||||
}
|
||||
return
|
||||
|
||||
@@ -547,9 +547,9 @@ type DiffData struct {
|
||||
left_path, right_path string
|
||||
available_cols, margin_size int
|
||||
|
||||
left_lines, right_lines []string
|
||||
left_moved_lines *utils.Set[int]
|
||||
right_moved_lines *utils.Set[int]
|
||||
left_lines, right_lines []string
|
||||
left_moved_lines *utils.Set[int]
|
||||
right_moved_lines *utils.Set[int]
|
||||
}
|
||||
|
||||
func hunk_title(hunk *Hunk) string {
|
||||
|
||||
Reference in New Issue
Block a user