Re: [code] More on the backtick in Spanish keyboards

From: Mitchell <m.att.foicica.com>
Date: Wed, 11 Oct 2017 15:32:07 -0400 (EDT)

Hi Pedro,

On Tue, 10 Oct 2017, Pedro Andres Aranda Gutierrez wrote:

> Hi,
>
> I have continued to work on this in order to make typeover, keypairs, etc.
> work consistently.
>
> I have come up with a single function to treat all insertions and typeovers
> and the kernel of this function is:
>
> if buffer.selection_start == buffer.selection_end then
> if textadept.editing.typeover_chars and
> textadept.editing.typeover_chars[code] then
> if buffer.char_at[buffer.current_pos] == code then
> buffer:char_right()
> return true
> end
> end
> else
> if textadept.editing.auto_pairs and
> textadept.editing.auto_pairs[altcode] then
>
> textadept.editing.enclose(string.char(code),textadept.editing.auto_pairs[code])
> return true
> end
> end
>
> AFAIK, this is also done in modules/textadept/editing.lua in two hooks. Now
> my questions:
>
> 1) Why not reorganise editing.lua to make this code be called in one hook
> and not in two?

I don't see why it cannot be. I think it's only split in two because of the fact they were implemented separately in time.

> 2) Why not make this code a public function that can be called from outside
> for things like patching the behaviour of a strange keyboard (that is used
> by 'a couple million' ;-) people on this planet) ?

API bloat. There used to be a `textadept.editing.strip_trailing_spaces()` function or something similar that I'd connect to `events.FILE_SAVED`. However, since the two were probably never used separately, I got to kill the API function and linked the two permanently.

> Mitchell, let me know if this makes sense to you and I will try to provide
> a sensible patch set

I'd be happy to see a patch if you have the time, but I cannot guarantee it will go in.

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 Wed 11 Oct 2017 - 15:32:07 EDT

This archive was generated by hypermail 2.2.0 : Thu 12 Oct 2017 - 06:50:21 EDT