From f2374c4aba53fa462dc88d4104e10d8cb97e61ba Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Mon, 25 May 2020 21:16:01 -0400 Subject: Allow views to be used as buffers and update API. This allows for a superficial separation of buffer- and view-specific Scintilla functionality. buffers and views can now be used interchangeably for the most part, and the APIs are guidance, not hard requirements. User scripts do not require any modification and will continue to function normally. --- themes/dark.lua | 60 ++++++++++++++++++++++++++++---------------------------- themes/light.lua | 60 ++++++++++++++++++++++++++++---------------------------- themes/term.lua | 36 +++++++++++++++++----------------- 3 files changed, 78 insertions(+), 78 deletions(-) (limited to 'themes') diff --git a/themes/dark.lua b/themes/dark.lua index d46655d5..6402c165 100644 --- a/themes/dark.lua +++ b/themes/dark.lua @@ -2,7 +2,7 @@ -- Dark theme for Textadept. -- Contributions by Ana Balan. -local buffer = buffer +local buffer, view = buffer, view local property, property_int = buffer.property, buffer.property_int -- Greyscale colors. @@ -88,50 +88,50 @@ property['style.variable'] = 'fore:$(color.light_blue)' property['style.whitespace'] = '' -- Multiple Selection and Virtual Space ---buffer.additional_sel_alpha = ---buffer.additional_sel_fore = ---buffer.additional_sel_back = ---buffer.additional_caret_fore = +--view.additional_sel_alpha = +--view.additional_sel_fore = +--view.additional_sel_back = +--view.additional_caret_fore = -- Caret and Selection Styles. -buffer:set_sel_fore(true, property_int['color.light_black']) -buffer:set_sel_back(true, property_int['color.grey']) ---buffer.sel_alpha = -buffer.caret_fore = property_int['color.grey'] -buffer.caret_line_back = property_int['color.light_black'] ---buffer.caret_line_back_alpha = +view:set_sel_fore(true, property_int['color.light_black']) +view:set_sel_back(true, property_int['color.grey']) +--view.sel_alpha = +view.caret_fore = property_int['color.grey'] +view.caret_line_back = property_int['color.light_black'] +--view.caret_line_back_alpha = -- Fold Margin. -buffer:set_fold_margin_colour(true, property_int['color.black']) -buffer:set_fold_margin_hi_colour(true, property_int['color.black']) +view:set_fold_margin_colour(true, property_int['color.black']) +view:set_fold_margin_hi_colour(true, property_int['color.black']) -- Markers. local MARK_BOOKMARK = textadept.bookmarks.MARK_BOOKMARK ---buffer.marker_fore[MARK_BOOKMARK] = property_int['color.black'] -buffer.marker_back[MARK_BOOKMARK] = property_int['color.dark_blue'] ---buffer.marker_fore[textadept.run.MARK_WARNING] = property_int['color.black'] -buffer.marker_back[textadept.run.MARK_WARNING] = property_int['color.yellow'] ---buffer.marker_fore[textadept.run.MARK_ERROR] = property_int['color.black'] -buffer.marker_back[textadept.run.MARK_ERROR] = property_int['color.red'] +--view.marker_fore[MARK_BOOKMARK] = property_int['color.black'] +view.marker_back[MARK_BOOKMARK] = property_int['color.dark_blue'] +--view.marker_fore[textadept.run.MARK_WARNING] = property_int['color.black'] +view.marker_back[textadept.run.MARK_WARNING] = property_int['color.yellow'] +--view.marker_fore[textadept.run.MARK_ERROR] = property_int['color.black'] +view.marker_back[textadept.run.MARK_ERROR] = property_int['color.red'] for i = buffer.MARKNUM_FOLDEREND, buffer.MARKNUM_FOLDEROPEN do -- fold margin - buffer.marker_fore[i] = property_int['color.black'] - buffer.marker_back[i] = property_int['color.dark_grey'] - buffer.marker_back_selected[i] = property_int['color.light_grey'] + view.marker_fore[i] = property_int['color.black'] + view.marker_back[i] = property_int['color.dark_grey'] + view.marker_back_selected[i] = property_int['color.light_grey'] end -- Indicators. -buffer.indic_fore[ui.find.INDIC_FIND] = property_int['color.dark_yellow'] -buffer.indic_alpha[ui.find.INDIC_FIND] = 255 +view.indic_fore[ui.find.INDIC_FIND] = property_int['color.dark_yellow'] +view.indic_alpha[ui.find.INDIC_FIND] = 255 local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH -buffer.indic_fore[INDIC_BRACEMATCH] = property_int['color.light_grey'] +view.indic_fore[INDIC_BRACEMATCH] = property_int['color.light_grey'] local INDIC_HIGHLIGHT = textadept.editing.INDIC_HIGHLIGHT -buffer.indic_fore[INDIC_HIGHLIGHT] = property_int['color.orange'] -buffer.indic_alpha[INDIC_HIGHLIGHT] = 255 +view.indic_fore[INDIC_HIGHLIGHT] = property_int['color.orange'] +view.indic_alpha[INDIC_HIGHLIGHT] = 255 local INDIC_PLACEHOLDER = textadept.snippets.INDIC_PLACEHOLDER -buffer.indic_fore[INDIC_PLACEHOLDER] = property_int['color.grey'] +view.indic_fore[INDIC_PLACEHOLDER] = property_int['color.grey'] -- Call tips. -buffer.call_tip_fore_hlt = property_int['color.light_blue'] +view.call_tip_fore_hlt = property_int['color.light_blue'] -- Long Lines. -buffer.edge_colour = property_int['color.dark_grey'] +view.edge_colour = property_int['color.dark_grey'] diff --git a/themes/light.lua b/themes/light.lua index 48c3912a..d72a85f9 100644 --- a/themes/light.lua +++ b/themes/light.lua @@ -2,7 +2,7 @@ -- Light theme for Textadept. -- Contributions by Ana Balan. -local buffer = buffer +local buffer, view = buffer, view local property, property_int = buffer.property, buffer.property_int -- Greyscale colors. @@ -88,50 +88,50 @@ property['style.variable'] = 'fore:$(color.dark_lavender)' property['style.whitespace'] = '' -- Multiple Selection and Virtual Space ---buffer.additional_sel_alpha = ---buffer.additional_sel_fore = ---buffer.additional_sel_back = ---buffer.additional_caret_fore = +--view.additional_sel_alpha = +--view.additional_sel_fore = +--view.additional_sel_back = +--view.additional_caret_fore = -- Caret and Selection Styles. -buffer:set_sel_fore(true, property_int['color.light_black']) -buffer:set_sel_back(true, property_int['color.light_grey']) ---buffer.sel_alpha = -buffer.caret_fore = property_int['color.grey_black'] -buffer.caret_line_back = property_int['color.dark_white'] ---buffer.caret_line_back_alpha = +view:set_sel_fore(true, property_int['color.light_black']) +view:set_sel_back(true, property_int['color.light_grey']) +--view.sel_alpha = +view.caret_fore = property_int['color.grey_black'] +view.caret_line_back = property_int['color.dark_white'] +--view.caret_line_back_alpha = -- Fold Margin. -buffer:set_fold_margin_colour(true, property_int['color.white']) -buffer:set_fold_margin_hi_colour(true, property_int['color.white']) +view:set_fold_margin_colour(true, property_int['color.white']) +view:set_fold_margin_hi_colour(true, property_int['color.white']) -- Markers. local MARK_BOOKMARK, t_run = textadept.bookmarks.MARK_BOOKMARK, textadept.run ---buffer.marker_fore[MARK_BOOKMARK] = property_int['color.white'] -buffer.marker_back[MARK_BOOKMARK] = property_int['color.dark_blue'] ---buffer.marker_fore[t_run.MARK_WARNING] = property_int['color.white'] -buffer.marker_back[t_run.MARK_WARNING] = property_int['color.light_yellow'] ---buffer.marker_fore[t_run.MARK_ERROR] = property_int['color.white'] -buffer.marker_back[t_run.MARK_ERROR] = property_int['color.light_red'] +--view.marker_fore[MARK_BOOKMARK] = property_int['color.white'] +view.marker_back[MARK_BOOKMARK] = property_int['color.dark_blue'] +--view.marker_fore[t_run.MARK_WARNING] = property_int['color.white'] +view.marker_back[t_run.MARK_WARNING] = property_int['color.light_yellow'] +--view.marker_fore[t_run.MARK_ERROR] = property_int['color.white'] +view.marker_back[t_run.MARK_ERROR] = property_int['color.light_red'] for i = buffer.MARKNUM_FOLDEREND, buffer.MARKNUM_FOLDEROPEN do -- fold margin - buffer.marker_fore[i] = property_int['color.white'] - buffer.marker_back[i] = property_int['color.grey'] - buffer.marker_back_selected[i] = property_int['color.grey_black'] + view.marker_fore[i] = property_int['color.white'] + view.marker_back[i] = property_int['color.grey'] + view.marker_back_selected[i] = property_int['color.grey_black'] end -- Indicators. -buffer.indic_fore[ui.find.INDIC_FIND] = property_int['color.yellow'] -buffer.indic_alpha[ui.find.INDIC_FIND] = 255 +view.indic_fore[ui.find.INDIC_FIND] = property_int['color.yellow'] +view.indic_alpha[ui.find.INDIC_FIND] = 255 local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH -buffer.indic_fore[INDIC_BRACEMATCH] = property_int['color.grey'] +view.indic_fore[INDIC_BRACEMATCH] = property_int['color.grey'] local INDIC_HIGHLIGHT = textadept.editing.INDIC_HIGHLIGHT -buffer.indic_fore[INDIC_HIGHLIGHT] = property_int['color.orange'] -buffer.indic_alpha[INDIC_HIGHLIGHT] = 255 +view.indic_fore[INDIC_HIGHLIGHT] = property_int['color.orange'] +view.indic_alpha[INDIC_HIGHLIGHT] = 255 local INDIC_PLACEHOLDER = textadept.snippets.INDIC_PLACEHOLDER -buffer.indic_fore[INDIC_PLACEHOLDER] = property_int['color.grey_black'] +view.indic_fore[INDIC_PLACEHOLDER] = property_int['color.grey_black'] -- Call tips. -buffer.call_tip_fore_hlt = property_int['color.light_blue'] +view.call_tip_fore_hlt = property_int['color.light_blue'] -- Long Lines. -buffer.edge_colour = property_int['color.grey'] +view.edge_colour = property_int['color.grey'] diff --git a/themes/term.lua b/themes/term.lua index bbb50b28..f3c5bfed 100644 --- a/themes/term.lua +++ b/themes/term.lua @@ -2,7 +2,7 @@ -- Terminal theme for Textadept. -- Contributions by Ana Balan. -local buffer = buffer +local buffer, view = buffer, view local property, property_int = buffer.property, buffer.property_int -- Normal colors. @@ -56,35 +56,35 @@ property['style.variable'] = 'fore:$(color.blue),bold' property['style.whitespace'] = '' -- Multiple Selection and Virtual Space ---buffer.additional_sel_fore = ---buffer.additional_sel_back = ---buffer.additional_caret_fore = +--view.additional_sel_fore = +--view.additional_sel_back = +--view.additional_caret_fore = -- Caret and Selection Styles. ---buffer:set_sel_fore(true, property_int['color.white']) ---buffer:set_sel_back(true, property_int['color.black']) ---buffer.caret_fore = property_int['color.black'] ---buffer.caret_line_back = +--view:set_sel_fore(true, property_int['color.white']) +--view:set_sel_back(true, property_int['color.black']) +--view.caret_fore = property_int['color.black'] +--view.caret_line_back = -- Fold Margin. ---buffer:set_fold_margin_colour(true, property_int['color.white']) ---buffer:set_fold_margin_hi_colour(true, property_int['color.white']) +--view:set_fold_margin_colour(true, property_int['color.white']) +--view:set_fold_margin_hi_colour(true, property_int['color.white']) -- Markers. local MARK_BOOKMARK = textadept.bookmarks.MARK_BOOKMARK -buffer.marker_back[MARK_BOOKMARK] = property_int['color.blue'] -buffer.marker_back[textadept.run.MARK_WARNING] = property_int['color.yellow'] -buffer.marker_back[textadept.run.MARK_ERROR] = property_int['color.red'] +view.marker_back[MARK_BOOKMARK] = property_int['color.blue'] +view.marker_back[textadept.run.MARK_WARNING] = property_int['color.yellow'] +view.marker_back[textadept.run.MARK_ERROR] = property_int['color.red'] -- Indicators. -buffer.indic_fore[ui.find.INDIC_FIND] = property_int['color.yellow'] +view.indic_fore[ui.find.INDIC_FIND] = property_int['color.yellow'] local INDIC_HIGHLIGHT = textadept.editing.INDIC_HIGHLIGHT -buffer.indic_fore[INDIC_HIGHLIGHT] = property_int['color.yellow'] +view.indic_fore[INDIC_HIGHLIGHT] = property_int['color.yellow'] local INDIC_PLACEHOLDER = textadept.snippets.INDIC_PLACEHOLDER -buffer.indic_fore[INDIC_PLACEHOLDER] = property_int['color.magenta'] +view.indic_fore[INDIC_PLACEHOLDER] = property_int['color.magenta'] -- Call tips. -buffer.call_tip_fore_hlt = property_int['color.blue'] +view.call_tip_fore_hlt = property_int['color.blue'] -- Long Lines. -buffer.edge_colour = property_int['color.red'] +view.edge_colour = property_int['color.red'] -- cgit v1.2.3