Hello, Pavel and Alexander! :) Monday, July 29, 2002, 12:11:30 AM, you wrote: PR> Hello! >> I changed mc to support CR/LF translation, patch is attached. >> It is very useful for cygwin and also useful under unixes if it is >> necessary to edit files in dos encoding. >> There is some old code in mc for CR/LF translation, but it is slow and based >> on FILE stdio.h interface, whereas editor now uses open/read/write >> interface. >> I wrote new code, which >> 1. reads file into buffer PR> This is unacceptable. As of now, the editor never loads the whole file - PR> it uses buffers. The viewer, however, tries to mmap() the whole file and PR> if mmap() fails, loads the whole file into the memory. Attached is a patch which implements it 'seamlessly' to the editor - i.e. it reads all data and it is translated on the fly. NOTE: The patch is not complete in therms of appliance to MC coding style (lets say), but it does it job pretty well - I forsee one or two questions from the start: One is: Move that functionality out in a separate function :) I'll do but I want some comments since I don't want to go too far if this approach is not going to be accepted at all. Although the code is not so small I tried to comment it good. There may be some strange things - I've spent almost all the night on it :) So all I ask you to appliy the patch and see how it works - and take a look at it of course :) Then I'd like to hear your opinions and we can go further enhancing it so i matches the MC philosphy. Btw the patch is again the Aug 21 snapshot. Thanks! :) Pavel Tsekov P.S. This patch handles only translation of CRLFs' on input - i plan to do the other if this is going to be accepted in one form or the other. Or maybe part of Alexanders patches can enter CVS with part of mine :)
Attachment:
mc-init_dynamic_edit_buffers.patch
Description: Binary data