RE: [code] [textadept] Issue with BÉPO keyboard layout on Win32

From: Julien L. <julienl81.att.hotmail.com>
Date: Wed, 27 Mar 2019 11:49:43 +0000

Hello Mitchell,

I thank you for your answer.

> The example handler I gave was very basic. It only adds characters. If you have text selected, the expected behavior when typing a key is to replace the selection with the typed character. Similarly, when multiple selections are active, the handler I gave you would only add a character at the current selection instead of all of them.

This is a good point.

Here is my proposed version of the workaround :
local problematicKeys = {
  [string.byte(",")] = ",",
  [string.byte("/")] = "/"
}

events.connect(events.KEYPRESS, function(code, shift, control, alt, meta)
    local char = problematicKeys[code]
    if char and not shift and not control and not alt and not meta then
      if buffer.selection_empty then
        buffer:add_text(char)
      else
        buffer:replace_sel(char)
      end
      return true -- do not propagate this key further
    end
  end)

I have been tested it for a couple of days and it seems to work fine, except for multiple and rectangular selections. I looked in the API on how to do that but I did not see how. Unless there is an easy solution, the current solution is enough for me.

Again thank you very much for your support.
And thank you for providing such a nice editor.
Regards,

--
Julien L.
-- 
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 27 Mar 2019 - 07:49:43 EDT

This archive was generated by hypermail 2.2.0 : Thu 28 Mar 2019 - 06:37:30 EDT