Re: [code] [textadept]

From: Colin <colin.holzman.att.protonmail.com>
Date: Wed, 29 Aug 2018 12:37:42 +0000

Mitchell,

I tried what you said and got the same results. However, I am still stuck. Here is an example of what I am trying to achieve: I have a file with 256 bytes where the first byte is 0x00, then 0x01, and so on up to 0xFF as the last byte in the file. I would like to be able to open this file in TA and see blobs for bytes 0-31 and 128-255 with normal characters for everything in between. What I see for bytes 128-255 is essentially ISO 8859-1 representation (CP-1252) when buffer.encoding is nil. I suspect this would work as I expect on my Mac.

After playing around with buffer:set_encoding and the list of GNU iconv encodings I was able to change the encoding to CP862 (which doesn't display at all like what I want) and then undo the encoding change (CTRL-Z twice) which caused the file displays as I expect (blobs for 0-31, 128-255). The status bar says the encoding is still CP862.

I don't understand this behavior. I understand that TA isn't designed to be a binary file editor, but it seems so close. I hope I have made my issue clear.

Thanks.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On August 28, 2018 10:39 PM, Mitchell <m.att.foicica.com> wrote:

> Hi Colin,
>
> On Tue, 28 Aug 2018, Colin wrote:
>
> > I tried what you suggested, and it doesn't seem to be that simple. Maybe there is another option somewhere similar to "Toggle View EOL" that is required to change the visibility of these special characters?
>
> I think Scintilla by default shows blobs for those kinds of characters, especially if they are invalid UTF-8.
>
> > Another interesting thing: string.format("0x%x", 128), for example, produces 0x80 as I would expect when I run it in the command entry field of TA. However, when I run
> > for i = 128, 255 do
> > print(buffer.representation[string.char(i)])
> > end
> > after having run
> > for i = 128, 255 do
> > buffer.representation[string.char(i)] = string.format("0x%x", i)
> > end
> > in my init file, the representations for i = 128, 255 have been stripped of their leading zero. No matter what I have tried I can't make that leading zero stick when assigning the string to buffer.representation. Maybe that has something to do with it.
>
> Here's what I did:
>
> 1. Start Textadept from scratch.
> 2. Open the command entry and typed: `for i=128,255 do print(string.char(i)) end` and pressed Enter.
> 3. At this point I have a bunch of blobs showing "x80", "x81", ..., "xFF".
> 4. Open the command entry again and typed: `for i=128,255 do buffer.representation[string.char(i)]=string.format('0x%x',i) end` and pressed Enter.
> 5. Now my blobs have changed to show '0x80', '0x81', ..., '0xff' (note the lower-case).
>
> Note this was sort of the reverse of what you did. Somehow I managed to get the "0x" prefix to "stick" that way.
>
> 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.
>

-- 
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 29 Aug 2018 - 08:37:42 EDT

This archive was generated by hypermail 2.2.0 : Thu 30 Aug 2018 - 06:29:55 EDT