From a488a97c9eb58d8e9db224f3793c74f23d26b07e Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Wed, 9 Oct 2013 00:24:58 -0400 Subject: Use an indicator to highlight matching braces. --- modules/textadept/editing.lua | 3 +++ properties.lua | 3 +++ themes/dark.lua | 8 ++++---- themes/light.lua | 6 +++--- themes/term.lua | 11 +++++------ 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/modules/textadept/editing.lua b/modules/textadept/editing.lua index bb096b89..1335b8aa 100644 --- a/modules/textadept/editing.lua +++ b/modules/textadept/editing.lua @@ -27,6 +27,8 @@ local M = {} -- @field STRIP_TRAILING_SPACES (bool) -- Strip trailing whitespace before saving files. -- The default value is `true`. +-- @field INDIC_BRACEMATCH (number) +-- The matching brace highlight indicator number. -- @field INDIC_HIGHLIGHT (number) -- The word highlight indicator number. module('textadept.editing')]] @@ -36,6 +38,7 @@ M.HIGHLIGHT_BRACES = true M.TYPEOVER_CHARS = true M.AUTOINDENT = true M.STRIP_TRAILING_SPACES = true +M.INDIC_BRACEMATCH = _SCINTILLA.next_indic_number() M.INDIC_HIGHLIGHT = _SCINTILLA.next_indic_number() --- diff --git a/properties.lua b/properties.lua index 117ccb8f..4f0ef707 100644 --- a/properties.lua +++ b/properties.lua @@ -123,6 +123,9 @@ end --buffer:marker_enable_highlight(true) -- Indicators. +local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH +buffer.indic_style[INDIC_BRACEMATCH] = buffer.INDIC_BOX +buffer:brace_highlight_indicator(not CURSES, INDIC_BRACEMATCH) local INDIC_HIGHLIGHT = textadept.editing.INDIC_HIGHLIGHT buffer.indic_style[INDIC_HIGHLIGHT] = buffer.INDIC_ROUNDBOX if not CURSES then buffer.indic_under[INDIC_HIGHLIGHT] = true end diff --git a/themes/dark.lua b/themes/dark.lua index 71bfd636..b95d02f7 100644 --- a/themes/dark.lua +++ b/themes/dark.lua @@ -41,7 +41,7 @@ property['color.lavender'] = 0xE69999 property['color.blue'] = 0xE6994D -- Light colors. -property['color.light_red'] = 0x8080CC +--property['color.light_red'] = 0x8080CC property['color.light_yellow'] = 0x80CCCC property['color.light_green'] = 0x80CC80 --property['color.light_teal'] = 0xCCCC80 @@ -63,9 +63,7 @@ end property['style.default'] = 'font:%(font),size:%(fontsize),'.. 'fore:%(color.light_grey),back:%(color.black)' property['style.linenumber'] = 'fore:%(color.dark_grey),back:%(color.black)' -property['style.bracelight'] = 'fore:%(color.light_blue)' -property['style.bracebad'] = 'fore:%(color.light_red)' -property['style.controlchar'] = '%(style.nothing)' +--property['style.controlchar'] = property['style.indentguide'] = 'fore:%(color.light_black)' property['style.calltip'] = 'fore:%(color.light_grey),back:%(color.light_black)' @@ -121,6 +119,8 @@ for i = 25, 31 do -- fold margin markers end -- Indicators. +local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH +buffer.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 diff --git a/themes/light.lua b/themes/light.lua index b13cb0ed..52546980 100644 --- a/themes/light.lua +++ b/themes/light.lua @@ -63,9 +63,7 @@ end property['style.default'] = 'font:%(font),size:%(fontsize),'.. 'fore:%(color.light_black),back:%(color.white)' property['style.linenumber'] = 'fore:%(color.grey),back:%(color.white)' -property['style.bracelight'] = 'fore:%(color.light_blue)' -property['style.bracebad'] = 'fore:%(color.light_red)' -property['style.controlchar'] = '%(style.nothing)' +--property['style.controlchar'] = '%(style.nothing)' property['style.indentguide'] = 'fore:%(color.dark_white)' property['style.calltip'] = 'fore:%(color.light_black),back:%(color.dark_white)' @@ -121,6 +119,8 @@ for i = 25, 31 do -- fold margin markers end -- Indicators. +local INDIC_BRACEMATCH = textadept.editing.INDIC_BRACEMATCH +buffer.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 diff --git a/themes/term.lua b/themes/term.lua index bee6b44f..d268a856 100644 --- a/themes/term.lua +++ b/themes/term.lua @@ -21,19 +21,18 @@ property['color.white'] = 0xC0C0C0 property['color.light_black'] = 0x404040 property['color.light_red'] = 0x0000FF property['color.light_green'] = 0x00FF00 -property['color.light_yellow'] = 0x00FFFF +--property['color.light_yellow'] = 0x00FFFF property['color.light_blue'] = 0xFF0000 property['color.light_magenta'] = 0xFF00FF -property['color.light_cyan'] = 0xFFFF00 +--property['color.light_cyan'] = 0xFFFF00 property['color.light_white'] = 0xFFFFFF -- Predefined styles. property['style.default'] = 'fore:%(color.white),back:%(color.black)' -property['style.linenumber'] = '%(style.default)' +--property['style.linenumber'] = property['style.bracelight'] = 'fore:%(color.black),back:%(color.white)' -property['style.bracebad'] = 'fore:%(color.red),bold' -property['style.controlchar'] = '%(style.nothing)' -property['style.indentguide'] = '%(style.nothing)' +--property['style.controlchar'] = +--property['style.indentguide'] = property['style.calltip'] = '%(style.default)' -- Token styles. -- cgit v1.2.3