Re: [code] Highlighting questions

From: Mitchell <m.att.foicica.com>
Date: Fri, 1 May 2020 14:52:40 -0400 (EDT)

Hi Christian,

On Fri, 1 May 2020, Christian Gelinek wrote:

> Hello,
>
> I was wondering whether anyone has tried to customise the behaviour of
> highlights. I am only aware of the Ctrl+Alt+Shift+H Word Highlight keyboard
> shortcut, which highlights the complete word under the caret and all
> occurrences in the document. Having migrated from Notepad++ (NPP) to
> Textadept, I'd like to replicate some features I am missing in TA:
>
> 1. Can the "complete word" functionality be made optional? Sometimes
> I'd like to highlight just the selected parts of a word, e.g. to
> quickly see all words that have "count" in them such as
> "line_count", "encountered" and "counting_eggs". In NPP, the
> behaviour is dependent on the "Whole word" option of the Search dialog.

That's a good idea. I'll look into this.

> 2. Can we have multiple simultaneous highlights with different colours
> for different (parts of) words?

You'd have to code this up on your own, but it's possible. *modules/textadept/editing.lua*'s `textadept.editing.highlight_word()` is a starting point of how you might go about doing this.

> 3. Can other occurrences of the currently selected word be (slightly)
> highlighted? I found this NPP feature useful when browsing through
> code and just double-clicking on a word to instantly see other uses.

`textadept.editing.highlight_word()` does the highlighting of selected words; you'd just have to change the color to be more "slightly highlighted". `textadept.editing.INDIC_HIGHLIGHT` is the indicator you'd want to change the color of.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Fri 01 May 2020 - 14:52:40 EDT

This archive was generated by hypermail 2.2.0 : Sat 02 May 2020 - 06:32:11 EDT