@@ -47,12 +47,6 @@ local M = {}
4747-- Alt+Left | ⌥⇠ | M-Left | Merge left
4848-- Alt+Right | ⌥⇢ | M-Right | Merge right
4949--
50- -- @field theme (string)
51- -- The theme to use, either 'dark' or 'light'.
52- -- This is not the theme used with Textadept. Depending on this setting, additions will be
53- -- colored 'dark_green' or 'light_green', deletions will be colored 'dark_red' or 'light_red',
54- -- and so on.
55- -- The default value is auto-detected.
5650-- @field MARK_ADDITION (number)
5751-- The marker for line additions.
5852-- @field MARK_DELETION (number)
@@ -65,10 +59,6 @@ local M = {}
6559-- The indicator number for text deleted within lines.
6660module('file_diff')]]
6761
68- M .theme = ' light'
69- local bg_color = view .property [' style.default' ]:match (' back:([^,]+)' )
70- if bg_color and tonumber (bg_color ) < 0x808080 and not CURSES then M .theme = ' dark' end
71-
7262M .MARK_ADDITION = _SCINTILLA .next_marker_number ()
7363M .MARK_DELETION = _SCINTILLA .next_marker_number ()
7464M .MARK_MODIFICATION = _SCINTILLA .next_marker_number ()
@@ -513,23 +503,25 @@ end)
513503-- Highlight differences as text is typed and deleted.
514504events .connect (events .MODIFIED , function (position , modification_type )
515505 if not _VIEWS [view1 ] or not _VIEWS [view2 ] then return end
516- if modification_type & (0x01 | 0x02 ) > 0 then mark_changes () end
506+ if modification_type & (0x01 | 0x02 ) > 0 then mark_changes () end -- insert text | delete text
517507end )
518508
519509events .connect (events .VIEW_NEW , function ()
520510 local markers = {
521- [MARK_ADDITION ] = M .theme .. ' _green' , [MARK_DELETION ] = M .theme .. ' _red' ,
522- [MARK_MODIFICATION ] = M .theme .. ' _yellow'
511+ [MARK_ADDITION ] = ' green' , [MARK_DELETION ] = ' red' , [MARK_MODIFICATION ] = ' yellow'
523512 }
524513 for mark , color in pairs (markers ) do
525- view :marker_define (mark , view .MARK_BACKGROUND )
526- view .marker_back [mark ] = view .property_int [' color.' .. color ]
514+ view :marker_define (mark , not CURSES and view .MARK_BACKGROUND or view .MARK_FULLRECT )
515+ view .marker_back [mark ] = view .colors [color ]
516+ if not CURSES then
517+ view .marker_layer [mark ], view .marker_alpha [mark ] = view .LAYER_UNDER_TEXT , 0x60
518+ end
527519 end
528- local indicators = {[INDIC_ADDITION ] = M . theme .. ' _green ' , [INDIC_DELETION ] = M . theme .. ' _red ' }
520+ local indicators = {[INDIC_ADDITION ] = ' green ' , [INDIC_DELETION ] = ' red ' }
529521 for indic , color in pairs (indicators ) do
530- view .indic_style [indic ] = view .INDIC_FULLBOX
531- view .indic_fore [indic ] = view .property_int [ ' color. ' .. color ]
532- view .indic_alpha [indic ], view .indic_under [indic ] = 255 , true
522+ view .indic_style [indic ] = not CURSES and view .INDIC_FULLBOX or view . INDIC_STRAIGHTBOX
523+ view .indic_fore [indic ] = view .colors [ color ]
524+ if not CURSES then view .indic_alpha [indic ], view .indic_under [indic ] = 0x60 , true end
533525 end
534526end )
535527
0 commit comments